/* =========================================================
   SteinerVGS — Main Stylesheet
   Design: Deep Indigo + Amber | Dark sidebar | Outfit/Inter
   Phase 7 visual redesign
   ========================================================= */

/* ---------------------------------------------------------
   1. Font imports (default — overridden by SiteSettings)
   --------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=Inter:ital,wght@0,400;0,500;0,600;1,400&family=DM+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 400;
  line-height: 1.65;
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------
   2. Design Tokens
   --------------------------------------------------------- */
:root {
  /* Brand — Deep Indigo */
  --brand:          #4f46e5;
  --brand-hover:    #4338ca;
  --brand-light:    #eef2ff;
  --brand-text:     #3730a3;
  --brand-dark:     #312e81;

  /* Accent — Amber */
  --accent:         #f59e0b;
  --accent-hover:   #d97706;
  --accent-light:   #fffbeb;
  --accent-text:    #92400e;

  /* Indigo scale */
  --indigo-50:  #eef2ff;
  --indigo-100: #e0e7ff;
  --indigo-200: #c7d2fe;
  --indigo-400: #818cf8;
  --indigo-500: #6366f1;
  --indigo-600: #4f46e5;
  --indigo-700: #4338ca;
  --indigo-800: #3730a3;
  --indigo-900: #312e81;

  /* Neutrals — warm slate */
  --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;

  /* Semantic */
  --green-50:  #f0fdf4;
  --green-100: #dcfce7;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --amber-50:  #fffbeb;
  --amber-100: #fef3c7;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-700: #b45309;
  --red-50:    #fff1f2;
  --red-500:   #ef4444;
  --red-700:   #b91c1c;
  --blue-50:   #eff6ff;
  --blue-200:  #bfdbfe;
  --blue-600:  #2563eb;
  --blue-700:  #1d4ed8;

  /* Surfaces — DARK THEME */
  --bg-page:    #0f172a;
  --bg-card:    #1e293b;
  --bg-topbar:  #0f172a;

  /* Sidebar — dark navy (default, overridable) */
  --sidebar-bg:      #0f172a;
  --sidebar-text:    rgba(255,255,255,0.75);
  --sidebar-active:  rgba(255,255,255,0.12);
  --sidebar-hover:   rgba(255,255,255,0.07);
  --sidebar-border:  rgba(255,255,255,0.08);
  --sidebar-heading: rgba(255,255,255,0.35);

  /* Text — dark theme */
  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --text-inverse:   #0f172a;

  /* Borders — dark theme */
  --border:       #334155;
  --border-focus: #6366f1;

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

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md: 0 4px 16px rgba(15,23,42,0.10), 0 2px 4px rgba(15,23,42,0.06);
  --shadow-lg: 0 12px 32px rgba(15,23,42,0.14), 0 4px 8px rgba(15,23,42,0.06);
  --shadow-brand: 0 4px 14px rgba(79,70,229,0.3);

  /* Spacing */
  --space-1:  0.25rem;  --space-2:  0.5rem;   --space-3:  0.75rem;
  --space-4:  1rem;     --space-5:  1.25rem;  --space-6:  1.5rem;
  --space-8:  2rem;     --space-10: 2.5rem;   --space-12: 3rem;
  --space-16: 4rem;

  /* Layout */
  --topbar-height: 64px;
  --sidebar-width: 240px;
}

/* ---------------------------------------------------------
   3. Top Navigation Bar — dark
   --------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-height);
  background: var(--bg-topbar);
  border-bottom: 2px solid rgba(0,0,0,0.15);
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: 100%;
  padding: 0 var(--space-6);
  max-width: 1440px;
  margin: 0 auto;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  flex-shrink: 0;
  padding-right: var(--space-4);
  border-right: 1px solid rgba(255,255,255,0.15);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-name {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  margin-left: var(--space-4);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.875rem;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  letter-spacing: 0.01em;
}

.nav-link:hover {
  background: rgba(255,255,255,0.12);
  color: #ffffff;
}

.nav-link.active {
  background: rgba(255,255,255,0.18);
  color: #ffffff;
  box-shadow: inset 0 -2px 0 rgba(255,255,255,0.5);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
  flex-shrink: 0;
}

.user-label {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.8);
}

/* Sign out button on dark topbar */
.topbar-user .btn-ghost {
  color: rgba(255,255,255,0.6);
  border-color: rgba(255,255,255,0.15);
}
.topbar-user .btn-ghost:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* ---------------------------------------------------------
   4. Role Badges
   --------------------------------------------------------- */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.role-admin   { background: rgba(245,158,11,0.2); color: #fbbf24; }
.role-teacher { background: rgba(99,102,241,0.25); color: #a5b4fc; }
.role-student { background: rgba(34,197,94,0.2);  color: #86efac; }

/* ---------------------------------------------------------
   5. Flash Messages
   --------------------------------------------------------- */
.messages-container {
  padding: var(--space-3) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 1440px;
  margin: var(--space-3) auto 0;
  width: 100%;
}

.message {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
}

.message-success { background: var(--green-50);  color: var(--green-700); border-color: var(--green-100); }
.message-error,
.message-danger   { background: var(--red-50);    color: var(--red-700);   border-color: #fecaca; }
.message-warning  { background: var(--amber-50);  color: var(--amber-700); border-color: var(--amber-100); }
.message-info,
.message-debug    { background: var(--indigo-50); color: var(--indigo-800); border-color: var(--indigo-100); }

.message-close {
  background: none; border: none; font-size: 18px; cursor: pointer;
  color: inherit; opacity: 0.5; padding: 0 4px; line-height: 1;
}
.message-close:hover { opacity: 1; }

/* ---------------------------------------------------------
   6. Main Content
   --------------------------------------------------------- */
.main-content {
  flex: 1;
  padding: var(--space-8) var(--space-8);
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

/* Lesson view — full bleed, no padding, no max-width */
body.layout-lesson .main-content {
  padding: 0;
  max-width: 100%;
  margin: 0;
}

/* ---------------------------------------------------------
   7. Page Header
   --------------------------------------------------------- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-8);
  gap: var(--space-4);
  flex-wrap: wrap;
}

.page-header-left h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-header-left p {
  margin-top: var(--space-1);
  font-size: 15px;
  color: var(--text-secondary);
}

.page-header-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-shrink: 0;
}

/* ---------------------------------------------------------
   8. Cards
   --------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: none;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
}

.card-header h2,
.card-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body { padding: var(--space-6); }

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ---------------------------------------------------------
   9. Buttons
   --------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.5rem 1.125rem;
  border-radius: var(--radius-md);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  box-shadow: 0 4px 18px rgba(79,70,229,0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--gray-100);
  color: var(--text-primary);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-accent:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--red-50);
  color: var(--red-700);
  border-color: #fecaca;
}
.btn-danger:hover {
  background: var(--red-500);
  color: #fff;
  border-color: var(--red-500);
}

.btn-sm  { font-size: 13px; padding: 0.3rem 0.75rem; }
.btn-lg  { font-size: 16px; padding: 0.75rem 1.5rem; }
.w-full  { width: 100%; justify-content: center; }

/* ---------------------------------------------------------
   10. Forms
   --------------------------------------------------------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-5);
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.form-label .required { color: var(--red-500); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 0.5625rem 0.875rem;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: 1.5;
}

.form-control:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
  background: rgba(255,255,255,0.07);
}

.form-control::placeholder { color: var(--text-muted); }

textarea.form-control { resize: vertical; min-height: 100px; }

select.form-control {
  appearance: none;
  background-color: #1e293b;
  color: #f1f5f9;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 36px;
  cursor: pointer;
}

select.form-control option {
  background-color: #1e293b;
  color: #f1f5f9;
}

.form-help  { font-size: 12px; color: var(--text-muted); }
.form-error { font-size: 12px; color: var(--red-700); }
.errorlist  { list-style: none; margin-top: var(--space-1); }
.errorlist li { font-size: 12px; color: var(--red-700); }

/* ---------------------------------------------------------
   11. Tables
   --------------------------------------------------------- */
.table-wrapper { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  text-align: left;
  padding: 0.75rem 1.25rem;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: rgba(255,255,255,0.03); }

/* ---------------------------------------------------------
   12. Dashboard Grid
   --------------------------------------------------------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.15s, transform 0.15s;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Accent bar on top of stat cards */
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
}

.stat-card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.stat-card-value {
  font-family: 'Outfit', sans-serif;
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  line-height: 1;
}

.stat-card-sub { font-size: 13px; color: var(--text-muted); }

/* ---------------------------------------------------------
   13. Teacher Two-Column Layout
   --------------------------------------------------------- */
.teacher-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 0;
  height: calc(100vh - var(--topbar-height));
  overflow: hidden;
}

.teacher-sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.teacher-panel {
  overflow-y: auto;
  padding: var(--space-8);
  background: var(--bg-page);
}

.sidebar-section { padding: var(--space-4); border-bottom: 1px solid var(--sidebar-border); }

.sidebar-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--sidebar-heading);
  padding: var(--space-2) var(--space-2) var(--space-3);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

.sidebar-item:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-item.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 500;
}

.sidebar-item-number {
  width: 20px; height: 20px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.sidebar-item.active .sidebar-item-number {
  background: var(--brand);
  color: #fff;
}

/* ---------------------------------------------------------
   14. Login Page
   --------------------------------------------------------- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--topbar-height));
  padding: var(--space-8) var(--space-4);
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  position: relative;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(79,70,229,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 50%, rgba(245,158,11,0.08) 0%, transparent 60%);
}

.login-card {
  background: rgba(255,255,255,0.97);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
  padding: var(--space-10) var(--space-10);
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  text-align: center;
}

.login-logo-mark {
  width: 56px; height: 56px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--brand) 0%, var(--indigo-400) 100%);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 26px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-brand);
  overflow: hidden;
}

.login-logo-mark img { width: 100%; height: 100%; object-fit: contain; }

.login-logo-name {
  font-family: 'Outfit', sans-serif;
  font-size: 24px; font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.login-logo-sub { font-size: 14px; color: var(--text-muted); }

/* ---------------------------------------------------------
   15. Badges
   --------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.badge-blue   { background: var(--indigo-50);  color: var(--indigo-700); }
.badge-green  { background: var(--green-50);   color: var(--green-700);  }
.badge-amber  { background: var(--amber-50);   color: var(--amber-700);  }
.badge-red    { background: var(--red-50);     color: var(--red-700);    }
.badge-gray   { background: var(--gray-100);   color: var(--gray-600);   }

/* ---------------------------------------------------------
   16. Empty State
   --------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-8);
  text-align: center;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 40px; margin-bottom: var(--space-4); opacity: 0.5; }
.empty-state h3   { font-family: 'Outfit', sans-serif; font-size: 17px; font-weight: 600; color: var(--text-secondary); margin-bottom: var(--space-2); }
.empty-state p    { font-size: 14px; max-width: 320px; line-height: 1.6; margin-bottom: var(--space-5); }

/* ---------------------------------------------------------
   17. Utility classes
   --------------------------------------------------------- */
.flex           { display: flex; }
.flex-col       { flex-direction: column; }
.items-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.gap-2 { gap: var(--space-2); } .gap-3 { gap: var(--space-3); } .gap-4 { gap: var(--space-4); }
.mt-4  { margin-top: var(--space-4); } .mt-6  { margin-top: var(--space-6); } .mt-8  { margin-top: var(--space-8); }
.mb-4  { margin-bottom: var(--space-4); } .mb-6  { margin-bottom: var(--space-6); }
.text-sm      { font-size: 13px; }
.text-muted   { color: var(--text-muted); }
.text-right   { text-align: right; }
.font-medium  { font-weight: 500; }
.font-mono    { font-family: 'DM Mono', monospace; }

/* ---------------------------------------------------------
   18. Site Footer
   --------------------------------------------------------- */
.site-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-card);
}

/* ---------------------------------------------------------
   19. Scrollbar
   --------------------------------------------------------- */
::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ---------------------------------------------------------
   20. Course Cards
   --------------------------------------------------------- */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-5);
}

.course-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: box-shadow 0.15s, transform 0.15s;
  position: relative;
  overflow: hidden;
}

.course-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  opacity: 0;
  transition: opacity 0.15s;
}

.course-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.course-card:hover::before { opacity: 1; }

.course-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
}

.course-card-title {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  line-height: 1.3;
}
.course-card-title:hover { color: var(--brand); }

.course-card-meta   { font-size: 13px; color: var(--text-muted); }
.course-card-desc   { font-size: 14px; color: var(--text-secondary); line-height: 1.6; flex: 1; }

.course-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* ---------------------------------------------------------
   21. File Preview Cards
   --------------------------------------------------------- */
.file-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.file-preview-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
  transition: box-shadow 0.15s, border-color 0.15s;
}

.file-preview-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--gray-300);
}

.file-preview-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  text-decoration: none;
}

.file-preview-thumb img { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.15s; }
.file-preview-thumb img:hover { opacity: 0.88; }
.file-preview-icon { background: var(--gray-100); }
.file-type-icon { font-size: 18px; font-weight: 800; letter-spacing: 0.04em; font-family: 'DM Mono', monospace; }

.file-preview-info {
  padding: 0.5rem 0.625rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.file-preview-name {
  font-size: 12px; font-weight: 500; color: var(--text-primary);
  text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block;
}
a.file-preview-name:hover { color: var(--brand); }
.file-preview-open { font-size: 11px; color: var(--text-muted); }

/* ---------------------------------------------------------
   22. Hamburger & Mobile Nav
   --------------------------------------------------------- */
.topbar-hamburger {
  display: none;
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-md);
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  color: rgba(255,255,255,0.8);
  font-size: 16px;
  line-height: 1;
  margin-left: auto;
}

.mobile-nav {
  display: none;
  position: fixed;
  top: var(--topbar-height);
  left: 0; right: 0; bottom: 0;
  z-index: 200;
}

.mobile-nav-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}

.mobile-nav-drawer {
  position: absolute;
  top: 0; left: 0;
  width: 280px;
  height: 100%;
  background: #0f172a;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 0.25rem;
  overflow-y: auto;
}

.mobile-nav.open { display: block; }

.mobile-nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  transition: background 0.12s;
}

.mobile-nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.mobile-nav-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 0.5rem 0; }

/* ---------------------------------------------------------
   23. Theme Settings — colour preset swatches
   --------------------------------------------------------- */
.colour-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-bottom: 1rem;
}

.colour-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  position: relative;
}

.colour-swatch:hover { transform: scale(1.15); }
.colour-swatch.selected { border-color: var(--text-primary); }
.colour-swatch.selected::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.sidebar-style-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.625rem;
  margin-bottom: 1rem;
}

.sidebar-style-btn {
  height: 48px;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, transform 0.15s;
}

.sidebar-style-btn:hover { transform: scale(1.02); }
.sidebar-style-btn.selected { border-color: var(--brand); }

.font-style-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
  margin-bottom: 1rem;
}

.font-style-btn {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  cursor: pointer;
  background: var(--bg-card);
  text-align: left;
  transition: border-color 0.15s;
}

.font-style-btn:hover { border-color: var(--gray-300); }
.font-style-btn.selected { border-color: var(--brand); background: var(--indigo-50); }
.font-style-btn .font-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.font-style-btn .font-sample { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---------------------------------------------------------
   24. Responsive
   --------------------------------------------------------- */
@media (max-width: 1024px) and (min-width: 769px) {
  .topbar-user .user-label { display: none; }
  .main-content { padding: var(--space-6) var(--space-5); }
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header-actions { flex-wrap: wrap; }
}

@media (max-width: 768px) {
  .topbar-hamburger { display: flex; align-items: center; }
  .topbar-nav       { display: none !important; }
  .topbar-user .user-label { display: none; }
  .topbar-user .role-badge { display: none; }

  .main-content { padding: var(--space-4) var(--space-3); max-width: 100%; }

  .page-header {
    flex-direction: column; align-items: flex-start;
    gap: var(--space-3); margin-bottom: var(--space-5);
  }
  .page-header-actions { width: 100%; flex-wrap: wrap; }

  .dashboard-grid { grid-template-columns: 1fr 1fr; gap: var(--space-3); }
  .stat-card-value { font-size: 26px; }

  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 540px; }

  .card-header { flex-wrap: wrap; gap: var(--space-2); }

  .login-page { background: #0f172a; }
  .login-card { padding: var(--space-8) var(--space-5); border-radius: var(--radius-lg); }

  .course-grid { grid-template-columns: 1fr; }
  .file-preview-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

  .teacher-layout { grid-template-columns: 1fr; }
  .teacher-sidebar { display: none; }
}

/* ---------------------------------------------------------
   Phase 10 — Messaging inbox button + badge
   --------------------------------------------------------- */
.topbar-inbox-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  color: rgba(255,255,255,0.65);
  font-size: 16px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.topbar-inbox-btn:hover,
.topbar-inbox-btn.active {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.inbox-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
  border: 1.5px solid #0f172a;
}

/* ---------------------------------------------------------
   Phase 10 — Messaging page styles
   --------------------------------------------------------- */
.thread-list { display: flex; flex-direction: column; gap: 0; }

.thread-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: background 0.12s;
}

.thread-item:hover { background: var(--gray-50); }
.thread-item.unread { background: var(--indigo-50); }
.thread-item.unread:hover { background: var(--indigo-100); }
.thread-item:last-child { border-bottom: none; }

.thread-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--indigo-400));
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: 'Outfit', sans-serif;
}

.thread-info { flex: 1; min-width: 0; }

.thread-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.thread-item.unread .thread-name { font-weight: 700; }

.thread-preview {
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.thread-item.unread .thread-preview { color: var(--text-secondary); }

.thread-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.thread-time { font-size: 11px; color: var(--text-muted); }

/* Message bubbles */
.message-bubble-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  max-height: 520px;
  overflow-y: auto;
}

.message-bubble-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.message-bubble-row.mine { flex-direction: row-reverse; }

.bubble-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--indigo-400));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: 'Outfit', sans-serif;
}

.bubble {
  max-width: 68%;
  padding: 0.75rem 1rem;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.6;
}

.bubble-theirs {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-bottom-left-radius: 4px;
}

.bubble-mine {
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bubble-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  padding: 0 0.25rem;
}

.message-bubble-row.mine .bubble-time { text-align: right; }

/* Reply box */
.reply-box {
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem;
  background: #1e293b;
}

/* Announcement cards */
.announcement-card {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}

.announcement-card.pinned {
  background: linear-gradient(135deg, var(--indigo-50) 0%, #e0e7ff 100%);
  border-color: var(--indigo-200);
  border-left-color: var(--brand);
}

.announcement-title {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.375rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.announcement-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.announcement-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ---------------------------------------------------------
   Language switcher
   --------------------------------------------------------- */
.lang-switcher { display: flex; align-items: center; }

.lang-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  padding: 0.25rem 0.4rem;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  transition: background 0.15s;
  color: transparent; /* show only emoji */
}

.lang-btn:hover {
  background: rgba(255,255,255,0.1);
}

/* ---------------------------------------------------------
   Brand logo — full height when uploaded, no squish
   --------------------------------------------------------- */
.brand-logo {
  height: 52px;
  max-height: calc(var(--topbar-height) - 12px);
  max-width: 220px;
  width: auto;
  object-fit: contain;
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* ---------------------------------------------------------
   Language switcher — EN / NO text buttons
   --------------------------------------------------------- */
.lang-btn {
  background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.4);
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  color: #ffffff !important;
  letter-spacing: 0.08em;
  font-family: inherit;
  line-height: 1.6;
  transition: background 0.15s, border-color 0.15s;
}

.lang-btn:hover {
  background: rgba(255,255,255,0.28);
  border-color: rgba(255,255,255,0.7);
}

/* ---------------------------------------------------------
   Python code runner panel
   --------------------------------------------------------- */
.python-runner-panel {
  margin-top: 2rem;
  border: 1.5px solid #bbf7d0;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: #f0fdf4;
}

.python-runner-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1.25rem;
  background: #dcfce7;
  border-bottom: 1px solid #bbf7d0;
}

.python-runner-icon { font-size: 18px; }

.python-runner-title {
  font-size: 14px;
  font-weight: 700;
  color: #15803d;
}

.python-runner-status {
  margin-left: auto;
  font-size: 12px;
  color: #6b7280;
  font-style: italic;
}

.python-runner-body { padding: 1rem 1.25rem; }

.python-code-area {
  width: 100%;
  min-height: 160px;
  font-family: 'Fira Mono', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  padding: 0.875rem 1rem;
  border: 1.5px solid #86efac;
  border-radius: var(--radius-md);
  background: #0f172a;
  color: #e2e8f0;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
  tab-size: 4;
}

.python-code-area:focus {
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22,163,74,0.15);
}

.python-runner-controls {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0 0.5rem;
  align-items: center;
}

.python-runner-controls .btn-ghost {
  color: #6b7280;
  font-size: 12px;
}

.python-output-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  margin-bottom: 0.375rem;
}

.python-output {
  font-family: 'Fira Mono', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  padding: 0.875rem 1rem;
  background: #0f172a;
  color: #a3e635;
  border-radius: var(--radius-md);
  border: 1px solid #334155;
  min-height: 80px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

/* Image resize toolbar animation */
#ql-img-toolbar {
  animation: img-toolbar-in 0.15s ease;
}
@keyframes img-toolbar-in {
  from { opacity:0; transform:translateY(4px); }
  to   { opacity:1; transform:translateY(0); }
}

/* ==========================================================
   MOBILE RESPONSIVE OVERHAUL
   Breakpoints:
     ≤ 1024px  tablet
     ≤ 768px   large phone / small tablet
     ≤ 480px   phone
   ========================================================== */

/* ── Tablet (≤ 1024px) ──────────────────────────────────── */
@media (max-width: 1024px) {

  /* Dashboard grids */
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }

  /* Page headers */
  .page-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .page-header-actions { flex-wrap: wrap; width: 100%; }

  /* Settings grid */
  .settings-grid { grid-template-columns: 1fr !important; }
  .preview-panel { position: static !important; }

  /* Course/report sidebar grids */
  [style*="grid-template-columns:1fr 340px"],
  [style*="grid-template-columns:1fr 300px"],
  [style*="grid-template-columns:1fr 260px"],
  [style*="grid-template-columns:1fr 280px"] {
    display: block !important;
  }
}

/* ── Large phone / small tablet (≤ 768px) ───────────────── */
@media (max-width: 768px) {

  /* Typography */
  .page-header-left h1 { font-size: 22px; }

  /* Main content padding */
  .main-content { padding: 1rem !important; }

  /* Dashboard */
  .dashboard-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .stat-card { padding: 1rem; }
  .stat-card-value { font-size: 28px; }

  /* Cards */
  .card-header { padding: 0.875rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
  .card-body { padding: 1rem; }

  /* Tables — horizontal scroll */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 500px; }

  /* Buttons */
  .btn { font-size: 13px; padding: 0.45rem 0.875rem; }
  .btn-lg { font-size: 15px; padding: 0.75rem 1.25rem; }

  /* Page header actions stack */
  .page-header-actions { flex-direction: column; align-items: stretch; }
  .page-header-actions .btn { width: 100%; justify-content: center; }

  /* Course grid */
  .course-grid { grid-template-columns: 1fr; gap: 0.75rem; }

  /* Forms */
  .form-group { margin-bottom: 1rem; }
  .form-control { font-size: 16px; } /* prevents iOS zoom */

  /* Login */
  .login-card { padding: 1.75rem 1.25rem; margin: 0.5rem; border-radius: 16px; }
  .login-page { padding: 1rem; align-items: flex-start; padding-top: 2rem; }

  /* Inline style grids — override with block */
  [style*="grid-template-columns"] { display: block !important; }
  [style*="grid-template-columns"] > * { margin-bottom: 1rem; }
  [style*="grid-template-columns"] > *:last-child { margin-bottom: 0; }

  /* Opt grids in settings */
  .opt-grid-2 { grid-template-columns: 1fr 1fr !important; }
  .opt-grid-3 { grid-template-columns: 1fr 1fr !important; }
  .opt-grid-4 { grid-template-columns: 1fr 1fr !important; }

  /* Lesson sidebar — show as bottom drawer toggle */
  .lesson-nav-sidebar { display: none !important; }
  .lesson-view-layout { grid-template-columns: 1fr !important; }
  .lesson-content-panel { width: 100%; }
  .lesson-reading-col { padding: 1.25rem 1rem; }
  .lesson-breadcrumb { font-size: 12px; }
  .lesson-title { font-size: 22px; }
  .lesson-pagination { flex-direction: column; gap: 0.75rem; }
  .lesson-pagination .btn { width: 100%; }

  /* Lesson mobile progress bar — show at top */
  .lesson-mobile-bar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    font-size: 13px;
    position: sticky;
    top: var(--topbar-height);
    z-index: 10;
  }

  /* Python runner */
  .python-code-area { min-height: 120px; font-size: 12px; }
  .python-runner-controls { flex-wrap: wrap; }

  /* Messaging */
  .message-bubble { max-width: 90% !important; }

  /* Grade config grid */
  .grade-config-grid { grid-template-columns: 1fr !important; }

  /* Topbar */
  .topbar-user .user-label { display: none; }
  .topbar-user .role-badge { display: none; }
  .topbar-nav { display: none !important; }
  .topbar-hamburger { display: flex !important; }
  .lang-switcher { display: none; } /* shown in mobile drawer instead */

  /* Editor toolbar buttons wrap */
  .editor-toolbar-right { flex-wrap: wrap; gap: 0.375rem; }

  /* AI panel */
  .student-ai-actions { grid-template-columns: 1fr 1fr !important; }
  .student-ai-concept-row { flex-direction: column; }
  .student-ai-concept-row input { width: 100%; }
  .student-ai-concept-row .student-ai-btn { width: 100%; }

  /* File preview grid */
  .file-preview-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ── Phone (≤ 480px) ────────────────────────────────────── */
@media (max-width: 480px) {

  /* Single column everything */
  .dashboard-grid { grid-template-columns: 1fr; }
  .opt-grid-2 { grid-template-columns: 1fr !important; }
  .opt-grid-3 { grid-template-columns: 1fr !important; }
  .opt-grid-4 { grid-template-columns: 1fr 1fr !important; }

  /* Topbar */
  .brand-name { font-size: 15px; }
  .brand-logo { max-height: 32px !important; }

  /* Tables */
  .table { min-width: 400px; }
  .table th, .table td { padding: 0.625rem 0.75rem; font-size: 13px; }

  /* Cards */
  .card-header h2, .card-header h3 { font-size: 14px; }

  /* Lesson view */
  .lesson-title { font-size: 20px; }
  .lesson-header { padding: 1rem; }
  .lesson-meta-row { flex-wrap: wrap; gap: 0.375rem; }

  /* Complete button */
  .lesson-complete-btn { font-size: 14px; padding: 0.75rem 1rem; }

  /* Student notes */
  .student-notes-textarea { min-height: 100px; }

  /* AI panel */
  .student-ai-actions { grid-template-columns: 1fr !important; }
  .student-ai-panel { padding: 1rem; }

  /* Python runner */
  .python-runner-body { padding: 0.75rem; }
  .python-code-area { font-size: 11px; }

  /* Login */
  .login-card { padding: 1.5rem 1rem; }

  /* File preview */
  .file-preview-grid { grid-template-columns: 1fr !important; }

  /* Colour swatches */
  .colour-swatch { width: 32px; height: 32px; }
}

/* ── Touch improvements (all mobile) ────────────────────── */
@media (hover: none) and (pointer: coarse) {

  /* Larger tap targets */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .nav-link { padding: 0.5rem 0.625rem; }
  .form-control { min-height: 44px; }
  .colour-swatch { width: 44px; height: 44px; }
  .option-card { padding: 0.875rem 1rem; }
  .sidebar-lesson-link { padding: 0.875rem 0.75rem; }
  .mobile-nav-link { padding: 0.875rem 1.25rem; min-height: 48px; }

  /* Remove hover effects that don't work on touch */
  .btn:hover { transform: none; }
  .colour-swatch:hover { transform: none; }
}

/* ── Lesson mobile progress bar (hidden on desktop) ─────── */
.lesson-mobile-bar { display: none; }

/* ==========================================================
   DARK THEME — Course cards with cover images
   ========================================================== */

/* Course grid — 3 columns on desktop */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.course-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  text-decoration: none;
  display: flex;
  flex-direction: column;
}

.course-card:hover {
  transform: translateY(-3px);
  border-color: #475569;
}

/* Cover image area */
.course-card-cover {
  height: 160px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.course-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.course-card:hover .course-card-cover img {
  transform: scale(1.04);
}

.course-card-cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15,23,42,0.88) 0%, rgba(15,23,42,0.2) 55%, transparent 100%);
}

/* Fallback gradient when no image */
.course-card-cover-placeholder {
  height: 160px;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 1rem;
  flex-shrink: 0;
}

.course-card-cover-emoji {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  font-size: 48px;
  opacity: 0.3;
  line-height: 1;
}

/* Text overlaid on cover */
.course-card-cover-text {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.875rem 1rem;
  z-index: 1;
}

.course-card-subject {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 3px;
}

.course-card-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  text-decoration: none;
}

/* Card footer with progress */
.course-card-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.625rem;
  background: rgba(255,255,255,0.02);
}

.course-card-prog-bar {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
}

.course-card-prog-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--brand);
  transition: width 0.4s ease;
}

.course-card-pct {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

/* Teacher course card meta */
.course-card-meta {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ==========================================================
   DARK THEME — Lesson hero with image
   ========================================================== */

.lesson-hero-section {
  position: relative;
  height: 220px;
  overflow: hidden;
  flex-shrink: 0;
}

.lesson-hero-section img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: brightness(0.6);
}

.lesson-hero-placeholder {
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e1b4b 0%, #3730a3 50%, #4f46e5 100%);
  position: relative;
  flex-shrink: 0;
}

.lesson-hero-placeholder-emoji {
  font-size: 64px;
  opacity: 0.25;
}

.lesson-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15,23,42,0.92) 0%, rgba(15,23,42,0.3) 55%, transparent 100%);
}

.lesson-hero-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.25rem 1.75rem;
  z-index: 1;
}

.lesson-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: rgba(99,102,241,0.3);
  border: 1px solid rgba(99,102,241,0.5);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #a5b4fc;
  margin-bottom: 0.5rem;
}

.lesson-hero-title {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

.lesson-hero-meta {
  display: flex;
  gap: 1.25rem;
  margin-top: 0.5rem;
}

.lesson-hero-meta-item {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* ==========================================================
   DARK THEME — Settings, empty states, misc
   ========================================================== */

.empty-state {
  background: rgba(255,255,255,0.02);
}

.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.settings-section-header {
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}

.option-card {
  background: rgba(255,255,255,0.04);
  border: 2px solid var(--border);
  color: var(--text-primary);
}

.option-card.selected {
  border-color: var(--brand);
  background: rgba(99,102,241,0.12);
}

/* Login page keep dark gradient as-is — already works */

/* Page header text */
.page-header-left h1 { color: var(--text-primary); }
.page-header-left p  { color: var(--text-secondary); }

/* Card footer */
.card-footer { background: rgba(255,255,255,0.03); border-top: 1px solid var(--border); }

/* Stat card */
.stat-card-label { color: var(--text-muted); }

/* Student dashboard two-col layout — stacks on mobile */
.dashboard-two-col {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 768px) {
  .dashboard-two-col {
    grid-template-columns: 1fr;
  }
}
