/* === Cards === */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.card-header {
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 1rem 1.5rem;
}
.card-body { padding: 1.5rem; }
.card-footer { border-top: 1px solid var(--border); }

.course-card {
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.course-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(46, 139, 87, 0.2);
}
.course-card .card-img-top {
  aspect-ratio: 16 / 9;
  width: 100%;
  object-fit: cover;
  background: var(--muted);
}
.course-card .card-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--heading);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.course-card .card-text {
  font-size: 0.8125rem;
  color: var(--muted-fg);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.course-card .card-footer {
  background: transparent;
  font-size: 0.8125rem;
  color: var(--muted-fg);
}

/* === Auth Forms === */
.auth-container {
  max-width: 440px;
  margin: 2rem auto;
}
.auth-container .card {
  border-radius: var(--radius-xl);
}
.auth-container h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--heading);
}

/* === Buttons (tu.ac.th style — dark + red) === */
.btn {
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.btn-sm {
  font-size: 0.8125rem;
  padding: 0.375rem 0.75rem;
}
.btn-outline-secondary {
  border-color: var(--border);
  color: var(--foreground);
}
.btn-outline-secondary:hover {
  background: var(--muted);
  border-color: var(--border);
  color: var(--foreground);
}
.btn-google {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--foreground);
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.btn-google:hover {
  background: var(--muted);
  box-shadow: var(--shadow-sm);
}

/* === Form Controls === */
.form-control, .form-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--tu-red);
  box-shadow: 0 0 0 3px rgba(46, 139, 87, 0.12);
}
.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--heading);
}

/* === Badges === */
.badge {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
}

/* === Profile === */
.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--tu-red);
}
.profile-avatar-placeholder {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--tu-red);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
}

/* === Progress Bar === */
.progress {
  height: 8px;
  border-radius: 9999px;
  background: var(--tu-red-lighter);
}
.progress .progress-bar {
  background: var(--tu-red) !important;
  border-radius: 9999px;
}

/* === Video Player === */
.video-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.video-wrapper iframe,
.video-wrapper video {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}
.video-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 10;
  cursor: default;
}
.video-progress-bar {
  height: 8px;
  background: var(--tu-red-lighter);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 0.5rem;
  cursor: pointer;
  position: relative;
}
.video-progress-bar:hover { height: 12px; }
.video-progress-seekable {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(var(--tu-red-rgb, 163,31,52), 0.2);
  border-radius: 9999px;
  pointer-events: none;
}
.video-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--tu-red);
  border-radius: 9999px;
  transition: width 0.3s;
  pointer-events: none;
}
.anti-seek-notice {
  font-size: 0.8125rem;
  color: var(--muted-fg);
}

/* === Quiz Modal === */
.modal-content {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}
.quiz-modal-header {
  background: var(--tu-navy);
  color: white;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 1rem 1.5rem;
  border-bottom: 3px solid var(--tu-red);
}
.quiz-modal-header .modal-title {
  font-size: 1rem;
  font-weight: 600;
}
.quiz-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.875rem;
}
.quiz-option:hover {
  border-color: var(--tu-red);
  background: var(--tu-red-lighter);
}
.quiz-option.selected {
  border-color: var(--tu-red);
  background: var(--tu-red-lighter);
  font-weight: 500;
}
.quiz-option.correct {
  border-color: var(--success);
  background: #fdf5dd;
}
.quiz-option.incorrect {
  border-color: var(--destructive);
  background: #f8d7da;
}

/* === Certificate === */
.certificate-frame {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 3px double var(--tu-red);
  border-radius: var(--radius-xl);
  padding: 3rem;
  text-align: center;
  position: relative;
  max-width: 700px;
  margin: 0 auto;
}
.certificate-frame::before {
  content: '';
  position: absolute;
  top: 12px; left: 12px; right: 12px; bottom: 12px;
  border: 1px solid var(--tu-red);
  border-radius: var(--radius-lg);
  pointer-events: none;
  opacity: 0.3;
}
.certificate-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--tu-red);
}
.certificate-name {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--tu-navy);
  margin: 1rem 0;
}
.certificate-course {
  font-size: 1.2rem;
  color: var(--foreground);
}
.certificate-code {
  font-size: 0.8125rem;
  color: var(--muted-fg);
  margin-top: 1.5rem;
}
/* Certificate with custom background image */
.certificate-frame.has-bg {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: none;
  aspect-ratio: 1.414;
  max-width: 850px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.certificate-frame.has-bg::before { display: none; }
.certificate-frame.has-bg .certificate-title { color: #1a365d; }
.certificate-frame.has-bg .certificate-name { color: #1a365d; }
.certificate-frame.has-bg .certificate-course { color: #2d3748; }
.certificate-frame.has-bg .certificate-code { color: #718096; }
.certificate-frame.has-bg .cert-text { color: #4a5568; }

/* === Tables (Admin) === */
.table {
  font-size: 0.875rem;
}
.table thead th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-fg);
  border-bottom: 1px solid var(--border);
}
.table-hover tbody tr:hover {
  background: var(--muted);
}
.table-light {
  background: var(--muted) !important;
}

/* === Alert === */
.alert {
  border-radius: var(--radius);
  font-size: 0.875rem;
  border: none;
}

/* === Footer (tu.ac.th style — dark) === */
.site-footer {
  background: var(--tu-navy);
  color: rgba(255,255,255,0.7);
  margin-top: 3rem;
}

.footer-main {
  padding: 3rem 0 2rem;
}

.site-footer .brand-icon {
  background: var(--tu-red);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.footer-brand-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff;
}

.footer-desc {
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.55);
  line-height: 1.7;
  margin-bottom: 0;
}

.footer-heading {
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--tu-red);
  display: inline-block;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 0.625rem;
  display: flex;
  align-items: flex-start;
}

/* Quick links rendered as two columns */
.footer-links--grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 1rem;
}
@media (max-width: 575.98px) {
  .footer-links--grid {
    grid-template-columns: 1fr;
  }
}

.footer-links li i,
.footer-links li [data-lucide] {
  width: 16px;
  height: 16px;
  color: var(--tu-yellow);
  flex-shrink: 0;
  margin-top: 3px;
}

.footer-links a {
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 0.8125rem;
  transition: color 0.2s ease, padding-left 0.2s ease;
}

.footer-links a:hover {
  color: var(--tu-yellow);
  padding-left: 2px;
}

.footer-contact li span {
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.55);
  line-height: 1.6;
}

.footer-website-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--tu-yellow);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  margin-top: 0.5rem;
  transition: opacity 0.2s ease;
}

.footer-website-link:hover {
  color: var(--tu-yellow-light);
  opacity: 0.85;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 1.25rem 0;
  text-align: center;
}

.footer-bottom small {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
}

/* Hide footer on admin pages */
body.admin-mode .site-footer {
  display: none;
}

@media (max-width: 767.98px) {
  .footer-main {
    padding: 2rem 0 1.5rem;
  }
  .footer-heading {
    margin-top: 0.5rem;
  }
}

/* === Admin Stats Cards === */
.card .text-primary { color: var(--tu-red) !important; }
.card .text-success { color: var(--success) !important; }
.card .text-warning { color: var(--tu-yellow) !important; }
.card .text-info { color: var(--link) !important; }

/* === Misc === */
.loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}
.spinner-border {
  color: var(--tu-red) !important;
}

/* === Page Headers (consolidated in Base) === */

/* === Responsive Container === */
.container {
  max-width: 1280px;
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-fg); }

/* === Yellow Accent Utilities === */
.accent-bar {
  height: 3px;
  background: var(--tu-yellow);
}
.badge-accent {
  background: var(--tu-yellow) !important;
  color: var(--tu-navy) !important;
}

