/* ============================================
   LEADEMY DESIGN SYSTEM v2.0
   Unified design system for all roles
   Inspired by: Linear, Clerk, Stripe
   ============================================ */

/* ----- Design Tokens ----- */
:root {
  /* Brand */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;

  /* Accent */
  --accent-50: #e0f2fe;
  --accent-100: #bae6fd;
  --accent-200: #7dd3fc;
  --accent-300: #38bdf8;
  --accent-400: #0ea5e9;
  --accent-500: #0284c7;
  --accent-600: #0369a1;

  /* Semantic */
  --success-50: #ecfdf5;
  --success-500: #10b981;
  --success-600: #059669;
  --warning-50: #fffbeb;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  --danger-50: #fef2f2;
  --danger-500: #ef4444;
  --danger-600: #dc2626;
  --info-50: #eff6ff;
  --info-500: #3b82f6;

  /* Neutrals */
  --white: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --gray-950: #020617;

  /* Dark surface */
  --dark-bg: #0b1120;
  --dark-card: #111b2e;
  --dark-border: #1e293b;
  --dark-hover: #1a2640;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --tracking-tight: -0.01em;

  /* Borders */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.06), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
  --shadow-card: 0 1px 2px rgba(0,0,0,0.02), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-dropdown: 0 10px 40px rgba(0,0,0,0.08);

  /* Layout */
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 68px;
  --header-h: 64px;
  --max-w: 1280px;
}

/* ----- Dark Mode Overrides ----- */
.dark {
  --gray-50: #0f172a;
  --gray-100: #1e293b;
  --gray-200: #334155;
  --gray-300: #475569;
  --gray-400: #64748b;
  --gray-500: #94a3b8;
  --gray-600: #cbd5e1;
  --gray-700: #e2e8f0;
  --gray-800: #f1f5f9;
  --gray-900: #f8fafc;
}

/* ----- Base ----- */
*, *::before, *::after { box-sizing: border-box; }
[x-cloak] { display: none !important; }

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* Prevent accidental horizontal page scroll without breaking position:sticky.
   `clip` (vs hidden) does not create a scroll container, so sticky headers
   keep working while page-level horizontal overflow is suppressed. */
html { overflow-x: clip; }
@supports not (overflow-x: clip) { html { overflow-x: hidden; } }

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--gray-900);
  background: var(--gray-50);
  transition: background 0.2s, color 0.2s;
}

.dark body { background: var(--dark-bg); color: var(--gray-800); }

a { color: inherit; text-decoration: none; }

/* ----- Scrollbar ----- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
.dark ::-webkit-scrollbar-thumb { background: var(--gray-600); }
.dark ::-webkit-scrollbar-thumb:hover { background: var(--gray-500); }

/* ----- Utilities ----- */
.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.aspect-video { aspect-ratio: 16 / 9; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ----- Card System ----- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s, border-color 0.2s;
}
@media (hover: hover) {
  .card:hover { box-shadow: var(--shadow-md); border-color: var(--gray-300); }
  .dark .card:hover { border-color: var(--gray-600); }
}
.dark .card { background: var(--dark-card); border-color: var(--dark-border); }

.card-body { padding: var(--space-5); }
.card-header { padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--gray-100); }
.dark .card-header { border-color: var(--dark-border); }
.card-footer { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--gray-100); }
.dark .card-footer { border-color: var(--dark-border); }

/* Stat Card */
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  padding: var(--space-5);
  transition: all 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); border-color: var(--gray-300); transform: translateY(-1px); }
.dark .stat-card { background: var(--dark-card); border-color: var(--dark-border); }
.dark .stat-card:hover { border-color: var(--gray-600); }

.stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.125rem; flex-shrink: 0;
}

/* Course Card */
.course-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--gray-200);
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}
.course-card:hover { box-shadow: var(--shadow-lg); border-color: var(--gray-300); transform: translateY(-2px); }
.dark .course-card { background: var(--dark-card); border-color: var(--dark-border); }
.dark .course-card:hover { border-color: var(--gray-600); }

.course-card .thumb {
  position: relative; overflow: hidden;
  aspect-ratio: 16/10;
  background: var(--gray-100);
}
.course-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.course-card:hover .thumb img { transform: scale(1.05); }

/* ----- Button System ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: 500; line-height: 1.4;
  transition: all 0.15s; cursor: pointer; border: none;
  text-decoration: none; white-space: nowrap;
  font-family: var(--font-sans);
}

.btn-primary { background: var(--primary-500); color: var(--white); }
.btn-primary:hover { background: var(--primary-600); }
.btn-primary:active { background: var(--primary-700); }

.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }
.dark .btn-secondary { background: var(--gray-800); color: var(--gray-300); }
.dark .btn-secondary:hover { background: var(--gray-700); }

.btn-outline {
  background: transparent; border: 1px solid var(--gray-300); color: var(--gray-700);
}
.btn-outline:hover { border-color: var(--primary-500); color: var(--primary-600); background: var(--primary-50); }
.dark .btn-outline { border-color: var(--gray-600); color: var(--gray-400); }
.dark .btn-outline:hover { border-color: var(--primary-400); color: var(--primary-400); background: rgba(59,130,246,0.1); }

.btn-ghost { background: transparent; color: var(--gray-500); }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-700); }
.dark .btn-ghost { color: var(--gray-400); }
.dark .btn-ghost:hover { background: rgba(51,65,85,0.4); color: var(--gray-200); }

.btn-success { background: var(--success-500); color: var(--white); }
.btn-success:hover { background: var(--success-600); }
.btn-danger { background: var(--danger-500); color: var(--white); }
.btn-danger:hover { background: var(--danger-600); }

.btn-sm { padding: 5px 10px; font-size: var(--text-xs); border-radius: var(--radius-sm); }
.btn-lg { padding: 10px 20px; font-size: var(--text-base); }
.btn-xl { padding: 12px 24px; font-size: var(--text-base); border-radius: var(--radius-lg); }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-md); }
.btn-icon-sm { width: 32px; height: 32px; padding: 0; border-radius: var(--radius-sm); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ----- Badge System ----- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 500; line-height: 1.4;
}
.badge-primary { background: var(--primary-50); color: var(--primary-700); }
.badge-success { background: var(--success-50); color: var(--success-600); }
.badge-warning { background: var(--warning-50); color: var(--warning-600); }
.badge-danger { background: var(--danger-50); color: var(--danger-600); }
.badge-neutral { background: var(--gray-100); color: var(--gray-600); }
.dark .badge-primary { background: rgba(59,130,246,0.15); color: var(--primary-300); }
.dark .badge-success { background: rgba(16,185,129,0.15); color: var(--success-500); }
.dark .badge-warning { background: rgba(245,158,11,0.15); color: var(--warning-500); }
.dark .badge-danger { background: rgba(239,68,68,0.15); color: var(--danger-500); }
.dark .badge-neutral { background: var(--gray-800); color: var(--gray-400); }

/* ----- Input / Form System ----- */
.input {
  width: 100%; padding: 8px 12px;
  border: 1.5px solid var(--gray-200); border-radius: var(--radius-md);
  font-size: var(--text-sm); transition: all 0.15s;
  background: var(--white); color: var(--gray-900);
  font-family: var(--font-sans);
}
.input:focus { outline: none; border-color: var(--primary-500); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.dark .input { background: var(--dark-card); border-color: var(--gray-200); color: var(--gray-700); }
.dark .input:focus { border-color: var(--primary-400); box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.input::placeholder { color: var(--gray-400); }
.input-sm { padding: 5px 10px; font-size: var(--text-xs); }
.input-lg { padding: 10px 14px; font-size: var(--text-base); }
.input-error { border-color: var(--danger-500); }
.input-error:focus { box-shadow: 0 0 0 3px rgba(239,68,68,0.1); }
.dark .input-error { border-color: var(--danger-500); }
textarea.input { min-height: 80px; resize: vertical; }

/* Select */
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* Checkbox / Radio */
.checkbox, .radio {
  appearance: none; width: 18px; height: 18px; border: 2px solid var(--gray-300);
  border-radius: 4px; cursor: pointer; transition: all 0.15s;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; vertical-align: middle;
}
.checkbox:checked { background: var(--primary-500); border-color: var(--primary-500); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: center; }
.dark .checkbox { border-color: var(--gray-600); }
.radio { border-radius: 50%; }
.radio:checked { background: var(--primary-500); border-color: var(--primary-500); box-shadow: inset 0 0 0 3px var(--white); }
.dark .radio:checked { box-shadow: inset 0 0 0 3px var(--dark-card); }

/* Label */
.label { display: block; font-size: var(--text-sm); font-weight: 500; color: var(--gray-700); margin-bottom: 6px; }
.dark .label { color: var(--gray-400); }
.label-sm { font-size: var(--text-xs); }

/* ----- Table System ----- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-lg); border: 1px solid var(--gray-200); }
.dark .table-wrap { border-color: var(--dark-border); }
.table-wrap table { width: 100%; font-size: var(--text-sm); border-collapse: collapse; }
.table-wrap th {
  text-align: left; padding: 10px 16px;
  font-size: var(--text-xs); font-weight: 600;
  color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--gray-50); border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.table-wrap td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.table-wrap tbody tr { transition: background 0.15s; }
.table-wrap tbody tr:hover { background: var(--gray-50); }
.table-wrap tbody tr:last-child td { border-bottom: none; }
.dark .table-wrap th { background: var(--dark-card); color: var(--gray-400); border-color: var(--dark-border); }
.dark .table-wrap td { border-color: var(--dark-border); }
.dark .table-wrap tbody tr:hover { background: rgba(30,41,59,0.5); }

/* ----- Modal / Dialog ----- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--white); border-radius: var(--radius-xl);
  width: 90%; max-width: 520px; max-height: 90vh;
  overflow-y: auto; box-shadow: var(--shadow-xl);
  animation: scaleIn 0.2s ease;
}
.dark .modal { background: var(--dark-card); }
.modal-header { padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: var(--space-6); }
.modal-footer { padding: var(--space-4) var(--space-6); border-top: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); }
.dark .modal-header, .dark .modal-footer { border-color: var(--dark-border); }

/* ----- Dropdown ----- */
.dropdown {
  background: var(--white); border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200); box-shadow: var(--shadow-dropdown);
  overflow: hidden; min-width: 180px;
}
.dark .dropdown { background: var(--dark-card); border-color: var(--dark-border); }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; font-size: var(--text-sm);
  color: var(--gray-700); transition: background 0.1s; cursor: pointer;
}
.dropdown-item:hover { background: var(--gray-50); }
.dropdown-item-danger { color: var(--danger-500); }
.dropdown-item-danger:hover { background: var(--danger-50); }
.dark .dropdown-item { color: var(--gray-300); }
.dark .dropdown-item:hover { background: rgba(51,65,85,0.4); }
.dark .dropdown-item-danger { color: var(--danger-500); }
.dark .dropdown-item-danger:hover { background: rgba(239,68,68,0.1); }

/* ----- Progress ----- */
.progress { height: 6px; background: var(--gray-100); border-radius: var(--radius-full); overflow: hidden; }
.dark .progress { background: var(--gray-800); }
.progress-bar { height: 100%; border-radius: var(--radius-full); transition: width 0.4s ease; }
.progress-bar-primary { background: var(--primary-500); }
.progress-bar-success { background: var(--success-500); }
.progress-bar-warning { background: var(--warning-500); }
.progress-ring { --size: 3rem; --stroke: 4px; width: var(--size); height: var(--size); border-radius: 50%; position: relative; }
.progress-ring svg { transform: rotate(-90deg); }

/* ----- Skeleton ----- */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}
.dark .skeleton {
  background: linear-gradient(90deg, var(--gray-800) 25%, var(--gray-700) 50%, var(--gray-800) 75%);
  background-size: 200% 100%;
}

/* ----- Avatar ----- */
.avatar {
  width: 36px; height: 36px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-sm); font-weight: 600;
  flex-shrink: 0; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: var(--text-xs); }
.avatar-lg { width: 44px; height: 44px; font-size: var(--text-base); }
.avatar-xl { width: 56px; height: 56px; font-size: var(--text-xl); }

/* ----- Tabs ----- */
.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--gray-200); padding: 0; }
.dark .tabs { border-color: var(--dark-border); }
.tab {
  padding: 10px 16px; font-size: var(--text-sm); font-weight: 500;
  color: var(--gray-500); border-bottom: 2px solid transparent;
  transition: all 0.15s; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--gray-700); }
.tab.active { color: var(--primary-600); border-bottom-color: var(--primary-500); }
.dark .tab { color: var(--gray-400); }
.dark .tab:hover { color: var(--gray-300); }
.dark .tab.active { color: var(--primary-400); border-bottom-color: var(--primary-400); }

/* ----- Empty State ----- */
.empty-state { text-align: center; padding: var(--space-12) var(--space-6); }
.empty-state-icon { width: 56px; height: 56px; margin: 0 auto var(--space-4); border-radius: var(--radius-xl); background: var(--gray-100); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: var(--gray-400); }
.dark .empty-state-icon { background: var(--gray-800); color: var(--gray-500); }
.empty-state-title { font-size: var(--text-base); font-weight: 600; color: var(--gray-900); margin-bottom: var(--space-1); }
.dark .empty-state-title { color: var(--gray-300); }
.empty-state-desc { font-size: var(--text-sm); color: var(--gray-500); margin-bottom: var(--space-6); }

/* ----- Notification / Alert ----- */
.alert {
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  font-size: var(--text-sm); display: flex; align-items: center; gap: var(--space-3);
}
.alert-info { background: var(--info-50); color: var(--info-500); border: 1px solid rgba(59,130,246,0.2); }
.alert-success { background: var(--success-50); color: var(--success-600); border: 1px solid rgba(16,185,129,0.2); }
.alert-warning { background: var(--warning-50); color: var(--warning-600); border: 1px solid rgba(245,158,11,0.2); }
.alert-danger { background: var(--danger-50); color: var(--danger-600); border: 1px solid rgba(239,68,68,0.2); }
.dark .alert-info { background: rgba(59,130,246,0.1); color: var(--info-500); border-color: rgba(59,130,246,0.15); }
.dark .alert-success { background: rgba(16,185,129,0.1); color: var(--success-500); border-color: rgba(16,185,129,0.15); }
.dark .alert-warning { background: rgba(245,158,11,0.1); color: var(--warning-500); border-color: rgba(245,158,11,0.15); }
.dark .alert-danger { background: rgba(239,68,68,0.1); color: var(--danger-500); border-color: rgba(239,68,68,0.15); }

/* ----- Page Header ----- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: var(--space-4); margin-bottom: var(--space-6);
}
.page-header h1 { font-size: var(--text-2xl); font-weight: 700; color: var(--gray-900); letter-spacing: var(--tracking-tight); }
.dark .page-header h1 { color: var(--gray-800); }
.page-header p { font-size: var(--text-sm); color: var(--gray-500); margin-top: 2px; }

/* ----- KPI Grid ----- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }

/* ----- Pagination ----- */
.pagination { display: flex; align-items: center; gap: var(--space-1); justify-content: center; padding: var(--space-4) 0; }
.pagination a, .pagination span {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: 500; transition: all 0.15s;
}
.pagination a { color: var(--gray-600); border: 1px solid var(--gray-200); }
.pagination a:hover { border-color: var(--primary-500); color: var(--primary-600); background: var(--primary-50); }
.pagination .active { background: var(--primary-500); color: var(--white); border-color: var(--primary-500); }
.pagination .disabled { color: var(--gray-300); cursor: not-allowed; }
.dark .pagination a { color: var(--gray-400); border-color: var(--gray-200); }
.dark .pagination a:hover { border-color: var(--primary-400); color: var(--primary-400); background: rgba(59,130,246,0.1); }
.dark .pagination .active { background: var(--primary-500); color: var(--white); border-color: var(--primary-500); }

/* ----- Tooltip ----- */
.tooltip { position: relative; }
.tooltip::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px);
  left: 50%; transform: translateX(-50%); padding: 4px 8px;
  background: var(--gray-900); color: var(--white); font-size: var(--text-xs);
  border-radius: var(--radius-sm); white-space: nowrap; opacity: 0;
  pointer-events: none; transition: opacity 0.15s;
}
.tooltip:hover::after { opacity: 1; }

/* ----- Search Bar ----- */
.search-bar {
  position: relative; width: 100%; max-width: 320px;
}
.search-bar input {
  width: 100%; height: 40px; padding: 0 14px 0 38px;
  border: 1px solid var(--gray-200); border-radius: var(--radius-md);
  font-size: var(--text-sm); transition: all 0.15s;
  background: var(--gray-50); color: var(--gray-900);
}
.search-bar input:focus { outline: none; border-color: var(--primary-500); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); background: var(--white); }
.dark .search-bar input { background: var(--dark-card); border-color: var(--dark-border); color: var(--gray-700); }
.dark .search-bar input:focus { border-color: var(--primary-400); background: var(--dark-card); }
.search-bar .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gray-400); font-size: var(--text-sm); pointer-events: none; }
.search-bar .search-kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 2px; }
.search-bar .search-kbd kbd { padding: 1px 5px; border-radius: 4px; background: var(--gray-100); border: 1px solid var(--gray-200); font-size: 10px; color: var(--gray-400); font-family: var(--font-sans); }

/* ----- Filter Bar ----- */
.filter-bar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-5); }
.filter-bar .filter-btn { padding: 6px 14px; border-radius: var(--radius-full); font-size: var(--text-sm); font-weight: 500; border: 1px solid var(--gray-200); background: var(--white); color: var(--gray-600); cursor: pointer; transition: all 0.15s; }
.filter-bar .filter-btn:hover { border-color: var(--primary-300); color: var(--primary-600); }
.filter-bar .filter-btn.active { background: var(--primary-50); border-color: var(--primary-500); color: var(--primary-700); }
.dark .filter-bar .filter-btn { background: var(--dark-card); border-color: var(--dark-border); color: var(--gray-400); }
.dark .filter-bar .filter-btn:hover { border-color: var(--primary-400); color: var(--primary-400); }
.dark .filter-bar .filter-btn.active { background: rgba(99,102,241,0.15); border-color: var(--primary-400); color: var(--primary-300); }

/* ----- Stats / KPI ----- */
.kpi-value { font-size: var(--text-2xl); font-weight: 700; color: var(--gray-900); letter-spacing: var(--tracking-tight); }
.dark .kpi-value { color: var(--gray-800); }
.kpi-label { font-size: var(--text-sm); color: var(--gray-500); margin-top: 2px; }
.kpi-trend { font-size: var(--text-xs); font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.kpi-trend-up { color: var(--success-500); }
.kpi-trend-down { color: var(--danger-500); }

/* ----- Sidebar Link (for the layout) ----- */
.sidebar-link {
  transition: all 0.15s; position: relative; border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: 500;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; cursor: pointer; color: var(--gray-400);
}
.sidebar-link:hover { background: rgba(255,255,255,0.05); color: var(--gray-200); }
.sidebar-link.active { background: rgba(59,130,246,0.18); color: #60a5fa; font-weight: 700; box-shadow: inset 0 0 0 1px rgba(59,130,246,0.15); }
.sidebar-link.active::before { content: ''; position: absolute; left: -16px; top: 50%; transform: translateY(-50%); width: 4px; height: 24px; background: linear-gradient(180deg, #60a5fa, #3b82f6); border-radius: 0 6px 6px 0; box-shadow: 0 0 8px rgba(59,130,246,0.5); }
.sidebar-link i { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; }
.dark .sidebar-link { color: var(--gray-500); }
.dark .sidebar-link:hover { background: rgba(255,255,255,0.03); color: var(--gray-300); }
.dark .sidebar-link.active { background: rgba(59,130,246,0.2); color: #93c5fd; box-shadow: inset 0 0 0 1px rgba(59,130,246,0.2); }

/* ----- Animations ----- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes ping { 0% { transform: scale(1); opacity: 1; } 75%, 100% { transform: scale(2); opacity: 0; } }

.animate-fade-in { animation: fadeIn 0.2s ease forwards; }
.animate-fade-in-up { animation: fadeInUp 0.35s ease forwards; }
.animate-fade-in-down { animation: fadeInDown 0.2s ease forwards; }
.animate-slide-up { animation: slideUp 0.35s ease forwards; }
.animate-scale-in { animation: scaleIn 0.2s ease forwards; }

.stagger-1 { animation-delay: 0.04s; }
.stagger-2 { animation-delay: 0.08s; }
.stagger-3 { animation-delay: 0.12s; }
.stagger-4 { animation-delay: 0.16s; }
.stagger-5 { animation-delay: 0.2s; }

/* Admin dashboard animation classes */
.animate-in { animation: slideUp 0.4s ease both; }
.animate-in.delay-1 { animation-delay: 0.06s; }
.animate-in.delay-2 { animation-delay: 0.12s; }
.animate-in.delay-3 { animation-delay: 0.18s; }
.animate-in.delay-4 { animation-delay: 0.24s; }

/* Glass card for admin dashboard */
.glass-card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s;
}
.glass-card:hover { box-shadow: var(--shadow-md); }
.dark .glass-card { background: var(--dark-card); border-color: var(--dark-border); }

/* Gradient Text */
.gradient-text {
  background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Hero glow */
.hero-glow {
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,0.08) 0%, transparent 70%);
  pointer-events: none;
}

/* Float shapes for gradient headers */
.float-shape { position: absolute; border-radius: 50%; pointer-events: none; }
.float-shape-1 { width: 300px; height: 300px; background: rgba(59,130,246,0.15); top: -80px; right: -60px; filter: blur(60px); }
.float-shape-2 { width: 200px; height: 200px; background: rgba(96,165,250,0.12); bottom: -40px; left: -40px; filter: blur(50px); }
.float-shape-3 { width: 150px; height: 150px; background: rgba(52,211,153,0.08); top: 50%; right: 20%; filter: blur(40px); }

/* Badge card for gradient header stats */
.badge-card { transition: transform 0.2s, box-shadow 0.2s; }
.badge-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }

/* Fade up animation for settings/management pages */
.animate-fade-up { animation: slideUp 0.4s ease both; }
.animate-fade-up-d1 { animation: slideUp 0.4s ease both; animation-delay: 0.08s; }
.animate-fade-up-d2 { animation: slideUp 0.4s ease both; animation-delay: 0.15s; }

/* Status badge for tables/lists */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600; white-space: nowrap;
}

/* Chart container */
.chart-container { position: relative; width: 100%; }

.stat-card { animation: slideUp 0.4s ease both; }

/* ----- Hover Effects ----- */
.hover-lift { transition: transform 0.2s, box-shadow 0.2s; }
@media (hover: hover) {
  .hover-lift:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
}
.hover-scale { transition: transform 0.2s; }
.hover-scale:hover { transform: scale(1.02); }

/* ----- Status Indicator ----- */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.online { background: var(--success-500); }
.status-dot.offline { background: var(--gray-300); }
.status-dot.away { background: var(--warning-500); }

/* ----- Print ----- */
@media print { header, footer, nav, .no-print, .sidebar, .mobile-nav { display: none !important; } body { background: var(--white) !important; color: #000 !important; } }

/* ----- Responsive ----- */
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
  .page-header { flex-direction: column; align-items: flex-start; }
  .filter-bar { overflow-x: auto; flex-wrap: nowrap; padding-bottom: var(--space-2); }
  .filter-bar::-webkit-scrollbar { height: 0; }
  .table-wrap { border-radius: var(--radius-md); }
  .search-bar { max-width: 100%; }
}

@media (max-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}

/* ----- Dashboard Responsive Overrides ----- */
@media (max-width: 767px) {
  .card-body { padding: clamp(12px, 3vw, 20px); }
  .card-header { padding: clamp(10px, 2.5vw, 16px) clamp(12px, 3vw, 20px); }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .grid.md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .grid.md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
}

/* Chart container must never overflow */
.chart-container { max-width: 100%; overflow: hidden; }

/* Card hover effect */
.card-hover { transition: all 0.3s ease; }
.card-hover:hover { transform: translateY(-2px); }

/* Marquee scroll for partners */
@keyframes scrollX { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
.scroll-track { display: flex; animation: scrollX 40s linear infinite; }
.scroll-track:hover { animation-play-state: paused; }

/* Float animations for hero cards */
@keyframes float-1 { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-8px); } }
@keyframes float-2 { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-6px); } }
@keyframes float-3 { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-10px); } }
@keyframes float-4 { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-5px); } }
.float-1 { animation: float-1 3s ease-in-out infinite; }
.float-2 { animation: float-2 3.5s ease-in-out infinite; }
.float-3 { animation: float-3 4s ease-in-out infinite; }
.float-4 { animation: float-4 3.2s ease-in-out infinite; }

/* ----- Chat / Messages ----- */
.msg-bubble { position: relative; }
.msg-bubble::after { content: ''; position: absolute; bottom: 0; width: 8px; height: 8px; }
.msg-bubble.sent::after { right: -4px; border-right: 4px solid var(--primary-500); border-bottom: 4px solid var(--primary-500); border-radius: 0 0 4px 0; }
.msg-bubble.received::after { left: -4px; border-left: 4px solid var(--gray-100); border-bottom: 4px solid var(--gray-100); border-radius: 0 0 0 4px; }
.dark .msg-bubble.received::after { border-left-color: var(--dark-card); border-bottom-color: var(--dark-card); }

/* ----- Rating Stars ----- */
.rating-stars input { display: none; }
.rating-stars label { cursor: pointer; font-size: 1.25rem; color: var(--gray-300); transition: color 0.2s; float: right; }
.rating-stars label:hover, .rating-stars label:hover ~ label, .rating-stars input:checked ~ label { color: #f59e0b; }

/* ----- On/Off Toggle ----- */
.toggle { position: relative; width: 44px; height: 24px; cursor: pointer; display: inline-block; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--gray-300); border-radius: var(--radius-full); transition: 0.2s; }
.toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: var(--white); border-radius: 50%; transition: 0.2s; }
.toggle input:checked + .toggle-slider { background: var(--primary-500); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }
.dark .toggle-slider { background: var(--gray-600); }

/* ----- File Upload ----- */
.file-upload { border: 2px dashed var(--gray-300); border-radius: var(--radius-lg); padding: var(--space-8); text-align: center; cursor: pointer; transition: all 0.15s; }
.file-upload:hover { border-color: var(--primary-500); background: var(--primary-50); }
.dark .file-upload { border-color: var(--gray-700); }
.dark .file-upload:hover { border-color: var(--primary-400); background: rgba(99,102,241,0.05); }
.file-upload-icon { font-size: 2rem; color: var(--gray-400); margin-bottom: var(--space-3); }
.file-upload-text { font-size: var(--text-sm); color: var(--gray-600); }
.file-upload-hint { font-size: var(--text-xs); color: var(--gray-400); margin-top: var(--space-1); }

/* ----- Video / Live Classes ----- */
.video-grid { display: grid; gap: var(--space-3); }
.video-grid.one { grid-template-columns: 1fr; }
.video-grid.two { grid-template-columns: 1fr 1fr; }
.video-grid.three { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.video-grid.four { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.video-grid.five { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); }
.video-grid.six { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); }
.video-participant { position: relative; border-radius: var(--radius-lg); overflow: hidden; background: var(--gray-900); aspect-ratio: 4/3; }
.video-participant video { width: 100%; height: 100%; object-fit: cover; }
.video-participant .name-tag { position: absolute; bottom: var(--space-2); left: var(--space-2); padding: 2px 8px; background: rgba(0,0,0,0.6); color: var(--white); border-radius: var(--radius-sm); font-size: var(--text-xs); }
.video-participant .speaker-indicator { position: absolute; top: var(--space-2); right: var(--space-2); width: 8px; height: 8px; border-radius: 50%; background: var(--success-500); }

/* ============================================
   COURSE DETAIL PAGE (Material Design 3 Classes)
   ============================================ */

/* Material Symbols */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal; font-style: normal;
  font-size: 24px; line-height: 1;
  letter-spacing: normal; text-transform: none;
  display: inline-block; white-space: nowrap; word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}

/* --- Typography --- */
.font-display { font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif; }
.font-headline-lg { font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif; font-weight: 700; }
.font-headline-md { font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif; font-weight: 600; }
.font-headline-sm { font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif; font-weight: 600; }
.font-body-sm { font-size: var(--text-xs); font-weight: 400; line-height: var(--leading-relaxed); }
.font-body-md { font-size: var(--text-base); font-weight: 400; line-height: var(--leading-relaxed); }
.font-body-lg { font-size: var(--text-lg); font-weight: 400; line-height: var(--leading-relaxed); }
.font-label-sm { font-size: var(--text-xs); font-weight: 500; letter-spacing: 0.03em; }
.font-label-md { font-size: var(--text-sm); font-weight: 500; }

.text-display { font-size: 2.25rem; line-height: 1.15; letter-spacing: -0.02em; }
.text-headline-lg { font-size: 1.75rem; line-height: 1.2; letter-spacing: -0.01em; }
.text-headline-md { font-size: 1.25rem; line-height: 1.3; }
.text-headline-sm { font-size: 0.938rem; line-height: 1.4; }
.text-body-sm { font-size: var(--text-xs); line-height: 1.4; }
.text-body-md { font-size: var(--text-base); line-height: var(--leading-relaxed); }
.text-body-lg { font-size: var(--text-lg); line-height: var(--leading-relaxed); }
.text-label-sm { font-size: var(--text-xs); line-height: 1.4; }
.text-label-md { font-size: var(--text-sm); line-height: 1.4; }

@media (max-width: 640px) {
  .text-display { font-size: 1.75rem; }
  .text-headline-lg { font-size: 1.35rem; }
}

/* --- Surface Colors --- */
.bg-surface { background: var(--white); }
.dark .bg-surface { background: var(--dark-card); }

.bg-surface-container-low { background: var(--gray-50); }
.dark .bg-surface-container-low { background: rgba(17,27,46,0.6); }

.bg-surface-container-high { background: var(--gray-100); }
.dark .bg-surface-container-high { background: rgba(30,41,59,0.7); }

.bg-surface-container-highest { background: var(--gray-200); }
.dark .bg-surface-container-highest { background: var(--gray-200); }

.bg-surface-container { background: var(--gray-100); }
.dark .bg-surface-container { background: var(--gray-100); }

.bg-surface-container-low\/50 { background: rgba(248,250,252,0.5); }
.dark .bg-surface-container-low\/50 { background: rgba(17,27,46,0.3); }

/* Material-token surfaces used directly in markup (dashboards, course player) */
:where(.dark) .bg-surface-container-lowest { background-color: var(--dark-card); }
:where(.dark) .bg-surface-bright { background-color: var(--dark-card); }
:where(.dark) .bg-surface-variant { background-color: var(--gray-100); }
:where(.dark) .bg-background { background-color: var(--dark-bg); }
:where(.dark) .bg-surface-container-lowest\/90 { background-color: rgba(17,27,46,0.9); }
:where(.dark) .bg-surface-container-low\/60 { background-color: rgba(17,27,46,0.6); }
:where(.dark) .bg-surface-container\/50 { background-color: rgba(30,41,59,0.5); }
:where(.dark) .bg-surface\/20 { background-color: rgba(17,27,46,0.2); }
:where(.dark) .bg-surface-variant\/30 { background-color: rgba(30,41,59,0.3); }

.bg-outline-variant { background: var(--gray-200); }
.dark .bg-outline-variant { background: var(--gray-200); }
.bg-outline-variant\/50 { background: rgba(226,232,240,0.5); }
.dark .bg-outline-variant\/50 { background: rgba(51,65,85,0.5); }

.bg-primary-container { background: var(--primary-50); }
.dark .bg-primary-container { background: rgba(59,130,246,0.12); }

/* tertiary = rose/red (for sale/promotional) */
.bg-on-tertiary-container { background: #e11d48; }
.bg-on-tertiary-container\/5 { background: rgba(225,29,72,0.05); }
.bg-on-tertiary-container\/10 { background: rgba(225,29,72,0.1); }

.bg-secondary\/5 { background: rgba(59,130,246,0.05); }

.bg-on-surface\/20 { background: rgba(15,23,42,0.2); }
.dark .bg-on-surface\/20 { background: rgba(241,245,249,0.2); }

/* --- Text Colors --- */
.text-primary { color: #000000; }
.dark .text-primary { color: var(--gray-800); }
.text-on-surface { color: #000000; }
.dark .text-on-surface { color: var(--gray-800); }

.text-on-surface-variant { color: #000000; }
.dark .text-on-surface-variant { color: var(--gray-400); }

.text-secondary { color: var(--primary-500); }
.dark .text-secondary { color: var(--primary-400); }

.text-on-tertiary-container { color: #e11d48; }
.dark .text-on-tertiary-container { color: #fb7185; }

.text-outline-variant { color: var(--gray-300); }
.dark .text-outline-variant { color: var(--gray-500); }

.text-on-primary-container { color: var(--primary-700); }
.dark .text-on-primary-container { color: var(--primary-300); }

.text-on-secondary { color: var(--white); }
.dark .text-on-secondary { color: var(--white); }

/* opacity variants */
.text-on-surface-variant\/30 { color: rgba(0,0,0,0.3); }
.dark .text-on-surface-variant\/30 { color: rgba(148,163,184,0.3); }
.text-on-surface-variant\/60 { color: rgba(0,0,0,0.6); }
.dark .text-on-surface-variant\/60 { color: rgba(148,163,184,0.6); }

/* --- Border Colors --- */
.border-outline-variant { border-color: var(--gray-200); }
.dark .border-outline-variant { border-color: var(--gray-200); }

.border-outline-variant\/10 { border-color: rgba(226,232,240,0.1); }
.dark .border-outline-variant\/10 { border-color: rgba(51,65,85,0.1); }
.border-outline-variant\/20 { border-color: rgba(226,232,240,0.2); }
.dark .border-outline-variant\/20 { border-color: rgba(51,65,85,0.2); }
.border-outline-variant\/30 { border-color: rgba(226,232,240,0.3); }
.dark .border-outline-variant\/30 { border-color: rgba(51,65,85,0.3); }
.border-outline-variant\/50 { border-color: rgba(226,232,240,0.5); }
.dark .border-outline-variant\/50 { border-color: rgba(51,65,85,0.5); }

.border-secondary { border-color: var(--primary-500); }
.dark .border-secondary { border-color: var(--primary-400); }
.border-secondary\/30 { border-color: rgba(99,102,241,0.3); }

.border-on-tertiary-container\/20 { border-color: rgba(225,29,72,0.2); }

/* --- Spacing --- */
.px-container-margin { padding-left: 1rem; padding-right: 1rem; }
@media (min-width: 640px) { .px-container-margin { padding-left: 1.5rem; padding-right: 1.5rem; } }
@media (min-width: 1024px) { .px-container-margin { padding-left: 2rem; padding-right: 2rem; } }

.pb-stack-lg { padding-bottom: 2.5rem; }
@media (min-width: 640px) { .pb-stack-lg { padding-bottom: 3rem; } }

.pb-safe-offset-4 { padding-bottom: 1rem; }
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .pb-safe-offset-4 { padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
}

.mb-stack-sm { margin-bottom: 1rem; }
.mb-stack-md { margin-bottom: 1.5rem; }
.mb-stack-lg { margin-bottom: 2rem; }

.space-y-section-gap > * + * { margin-top: 2.5rem; }
@media (min-width: 640px) { .space-y-section-gap > * + * { margin-top: 3rem; } }

/* --- Effects --- */
.glass-effect {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.2);
}
.dark .glass-effect {
  background: rgba(17,27,46,0.85);
  border-color: rgba(255,255,255,0.08);
}

.instructor-card-shadow { box-shadow: 0 2px 12px rgba(0,0,0,0.04); }
.dark .instructor-card-shadow { box-shadow: 0 2px 12px rgba(0,0,0,0.15); }

.sticky-sidebar { position: sticky; top: 6rem; }

/* --- Countdown --- */
.countdown-timer { font-variant-numeric: tabular-nums; }

/* --- Active states --- */
.hover\:bg-surface-container:hover { background: var(--gray-100); }
.dark .hover\:bg-surface-container:hover { background: var(--gray-100); }

.hover\:bg-surface-container-low:hover { background: var(--gray-50); }
.dark .hover\:bg-surface-container-low:hover { background: rgba(17,27,46,0.6); }

.active\:bg-surface-container-low:active { background: var(--gray-100); }
.dark .active\:bg-surface-container-low:active { background: rgba(30,41,59,0.7); }

/* --- Hero grid (home-style hero decoration) --- */
.hero-grid {
    background-image: radial-gradient(circle at 1px 1px, rgba(0,64,138,0.08) 1px, transparent 0);
    background-size: 28px 28px;
    -webkit-mask-image: radial-gradient(ellipse 85% 65% at 50% 30%, black 30%, transparent 72%);
    mask-image: radial-gradient(ellipse 85% 65% at 50% 30%, black 30%, transparent 72%);
}
.dark .hero-grid {
    background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.06) 1px, transparent 0);
}

/* ============================================================
   GLOBAL GRAYSCALE UTILITY DARK MAPPING
   Fallback layer for raw Tailwind gray/slate utilities that
   have no explicit `dark:` counterpart in the markup.

   `:where(.dark)` keeps specificity at (0,1,0) — identical to
   the compiled utility itself — so that:
     - the fallback wins over the light utility (app.css loads
       after tailwind.css), and
     - any real `dark:*` variant on the same element
       (`x.dark .dark\:bg-...` = 0,2,0) always wins instead.
   Only the LIGHT grays are remapped; the mid/dark grays
   (gray-400+, slate-400+) already read as dark and are left
   untouched, preserving dark buttons, footers, sidebars, etc.
   ============================================================ */

/* ----- Backgrounds (light surfaces -> dark surfaces) ----- */
:where(.dark) .bg-white { background-color: var(--dark-card); }
:where(.dark) .bg-gray-50 { background-color: var(--gray-50); }
:where(.dark) .bg-gray-100 { background-color: var(--gray-100); }
:where(.dark) .bg-gray-200 { background-color: var(--gray-200); }
:where(.dark) .bg-gray-300 { background-color: var(--gray-300); }
:where(.dark) .bg-slate-50 { background-color: var(--gray-50); }
:where(.dark) .bg-slate-100 { background-color: var(--gray-100); }
:where(.dark) .bg-slate-200 { background-color: var(--gray-200); }
:where(.dark) .bg-slate-300 { background-color: var(--gray-300); }

:where(.dark) .bg-white\/50 { background-color: rgba(17,27,46,0.5); }
:where(.dark) .bg-gray-50\/50 { background-color: rgba(15,23,42,0.5); }
:where(.dark) .bg-gray-50\/80 { background-color: rgba(15,23,42,0.8); }
:where(.dark) .bg-gray-50\/30 { background-color: rgba(15,23,42,0.3); }
:where(.dark) .bg-gray-100\/70 { background-color: rgba(30,41,59,0.7); }
:where(.dark) .bg-slate-50\/80 { background-color: rgba(15,23,42,0.8); }
:where(.dark) .bg-slate-50\/70 { background-color: rgba(15,23,42,0.7); }
:where(.dark) .bg-slate-50\/50 { background-color: rgba(15,23,42,0.5); }
:where(.dark) .bg-slate-100\/80 { background-color: rgba(30,41,59,0.8); }
:where(.dark) .bg-slate-100\/70 { background-color: rgba(30,41,59,0.7); }
:where(.dark) .bg-slate-100\/60 { background-color: rgba(30,41,59,0.6); }
:where(.dark) .bg-slate-200\/70 { background-color: rgba(51,65,85,0.7); }

/* hover / active / group-hover background surfaces */
:where(.dark) .hover\:bg-gray-50:hover { background-color: var(--gray-50); }
:where(.dark) .hover\:bg-gray-100:hover { background-color: var(--gray-100); }
:where(.dark) .hover\:bg-gray-200:hover { background-color: var(--gray-200); }
:where(.dark) .hover\:bg-slate-50:hover { background-color: var(--gray-50); }
:where(.dark) .hover\:bg-slate-100:hover { background-color: var(--gray-100); }
:where(.dark) .hover\:bg-slate-200:hover { background-color: var(--gray-200); }
:where(.dark) .active\:bg-slate-50:active { background-color: var(--gray-50); }
:where(.dark) .active\:bg-slate-100:active { background-color: var(--gray-100); }
:where(.dark) .group:hover .group-hover\:bg-slate-200 { background-color: var(--gray-200); }

/* ----- Text (dark text -> light text, inverted gray ramp) ----- */
:where(.dark) .text-gray-900 { color: var(--gray-900); }
:where(.dark) .text-gray-800 { color: var(--gray-800); }
:where(.dark) .text-gray-700 { color: var(--gray-700); }
:where(.dark) .text-gray-600 { color: var(--gray-600); }
:where(.dark) .text-gray-500 { color: var(--gray-500); }
:where(.dark) .text-gray-400 { color: var(--gray-400); }
:where(.dark) .text-slate-900 { color: var(--gray-900); }
:where(.dark) .text-slate-800 { color: var(--gray-800); }
:where(.dark) .text-slate-700 { color: var(--gray-700); }
:where(.dark) .text-slate-600 { color: var(--gray-600); }
:where(.dark) .text-slate-500 { color: var(--gray-500); }
:where(.dark) .text-slate-400 { color: var(--gray-400); }

/* ----- Borders (light borders -> dark borders) ----- */
:where(.dark) .border-gray-50 { border-color: var(--gray-100); }
:where(.dark) .border-gray-100 { border-color: var(--gray-100); }
:where(.dark) .border-gray-200 { border-color: var(--gray-200); }
:where(.dark) .border-gray-300 { border-color: var(--gray-300); }
:where(.dark) .border-slate-50 { border-color: var(--gray-100); }
:where(.dark) .border-slate-100 { border-color: var(--gray-100); }
:where(.dark) .border-slate-200 { border-color: var(--gray-200); }
:where(.dark) .border-slate-300 { border-color: var(--gray-300); }

:where(.dark) .border-gray-100\/50 { border-color: rgba(30,41,59,0.5); }
:where(.dark) .border-gray-200\/40 { border-color: rgba(51,65,85,0.4); }
:where(.dark) .border-gray-200\/50 { border-color: rgba(51,65,85,0.5); }
:where(.dark) .border-gray-200\/60 { border-color: rgba(51,65,85,0.6); }
:where(.dark) .border-slate-100\/50 { border-color: rgba(30,41,59,0.5); }
:where(.dark) .border-slate-200\/40 { border-color: rgba(51,65,85,0.4); }
:where(.dark) .border-slate-200\/50 { border-color: rgba(51,65,85,0.5); }
:where(.dark) .border-slate-200\/60 { border-color: rgba(51,65,85,0.6); }
:where(.dark) .border-slate-200\/80 { border-color: rgba(51,65,85,0.8); }

/* ----- Dividers ----- */
:where(.dark) .divide-gray-50 > :not([hidden]) ~ :not([hidden]) { border-color: var(--gray-100); }
:where(.dark) .divide-gray-100 > :not([hidden]) ~ :not([hidden]) { border-color: var(--gray-100); }
:where(.dark) .divide-gray-200 > :not([hidden]) ~ :not([hidden]) { border-color: var(--gray-200); }
:where(.dark) .divide-slate-50 > :not([hidden]) ~ :not([hidden]) { border-color: var(--gray-100); }
:where(.dark) .divide-slate-100 > :not([hidden]) ~ :not([hidden]) { border-color: var(--gray-100); }
:where(.dark) .divide-slate-200 > :not([hidden]) ~ :not([hidden]) { border-color: var(--gray-200); }

/* ----- Placeholders ----- */
:where(.dark) .placeholder-gray-400::placeholder { color: var(--gray-400); }
:where(.dark) .placeholder-gray-500::placeholder { color: var(--gray-500); }
:where(.dark) .placeholder-slate-300::placeholder { color: var(--gray-300); }
:where(.dark) .placeholder-slate-400::placeholder { color: var(--gray-400); }
:where(.dark) .placeholder-slate-500::placeholder { color: var(--gray-500); }
:where(.dark) .placeholder\:text-gray-300::placeholder { color: var(--gray-500); }
:where(.dark) .placeholder\:text-gray-400::placeholder { color: var(--gray-400); }
:where(.dark) .placeholder\:text-gray-500::placeholder { color: var(--gray-500); }
:where(.dark) .placeholder\:text-slate-300::placeholder { color: var(--gray-300); }
:where(.dark) .placeholder\:text-slate-400::placeholder { color: var(--gray-400); }
:where(.dark) .placeholder\:text-slate-500::placeholder { color: var(--gray-500); }

/* ----- Rings ----- */
:where(.dark) .ring-gray-100 { --tw-ring-color: var(--gray-100); }
:where(.dark) .ring-gray-200 { --tw-ring-color: var(--gray-200); }
:where(.dark) .ring-gray-300 { --tw-ring-color: var(--gray-300); }
:where(.dark) .ring-slate-100 { --tw-ring-color: var(--gray-100); }
:where(.dark) .ring-slate-200 { --tw-ring-color: var(--gray-200); }
:where(.dark) .ring-slate-300 { --tw-ring-color: var(--gray-300); }

/* ============================================================
   AUTH PAGE DARK COMPONENTS
   Covers the bespoke auth-page classes (login, register, forgot,
   reset, verify-email, device-check, complete-profile) so those
   pages inherit dark styling even though they ship their own
   `<style>` blocks. Local `.dark .x` rules (0,2,0) still win.
   ============================================================ */
:where(.dark) .bg-grid {
    background-image:
        linear-gradient(rgba(99,102,241,0.10) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99,102,241,0.10) 1px, transparent 1px);
}
:where(.dark) .input-field {
    background: #0f172a;
    border-color: #334155;
}
:where(.dark) .input-field:focus {
    background: #111827;
    border-color: #6366f1;
}
:where(.dark) .input-field:hover:not(:focus) {
    border-color: #475569;
}
:where(.dark) .btn-primary {
    background: linear-gradient(135deg, #818cf8, #a78bfa);
}
:where(.dark) .stat-card {
    background: rgba(30,41,59,0.6);
}
:where(.dark) .stat-card:hover {
    background: rgba(30,41,59,0.8);
}

/* ============================================================
   DARK MODE COLOR-SCHEME + AUTOFILL
   Forces native form controls (selects, date pickers, autofill)
   to follow the theme instead of rendering with a light palette.
   ============================================================ */
.dark { color-scheme: dark; }
.dark input:-webkit-autofill,
.dark input:-webkit-autofill:hover,
.dark input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--gray-700);
    -webkit-box-shadow: 0 0 0 1000px var(--dark-card) inset;
    transition: background-color 9999s ease-out 0s;
}
.dark select {
    background-color: var(--dark-card);
    color: var(--gray-700);
}
.dark option {
    background-color: var(--dark-card);
    color: var(--gray-700);
}

/* ===== Course preview (views/courses/show.php) utility fallbacks =====
   Mirrors the Material-3 tokens used by the new course preview so the page
   renders correctly with the site's compiled Tailwind (no Play CDN needed). */
.max-w-container-max { max-width: 1280px; }
.px-margin-mobile { padding-left: 1rem; padding-right: 1rem; }
@media (min-width: 768px) {
  .md\:px-margin-desktop { padding-left: 3rem; padding-right: 3rem; }
}
.py-base { padding-top: .5rem; padding-bottom: .5rem; }
.gap-stack-lg { gap: 2.5rem; }
.gap-stack-md { gap: 1.5rem; }
.mt-stack-lg { margin-top: 2.5rem; }
.py-stack-md { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.pt-stack-md { padding-top: 1.5rem; }
.font-label-md { font-family: 'Plus Jakarta Sans', system-ui, sans-serif; font-weight: 500; }
.text-label-md { font-size: 12px; line-height: 16px; font-weight: 500; }
.text-caption { font-size: 12px; line-height: 16px; }
.shadow-ambient { box-shadow: 0 4px 20px rgba(53, 37, 205, .08); }
.shadow-ambient-hover { box-shadow: 0 10px 30px rgba(53, 37, 205, .15); }


/* ============================================================
   UDEMY-STYLE COURSE PAGE  (views/courses/show.php)
   Self-contained styles so the page renders correctly without
   depending on Tailwind's purged utility classes.
   ============================================================ */
.ud-course { background:#fff; color:#1c1d1f; font-family:'Inter','Plus Jakarta Sans',system-ui,sans-serif; }
.ud-container { max-width:1340px; margin:0 auto; padding:0 24px; }
@media (max-width:767px){ .ud-container{ padding:0 16px; } }
.ud-layout { display:grid; grid-template-columns:1fr; gap:32px; padding:24px 0 80px; align-items:start; }
.ud-main { min-width:0; }
.ud-aside { display:none; }

.ud-title { font-size:26px; line-height:1.25; font-weight:700; color:#1c1d1f; margin:0 0 8px; }
.ud-subtitle { font-size:18px; color:#6a6f73; margin:0 0 12px; }
.ud-rating { display:flex; flex-wrap:wrap; align-items:center; gap:6px; font-size:14px; color:#6a6f73; margin-bottom:6px; }
.ud-rating-num { font-weight:700; color:#b4690e; }
.ud-stars { color:#e59800; display:inline-flex; }
.ud-link { color:#a435f0; text-decoration:none; }
.ud-link:hover { text-decoration:underline; }
.ud-createdby { font-size:14px; color:#6a6f73; margin-bottom:6px; }
.ud-metabar { font-size:13px; color:#6a6f73; display:flex; flex-wrap:wrap; align-items:center; margin-bottom:10px; }
.ud-dot { color:#6a6f73; margin:0 8px; }
.ud-badge-bs { display:inline-block; background:#f3ca37; color:#1c1d1f; font-size:12px; font-weight:700; padding:2px 8px; border-radius:4px; margin-bottom:10px; }

.ud-h2 { font-size:24px; font-weight:700; color:#1c1d1f; margin:0 0 16px; }
.ud-section { margin:32px 0; }
.ud-prose { font-size:15px; line-height:1.6; color:#1c1d1f; }
.ud-list { list-style:disc; padding-left:20px; font-size:15px; line-height:1.6; color:#1c1d1f; }
.ud-list li { margin-bottom:8px; }

/* What you'll learn */
.ud-learn { background:#f7f9fa; border:1px solid #d1d7dc; padding:24px; }
.ud-learn-grid { display:grid; grid-template-columns:1fr; gap:12px 24px; }
@media (min-width:768px){ .ud-learn-grid{ grid-template-columns:1fr 1fr; } }
.ud-learn-item { display:flex; gap:10px; align-items:flex-start; font-size:14px; color:#1c1d1f; }
.ud-check { color:#1c1d1f; font-size:20px; flex-shrink:0; }

/* Purchase card */
.ud-card { position:sticky; top:84px; background:#fff; border:1px solid #d1d7dc; }
.ud-card-media { position:relative; width:100%; aspect-ratio:16/9; background:#1c1d1f; overflow:hidden; cursor:pointer; }
.ud-card-media img, .ud-card-media-btn { width:100%; height:100%; object-fit:cover; border:0; display:block; }
.ud-card-media-btn { background-size:cover; background-position:center; cursor:pointer; }
.ud-card-media-ph { width:100%; height:100%; background:#1c1d1f; }
.ud-card-media-overlay { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(0,0,0,.35); }
.ud-play { width:64px; height:64px; border-radius:50%; background:#fff; display:flex; align-items:center; justify-content:center; box-shadow:0 4px 12px rgba(0,0,0,.3); }
.ud-play .material-symbols-outlined { color:#1c1d1f; font-size:34px; }
.ud-card-body { padding:24px; }
.ud-price { display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; margin-bottom:16px; }
.ud-price-now { font-size:28px; font-weight:700; color:#1c1d1f; }
.ud-price-old { font-size:18px; color:#6a6f73; text-decoration:line-through; }
.ud-price-off { font-size:14px; font-weight:700; color:#1c1d1f; }
.ud-btn { display:block; width:100%; box-sizing:border-box; text-align:center; padding:14px 16px; font-size:16px; font-weight:700; border-radius:0; cursor:pointer; text-decoration:none; margin-top:12px; }
.ud-btn-dark { background:#000; color:#fff; border:1px solid #000; }
.ud-btn-dark:hover { background:#333; }
.ud-btn-outline { background:#fff; color:#000; border:1px solid #000; }
.ud-btn-outline:hover { background:#f7f7f7; }
.ud-guarantee { display:flex; align-items:center; gap:6px; justify-content:center; margin-top:12px; font-size:13px; color:#6a6f73; }
.ud-includes { margin-top:16px; border-top:1px solid #d1d7dc; padding-top:16px; }
.ud-includes-title { font-size:14px; font-weight:700; color:#1c1d1f; margin-bottom:8px; }
.ud-includes-list { list-style:none; margin:0; padding:0; }
.ud-includes-list li { display:flex; gap:10px; align-items:flex-start; font-size:14px; color:#1c1d1f; margin-bottom:8px; }
.ud-ic { color:#6a6f73; font-size:18px; flex-shrink:0; }
.ud-card-foot { margin-top:16px; display:flex; justify-content:space-around; font-size:13px; gap:8px; flex-wrap:wrap; }
.ud-foot-link { color:#a435f0; cursor:pointer; display:flex; gap:4px; align-items:center; }
.ud-foot-link:hover { color:#7c2bb0; }

/* Curriculum accordion */
.ud-content-meta { display:flex; justify-content:space-between; align-items:center; gap:12px; font-size:14px; color:#6a6f73; margin-bottom:8px; flex-wrap:wrap; }
.ud-expand { color:#a435f0; background:none; border:0; cursor:pointer; font-size:14px; font-weight:700; padding:0; }
.ud-acc-item { border:1px solid #d1d7dc; margin-bottom:-1px; }
.ud-acc-head { width:100%; text-align:left; background:#f7f9fa; padding:16px; display:flex; justify-content:space-between; align-items:center; gap:12px; cursor:pointer; border:0; font:inherit; }
.ud-acc-head:hover { background:#f1f3f5; }
.ud-acc-title { font-size:16px; font-weight:700; color:#1c1d1f; display:flex; align-items:center; gap:10px; }
.ud-acc-meta { font-size:14px; color:#6a6f73; white-space:nowrap; }
.ud-lesson { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:12px 16px; cursor:pointer; font-size:14px; color:#1c1d1f; }
.ud-lesson:hover { background:#f7f9fa; }
.ud-lesson-title { display:flex; align-items:center; gap:10px; color:#a435f0; }
.ud-lesson-title .material-symbols-outlined { color:#6a6f73; font-size:20px; }
.ud-preview-badge { color:#a435f0; font-weight:600; font-size:12px; margin-left:4px; }
.ud-lesson-dur { font-size:13px; color:#6a6f73; white-space:nowrap; }

/* Instructor */
.ud-instr { display:flex; gap:20px; align-items:flex-start; }
.ud-instr-avatar { width:96px; height:96px; border-radius:50%; object-fit:cover; flex-shrink:0; }
.ud-instr-name { font-size:20px; font-weight:700; color:#1c1d1f; margin:0 0 2px; }
.ud-instr-title { font-size:15px; color:#6a6f73; margin:0 0 12px; }
.ud-instr-bio { font-size:14px; line-height:1.6; color:#1c1d1f; }
.ud-instr-stats { display:flex; flex-wrap:wrap; gap:20px; font-size:13px; color:#6a6f73; margin-bottom:12px; }
.ud-instr-stats b { color:#1c1d1f; }
.ud-follow { margin-top:8px; color:#a435f0; background:none; border:1px solid #a435f0; border-radius:999px; padding:8px 16px; font-size:14px; font-weight:700; cursor:pointer; }
.ud-follow:hover { background:#a435f0; color:#fff; }

/* Reviews */
.ud-rev-summary { display:flex; align-items:center; gap:16px; margin-bottom:16px; }
.ud-rev-num { font-size:48px; font-weight:700; color:#1c1d1f; line-height:1; }
.ud-rev-card { border-top:1px solid #d1d7dc; padding:16px 0; }
.ud-rev-head { display:flex; align-items:center; gap:10px; margin-bottom:6px; }
.ud-rev-avatar { width:40px; height:40px; border-radius:50%; background:#d1d7dc; display:flex; align-items:center; justify-content:center; font-weight:700; color:#1c1d1f; }
.ud-rev-name { font-weight:700; color:#1c1d1f; font-size:14px; }
.ud-rev-meta { font-size:12px; color:#6a6f73; }
.ud-rev-text { font-size:14px; color:#1c1d1f; line-height:1.5; }

/* Mobile sticky bar */
.ud-mobile-bar { position:fixed; bottom:0; left:0; right:0; background:#fff; border-top:1px solid #d1d7dc; padding:12px 16px; display:flex; align-items:center; justify-content:space-between; gap:12px; z-index:50; }
.ud-mobile-bar .ud-price { margin:0; }
.ud-mobile-bar .ud-btn { margin:0; width:auto; padding:12px 20px; }

@media (min-width:992px){
  .ud-layout { grid-template-columns:minmax(0,1fr) 380px; }
  .ud-aside { display:block; }
  .ud-mobile-bar { display:none; }
  .ud-title { font-size:32px; }
}


/* ===== Preview modals (ensure they render without Tailwind's purged classes) ===== */
#previewModalM, #previewModalD { position:fixed; inset:0; z-index:100; align-items:center; justify-content:center; padding:16px; }
#previewModalM { background:rgba(0,0,0,.6); }
#previewModalM > div { background:#fff; border-radius:24px; overflow:hidden; max-width:768px; width:100%; box-shadow:0 25px 50px -12px rgba(0,0,0,.25); }
#previewModalD { background:rgba(0,0,0,.7); backdrop-filter:blur(4px); -webkit-backdrop-filter:blur(4px); }
#previewModalD > div { background:#fff; overflow:hidden; max-width:896px; width:100%; box-shadow:0 25px 50px -12px rgba(0,0,0,.25); }

