/* eLearning Platform Styles */

/* === DESIGN TOKENS === */
:root {
  --primary: #22C55E;
  --primary-deep: #16A34A;
  --primary-glow: rgba(34,197,94,0.35);
  --accent: #3E92CC;
  --accent-warm: #F2A93B;
  --accent-warm-deep: #D98A1F;
  --green: #22C55E;
  --green-deep: #16A34A;
  --danger: #ef4444;

  --bg: #CED2D7;
  --surface: #FFFFFF;
  --surface-2: #F2F8F3;
  --surface-3: #F8F4EC;
  --card-bg: #FFFFFF;
  --ink: #122043;
  --ink-soft: #1c2f5c;
  --text: #22252A;
  --text-primary: #22252A;
  --muted: #5B6270;
  --border: #E7DFCF;
  --border-light: #F0EBE3;

  --header-bg: #CED2D7;
  --footer-bg: #0f172a;
  --footer-text: #94a3b8;
  --footer-heading: #e2e8f0;

  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --radius-pill: 999px;

  --shadow-sm: 0 2px 8px rgba(18,32,67,0.06);
  --shadow: 0 8px 24px rgba(18,32,67,0.08);
  --shadow-lg: 0 18px 40px rgba(18,32,67,0.12);
  --shadow-card: 0 4px 20px rgba(18,32,67,0.06);
  --shadow-green: 0 8px 18px -6px var(--primary-glow);

  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
  --transition-slow: 0.4s cubic-bezier(0.4,0,0.2,1);
}

html[data-theme="dark"] {
  --bg: #0B1220;
  --surface: #141B2E;
  --surface-2: #101A28;
  --surface-3: #1A2340;
  --card-bg: #141B2E;
  --ink: #EDEFF7;
  --ink-soft: #C7CCDC;
  --text: #DCE1EC;
  --text-primary: #DCE1EC;
  --muted: #94A0B8;
  --border: rgba(255,255,255,0.10);
  --border-light: rgba(255,255,255,0.06);
  --header-bg: rgba(11,18,32,0.82);
  --footer-bg: #060A14;
}

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.35s cubic-bezier(0.4,0,0.2,1), color 0.35s cubic-bezier(0.4,0,0.2,1);
}
body.loading .site-header,
body.loading .site-footer { visibility: hidden; }
.app-loader {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  transition: opacity 0.3s ease;
}
body:not(.loading) .app-loader { opacity: 0; pointer-events: none; }
.app-loader-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.25;
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-deep); }
img { max-width: 100%; display: block; }
.mono { font-family: var(--font-mono); }
.container { max-width: 1180px; margin: 0 auto; padding: 0 28px; }

/* === HEADER (glassmorphic — arday252 + macruuftech) === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(18,32,67,0.08), 0 6px 24px rgba(18,32,67,0.06);
  animation: header-drop 0.5s cubic-bezier(0.4,0,0.2,1) both;
}
@keyframes header-drop {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { color: var(--ink); text-decoration: none; }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px -2px var(--primary-glow);
  transition: transform var(--transition);
  flex-shrink: 0;
}
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.05); }
.brand-mark svg { width: 18px; height: 18px; fill: none; stroke: white; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

/* === NAVIGATION === */
.nav { display: flex; align-items: center; gap: 8px; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: var(--radius-xs);
  position: relative;
  transition: color var(--transition), background var(--transition);
}
.nav-links a::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 4px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
  transform: scaleX(0);
  transition: transform var(--transition);
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-links a:hover::after { transform: scaleX(1); }
.nav-links a.active { color: var(--primary-deep); font-weight: 600; }
.nav-links a.active::after { transform: scaleX(1); }

/* CTA button in nav (somalitech pill style) */
.nav-cta {
  background: var(--primary) !important;
  color: #fff !important;
  padding: 8px 20px !important;
  border-radius: var(--radius-pill) !important;
  font-weight: 600 !important;
  font-size: 0.88rem !important;
  box-shadow: var(--shadow-green);
  transition: transform var(--transition), box-shadow var(--transition) !important;
}
.nav-cta::after { display: none !important; }
.nav-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -6px var(--primary-glow);
  background: var(--primary-deep) !important;
}

/* Theme toggle (macruuftech) */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover { transform: rotate(14deg); border-color: var(--accent-warm); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* Logout button */
.btn-link {
  background: none;
  border: none;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.92rem;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: var(--radius-xs);
  transition: color var(--transition), background var(--transition);
  font-family: inherit;
}
.btn-link:hover { color: var(--danger); background: rgba(239,68,68,0.08); text-decoration: none; }

/* === HERO SECTION (arday252 + somalitech) === */
.hero {
  background: radial-gradient(circle at 50% 0%, var(--surface-2) 0%, var(--bg) 50%);
  padding: 56px 0 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}
html[data-theme="dark"] .hero {
  background: radial-gradient(circle at 50% 0%, var(--surface-2) 0%, var(--bg) 50%);
}
.hero-inner { position: relative; z-index: 2; }

/* Eyebrow pill (arday252) */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--primary-deep);
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.2);
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  margin-bottom: 24px;
}
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  color: var(--ink);
  line-height: 1.1;
  max-width: 20ch;
  margin: 0 auto;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.hero h1 .accent {
  font-style: italic;
  font-weight: 500;
  color: var(--primary);
  display: block;
  margin-top: 0.04em;
}
.hero p.lead {
  margin-top: 20px;
  font-size: clamp(0.95rem, 1.4vw, 1.1rem);
  max-width: 48ch;
  margin-left: auto;
  margin-right: auto;
  color: var(--muted);
}
.hero-ctas {
  display: flex;
  gap: 14px;
  margin-top: 32px;
  justify-content: center;
  flex-wrap: wrap;
}

/* === STAT STRIP (arday252) === */
.stat-strip {
  background: var(--ink);
  padding: 28px 0;
  margin-top: 48px;
  border-radius: 0 0 40px 40px;
  position: relative;
  z-index: 2;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.stat { text-align: center; }
.stat .num {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--bg);
}
.stat .num span { color: var(--primary); }
.stat .label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

/* === SECTIONS === */
.section { padding: 72px 0; }
.section-alt { background: var(--surface-2); }
.section-head { margin-bottom: 40px; }
.section-head .kicker {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 8px;
}
.section-head h2 { font-size: clamp(1.6rem, 2.8vw, 2.2rem); }
.section-head p { margin-top: 10px; color: var(--muted); font-size: 1rem; }

/* Catalog toolbar (search + Level/Category filters) */
.catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 18px;
  margin: -8px 0 24px;
}
.catalog-toolbar__search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 300px;
  max-width: 560px;
}
.catalog-toolbar__search .svg-ic {
  position: absolute;
  left: 15px;
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}
.catalog-toolbar__input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.catalog-toolbar__input::placeholder { color: var(--muted); }
.catalog-toolbar__input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.12);
}
.catalog-toolbar__filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.catalog-toolbar__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
  white-space: nowrap;
}
.catalog-toolbar .select {
  width: auto;
  padding: 7px 12px;
  font-size: 0.9rem;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  /* Native rendering. The base .select uses appearance:none plus a custom
     background, which makes Chrome on Windows paint the hovered row of the
     open list as white-on-white (invisible text). Restoring native
     appearance lets the browser draw its own hover highlight. */
  appearance: auto;
  -webkit-appearance: auto;
  background-image: none;
  padding-right: 12px;
}
.catalog-toolbar .select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.12);
}

/* === CARDS (somalitech 3D + arday252 hover) === */
.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

/* Course card specific */
.course-card { position: relative; overflow: hidden; }
.course-card h3 { margin: 0 0 0.4rem; font-size: 1.1rem; font-family: var(--font-body); font-weight: 600; }
.course-card h3 a { color: var(--ink); }
.course-card h3 a:hover { color: var(--primary-deep); }
.course-card .desc { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.75rem; line-height: 1.5; }
.course-card .badges { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.course-card .meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}

/* === COURSE CARD V2 (Udemy-inspired) === */
.course-card-v2 {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.course-card-v2:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
  text-decoration: none;
  color: inherit;
}

/* Image */
.course-card-v2__image {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--surface-2);
}
.course-card-v2__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.course-card-v2:hover .course-card-v2__image img {
  transform: scale(1.05);
}
.course-card-v2__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
}
.course-card-v2__placeholder svg {
  width: 48px;
  height: 48px;
  opacity: 0.3;
}

/* "New" badge — top-left of the thumbnail, only while the course is ≤15 days old */
.course-card-v2__new {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(18, 32, 67, 0.18);
}
.course-card-v2__new .svg-ic {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Pricing row (price + discount badge, above the Details button).
   margin-top:auto pins the price/button block to the bottom of equal-height
   cards, so any spare height shows as a gap under the title. */
.course-card-v2__pricing {
  margin-top: auto;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding-top: 0.75rem;
  margin-bottom: 0.75rem;
}
.course-card-v2__price-group {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.course-card-v2__price {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.course-card-v2__price-original {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
  text-decoration: line-through;
}

/* Discount badge ("X% OFF") */
.course-card-v2__sale {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(239,68,68,0.12);
  color: #b91c1c;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

/* Body */
.course-card-v2__body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Badges */
.course-card-v2__badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  row-gap: 0.3rem;
  margin-bottom: 0.5rem;
}
.course-card-v2__category {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: rgba(34,197,94,0.1);
  color: var(--primary-deep);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
}
.course-card-v2__level {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0;
  background: rgba(62,146,204,0.1);
  color: var(--accent);
  border-radius: var(--radius-pill);
  padding: 3px 6px;
}

/* Total duration badge (clock icon + watch time, far right) */
.course-card-v2__duration {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.course-card-v2__duration .svg-ic {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Lesson count badge (book icon + lessons, spaced from the duration) */
.course-card-v2__lessons {
  margin-left: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.course-card-v2__lessons .svg-ic {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Title — fixed 3-line capacity.
   min-height reserves exactly 3 lines (3 × 1.35 line-height = 4.05em) so a
   1-, 2-, or 3-line title all take the same space and cards stay equal
   height; anything longer is clipped by the line clamp with an ellipsis. */
.course-card-v2__title {
  margin: 0 0 1rem;
  font-size: 1.2rem;
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
  min-height: 4.05em;
}

/* Instructor label (light, above the instructor name) */
.course-card-v2__instructor-label {
  margin: 26px 0 6px;
  font-size: 0.63rem;
  font-weight: 300;
  letter-spacing: 0.05em;
  color: var(--muted);
  line-height: 1.3;
}

/* Instructor name (bold, below the label) */
.course-card-v2__instructor {
  margin: 0 0 1.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Meta row (rating + students) */
.course-card-v2__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-light);
}
.course-card-v2__rating {
  display: flex;
  align-items: center;
  gap: 4px;
}
.course-card-v2__stars {
  color: #f4c150;
  font-size: 0.9rem;
  letter-spacing: 1px;
}
.course-card-v2__rating-count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-warm-deep);
}
.course-card-v2__students {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

/* Actions */
.course-card-v2__actions {
  margin-top: 0;
}
.course-card-v2__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 14px 16px;
  border-radius: 11px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  cursor: pointer;
}
.course-card-view {
  background: var(--primary);
  color: #fff;
}
.course-card-view:hover {
  background: var(--primary-deep);
}
.course-card-details {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--ink);
}
.course-card-details:hover {
  border-color: var(--ink);
  background: var(--surface-2);
}

/* Badges */
.badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: var(--surface-3);
  color: var(--muted);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
}
.badge-primary { background: rgba(34,197,94,0.1); color: var(--primary-deep); }
.badge-accent { background: rgba(62,146,204,0.1); color: var(--accent); }
.badge-warm { background: rgba(242,169,59,0.12); color: var(--accent-warm-deep); }

/* === BUTTONS (somalitech pill + arday252 glow) === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  border: none;
  border-radius: var(--radius-pill);
  padding: 11px 24px;
  cursor: pointer;
  font-family: inherit;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover {
  background: var(--primary-deep);
  transform: translateY(-2px);
  box-shadow: var(--shadow-green);
  color: #fff;
  text-decoration: none;
}
.btn-block { width: 100%; text-align: center; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
  box-shadow: none;
}
.btn-outline:hover {
  border-color: var(--ink);
  background: var(--surface-2);
  box-shadow: none;
  color: var(--ink);
}
.btn-ghost {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  color: var(--ink);
}
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 6px 16px; font-size: 0.82rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }

/* === RICH EDITOR (Word/Canva style) === */
.rich-editor {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.rich-editor:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34,197,94,0.1);
}
.rich-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
}
.rich-editor-toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
}
.rich-editor-toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 6px;
}
.rich-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text);
  transition: all 0.15s;
  font-family: inherit;
}
.rich-btn:hover {
  background: var(--surface-3);
  border-color: var(--border);
}
.rich-btn:active {
  background: var(--primary);
  color: #fff;
}
.rich-editor-content {
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
  padding: 16px 20px;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  outline: none;
}
.rich-editor-content:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}
.rich-editor-content h2 { font-size: 1.4rem; margin: 0.5rem 0; }
.rich-editor-content h3 { font-size: 1.2rem; margin: 0.5rem 0; }
.rich-editor-content p { margin: 0.5rem 0; }
.rich-editor-content ul, .rich-editor-content ol { margin: 0.5rem 0; padding-left: 1.5rem; }
.rich-editor-content a { color: var(--primary-deep); text-decoration: underline; }
.rich-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-2);
  border-top: 1px solid var(--border-light);
}
.rich-editor-char-count {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

/* === FORMS === */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}
.input, .select, .textarea {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34,197,94,0.15);
}
.textarea { min-height: 120px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%235B6270' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* === ALERTS === */
.alert {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
}
.alert-error {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  color: #dc2626;
}
.field-error {
  color: #dc2626;
  font-size: 0.83rem;
  font-weight: 500;
  margin-top: 0.35rem;
}
.alert-success {
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.25);
  color: var(--primary-deep);
}

/* === AUTH CARD === */
.auth-card {
  max-width: 420px;
  margin: 3rem auto;
  text-align: center;
}
.auth-card h2 { margin-bottom: 1.5rem; }
.auth-card .divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 1.2rem 0;
  color: var(--muted);
  font-size: 0.8rem;
}
.auth-card .divider::before, .auth-card .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* === REGISTER: PHONE + PASSWORD STRENGTH + TERMS === */
.phone-row { display: flex; gap: 8px; }
.phone-row .phone-cc {
  width: 56%;
  max-width: 250px;
  flex-shrink: 0;
  padding-right: 30px;
  text-overflow: ellipsis;
}
.phone-row .phone-num { flex: 1; min-width: 0; }

.pw-input-wrap { position: relative; }
.pw-input-wrap .input { padding-right: 42px; }
.pw-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 6px;
  opacity: 0.65;
}
.pw-eye:hover { opacity: 1; }

.pw-bars {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.pw-bars span {
  height: 6px;
  flex: 1;
  border-radius: 999px;
  background: var(--border);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.pw-bars span.on-red {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.55);
}
.pw-bars span.on-yellow {
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.55);
}
.pw-bars span.on-green {
  background: var(--primary);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.55);
}

.pw-reqs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.pw-reqs span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 4px 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  transition: all 0.3s ease;
}
.pw-reqs span.valid {
  color: var(--primary);
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.08);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.12);
}
.pw-reqs span.valid::before { content: '✓'; font-weight: 700; }

.pw-match { font-size: 0.78rem; margin-top: 6px; min-height: 1em; }
.pw-match.ok { color: var(--primary); }
.pw-match.bad { color: #ef4444; }

.terms-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0.2rem 0 1.1rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.terms-check input[type="checkbox"] {
  margin: 3px 0 0;
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  cursor: pointer;
}
.terms-check label { margin: 0; cursor: pointer; }
.terms-check a { color: var(--primary); font-weight: 600; }

/* === PROGRESS BAR === */
.progress-bar {
  background: var(--surface-3);
  border-radius: var(--radius-pill);
  height: 8px;
  overflow: hidden;
  margin: 0.5rem 0;
}
.progress-fill {
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
}

/* === COURSE CURRICULUM (Udemy-style sections → lectures) === */
.curriculum-section {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-top: 0.75rem;
  overflow: hidden;
  background: var(--surface);
}
.curriculum-section.open .curriculum-section__head { background: var(--surface-2); }
.curriculum-section__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 14px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  text-align: left;
  user-select: none;
}
.curriculum-section__chevron { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.curriculum-section__chevron svg { width: 14px; height: 14px; stroke: var(--muted); fill: none; stroke-width: 2; }
.curriculum-section.open .curriculum-section__chevron svg { transform: rotate(180deg); }
.curriculum-section__title { flex: 1; min-width: 0; font-weight: 600; font-size: 0.95rem; line-height: 1.35; overflow-wrap: anywhere; }
.curriculum-section__meta { flex-shrink: 0; font-size: 0.78rem; color: var(--muted); font-family: var(--font-mono); white-space: nowrap; }
.curriculum-section__body { display: none; }
.curriculum-section.open .curriculum-section__body { display: block; }

.curriculum-lectures { list-style: none; padding: 0; margin: 0; }
.curriculum-lecture {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 10px 16px;
  border-top: 1px solid var(--border-light);
}
.curriculum-lecture:hover { background: var(--surface-2); }
.cl-icon { display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--primary-deep); }
.cl-icon svg { width: 15px; height: 15px; stroke: var(--primary-deep); fill: none; stroke-width: 2; }
.cl-title { flex: 1; min-width: 0; color: var(--text); font-weight: 500; font-size: 0.92rem; overflow-wrap: anywhere; }
.cl-title:hover { color: var(--primary-deep); }
.cl-preview {
  flex-shrink: 0;
  color: var(--accent-warm-deep);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.cl-duration { flex-shrink: 0; font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); white-space: nowrap; }

/* Module accordion toggle icon (shared with student player) */
.module-toggle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.module-toggle svg { width: 14px; height: 14px; stroke: var(--muted); fill: none; stroke-width: 2; }

/* === VIDEO FRAME === */
.video-frame {
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 1.25rem;
  position: relative;
}



.video-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--ink) 0%, #1a2744 100%);
  cursor: pointer;
}
.video-placeholder .play-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px var(--primary-glow);
  transition: transform var(--transition);
}
.video-placeholder:hover .play-icon { transform: scale(1.1); }
.video-placeholder .play-icon svg { width: 24px; height: 24px; fill: white; margin-left: 3px; }

/* === CERTIFICATE CARD === */
.cert-card {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  padding: 2.5rem;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 2px solid var(--primary);
  position: relative;
  overflow: hidden;
}
.cert-card::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--accent-warm));
}
.cert-card .cert-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(34,197,94,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}
.cert-card .cert-icon svg { width: 32px; height: 32px; stroke: var(--primary); fill: none; stroke-width: 2; }
.cert-code {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  background: var(--surface-3);
  padding: 8px 20px;
  border-radius: var(--radius-xs);
  display: inline-block;
  margin: 0.75rem 0;
  letter-spacing: 0.05em;
  color: var(--ink);
}

/* === DASHBOARD === */
.dash-welcome {
  font-size: clamp(1.4rem, 2.5vw, 1.8rem);
  margin-bottom: 0.5rem;
}
.dash-subtitle { color: var(--muted); margin-bottom: 2rem; }

/* === MAIN CONTENT === */
#app { padding: 0 0 2rem; min-height: 60vh; }

/* === FOOTER (somalitech dark gradient) === */
.site-footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  margin-top: 4rem;
  border-radius: 40px 40px 0 0;
}
.footer-main {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  padding: 56px 0 40px;
}
.footer-brand p { font-size: 0.88rem; line-height: 1.6; margin-top: 12px; max-width: 280px; }
.footer-col h4 {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--footer-heading);
  margin-bottom: 16px;
}
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 8px; }
.footer-col a {
  color: var(--footer-text);
  font-size: 0.88rem;
  transition: color var(--transition);
}
.footer-col a:hover { color: var(--primary); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}
.footer-social { display: flex; gap: 12px; }
.footer-social a {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--footer-text);
  transition: background var(--transition), color var(--transition);
}
.footer-social a:hover { background: var(--primary); color: #fff; }
.footer-social svg { width: 16px; height: 16px; }

/* === SCROLL REVEAL (arday252) — animations removed === */
.reveal {
  opacity: 1;
  transform: none;
}

/* === UTILITIES === */
.muted { color: var(--muted); font-size: 0.9rem; }
.spacer { height: 1rem; }
.flex { display: flex; gap: 0.75rem; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.text-center { text-align: center; }
.hidden { display: none !important; }

/* === COURSE DETAIL HEADER === */
.course-hero {
  padding: 2rem 0;
}
.course-hero h1 {
  font-size: clamp(2rem, 4.5vw, 3.3rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
}
.course-hero .course-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.course-hero .course-desc {
  font-size: 1rem;
  color: var(--muted);
  max-width: 60ch;
  line-height: 1.7;
}

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}
.empty-state .empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}
.empty-state .empty-icon svg { width: 32px; height: 32px; stroke: var(--muted); fill: none; stroke-width: 1.5; }
.empty-state h3 { margin-bottom: 0.5rem; }
.empty-state p { color: var(--muted); margin-bottom: 1.5rem; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .header-inner { height: 56px; }
  .nav-links a { padding: 6px 10px; font-size: 0.85rem; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .stat .num { font-size: 1.4rem; }
  .grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
  .hero-ctas { flex-direction: column; align-items: center; }
  .footer-main { grid-template-columns: 1fr 1fr; gap: 28px; padding: 36px 0 28px; }
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }
  .section { padding: 48px 0; }
  .course-hero .course-meta { gap: 6px; }
  .stat-strip { border-radius: 0 0 24px 24px; }
  .site-footer { border-radius: 24px 24px 0 0; }
}

@media (max-width: 480px) {
  .nav-links a.hide-mobile { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .footer-main { grid-template-columns: 1fr; }
  .auth-card { margin: 2rem 1rem; }
  .course-card-v2__body { padding: 1rem; }
}

/* ============================================================
   ADMIN PANEL
   ============================================================ */

/* === ADMIN LAYOUT === */
/* The Admin Panel is its own application context: a full-height section below
   the site header. The frontend footer is structurally excluded from Admin
   routes (see body.admin-page rules), so nothing participates below this
   section — the sidebar can be permanently anchored to the viewport. */
.admin-layout {
  min-height: calc(100vh - 64px);
  min-height: calc(100dvh - 64px);
}

/* === ADMIN HEADER === */
.admin-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 24px;
  background: var(--header-bg, var(--surface));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.admin-logo {
  height: 36px;
  width: auto;
  display: block;
}
.admin-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.admin-header-logout {
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  transition: background var(--transition), color var(--transition);
}
.admin-header-logout:hover {
  background: var(--surface-2);
  color: var(--danger, #ef4444);
}
.admin-theme-toggle {
  width: 36px;
  height: 36px;
}
.admin-body {
  display: flex;
  min-height: calc(100vh - 64px);
  min-height: calc(100dvh - 64px);
}

/* === SIDEBAR COLLAPSE/EXPAND ARROWS === */
.sidebar-collapse-btn,
.sidebar-expand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover,
.sidebar-expand-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}
.sidebar-collapse-btn svg,
.sidebar-expand-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}
.sidebar-collapse-btn {
  margin-left: auto;
}
.sidebar-expand-btn {
  float: left;
  margin-right: 12px;
  margin-top: 4px;
}
.admin-main::after {
  content: '';
  display: table;
  clear: both;
}

/* === SIDEBAR COLLAPSE STATE === */
.admin-layout.sidebar-collapsed .admin-sidebar {
  margin-left: -240px;
}
.admin-layout.sidebar-collapsed .admin-main {
  margin-left: 0;
}
.admin-layout.sidebar-collapsed .sidebar-collapse-btn {
  display: none;
}
.admin-layout:not(.sidebar-collapsed) .sidebar-expand-btn {
  display: none !important;
}

/* === DESKTOP BOTTOM NAV — Shows when sidebar collapsed === */
.admin-layout:not(.sidebar-collapsed) .admin-bottom-nav {
  display: none;
}
.admin-layout.sidebar-collapsed .admin-bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--surface);
  border-top: 1px solid var(--border-light);
  padding: 4px 8px;
  justify-content: space-evenly;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.admin-layout.sidebar-collapsed .admin-bottom-nav::-webkit-scrollbar {
  display: none;
}
.admin-layout.sidebar-collapsed .admin-bottom-nav .admin-bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 6px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  flex: 1;
  min-width: 0;
  max-width: 90px;
  white-space: nowrap;
  border-radius: var(--radius-xs);
  transition: color var(--transition), background var(--transition);
}
.admin-layout.sidebar-collapsed .admin-bottom-nav .admin-bottom-nav-item:hover {
  background: var(--surface-2);
}
.admin-layout.sidebar-collapsed .admin-bottom-nav .admin-bottom-nav-item svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}
.admin-layout.sidebar-collapsed .admin-bottom-nav .admin-bottom-nav-item.active {
  color: var(--primary-deep);
}
.admin-layout.sidebar-collapsed .admin-bottom-nav .admin-bottom-nav-item.active svg {
  stroke: var(--primary-deep);
}
.admin-layout.sidebar-collapsed .admin-main.has-bottom-nav {
  padding-bottom: 70px;
}

/* === ADMIN SIDEBAR === */
/* Permanently visible navigation region for the Admin interface: viewport
   anchored just below the sticky site header (top:64px), full remaining
   height, own vertical scroll. It never depends on the height of the current
   table/card and never scrolls away with the Admin content. */
.admin-sidebar {
  position: fixed;
  top: 64px;
  left: 0;
  width: 240px;
  height: calc(100vh - 64px);
  height: calc(100dvh - 64px);
  background: var(--surface);
  border-right: 1px solid var(--border-light);
  padding: 24px 0;
  overflow-y: auto;
  z-index: 90;
  transition: margin-left 0.3s ease;
}
.admin-sidebar .sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 8px;
}
.admin-sidebar .sidebar-brand h3 {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0;
}
.admin-nav { list-style: none; padding: 0; margin: 0; }
.admin-nav li { margin: 2px 8px; }
.admin-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition), background var(--transition);
  text-decoration: none;
}
.admin-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.admin-nav a.active {
  color: var(--primary-deep);
  background: rgba(34,197,94,0.08);
  font-weight: 600;
}
.admin-nav a svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; flex-shrink: 0; }
.admin-nav .nav-divider { height: 1px; background: var(--border-light); margin: 8px 14px; }
.admin-nav .back-link { color: var(--accent); }

/* === ADMIN MAIN === */
/* Reserves the fixed sidebar's width (margin-left) and is constrained to the
   remaining viewport width (min-width:0), so a wide table can never widen the
   Admin column — the table scrolls inside its own wrapper instead. */
.admin-main {
  flex: 1;
  margin-left: 240px;
  min-width: 0;
  padding: 28px 32px;
  background: var(--bg);
  min-height: calc(100vh - 64px);
  min-height: calc(100dvh - 64px);
  transition: margin-left 0.3s ease;
  position: relative;
}
.admin-page-header {
  margin-bottom: 28px;
}
.admin-page-header h1 {
  font-size: 1.6rem;
  margin-bottom: 4px;
}
.admin-page-header p { color: var(--muted); font-size: 0.9rem; }

/* === ADMIN STAT CARDS === */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.admin-stat-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.admin-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.admin-stat-icon svg { width: 22px; height: 22px; stroke: white; fill: none; stroke-width: 2; }
.admin-stat-icon.green { background: linear-gradient(135deg, #22C55E, #16A34A); }
.admin-stat-icon.blue { background: linear-gradient(135deg, #3E92CC, #2563EB); }
.admin-stat-icon.amber { background: linear-gradient(135deg, #F2A93B, #D98A1F); }
.admin-stat-icon.purple { background: linear-gradient(135deg, #8B5CF6, #7C3AED); }
.admin-stat-info .num {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
}
.admin-stat-info .label { font-size: 0.82rem; color: var(--muted); margin-top: 4px; }

/* === ADMIN TABLE === */
.admin-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
}
.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  gap: 12px;
  flex-wrap: wrap;
}
.admin-card-header h3 {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}
.admin-table-wrap { overflow-x: auto; min-width: 0; max-width: 100%; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.admin-table th {
  text-align: left;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}
.admin-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--surface-2); }
.admin-table .mono { font-family: var(--font-mono); font-size: 0.82rem; }
.admin-status-select {
  font-size: 0.78rem;
  padding: 4px 8px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: var(--surface-1);
  color: var(--text);
  cursor: pointer;
  max-width: 140px;
}
.admin-status-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Fixed-layout tables (explicit <colgroup> widths): short columns stay
   compact and the flexible columns receive the available width instead of
   the browser inflating every column to fill the container. The min-width
   guarantees the Actions column always has room for the Edit/Delete/Manage
   buttons on a single row; below it the wrapper scrolls (never the page). */
.admin-table--fixed { table-layout: fixed; min-width: 1000px; }

/* === USER MANAGEMENT TABLE (scoped variant) ===
   Auto layout let the columns inflate from their content and pushed the table
   beyond the content area. Fixed layout uses exactly the <colgroup> widths
   below: compact columns stay compact, EMAIL is the flexible column that
   absorbs the remaining space, and cell padding is trimmed (16px -> 10px) to
   reclaim wasted horizontal space while staying readable. The min-width is the
   smallest width at which all nine columns stay readable; below it the table
   wrapper scrolls only because the viewport genuinely cannot fit them. */
.admin-table--users { table-layout: fixed; min-width: 1050px; }
.admin-table--users th,
.admin-table--users td { padding: 10px 10px; }
/* Long unbreakable emails must not spill over the cell into the Sex/Phone
   columns: when an address is longer than the Email column, break it onto a
   second line inside the cell instead. Short addresses stay on one line. */
.admin-table--users .email-cell { word-break: break-all; }

/* Shared action-icon sizing for every admin-table button (14px course
   baseline). Icon color comes from `stroke="currentColor"` on the SVG, so it
   inherits the button's text color in both themes. */
.admin-table .btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.user-avatar.placeholder {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.admin-count {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.85rem;
  margin-left: 4px;
}

/* Table badges */
.role-badge, .status-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  display: inline-block;
}
.role-badge.admin { background: rgba(139,92,246,0.1); color: #7C3AED; }
.role-badge.instructor { background: rgba(62,146,204,0.1); color: var(--accent); }
.role-badge.student { background: rgba(34,197,94,0.1); color: var(--primary-deep); }
.role-badge.super_admin { background: rgba(239,68,68,0.1); color: #DC2626; }
.status-badge.active { background: rgba(34,197,94,0.1); color: var(--primary-deep); }
.status-badge.suspended { background: rgba(239,68,68,0.1); color: #DC2626; }
.status-badge.published { background: rgba(34,197,94,0.1); color: var(--primary-deep); }
.status-badge.draft { background: rgba(242,169,59,0.12); color: var(--accent-warm-deep); }
.status-badge.archived { background: rgba(148,163,184,0.15); color: var(--muted); }

/* === ADMIN FILTERS === */
.admin-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.admin-search {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 7px 12px;
  font-size: 0.85rem;
  color: var(--text);
  font-family: inherit;
  min-width: 200px;
  transition: border-color var(--transition);
}
.admin-search:focus { outline: none; border-color: var(--primary); }
.admin-filter-select {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 7px 28px 7px 10px;
  font-size: 0.85rem;
  color: var(--text);
  font-family: inherit;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%235B6270' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
}

/* === ADMIN PAGINATION === */
.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  font-size: 0.82rem;
  color: var(--muted);
}
.admin-pagination .page-btns { display: flex; gap: 4px; }
.admin-pagination button {
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  padding: 5px 12px;
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition);
}
.admin-pagination button:hover { background: var(--border); }
.admin-pagination button:disabled { opacity: 0.4; cursor: default; }
.admin-pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* === ADMIN MODAL === */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}
.admin-modal-overlay.show { opacity: 1; visibility: visible; }
.admin-modal {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.2s;
}
.admin-modal-overlay.show .admin-modal { transform: translateY(0) scale(1); }
.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}
.admin-modal-header h3 {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}
.admin-modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: background var(--transition);
}
.admin-modal-close:hover { background: var(--border); }
.admin-modal-body { padding: 20px; }
.admin-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
}

/* ─── Delete Course Confirm Modal ─── */
.delete-course-confirm {
  padding: 1rem 0;
}
.delete-course-confirm__enrolled {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}
.delete-course-confirm__enrolled-icon {
  font-size: 1.3rem;
  color: var(--primary);
}
.delete-course-confirm__instruction {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.delete-course-confirm__input {
  width: 100%;
  max-width: 400px;
  padding: 12px 14px;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.delete-course-confirm__input:focus {
  border-color: var(--danger);
}
.delete-course-confirm__input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

/* === ADMIN RESPONSIVE === */
@media (max-width: 900px) {
  .admin-sidebar {
    position: fixed;
    left: -260px;
    top: 64px;
    width: 240px;
    z-index: 150;
    transition: left 0.3s;
    box-shadow: var(--shadow-lg);
  }
  .admin-sidebar.open { left: 0; }
  .admin-main { margin-left: 0; padding: 20px 16px; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .admin-card-header { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .admin-stats { grid-template-columns: 1fr; }
  .admin-filters { flex-direction: column; }
  .admin-search { min-width: 100%; }
}

/* Admin Progress Dashboard responsive */
@media (max-width: 900px) {
  .admin-progress-layout { grid-template-columns: 1fr !important; }
}
.admin-progress-tree-item:hover { background: var(--surface-2) !important; }
.admin-progress-tree-item.active { background: var(--primary-light) !important; }

/* ============================================================
   COURSE BUILDER — Multi-Step Wizard
   ============================================================ */

.builder-layout {
  min-height: calc(100vh - 64px);
  background: var(--bg);
}

.builder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  gap: 16px;
  flex-wrap: wrap;
}

.builder-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.builder-course-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  padding: 4px 8px;
  outline: none;
  min-width: 200px;
  transition: border-color var(--transition);
}
.builder-course-title:hover,
.builder-course-title:focus {
  border-color: var(--primary);
  background: var(--surface-2);
}

.builder-header-right {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Step indicator */
.builder-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 20px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
}

.builder-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--transition);
}
.builder-step:hover {
  color: var(--text);
}
.builder-step:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  border-radius: var(--radius-xs);
}
.builder-step.active {
  color: var(--primary-deep);
  font-weight: 600;
}
.builder-step.completed {
  color: var(--green);
}
.builder-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  border: 2px solid var(--border);
}
.builder-step.active .builder-step-num {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.builder-step.completed .builder-step-num {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

.builder-step::after {
  content: '';
  position: absolute;
  right: -20px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 2px;
  background: var(--border);
}
.builder-step:last-child::after {
  display: none;
}
.builder-step.completed::after {
  background: var(--green);
}

/* Builder content */
.builder-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 28px;
  min-width: 0;
}

.builder-footer {
  display: flex;
  justify-content: space-between;
  padding: 16px 28px;
  border-top: 1px solid var(--border-light);
  background: var(--surface);
}

/* Builder grid layout (Step 1 & 3) */
.builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 1.05fr);
  gap: 24px;
  align-items: start;
}

.builder-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.builder-sidebar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-content: start;
  min-width: 0;
}

.builder-sidebar > .builder-card {
  min-height: 96px;
}

/* Summary step (Step 3) — horizontally centered */
.builder-summary {
  width: 100%;
  padding: 8px 0;
}
.builder-summary .builder-summary-card {
  max-width: 760px;
  margin-inline: auto;
}

.builder-media-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 4px;
}

.builder-media-grid .builder-card h3 {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

@media (max-width: 768px) {
  .builder-grid {
    grid-template-columns: 1fr;
  }
  .builder-media-grid {
    grid-template-columns: 1fr;
  }
  .builder-sidebar {
    grid-template-columns: 1fr;
  }
}

.builder-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  padding: 20px;
}
.builder-card h3 {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--ink);
}

/* Builder form elements */
.builder-card .form-group {
  margin-bottom: 14px;
}
.builder-card .form-group:last-child {
  margin-bottom: 0;
}
.builder-card label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 5px;
}

.builder-card .input,
.builder-card .select,
.builder-card textarea {
  width: 100%;
}

/* "What You'll Learn" learning-objective repeater */
.wyyl-items {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 0.6rem;
}
.wyyl-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.wyyl-item .input { flex: 1; }
.wyyl-item .btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.input-group {
  display: flex;
  align-items: center;
}
.input-prefix {
  padding: 8px 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius-xs) 0 0 var(--radius-xs);
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}
.input-group .input {
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}

.form-row {
  display: flex;
  gap: 12px;
}

/* Visibility select with icon */
.visibility-select {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 8px 12px;
  background: var(--surface);
}
.visibility-select svg { color: var(--muted); flex-shrink: 0; }
.visibility-select .select {
  border: none;
  background: transparent;
  padding: 0;
  font-weight: 500;
}

/* Toggle switch (Tutor LMS style) */
.toggle-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.toggle-row span:first-child {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
}
.toggle-slider {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  transition: background 0.2s;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-row input[type="checkbox"] { display: none; }
.toggle-row input[type="checkbox"]:checked + .toggle-slider {
  background: var(--primary);
}
.toggle-row input[type="checkbox"]:checked + .toggle-slider::after {
  transform: translateX(20px);
}

/* Pricing radio buttons */
.pricing-radio {
  display: flex;
  gap: 16px;
}
.radio-label {
  display: flex !important;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.88rem;
}
.radio-label input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* Register: sex radio row */
.sex-row {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  padding: 0.2rem 0.3rem;
}
.sex-row strong {
  font-weight: 700;
}

/* Upload areas (Tutor LMS style) */
.upload-thumb, .upload-video {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--surface-2);
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.upload-thumb:hover, .upload-video:hover {
  border-color: var(--primary);
  background: rgba(34,197,94,0.03);
}
.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.upload-placeholder svg { opacity: 0.7; width: 28px; height: 28px; }
.upload-placeholder small {
  color: var(--muted);
  font-size: 0.72rem;
}
.btn-accent {
  background: var(--accent);
  color: #fff;
  padding: 8px 20px;
  border-radius: var(--radius-xs);
  font-weight: 600;
  font-size: 0.85rem;
}
.btn-accent:hover {
  background: var(--primary-deep);
  color: #fff;
}
.add-from-url-link {
  color: var(--primary-deep);
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
}
.add-from-url-link:hover { color: var(--primary); }

/* Schedule calendar */
.schedule-calendar {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}
.schedule-calendar .input {
  width: 100%;
  margin-top: 4px;
}

/* Dynamic tag manager */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 4px;
  margin-bottom: 10px;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(62, 146, 204, 0.12);
  color: var(--accent);
  border: 1px solid rgba(62, 146, 204, 0.25);
  border-radius: var(--radius-pill);
  padding: 4px 6px 4px 10px;
  font-size: 0.78rem;
  font-weight: 500;
}
.tag-chip-remove {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0 2px;
}
.tag-chip-remove:hover {
  color: var(--danger);
}
.tag-add-row {
  display: flex;
  gap: 8px;
}
.tag-add-row .input {
  flex: 1;
  min-width: 0;
}
.tag-add-row .btn {
  flex-shrink: 0;
}

/* Video preview */
.video-preview {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius-xs);
  overflow: hidden;
  background: #000;
}
.video-preview iframe {
  width: 100%;
  height: 100%;
}

/* Media Library Modal */
.media-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.media-modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}
.media-modal {
  background: var(--surface);
  border-radius: 12px;
  width: 90%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.media-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}
.media-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}
.media-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 8px;
}
.media-modal-close:hover { color: var(--ink); }

/* Video player modal (reusable Play/Preview for READY videos) */
.video-player-modal {
  max-width: 880px;
  width: 92%;
}
.video-player-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  background: #000;
  overflow: hidden;
}
.video-player-stage video,
.video-player-stage iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
.media-modal-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-light);
  padding: 0 20px;
}
.media-tab {
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.media-tab.active {
  color: var(--primary-deep);
  border-bottom-color: var(--primary-deep);
}
.media-tab:hover { color: var(--text); }
.media-modal-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.media-grid-area {
  flex: 1;
  min-width: 0;
  padding: 16px 20px;
  overflow-y: auto;
  overflow-x: hidden;
}
.media-modal.video-mode {
  max-width: 980px;
}
.media-modal.video-mode .media-sidebar {
  width: 230px;
}
.media-sidebar {
  width: 260px;
  border-left: 1px solid var(--border-light);
  padding: 16px;
  overflow-y: auto;
}
.media-sidebar h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 12px;
}
.media-sidebar .form-group { margin-bottom: 12px; }
.media-sidebar label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 4px;
}
.media-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  gap: 8px;
}
.media-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.media-filter-row label {
  font-size: 0.82rem;
  color: var(--muted);
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}
.media-grid-item {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
  position: relative;
}
.media-grid-item:hover { border-color: var(--primary); }
.media-grid-item.selected { border-color: var(--primary-deep); }
.media-grid-item img { width: 100%; height: 100%; object-fit: cover; }
.media-delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(220,38,38,0.9);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.media-grid-item:hover .media-delete-btn { opacity: 1; }
.media-upload-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.media-upload-zone:hover {
  border-color: var(--primary);
  background: rgba(34,197,94,0.03);
}
.media-upload-zone p {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Upload area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
  overflow: hidden;
}
.upload-area:hover {
  border-color: var(--primary);
  background: var(--surface-2);
}
.upload-placeholder span {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
}
.upload-placeholder p {
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 4px;
}
.upload-placeholder small {
  color: var(--muted);
  font-size: 0.78rem;
}
.upload-preview {
  width: 100%;
  max-height: 250px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  display: block;
}
.upload-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  border-radius: var(--radius-sm);
}
.upload-area:hover .upload-overlay {
  opacity: 1;
}
.upload-overlay span {
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  background: var(--primary-deep);
  padding: 8px 16px;
  border-radius: 8px;
}
.upload-area.drag-over {
  border-color: var(--primary);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}
.video-progress-bar {
  width: 100%;
  max-width: 320px;
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.video-upload-status {
  margin-top: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.video-upload-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
}
.video-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.2s ease;
}
.video-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.video-status-ready {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}
.video-status-failed {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}
.video-status-pending {
  background: rgba(234, 179, 8, 0.15);
  color: #ca8a04;
}
.video-status-error {
  display: block;
  margin-top: 4px;
  color: #dc2626;
  font-size: 0.75rem;
}
.video-quality-pills {
  display: inline-flex;
  gap: 4px;
  margin-left: 8px;
  vertical-align: middle;
}
.video-quality-pill {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(234, 179, 8, 0.15);
  color: #ca8a04;
  white-space: nowrap;
}
.video-quality-pill.is-done {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}
.video-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 4px 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.video-meta span:first-child {
  color: var(--text);
  font-weight: 600;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.video-library-table {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  min-width: 0;
  width: 100%;
}
.video-library-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) 84px 56px 72px minmax(0, 1.4fr) auto;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  font-size: 0.82rem;
}
.video-library-row > span {
  min-width: 0;
}
.video-library-row > span:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
  align-items: center;
}
.video-library-row .btn {
  white-space: nowrap;
  padding: 3px 8px;
  font-size: 0.72rem;
}
.video-library-row.video-library-head {
  border: none;
  background: transparent;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.72rem;
}
.video-library-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Status cell is one coherent inline block: the status badge and the
   quality pills sit on the same horizontal row with a shared vertical
   centerline (Ready | 360p | 480p | ...). On narrow widths they wrap as a
   group instead of overflowing the cell. */
.video-library-status-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.video-library-status-cell .video-quality-pills { margin-left: 0; }
.video-library-status-cell .video-status-error { flex-basis: 100%; margin-top: 0; }
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin: 0 auto 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Summary list */
.summary-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
}
.summary-item:last-child { border-bottom: none; }
.summary-item span { color: var(--muted); }
.summary-item strong { color: var(--ink); font-weight: 500; }

/* ============================================================
   CURRICULUM BUILDER (Step 2)
   ============================================================ */

.builder-curriculum {
  max-width: 800px;
  margin: 0 auto;
}

.curriculum-header {
  margin-bottom: 24px;
}
.curriculum-header h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: 4px;
}

.curriculum-topics {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Topic card */
.curriculum-topic {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.topic-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-light);
}
.topic-drag {
  cursor: grab;
  color: var(--muted);
  font-size: 1.1rem;
  user-select: none;
}
.topic-number {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 600;
  flex-shrink: 0;
}
.topic-title-input {
  flex: 1;
  border: 1px solid transparent !important;
  background: transparent !important;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 4px 8px !important;
}
.topic-title-input:hover,
.topic-title-input:focus {
  border-color: var(--border) !important;
  background: var(--surface) !important;
}

.topic-lessons {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Curriculum items (lessons, quizzes) */
.curriculum-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  transition: background var(--transition);
}
.curriculum-item:hover {
  background: var(--surface-3);
}

.curriculum-item-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.curriculum-item-info {
  flex: 1;
  min-width: 0;
}
.curriculum-item-title {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.curriculum-item-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--muted);
}

.curriculum-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.btn-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition);
}
.btn-icon:hover {
  background: var(--surface-3);
  border-color: var(--border);
}
.btn-icon.btn-danger:hover {
  background: #FEE2E2;
  border-color: #FECACA;
  color: #DC2626;
}

.badge-sm {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.topic-add {
  padding-top: 6px;
}

.btn-add-topic {
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  border-style: dashed;
  font-size: 0.9rem;
}

/* ============================================================
   QUIZ BUILDER — SPLIT-VIEW MODAL
   ============================================================ */
.quiz-builder-modal { width: 100vw; height: 100vh; max-width: none; max-height: none; border-radius: 0; border: none; box-shadow: none; margin: 0; padding: 0; transform: none; display: flex; flex-direction: column; }
/* Override overlay for quiz fullscreen */
#quiz-modal { padding: 0 !important; background: var(--surface) !important; backdrop-filter: none !important; align-items: stretch !important; justify-content: stretch !important; }
.quiz-builder-body { display: flex; gap: 0; flex: 1; min-height: 0; padding: 0 !important; overflow: hidden; height: 100%; }
/* Fullscreen header */
#quiz-modal .admin-modal-header { border-radius: 0; }
/* Fullscreen body fills remaining space */
#quiz-modal .admin-modal-body { flex: 1; min-height: 0; padding: 0 !important; overflow: hidden; height: calc(100vh - 56px); }
.quiz-builder-left {
  flex: 1 1 55%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-light);
  overflow-y: auto;
}
.quiz-builder-right {
  flex: 1 1 45%;
  min-width: 0;
  overflow-y: auto;
  padding: 20px;
}
.quiz-builder-section { padding: 16px 20px; }
.quiz-builder-section + .quiz-builder-section { border-top: 1px solid var(--border-light); }
.quiz-builder-section-title { font-size: 0.85rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.quiz-builder-right .form-group { margin-bottom: 14px; }
.quiz-builder-right .form-row { display: flex; gap: 12px; }
.quiz-builder-right .form-row .form-group { flex: 1; }
.quiz-preview-box {
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 16px;
  min-height: 120px;
}
.quiz-preview-box .preview-question-text { font-size: 0.95rem; font-weight: 500; margin-bottom: 10px; line-height: 1.5; }
.quiz-preview-box .preview-option { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 0.88rem; }
.quiz-preview-box .preview-option.correct { color: var(--primary); font-weight: 600; }
.quiz-preview-box .preview-badge { display: inline-block; font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; background: var(--primary); color: #fff; margin-bottom: 8px; }
.quiz-builder-right .quiz-builder-actions { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-light); }
.quiz-builder-placeholder { text-align: center; color: var(--muted); font-size: 0.88rem; padding: 24px 0; }
.quiz-builder-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.85rem; margin-bottom: 12px; }

/* ============================================================
   STUDENT QUIZ INTERFACE
   ============================================================ */
#student-quiz-container {
  background: var(--surface-2);
  min-height: 100%;
  overflow-y: auto;
  padding: 32px 28px;
}
.student-quiz { max-width: 720px; margin: 0 auto; }
.quiz-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 300px; }
.student-quiz__header { margin-bottom: 28px; }
.student-quiz__title { font-size: 1.3rem; font-weight: 700; margin-bottom: 8px; color: var(--text-primary); }
.student-quiz__meta { display: flex; gap: 16px; font-size: 0.85rem; color: var(--muted); flex-wrap: wrap; }
.student-quiz__body { display: flex; flex-direction: column; gap: 20px; margin-bottom: 28px; }
.quiz-question { background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 22px 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.quiz-question__text { font-size: 1rem; font-weight: 600; line-height: 1.6; margin-bottom: 14px; color: var(--text-primary); }
.quiz-question__num { color: var(--primary); margin-right: 6px; }
.quiz-question__answers { display: flex; flex-direction: column; gap: 8px; }
.quiz-answer { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border: 1px solid var(--border-light); border-radius: var(--radius-xs); cursor: pointer; transition: all 0.15s; font-size: 0.92rem; background: var(--surface); }
.quiz-answer:hover { border-color: var(--primary); background: var(--surface-2); }
.quiz-answer input[type="radio"] { accent-color: var(--primary); width: 18px; height: 18px; }
.quiz-answer__text { flex: 1; color: var(--text-primary); }
.quiz-answer--checkbox { border-color: var(--border-light); }
.quiz-answer--checkbox input[type="checkbox"] { accent-color: var(--primary); width: 18px; height: 18px; }
.quiz-checkbox-group { display: flex; flex-direction: column; gap: 8px; }
.quiz-textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-xs); font-size: 0.95rem; resize: vertical; font-family: inherit; line-height: 1.5; transition: border-color 0.2s; }
.quiz-textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 59,130,246), 0.15); }
.student-quiz__footer { display: flex; gap: 12px; padding-top: 4px; }

/* ============================================================
   FLOATING QUIZ RESULT MODAL
   ============================================================ */
.quiz-result-modal {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.quiz-result-modal.show { opacity: 1; pointer-events: auto; }
.quiz-result-modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.quiz-result-modal__content {
  position: relative; z-index: 1;
  background: var(--surface);
  border-radius: 16px;
  padding: 40px 36px;
  max-width: 400px; width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}
.quiz-result-modal.show .quiz-result-modal__content { transform: scale(1); }
.quiz-result-modal__icon { font-size: 3rem; margin-bottom: 8px; }
.quiz-result-modal__title { font-size: 1.25rem; font-weight: 700; color: var(--ink); margin-bottom: 12px; }
.quiz-result-modal__score { font-size: 3rem; font-weight: 800; margin: 8px 0; }
.quiz-result-modal__score.passed { color: #22c55e; }
.quiz-result-modal__score.failed { color: #ef4444; }
.quiz-result-modal__detail { font-size: 0.9rem; color: var(--muted); margin-bottom: 4px; }
.quiz-result-modal__threshold { font-size: 0.82rem; color: var(--muted); margin-bottom: 20px; }
.quiz-result-modal__close { min-width: 120px; }

/* ============================================================
   QUIZ EDITOR (builder)
   ============================================================ */

.quiz-question-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  margin-bottom: 8px;
}
.quiz-question-order {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}
.quiz-question-main {
  flex: 1;
  min-width: 0;
}
.quiz-question-text {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quiz-question-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 3px;
  font-size: 0.75rem;
  color: var(--muted);
}
.quiz-question-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.quiz-options-group {
  margin-bottom: 14px;
}
.quiz-options-group > label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 5px;
}
.quiz-option-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.quiz-option-row .quiz-option-correct {
  flex-shrink: 0;
}
.quiz-option-row .quiz-option-text {
  flex: 1;
  min-width: 0;
}
.quiz-option-label {
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 500;
}

/* ============================================================
   TOAST
   ============================================================ */

.app-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--ink);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: min(90vw, 480px);
  text-align: center;
}
.app-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.app-toast.error {
  background: #DC2626;
}

/* ============================================================
   RICH TEXT EDITOR
   ============================================================ */

.rich-editor-toolbar {
  display: flex;
  gap: 2px;
  padding: 6px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  flex-wrap: wrap;
}
.rich-editor-toolbar button {
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text);
  transition: all var(--transition);
}
.rich-editor-toolbar button:hover {
  background: var(--surface);
  border-color: var(--border);
}

.rich-editor {
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-xs) var(--radius-xs);
  background: var(--surface);
  font-size: 0.9rem;
  line-height: 1.7;
  outline: none;
  color: var(--text);
}
.rich-editor:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}

/* Builder responsive */
@media (max-width: 900px) {
  .builder-grid {
    grid-template-columns: 1fr;
  }
  .builder-sidebar {
    position: static;
  }
  .builder-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .builder-steps {
    padding: 12px 16px;
    gap: 0;
    overflow-x: auto;
  }
  .builder-step {
    padding: 6px 12px;
    font-size: 0.82rem;
  }
  .builder-step::after {
    width: 20px;
    right: -10px;
  }
  .builder-content {
    padding: 16px;
  }
  .builder-footer {
    padding: 12px 16px;
  }
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}
.status-badge.active, .status-badge.published {
  background: rgba(34,197,94,0.12);
  color: var(--green-deep);
}
.status-badge.draft {
  background: rgba(242,169,59,0.12);
  color: var(--accent-warm-deep);
}
.status-badge.review {
  background: rgba(62,146,204,0.12);
  color: var(--accent);
}
.status-badge.suspended, .status-badge.revoked {
  background: rgba(239,68,68,0.12);
  color: #DC2626;
}
.status-badge.completed {
  background: rgba(34,197,94,0.12);
  color: var(--green-deep);
}
.status-badge.expired {
  background: rgba(242,169,59,0.12);
  color: var(--accent-warm-deep);
}
.status-badge.cancelled {
  background: rgba(107,114,128,0.12);
  color: #6B7280;
}

/* Role badges */
.role-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}
.role-badge.student {
  background: rgba(62,146,204,0.12);
  color: var(--accent);
}
.role-badge.instructor {
  background: rgba(34,197,94,0.12);
  color: var(--green-deep);
}
.role-badge.admin, .role-badge.super_admin {
  background: rgba(139,92,246,0.12);
  color: #7C3AED;
}
.role-badge.leader {
  background: rgba(242,169,59,0.12);
  color: var(--accent-warm-deep);
}


/* === Course table compact action group === */
.course-actions { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; white-space: nowrap; }
.course-actions .btn { padding: 6px 10px; font-size: 0.78rem; border-radius: 8px; gap: 6px; min-height: 32px; white-space: nowrap; }
.course-actions .btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.course-actions .btn span { line-height: 1; }
.course-actions .course-action-danger { color: var(--danger); }
.course-actions .course-action-danger:hover { border-color: var(--danger); color: var(--danger); }

/* === Manage workspace (full-screen) === */
.manage-workspace .manage-back { margin-bottom: 4px; }
.manage-workspace { min-width: 0; max-width: 100%; }
.manage-notice { padding: 10px 14px; border-radius: 8px; margin: 12px 0; font-size: 0.85rem; font-weight: 500; display: none; }
.manage-notice.success { background: rgba(34,197,94,.12); color: var(--success); border: 1px solid rgba(34,197,94,.3); }
.manage-notice.error { background: rgba(239,68,68,.12); color: var(--danger); border: 1px solid rgba(239,68,68,.3); }
.manage-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 4px 0 0; }
.manage-tab { border: none; background: transparent; padding: 10px 18px; font-family: inherit; font-size: 0.88rem; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; transition: color .15s; }
.manage-tab:hover { color: var(--ink); }
.manage-tab.active { color: var(--ink); border-bottom-color: var(--primary); }
.manage-tab-count { font-size: 0.75rem; color: var(--muted); margin-left: 2px; }
.manage-toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border-light); flex-wrap: wrap; }
.manage-search { flex: 1; min-width: 200px; max-width: 360px; }
.manage-sort { width: auto; }
.manage-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.manage-actions .btn { border-radius: 8px; }
.manage-actions .btn svg { width: 14px; height: 14px; }
.row-muted td { opacity: .55; }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state p { margin: 4px 0; }
.manage-check { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.manage-check:disabled { cursor: not-allowed; }
.course-actions .btn:disabled, .manage-actions .btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

/* === Universal bulk selection (admin tables) === */
.bulk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 20px 4px; }
.bulk-bar--flush { padding: 4px 0 12px; }
.bulk-bar .bulk-count { font-size: 0.82rem; color: var(--muted); min-width: 68px; }
.bulk-bar .btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.bulk-check-cell { width: 34px; text-align: center; }
.bulk-check-cell .manage-check { vertical-align: middle; }
@media (max-width: 767.98px) {
  .admin-table td.bulk-check-cell {
    justify-content: flex-start;
    min-height: auto;
    padding: 6px 0 0;
    border-bottom: none;
  }
  .admin-table td.bulk-check-cell::before { content: none; }
  .bulk-bar { padding: 10px 14px 4px; }
  .bulk-bar--flush { padding: 4px 0 12px; }
}

/* === COURSE LANDING PAGE (hybrid: hero + stats + sidebar + curriculum) === */
.svg-ic { width: 20px; height: 20px; flex-shrink: 0; }

.course-breadcrumb {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 0.85rem; color: var(--muted); margin-bottom: 1rem;
}
.course-breadcrumb a { color: var(--accent); text-decoration: none; font-weight: 500; }
.course-breadcrumb a:hover { text-decoration: underline; }
.course-breadcrumb .cb-sep { color: var(--border); }
.course-breadcrumb .cb-current { color: var(--muted); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.course-landing .course-hero { padding: 0.25rem 0 1rem; }
.course-landing .course-hero h1 {
  font-size: clamp(2.1rem, 4.5vw, 3.4rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
}
.course-landing .course-desc {
  font-size: 1.08rem;
  color: var(--muted);
  max-width: 72ch;
  line-height: 1.75;
  margin-bottom: 1rem;
}

/* Stats strip */
.course-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 1.25rem 0 2rem;
}
.course-stat {
  background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  padding: 14px 16px; display: flex; align-items: center; gap: 12px;
}
.course-stat__icon {
  width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); color: var(--primary-deep);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.course-stat__txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.course-stat .cs-num { font-family: var(--font-mono); font-weight: 600; font-size: 1.02rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-stat .cs-label { font-size: 0.76rem; color: var(--muted); }

/* Two-column layout */
.course-page { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 2rem; align-items: start; }
.course-main { min-width: 0; display: flex; flex-direction: column; gap: 1.25rem; }
.course-sidebar { display: flex; flex-direction: column; gap: 1.25rem; }

/* Sidebar card — compact, tight vertical rhythm (Udemy-style) */
.sidebar-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: 0 10px 30px rgba(18,32,67,0.06); }
.sidebar-card__body { padding: 0.8rem 1.25rem 0.85rem; }
.sidebar-card__foot { padding: 0.7rem 1.25rem 0.9rem; background: var(--surface-3); border-top: 1px solid var(--border-light); }
.price-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 0.5rem; }
.price-current { font-family: var(--font-mono); font-size: 1.9rem; font-weight: 700; color: var(--ink); }
.price-old { text-decoration: line-through; color: var(--muted); font-family: var(--font-mono); font-size: 0.95rem; }
.price-save {
  background: rgba(242,169,59,0.14); color: var(--accent-warm-deep); font-size: 0.75rem; font-weight: 700;
  padding: 3px 8px; border-radius: 999px; font-family: var(--font-mono);
}
.price-note { color: var(--muted); font-size: 0.85rem; }

.btn-block { width: 100%; display: flex; justify-content: center; align-items: center; box-sizing: border-box; }

.course-includes { list-style: none; padding: 0; margin: 0.35rem 0 0; }
.course-includes li {
  display: flex; align-items: center; gap: 10px; padding: 4px 0; border-top: 1px solid var(--border-light);
  font-size: 0.9rem; color: var(--text); line-height: 1.4;
}
.course-includes li:first-child { border-top: none; }
.course-includes li .svg-ic { color: var(--primary-deep); }

/* Sidebar "This course details" sub-panel */
.course-details-panel {
  margin-top: 0.9rem;
  padding: 0.8rem 1rem 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: 12px;
}
.course-details-panel .kicker { display: block; margin-bottom: 0.3rem; font-weight: 700; }
.course-details-panel .course-includes li { border-top: none; padding: 3px 0; font-size: 0.86rem; }
.course-details-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border-light);
}
.course-details-action {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.course-details-action:hover { color: var(--primary-deep); }
.course-details-action .svg-ic {
  width: 36px;
  height: 36px;
  padding: 9px;
  box-sizing: border-box;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
}
.course-details-action.is-saved { color: var(--primary-deep); }
.course-details-action.is-saved .svg-ic { background: var(--primary-deep); }

/* Share sheet modal (course details "Share" button) */
.share-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 3500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(18, 32, 67, 0.5);
}
.share-sheet {
  width: min(430px, 100%);
  max-height: min(86vh, 700px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: 18px;
  padding: 16px 18px 20px;
  box-shadow: 0 24px 64px rgba(18, 32, 67, 0.35);
}
.share-sheet__head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.share-sheet__head > .svg-ic { width: 20px; height: 20px; color: var(--ink); flex-shrink: 0; }
.share-sheet__title { flex: 1; font-weight: 700; font-size: 1.02rem; color: var(--ink); }
.share-sheet__close {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.share-sheet__close:hover { background: var(--surface-2); color: var(--ink); }
.share-sheet__close .svg-ic { width: 16px; height: 16px; }
.share-sheet__link {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 10px;
}
.share-sheet__link-ic,
.share-sheet__copy {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.share-sheet__link-ic .svg-ic { width: 18px; height: 18px; }
.share-sheet__copy { cursor: pointer; color: var(--ink); }
.share-sheet__copy:hover { border-color: var(--primary); color: var(--primary-deep); }
.share-sheet__copy .svg-ic { width: 18px; height: 18px; }
.share-sheet__link-text { flex: 1; min-width: 0; display: block; }
.share-sheet__link-text strong {
  display: block;
  font-size: 0.88rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.share-sheet__link-text > span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.share-sheet__label { margin: 16px 0 10px; font-size: 0.9rem; font-weight: 600; color: var(--muted); }
.share-sheet__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 8px; }
.share-sheet__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
}
.share-sheet__item svg { width: 40px; height: 40px; }
.share-sheet__item span {
  font-size: 0.72rem;
  line-height: 1.25;
  color: var(--text);
  text-align: center;
}
.share-sheet__item:hover span { color: var(--primary-deep); }

/* Share via email form */
.share-email { display: flex; flex-direction: column; gap: 1rem; margin-top: 0.25rem; }
.share-email__label { display: block; font-weight: 600; font-size: 0.85rem; color: var(--ink); margin-bottom: 0.4rem; }
.share-email__input {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
}
.share-email__input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15); }
.share-email__hint { margin: 0.35rem 0 0; font-size: 0.75rem; color: var(--muted); }
.share-email__errors { margin: 0.35rem 0 0; padding: 0; list-style: none; }
.share-email__errors li { font-size: 0.78rem; color: #dc2626; line-height: 1.45; }
.share-email__success { margin: 0; font-size: 0.88rem; font-style: italic; font-weight: 600; color: var(--primary-deep); }
.share-email__foot { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.share-email__note { font-size: 0.72rem; color: var(--muted); max-width: 220px; line-height: 1.4; }
.share-email__actions { display: flex; align-items: center; gap: 0.5rem; }
.share-email__cancel {
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 1.1rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.share-email__cancel:hover { border-color: var(--ink); }
.share-email__send {
  background: var(--primary);
  border: none;
  border-radius: 10px;
  padding: 0.55rem 1.4rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
}
.share-email__send:hover { background: var(--primary-deep); }
.share-email__send:disabled { opacity: 0.6; cursor: default; }

@media (max-width: 480px) {
  .share-sheet__grid { grid-template-columns: repeat(3, 1fr); }
}

/* Sidebar "Course Includes" card */
.sidebar-includes-card .includes-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.3rem;
}
.sidebar-includes-card .includes-head .svg-ic { width: 18px; height: 18px; color: var(--primary-deep); }
.sidebar-includes-card .includes-head h3 { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.sidebar-includes-card .course-includes { margin-top: 0.4rem; }
.sidebar-includes-card .course-includes li { border-top: none; padding: 6px 0; }

/* Course content / curriculum */
.course-content { padding: 1.5rem; }
.course-content-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 10px; margin-bottom: 0.5rem; }
.cc-counts { display: block; font-size: 0.82rem; color: var(--muted); font-family: var(--font-mono); margin-top: 6px; }

/* About / What you'll learn */
.course-about { padding: 1.5rem; }
.course-about__text { color: var(--muted); line-height: 1.75; white-space: pre-line; }

/* Udemy-style "What you'll learn" checklist — balanced two-column grid */
.course-learn { padding: 1.5rem; }
.course-learn-grid {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 1.5rem;
  row-gap: 0.85rem;
}
.course-learn-grid__item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text);
  min-width: 0;
}
.course-learn-grid__check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border-radius: 50%;
  background: rgba(31, 167, 93, 0.12);
  color: #1fa75d;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.course-learn-grid__check .svg-ic { width: 12px; height: 12px; }
.course-learn-grid__text { min-width: 0; }

@media (max-width: 768px) {
  .course-learn-grid { grid-template-columns: 1fr; }
}

/* What you'll learn: collapse after two rows with a bottom fade */
.course-learn-wrap { position: relative; }
.course-learn-wrap.is-collapsed {
  max-height: var(--learn-cap, 220px);
  overflow: hidden;
}
.course-learn-wrap.is-collapsed::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--learn-fade, 96px);
  background: linear-gradient(to bottom, rgba(242, 248, 243, 0), var(--surface-2) 92%);
  pointer-events: none;
}
.course-learn-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.9rem;
  padding: 0.4rem 0;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.course-learn-toggle[hidden] { display: none; }
.course-learn-toggle:hover { color: var(--primary-deep); }
.course-learn-toggle .svg-ic { width: 14px; height: 14px; transition: transform 0.2s ease; }
.course-learn-toggle[aria-expanded="true"] .svg-ic { transform: rotate(180deg); }

/* Curriculum section tabs */
.course-tabs {
  display: flex;
  gap: 1.75rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 1.1rem;
}
.course-tab {
  position: relative;
  padding: 0.35rem 0 0.65rem;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.course-tab:hover { color: var(--ink); }
.course-tab.is-active { color: var(--ink); }
.course-tab.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--primary);
}
.course-tab-panel { display: none; }
.course-tab-panel.is-active { display: block; }

/* Curriculum: default max 10 sections, reveal the rest via See More button */
.curriculum-section.is-more-hidden { display: none; }
.curriculum-more { width: 100%; font-size: 1rem; padding: 14px 24px; margin-top: -0.75rem; }
.curriculum-more[hidden] { display: none; }

/* Subtle panel treatment (Learning outcomes + Course Content) */
.course-landing .card.course-about,
.course-landing .card.course-content {
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: none;
  padding: 1.35rem 1.5rem;
}
.course-landing .card.course-about:hover,
.course-landing .card.course-content:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border-light);
}
@media (max-width: 768px) {
  .course-landing .card.course-about,
  .course-landing .card.course-content { padding: 1rem 1.1rem; }
}

/* Instructor */
.instructor-card { display: flex; gap: 1rem; align-items: center; padding: 1.25rem 1.5rem; }
.instructor-avatar {
  width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.2rem;
}

/* Instructor profile (below Related Courses) */
.course-instructor-profile { padding: 0.35rem 0 0.1rem; }
.course-instructor-profile .kicker { display: block; }
.course-instructor-profile__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.55rem;
  color: var(--ink);
  margin: 0.2rem 0 0.9rem;
}
.course-instructor-profile__row { display: flex; align-items: center; gap: 1.1rem; }
.course-instructor-profile .instructor-avatar { width: 84px; height: 84px; font-size: 1.7rem; }
.course-instructor-profile__meta { margin: 0; font-size: 0.95rem; }

/* Certificate banner */
.cert-banner {
  display: flex; gap: 1rem; align-items: center; padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, var(--surface-2), var(--surface)); border: 1.5px dashed var(--primary);
  border-radius: var(--radius);
}
.cert-banner__icon {
  width: 48px; height: 48px; border-radius: 50%; background: var(--primary); color: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.cert-banner__icon svg { width: 24px; height: 24px; }

/* Related courses */
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
/* Related-course cards on the course page are static (no hover animations). */
.related-grid .course-card-v2,
.related-grid .course-card-v2:hover { transform: none; transition: none; }
.related-grid .course-card-v2:hover .course-card-v2__image img { transform: none; }

/* Mobile sticky CTA */
.mobile-cta { display: none; }
.mobile-cta-spacer { display: none; }

@media (max-width: 1024px) {
  .course-page { grid-template-columns: 1fr; gap: 1.25rem; }
  .course-sidebar { position: static; order: 2; }
  .course-main { order: 1; }
}
@media (max-width: 768px) {
  .course-stats { grid-template-columns: repeat(2, 1fr); }
  .related-grid { grid-template-columns: 1fr; }
  .course-content { padding: 1.25rem; }
  .course-content-head { align-items: flex-start; }
  .mobile-cta {
    display: flex; align-items: center; gap: 12px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 10px 16px; box-shadow: 0 -6px 20px rgba(0,0,0,0.08);
  }
  .mobile-cta__price { font-family: var(--font-mono); font-size: 1.05rem; color: var(--ink); white-space: nowrap; }
  .mobile-cta__price strong { color: var(--primary-deep); }
  .mobile-cta__price .price-old { font-size: 0.8rem; }
  .mobile-cta .btn { margin: 0; flex: 1; }
  .mobile-cta-spacer { display: block; height: 78px; }
}

/* ============================================================
   STUDENT PORTAL — shared shell, dashboard, learning, player
   ============================================================ */

/* --- Skeleton loading --- */
.skel {
  height: 14px; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.3s infinite;
}
.skel-title { height: 26px; width: 220px; }
.skel-card { border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border-light); overflow: hidden; position: relative; }
@keyframes skel-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* --- Shell --- */
.student-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: calc(100vh - 64px);
  max-width: 1440px;
  margin: 0 auto;
}
.student-sidebar {
  border-right: 1px solid var(--border-light);
  background: var(--surface);
  padding: 1.25rem 0.9rem;
  position: sticky;
  top: 64px;
  align-self: start;
  height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
}
.student-nav { display: flex; flex-direction: column; gap: 4px; }
.student-nav__item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.93rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.student-nav__item .svg-ic { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.student-nav__item:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.student-nav__item.active {
  background: rgba(34,197,94,0.12);
  color: var(--primary-deep);
  font-weight: 600;
}
.student-nav__item.active .svg-ic { color: var(--primary-deep); }
.student-sidebar__foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border-light); }
.student-main { padding: 1.75rem 2rem 3rem; min-width: 0; }

/* --- Page header + welcome --- */
.student-page { max-width: 1120px; margin: 0 auto; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin-bottom: 1.5rem; flex-wrap: wrap;
}
.page-head h1 { font-size: 1.7rem; }
.dash-welcome-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin-bottom: 1.5rem; flex-wrap: wrap;
}
.dash-welcome { font-size: 1.85rem; margin: 0; }
.dash-subtitle { color: var(--muted); margin-top: 4px; }
.dash-welcome-actions { display: flex; align-items: center; gap: 10px; }
.overall-grade { color: var(--muted); font-size: 0.9rem; }
.overall-grade strong { color: var(--primary-deep); font-family: var(--font-mono); }

/* --- Continue Learning hero --- */
.continue-card {
  display: grid;
  grid-template-columns: 280px 1fr;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(135deg, rgba(34,197,94,0.10), var(--surface));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  margin-bottom: 1.5rem;
}
.continue-card__media { position: relative; min-height: 180px; background: var(--surface-3); }
.continue-card__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.continue-card__ph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}
.continue-card__ph svg { width: 48px; height: 48px; }
.continue-card__body { padding: 1.5rem; display: flex; flex-direction: column; gap: 0.6rem; align-items: flex-start; }
.continue-card__body h2 { margin: 0; }
.continue-card__meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.continue-card__progress { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 420px; }
.continue-card__progress .progress-bar { flex: 1; }

/* --- KPI cards --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 1.5rem;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex; align-items: center; gap: 12px;
}
.kpi-card__icon {
  width: 42px; height: 42px; border-radius: 12px;
  background: rgba(34,197,94,0.12);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary-deep); flex-shrink: 0;
}
.kpi-card__icon .svg-ic { width: 20px; height: 20px; }
.kpi-card__value { display: block; font-size: 1.25rem; font-weight: 700; font-family: var(--font-mono); color: var(--ink); line-height: 1.1; }
.kpi-card__label { display: block; font-size: 0.78rem; color: var(--muted); }

/* --- Two-column dashboard grid --- */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.panel { padding: 1.25rem; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 0.9rem;
}
.panel-head h3 { margin: 0; font-size: 1.1rem; }
.panel-head .kicker { margin: 0; }
.panel-empty { padding: 1rem 0; }

/* --- Tasks --- */
.task-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.task-item {
  display: flex; align-items: center; gap: 12px;
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid var(--border-light);
}
.task-item:last-child { border-bottom: none; }
.task-item__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.task-item__dot.task-session { background: var(--accent); }
.task-item__dot.task-quiz { background: var(--accent-warm); }
.task-item__dot.task-expiry { background: var(--primary); }
.task-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.task-item__badge { flex-shrink: 0; }

/* --- Events / calendar --- */
.event-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.event-item {
  display: flex; align-items: center; gap: 12px;
  padding: 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--surface-2);
}
.event-item__date {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--font-mono);
}
.event-item__date strong { font-size: 1.05rem; color: var(--primary-deep); line-height: 1; }
.event-item__date span { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; }
.event-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.calendar-day { margin-bottom: 1.5rem; }
.calendar-day h3 { font-size: 1.05rem; margin-bottom: 0.6rem; }

/* --- My Learning list (dashboard preview) --- */
.learning-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.learning-item {
  display: flex; gap: 12px; align-items: center;
  padding: 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}
.learning-item__thumb {
  width: 68px; height: 46px; border-radius: 8px; overflow: hidden; flex-shrink: 0;
  background: var(--surface-3); display: flex; align-items: center; justify-content: center; color: var(--primary);
}
.learning-item__thumb img { width: 100%; height: 100%; object-fit: cover; }
.learning-item__thumb svg { width: 22px; height: 22px; }
.learning-item__body { flex: 1; min-width: 0; }

/* --- Activity --- */
.activity-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.activity-item {
  display: flex; align-items: center; gap: 12px;
  padding: 0.6rem 0.3rem;
  border-bottom: 1px solid var(--border-light);
}
.activity-item:last-child { border-bottom: none; }
.activity-item__icon {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: rgba(34,197,94,0.12); color: var(--primary-deep);
  display: flex; align-items: center; justify-content: center;
}
.activity-item__icon .svg-ic { width: 16px; height: 16px; }
.activity-item__icon.award { background: rgba(242,169,59,0.15); color: var(--accent-warm-deep); }

/* --- Notifications --- */
.notif-wrap { position: relative; }
.notif-bell { position: relative; }
.notif-bell__count {
  position: absolute; top: -4px; right: -4px;
  min-width: 16px; height: 16px; border-radius: 8px;
  background: var(--primary); color: #fff;
  font-size: 0.68rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}
.notif-drop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
  width: 300px; max-height: 360px; overflow: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: 0.5rem;
}
.notif-item { padding: 0.7rem; border-bottom: 1px solid var(--border-light); }
.notif-item:last-child { border-bottom: none; }
.notif-item p { margin: 2px 0 8px; }
.notif-item .btn { margin: 0; }

/* --- Filters --- */
.filter-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 1.25rem; }
.filter-tab {
  padding: 8px 14px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 0.85rem; font-weight: 500; cursor: pointer;
  transition: all var(--transition);
}
.filter-tab:hover { border-color: var(--primary); }
.filter-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* --- My Learning grid cards --- */
.learning-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.course-card-l { overflow: hidden; display: flex; flex-direction: column; }
.course-card-l__media { position: relative; aspect-ratio: 16 / 9; background: var(--surface-3); }
.course-card-l__media img { width: 100%; height: 100%; object-fit: cover; }
.course-card-l__ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--primary); }
.course-card-l__ph svg { width: 36px; height: 36px; }
.course-card-l__status { position: absolute; top: 10px; left: 10px; }
.course-card-l__body { padding: 1rem; display: flex; flex-direction: column; flex: 1; }
.course-card-l__body h3 { font-size: 1.05rem; margin: 0 0 2px; }
.course-card-l__foot { margin-top: auto; padding-top: 0.8rem; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* --- Certificates --- */
.cert-list { display: flex; flex-direction: column; gap: 12px; }
.cert-row { display: flex; align-items: center; gap: 16px; padding: 1.1rem 1.25rem; }
.cert-row__icon {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  background: rgba(242,169,59,0.15); color: var(--accent-warm-deep);
  display: flex; align-items: center; justify-content: center;
}
.cert-row__icon svg { width: 26px; height: 26px; }
.cert-row__body { flex: 1; min-width: 0; }
.cert-row__body h3 { font-size: 1.1rem; margin: 0; }

/* --- Grades --- */
.grade-list { list-style: none; display: flex; flex-direction: column; }
.grade-item {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0.9rem 0.3rem;
  border-bottom: 1px solid var(--border-light);
}
.grade-item:last-child { border-bottom: none; }
.grade-item__main { flex: 1; min-width: 0; }
.grade-item__score {
  font-family: var(--font-mono); font-weight: 700; font-size: 1.1rem;
  text-align: right; display: flex; flex-direction: column;
}
.grade-item__score small { font-size: 0.7rem; font-family: var(--font-body); font-weight: 500; }
.grade-item__score.pass { color: var(--primary-deep); }
.grade-item__score.fail { color: var(--accent-warm-deep); }

/* --- Player: shell --- */
body.player-mode .site-header,
body.player-mode .site-footer { display: none; }
/* --- Admin Panel: separate layout context --- */
/* The frontend footer is structurally excluded from the Admin Panel. render()
   toggles body.admin-page on Admin routes, so the footer (and its spacing)
   exist only on public/frontend pages and are completely absent here. */
body.admin-page .site-footer { display: none; }
body.admin-page .site-header { display: none; }
body.admin-page #app { padding-bottom: 0; }
.player { min-height: 100vh; background: var(--bg); }
.player-header {
  position: sticky; top: 0; z-index: 90;
  display: flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.player-header__menu { font-size: 1.2rem; display: none; }
.player-header__brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; color: var(--ink); }
.player-header__course { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.player-header__course strong { font-size: 0.9rem; color: var(--ink); }
.player-header__course span { font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-header__actions { display: flex; align-items: center; gap: 8px; }
.player-header__back { margin-left: 4px; }

/* --- Player body grid --- */
.player-body {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  height: calc(100vh - 60px);
  overflow: hidden;
}
.player-body ~ *, #app:has(.player-body) { padding-bottom: 0; }
.curriculum {
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex; flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.curriculum__head { padding: 1rem 1.1rem; border-bottom: 1px solid var(--border-light); display: flex; flex-direction: column; gap: 2px; }
.curriculum__head strong { font-size: 0.98rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.curriculum__scroll { flex: 1; overflow-y: auto; padding: 0.75rem 0.6rem; }

.curriculum-progress { padding: 0.75rem; border-bottom: 1px solid var(--border-light); margin-bottom: 0.5rem; }
.curriculum-expiry {
  margin: 0 0.75rem 0.75rem; padding: 0.6rem 0.75rem;
  border-radius: var(--radius-xs);
  background: rgba(242,169,59,0.12); color: var(--accent-warm-deep);
  font-size: 0.8rem;
}
.curriculum-expiry.expired { background: rgba(239,68,68,0.12); color: #dc2626; }

.curriculum-module { margin-bottom: 0.35rem; }
.curriculum-module__head {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0.65rem 0.7rem; border: none; background: transparent; cursor: pointer;
  color: var(--text); font-family: var(--font-body); text-align: left; border-radius: var(--radius-xs);
}
.curriculum-module__head:hover { background: var(--surface-2); }
.curriculum-module__head .module-toggle { transition: transform var(--transition); display: flex; }
.curriculum-module.open .module-toggle { transform: rotate(180deg); }
.curriculum-module__lessons { display: none; list-style: none; }
.curriculum-module.open .curriculum-module__lessons { display: block; }
.curriculum-module__lessons li { margin: 2px 0; }

.curriculum-lesson {
  display: flex; align-items: center; gap: 8px;
  padding: 0.55rem 0.7rem; border-radius: var(--radius-xs);
  color: var(--text); font-size: 0.87rem; line-height: 1.35;
}
.curriculum-lesson:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.curriculum-lesson__state { width: 16px; flex-shrink: 0; font-size: 0.8rem; text-align: center; color: var(--muted); }
.curriculum-lesson__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.curriculum-lesson.completed .curriculum-lesson__state { color: var(--primary-deep); }
.curriculum-lesson.completed { color: var(--muted); }
.curriculum-lesson.active {
  background: rgba(34,197,94,0.12);
  color: var(--ink); font-weight: 600;
}
.curriculum-lesson.active .curriculum-lesson__state { color: var(--primary-deep); }
.curriculum-lesson.in_progress .curriculum-lesson__state { color: var(--accent-warm-deep); }
.curriculum-lesson.locked { color: var(--muted); opacity: 0.7; cursor: not-allowed; }

/* --- Player main --- */
.player-main { min-width: 0; padding: 0; height: 100%; overflow-y: auto; }
.media-wrap {
  background: #000;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
}
.media-wrap video,
.media-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
.media-loading { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); padding: 2rem; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.player-error { color: var(--text); text-align: center; padding: 2rem; display: flex; flex-direction: column; gap: 10px; align-items: center; }

.player-under { padding: 1.4rem 1.75rem 2.5rem; }
.lesson-context { margin-bottom: 1.25rem; }
.breadcrumb { color: var(--muted); font-size: 0.85rem; margin-bottom: 4px; }
.lesson-context h2 { font-size: 1.5rem; margin: 0 0 4px; }

/* --- Supporting tabs --- */
.supporting { margin-bottom: 1.25rem; }
.tab-bar { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 1rem; flex-wrap: wrap; }
.tab-btn {
  padding: 0.6rem 1rem; border: none; background: transparent; cursor: pointer;
  color: var(--muted); font-size: 0.9rem; font-weight: 500; font-family: var(--font-body);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--primary-deep); border-bottom-color: var(--primary); font-weight: 600; }

/* --- Notes --- */
.notes-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 1rem; }
.notes-form textarea {
  width: 100%; resize: vertical; min-height: 60px;
  padding: 0.7rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-family: var(--font-body);
}
.notes-form textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: transparent; }
.notes-form .btn { align-self: flex-start; }
.note-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.note-item {
  padding: 0.8rem; border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.note-item__meta { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.note-item__meta .btn-icon { margin-left: auto; }

/* --- Materials --- */
.material-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.material-item {
  display: flex; align-items: center; gap: 12px;
  padding: 0.8rem; border: 1px solid var(--border-light); border-radius: var(--radius-sm);
}
.material-item__icon {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: rgba(62,146,204,0.12); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.material-item__icon .svg-ic { width: 18px; height: 18px; }
.material-item > div { flex: 1; min-width: 0; }
.material-item .btn { flex-shrink: 0; }

/* --- Lesson nav --- */
.lesson-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 1.25rem; flex-wrap: wrap; }
.lesson-nav .btn { margin: 0; max-width: 50%; white-space: normal; }

/* --- Lesson text (non-video) --- */
.lesson-text { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 960px; margin: 0 auto; align-self: center; }

/* --- Access denied / empty --- */
.access-denied { margin: 3rem auto; max-width: 480px; }

/* --- Badge variants used in portal --- */
.badge-success { background: rgba(34,197,94,0.14); color: var(--primary-deep); }
.badge-danger { background: rgba(239,68,68,0.14); color: #dc2626; }
.badge-accent { background: rgba(62,146,204,0.14); color: var(--accent); }

/* --- Responsive --- */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .learning-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .student-shell { grid-template-columns: 200px minmax(0, 1fr); }
  .player-body { grid-template-columns: 1fr; }
  .curriculum {
    position: fixed; left: 0; top: 60px; bottom: 0; width: 320px;
    transform: translateX(-100%); transition: transform var(--transition-slow);
    z-index: 80; box-shadow: var(--shadow-lg);
  }
  .player-body.curriculum-open .curriculum { transform: translateX(0); }
  .player-header__menu { display: inline-flex; }
}
@media (max-width: 768px) {
  .student-shell { grid-template-columns: 1fr; }
  .student-sidebar {
    position: static; top: auto; height: auto;
    flex-direction: row; overflow-x: auto; padding: 0.5rem;
    border-right: none; border-bottom: 1px solid var(--border-light);
  }
  .student-nav { flex-direction: row; gap: 6px; }
  .student-nav__item { padding: 8px 12px; white-space: nowrap; }
  .student-nav__item .svg-ic { display: none; }
  .student-sidebar__foot { display: none; }
  .student-main { padding: 1.25rem 1rem 2.5rem; }
  .dash-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .continue-card { grid-template-columns: 1fr; }
  .continue-card__media { min-height: 140px; }
  .learning-grid { grid-template-columns: 1fr; }
  .player-under { padding: 1.1rem 1rem 2rem; }
  .lesson-nav .btn { max-width: 100%; width: 100%; }

  /* === Mobile Video Player Overhaul === */

  /* Hide Plyr's bottom-left play button on mobile */
  .elp-viewport .plyr__controls .plyr__controls__item:first-child {
    display: none !important;
  }

  /* Hide duplicate Rewind/Forward buttons in bottom bar (center cluster has them) */
  .elp-viewport .plyr__controls [data-plyr="rewind"],
  .elp-viewport .plyr__controls [data-plyr="fast-forward"] {
    display: none !important;
  }

  /* Hide volume slider on mobile — keep only mute toggle icon */
  .elp-viewport .plyr__controls .plyr__volume input[type=range] {
    display: none !important;
  }
  .elp-viewport .plyr__controls .plyr__volume {
    min-width: auto !important;
  }

  /* Make the center overlaid play button bigger and more prominent on mobile */
  .elp-viewport .plyr__control--overlaid {
    padding: 20px !important;
    opacity: 0.95 !important;
    background: rgba(0,0,0,0.3) !important;
    border: 3px solid rgba(255,255,255,0.8) !important;
  }
  .elp-viewport .plyr__control--overlaid svg {
    width: 28px !important;
    height: 28px !important;
    fill: #fff !important;
  }

  /* Hide center play when video is playing */
  .elp-viewport .plyr--playing .plyr__control--overlaid {
    opacity: 0 !important;
    visibility: hidden !important;
  }

  /* Center cluster: rewind | play | forward overlay */
  .elp-mobile-cluster {
    display: flex !important;
    align-items: center;
    gap: 20px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    pointer-events: none;
  }
  .elp-mobile-cluster button {
    pointer-events: auto;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.8);
    background: rgba(0,0,0,0.3);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }
  .elp-mobile-cluster button:active {
    transform: scale(0.9);
    background: rgba(255,255,255,0.2);
  }
  .elp-mobile-cluster button svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
  }
  .elp-mobile-cluster .elp-cluster-play {
    width: 64px;
    height: 64px;
    border: 3px solid rgba(255,255,255,0.8);
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }
  .elp-mobile-cluster .elp-cluster-play svg {
    width: 30px;
    height: 30px;
    margin-left: 3px;
  }

  /* Hide center cluster when playing (video is active) */
  .elp-viewport.plyr--playing .elp-mobile-cluster {
    opacity: 0;
    transition: opacity 0.4s ease;
  }
  .elp-viewport:not(.plyr--playing) .elp-mobile-cluster {
    opacity: 1;
    transition: opacity 0.3s ease;
  }

  /* Make the ELP custom controls more touch-friendly on mobile */
  .elp-controls {
    padding: 8px 12px !important;
    border-radius: 0 !important;
  }
  .elp-seek {
    height: 10px !important;
    border-radius: 5px !important;
  }
  .elp-seek::-webkit-slider-thumb {
    width: 18px !important;
    height: 18px !important;
  }
  .elp-time {
    font-size: 14px !important;
    font-weight: 500;
  }
  .elp-controls button {
    min-width: 44px;
    min-height: 44px;
    padding: 8px 12px !important;
    font-size: 14px;
  }

  /* Volume slider: vertical, slides from left on mobile */
  .elp-volume-slider {
    display: flex !important;
    position: absolute;
    left: 0;
    bottom: 60px;
    width: 44px;
    height: 160px;
    background: rgba(10,14,20,0.95);
    border-radius: 0 8px 8px 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
  }
  .elp-volume-slider.elp-volume-visible {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }
  .elp-volume-slider input[type=range] {
    writing-mode: vertical-lr;
    direction: rtl;
    width: 6px;
    height: 100px;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    outline: none;
  }
  .elp-volume-slider input[type=range]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0f766e;
    cursor: pointer;
  }
  .elp-volume-slider .elp-vol-icon {
    color: #e5e7eb;
    font-size: 18px;
    cursor: pointer;
  }
}
@media (prefers-reduced-motion: reduce) {
  .skel, .spinner { animation: none; }
  .curriculum { transition: none; }
}

/* ===== Admin Media Library page ===== */
.admin-media-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 2px solid var(--border, #e5e7eb);
  margin-bottom: 0;
  flex-wrap: wrap;
}
.admin-media-tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted, #6b7280);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  margin-bottom: -2px;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.admin-media-tab:hover { color: var(--text, #111827); background: rgba(0,0,0,.03); }
.admin-media-tab.active {
  color: var(--primary, #2563eb);
  border-color: var(--border, #e5e7eb);
  border-bottom-color: transparent;
  background: var(--card-bg, #fff);
}
.media-admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 4px 0 12px;
}
.media-admin-upload-label { cursor: pointer; display: inline-flex; align-items: center; }
.admin-media-library { min-width: 0; width: 100%; }
/* Upload progress/status lives directly under the Media toolbar as a
   full-width status strip (no stray right-hand whitespace). */
.admin-media-video-status {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
}
.admin-media-video-status:empty { display: none; padding: 0; margin: 0; }
.admin-media-video-status .video-progress-bar { max-width: none; width: 100%; }
.admin-media-video-status p { margin: 0; font-size: 0.85rem; font-weight: 600; }
.admin-media-video-status small { color: var(--muted); }
.admin-media-video-status .video-status-badge { align-self: flex-start; }
.admin-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 8px; }
.admin-media-grid .media-grid-item { position: relative; border-radius: 8px; overflow: hidden; border: 1px solid var(--border, #e5e7eb); }
.admin-media-grid .media-grid-item img { display: block; width: 100%; height: 110px; object-fit: cover; }
.admin-media-grid .media-grid-name {
  font-size: .74rem;
  color: var(--muted, #6b7280);
  padding: 6px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--card-bg, #fff);
}
.admin-media-queue { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.admin-media-queue-item {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 1.4fr auto auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--card-bg, #fff);
}
.admin-media-queue-name { font-size: .82rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-media-queue-state { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.admin-media-queue-state.queued { color: var(--muted, #6b7280); }
.admin-media-queue-state.uploading { color: var(--primary, #2563eb); }
.admin-media-queue-state.paused { color: #d97706; }
.admin-media-queue-state.done { color: #16a34a; }
.admin-media-queue-state.error { color: #dc2626; }
.software-url-row { display: flex; gap: 6px; align-items: center; }
@media (max-width: 640px) {
  .admin-media-queue-item { grid-template-columns: 1fr; gap: 6px; }
  .admin-media-tab { font-size: .85rem; padding: 8px 12px; }
}

/* === Udemy-style Course Preview banner (top of Course Details sidebar) === */
.course-preview-banner {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  cursor: pointer;
  background: var(--primary-deep);
}
.course-preview-banner--static { cursor: default; }
.course-preview-banner__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.course-preview-banner:hover .course-preview-banner__img { transform: scale(1.05); }
.course-preview-banner__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(180deg, rgba(18,32,67,0.08) 0%, rgba(18,32,67,0.55) 100%);
  color: #fff;
}
.course-preview-banner__play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  transition: transform 0.2s ease;
}
.course-preview-banner__play .svg-ic { width: 26px; height: 26px; stroke: var(--primary-deep); fill: none; }
.course-preview-banner:hover .course-preview-banner__play { transform: scale(1.08); }
.course-preview-banner__label {
  font-weight: 600;
  font-size: 0.9rem;
  text-shadow: 0 1px 3px rgba(0,0,0,0.45);
}
.course-preview-banner:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Udemy-style stacked purchase buttons (Add to Cart / Buy Now) */
.course-cta-stack { display: flex; flex-direction: row; gap: 0.5rem; margin-bottom: 0.15rem; }
.course-cta-stack .btn { flex: 1; min-width: 0; margin: 0; }

/* Buy Now (scoped to the sidebar stack) — metric parity with "Add to Cart":
   identical radius, weight, vertical padding, height and hover transition,
   and the SAME brand-green background (var(--primary), hover primary-deep).
   The global .btn-accent (admin/media buttons) is intentionally untouched. */
.course-cta-stack .btn-accent {
  background: var(--primary);
  color: #fff;
  padding: 14px 32px;
  border-radius: var(--radius-pill);
  font-size: 1rem;
  font-weight: 600;
  box-shadow: none;
}
.course-cta-stack .btn-accent:hover {
  background: var(--primary-deep);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-green);
}

/* ============================================================
   DEDICATED CoursePreviewModal — fully isolated component.
   Independent of the shared #video-player-modal (Admin Media
   Library / generic media viewer). Compact ~720px dialog with a
   16:9 player on top and a "Free Sample Videos" playlist stacked
   directly below (Udemy-style). All selectors are namespaced
   under .course-preview-* so nothing bleeds into the shared modal.
   ============================================================ */
.course-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 15, 24, 0.65);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.course-preview-overlay.show { opacity: 1; pointer-events: auto; }

.course-preview-dialog {
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #101828;
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

.course-preview-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.course-preview-dialog__header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
}
.course-preview-dialog__subtitle {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  color: #94a3b8;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 560px;
}
.course-preview-dialog__header .media-modal-close { color: #94a3b8; }
.course-preview-dialog__header .media-modal-close:hover { color: #fff; }

.course-preview-dialog__stage {
  position: relative;
  width: 100%;
  /* The stage matches the source video's NATIVE ratio (set from JS as
     --preview-stage-ratio once videoWidth/videoHeight are known; 16/9 default).
     object-fit: contain below therefore renders the full frame flush —
     no top/bottom bars, no side pillarboxes, no cropping. */
  aspect-ratio: var(--preview-stage-ratio, 16 / 9);
  background: #000;
  flex-shrink: 0;
  overflow: hidden;
}
.course-preview-dialog__stage video,
.course-preview-dialog__stage iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
.course-preview-dialog__stage video { object-fit: contain !important; }

.course-preview-playlist {
  flex: 1 1 auto;
  min-height: 120px;
  overflow-y: auto;
  padding: 12px 18px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #0b1526;
}
.course-preview-playlist .kicker {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.course-preview-list { list-style: none; margin: 8px 0 0; padding: 0; }
.course-preview-list__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  color: #dce1ec;
}
.course-preview-list__item:hover { background: rgba(255, 255, 255, 0.06); }
.course-preview-list__item.active { background: rgba(62, 146, 204, 0.22); color: #7db4dd; }
.course-preview-list__icon .svg-ic { width: 16px; height: 16px; }
.course-preview-list__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-preview-list__duration { font-family: var(--font-mono); font-size: 0.78rem; color: #94a3b8; }
.course-preview-list__status { font-size: 0.72rem; font-weight: 700; color: var(--accent); min-width: 46px; text-align: right; }

/* Short viewports: the stage would otherwise push the playlist out of view,
   so scale the whole stage down proportionally (height-driven, width auto →
   both dimensions shrink together, still the video's native ratio). contain
   guarantees the full frame stays visible with zero cropping. */
@media (max-height: 640px) {
  .course-preview-dialog { max-height: 94vh; }
  .course-preview-dialog__stage {
    height: 46vh;
    width: auto;
    margin-inline: auto;
  }
  .course-preview-playlist { min-height: 90px; }
}
@media (max-width: 640px) {
  .course-preview-overlay { padding: 12px; }
  .course-preview-dialog__subtitle { max-width: 340px; }
}

/* Header cart link + count badge */
.nav-cart {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  padding: 6px;
  border-radius: 8px;
  margin-right: 4px;
}
.nav-cart:hover { color: var(--primary-deep); }
.nav-cart svg { width: 22px; height: 22px; }
.nav-cart__badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
}
.nav-cart__badge[hidden] { display: none; }

/* Cart page */
.cart-list { list-style: none; margin: 1.25rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.cart-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.cart-item__thumb { width: 84px; height: 48px; border-radius: 6px; overflow: hidden; flex-shrink: 0; background: var(--surface-3); display: flex; align-items: center; justify-content: center; }
.cart-item__thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-item__thumb--ph .svg-ic { width: 22px; height: 22px; color: var(--muted); }
.cart-item__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cart-item__title { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-item__title:hover { color: var(--primary-deep); }
.cart-item__price { display: flex; align-items: baseline; gap: 8px; flex-shrink: 0; }
.cart-item__now { font-family: var(--font-mono); font-weight: 700; font-size: 1.05rem; }
.cart-item__actions { display: flex; gap: 8px; flex-shrink: 0; }
.cart-total { display: flex; justify-content: flex-end; align-items: baseline; gap: 8px; margin-top: 1rem; font-size: 1.1rem; }
.cart-total strong { font-family: var(--font-mono); font-size: 1.4rem; color: var(--primary-deep); }
@media (max-width: 640px) {
  .cart-item { flex-wrap: wrap; }
  .cart-item__actions { width: 100%; justify-content: flex-end; }
}

/* Checkout page responsive */
@media (max-width: 768px) {
  #checkout-form > div { grid-template-columns: 1fr !important; gap: 1.5rem !important; }
  #checkout-form > div > div:last-child { position: static !important; }
}

/* ============================================================
   ENTERPRISE RESPONSIVE DESIGN SYSTEM
   Bootstrap 5 breakpoints as REFERENCE — custom CSS only
   Focus: xs (<576px), sm (≥576px), md (≥768px)
   Desktop (≥992px) is NOT modified
   ============================================================ */

/* ─────────────────────────────────────────────
   GLOBAL MOBILE FOUNDATIONS (max-width: 767.98px)
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  /* Touch-friendly base: all inputs/buttons ≥44px */
  .input, .select, textarea, button.btn, a.btn {
    min-height: 44px;
    font-size: 16px; /* Prevent iOS zoom on focus */
  }
  /* Reduce body padding */
  .container { padding: 0 12px; }
  /* Page headings smaller */
  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.2rem; }
  h3 { font-size: 1.05rem; }
}

/* ─────────────────────────────────────────────
   HEADER — Hamburger menu for mobile
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .site-header { position: sticky; top: 0; z-index: 200; }
  .header-inner { height: 56px; padding: 0 12px; }
  .brand { font-size: 1.05rem; gap: 8px; }
  .brand-mark { width: 30px; height: 30px; }
  .brand-mark svg { width: 16px; height: 16px; }
  /* Hide nav links on mobile */
  .nav-links { display: none; }
  .nav-links.mobile-open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 12px;
    gap: 4px;
    z-index: 199;
  }
  .nav-links.mobile-open a,
  .nav-links.mobile-open button {
    width: 100%;
    padding: 12px 16px;
    min-height: 48px;
    font-size: 1rem;
    text-align: left;
    border-radius: var(--radius-xs);
  }
  .nav-links.mobile-open .nav-cta {
    text-align: center;
    margin-top: 8px;
  }
  /* Hamburger button */
  .hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ink);
    border-radius: var(--radius-xs);
    flex-shrink: 0;
  }
  .hamburger-btn:active { background: var(--surface-2); }
  .hamburger-btn svg { width: 24px; height: 24px; }
  /* Nav items touch-friendly */
  .nav-links a, .nav-links button {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 10px 14px;
  }
  .nav-cart { margin-right: 0; }
  .nav-cart svg { width: 24px; height: 24px; }
  .theme-toggle { width: 44px; height: 44px; }
  /* Hide secondary links */
  .hide-mobile { display: none !important; }
}
@media (min-width: 768px) {
  .hamburger-btn { display: none; }
}

/* ─────────────────────────────────────────────
   ADMIN SIDEBAR — Off-canvas mobile + overlay
   ───────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .admin-sidebar {
    position: fixed;
    left: -280px;
    top: 64px;
    width: 260px;
    height: calc(100vh - 64px);
    z-index: 200;
    box-shadow: var(--shadow-lg);
    transition: left 0.3s cubic-bezier(0.4,0,0.2,1);
    border-right: 1px solid var(--border);
  }
  .admin-sidebar.open { left: 0; }
  /* Overlay backdrop */
  .admin-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: 64px;
    background: rgba(0,0,0,0.4);
    z-index: 199;
    backdrop-filter: blur(2px);
  }
  .admin-sidebar-overlay.show { display: block; }
  .admin-main { margin-left: 0; padding: 20px 14px; }
  /* Hamburger toggle button in admin header */
  .admin-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    cursor: pointer;
    color: var(--ink);
    flex-shrink: 0;
    margin-right: 8px;
  }
  .admin-menu-btn svg { width: 22px; height: 22px; }
  .admin-menu-btn:active { background: var(--surface-2); }
  /* Hide desktop collapse/expand buttons on mobile */
  .sidebar-collapse-btn { display: none !important; }
  .sidebar-expand-btn { display: none !important; }
}
@media (min-width: 992px) {
  .admin-menu-btn { display: none; }
  .admin-sidebar-overlay { display: none !important; }
}

/* ─────────────────────────────────────────────
   ADMIN STATS CARDS — Stack on mobile
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .admin-stats {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .admin-stat-card {
    padding: 14px;
    gap: 10px;
  }
  .admin-stat-icon {
    width: 40px;
    height: 40px;
  }
  .admin-stat-info .num { font-size: 1.3rem; }
  .admin-stat-info .label { font-size: 0.78rem; }
}
@media (max-width: 479.98px) {
  .admin-stats {
    grid-template-columns: 1fr;
  }
}

/* ─────────────────────────────────────────────
   ADMIN DASHBOARD GRID — 2-column → 1-column on mobile
   ───────────────────────────────────────────── */
.admin-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 767.98px) {
  .admin-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* ─────────────────────────────────────────────
   ADMIN TABLES — Card-based mobile layout
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .admin-card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px 14px;
  }
  .admin-filters {
    flex-direction: column;
    gap: 8px;
  }
  .admin-search {
    min-width: 100%;
    width: 100%;
    padding: 10px 12px;
    font-size: 16px;
  }
  .admin-filter-select {
    width: 100%;
    padding: 10px 28px 10px 12px;
    font-size: 16px;
  }
  /* Table: hide headers, convert rows to cards */
  .admin-table-wrap { overflow-x: visible; }
  .admin-table thead { display: none; }
  .admin-table,
  .admin-table--fixed,
  .admin-table--users {
    table-layout: auto;
    min-width: 0;
  }
  .admin-table tbody tr {
    display: block;
    padding: 14px;
    margin-bottom: 12px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
  }
  .admin-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    text-align: right;
    min-height: 40px;
    gap: 12px;
  }
  .admin-table td:last-child { border-bottom: none; }
  /* Show column labels via data-label attribute */
  .admin-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    text-align: left;
    flex-shrink: 0;
    font-size: 0.82rem;
  }
  /* Action buttons full-width */
  .course-actions {
    flex-direction: column;
    gap: 6px;
    width: 100%;
  }
  .course-actions .btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }
  /* Status select full width */
  .admin-status-select {
    max-width: 100%;
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
  }
  /* Pagination touch-friendly */
  .admin-pagination {
    flex-direction: column;
    gap: 10px;
    padding: 14px;
  }
  .admin-pagination button {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 14px;
  }
  .admin-pagination .page-btns {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* ─────────────────────────────────────────────
   ADMIN MODALS — Full-screen on mobile
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .admin-modal-overlay { padding: 0; }
  .admin-modal {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
    min-height: 100vh;
  }
  .admin-modal-header,
  .admin-modal-body,
  .admin-modal-footer { padding: 16px; }
  /* Touch-friendly form inputs */
  .admin-modal-body input[type="text"],
  .admin-modal-body input[type="email"],
  .admin-modal-body input[type="password"],
  .admin-modal-body input[type="tel"],
  .admin-modal-body input[type="file"],
  .admin-modal-body select,
  .admin-modal-body textarea {
    min-height: 48px;
    font-size: 16px;
    padding: 10px 12px;
    width: 100%;
    box-sizing: border-box;
  }
  .admin-modal-body .form-group {
    margin-bottom: 14px;
  }
  .admin-modal-body label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
  }
  .admin-modal-footer {
    display: flex;
    gap: 10px;
    padding: 12px 16px env(safe-area-inset-bottom, 12px);
  }
  .admin-modal-footer .btn {
    flex: 1;
    min-height: 44px;
  }
  .admin-modal-footer .btn-cancel {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
  }
  .admin-modal-footer .btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
  }
}

/* ─────────────────────────────────────────────
   ADMIN PAGE HEADER — Flex wrap on mobile
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .admin-page-header { margin-bottom: 16px; }
  .admin-page-header h1 { font-size: 1.3rem; }
  .admin-page-header p { font-size: 0.85rem; }
  .admin-page-header .flex-between,
  .admin-page-header .flex {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
}

/* ─────────────────────────────────────────────
   STUDENT SHELL — Sidebar collapse on mobile
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .student-shell {
    grid-template-columns: 1fr;
  }
  .student-sidebar {
    position: static;
    top: auto;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    padding: 8px 12px;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .student-sidebar::-webkit-scrollbar { display: none; }
  .student-nav {
    flex-direction: row;
    gap: 6px;
    flex-wrap: nowrap;
  }
  .student-nav__item {
    padding: 10px 14px;
    white-space: nowrap;
    font-size: 0.88rem;
    min-height: 44px;
  }
  .student-nav__item .svg-ic { display: none; }
  .student-sidebar__foot { display: none; }
  .student-main { padding: 16px 12px 80px; }
}

/* ─────────────────────────────────────────────
   STUDENT DASHBOARD — KPI, continue card, grids
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .dash-welcome-row {
    flex-direction: column;
    gap: 12px;
  }
  .dash-welcome { font-size: 1.4rem; }
  .dash-welcome-actions { width: 100%; }
  .dash-welcome-actions .btn { width: 100%; min-height: 48px; }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .kpi-card {
    padding: 12px;
    gap: 10px;
  }
  .kpi-card__icon {
    width: 38px;
    height: 38px;
  }
  .kpi-card__value { font-size: 1.1rem; }
  .kpi-card__label { font-size: 0.72rem; }
  .dash-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .continue-card {
    grid-template-columns: 1fr;
  }
  .continue-card__media {
    min-height: 140px;
    max-height: 180px;
  }
  .continue-card__body {
    padding: 1rem;
  }
  .continue-card__body h2 { font-size: 1.1rem; }
  .continue-card__progress { max-width: 100%; }
  .learning-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .page-head h1 { font-size: 1.3rem; }
  /* Filter tabs scroll horizontally */
  .filter-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .filter-tabs::-webkit-scrollbar { display: none; }
  .filter-tab {
    flex-shrink: 0;
    min-height: 44px;
    padding: 10px 16px;
  }
  /* Panels */
  .panel { padding: 1rem; }
  .panel-head h3 { font-size: 1rem; }
  /* Learning items */
  .learning-item { padding: 10px; }
  .learning-item__thumb { width: 56px; height: 40px; }
  /* Certificate rows */
  .cert-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 1rem;
  }
  .cert-row__icon { width: 44px; height: 44px; }
  /* Grade items */
  .grade-item {
    padding: 10px 0;
    gap: 10px;
  }
  .grade-item__score { font-size: 1rem; }
}
@media (max-width: 479.98px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-card { flex-direction: column; text-align: center; gap: 8px; }
}

/* ─────────────────────────────────────────────
   COURSE BUILDER — Mobile responsive
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .builder-header {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 14px;
    gap: 10px;
  }
  .builder-header-left { min-width: 0; }
  .builder-course-title {
    min-width: 0;
    width: 100%;
    font-size: 1rem;
  }
  .builder-header-right {
    width: 100%;
  }
  .builder-header-right .btn {
    flex: 1;
    min-height: 44px;
  }
  .builder-steps {
    padding: 10px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    justify-content: flex-start;
  }
  .builder-steps::-webkit-scrollbar { display: none; }
  .builder-step {
    padding: 8px 14px;
    font-size: 0.82rem;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .builder-step-num {
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
  }
  .builder-step::after { display: none; }
  .builder-content {
    padding: 14px 12px;
  }
  .builder-footer {
    padding: 12px 14px;
    flex-direction: column;
    gap: 8px;
  }
  .builder-footer .btn {
    width: 100%;
    min-height: 48px;
  }
  .builder-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .builder-sidebar {
    grid-template-columns: 1fr;
  }
  .builder-media-grid {
    grid-template-columns: 1fr;
  }
  /* Form groups */
  .form-row {
    flex-direction: column;
    gap: 12px;
  }
  .builder-card label { font-size: 0.88rem; }
  .builder-card .input,
  .builder-card .select,
  .builder-card textarea {
    padding: 12px;
    font-size: 16px;
  }
  .upload-thumb, .upload-video {
    min-height: 100px;
    padding: 16px;
  }
  .toggle-row {
    min-height: 48px;
    padding: 8px 0;
  }
  .wyyl-item .btn {
    width: 44px;
    height: 44px;
  }
  .input-group { flex-direction: column; }
  .input-prefix {
    border-right: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-xs) var(--radius-xs) 0 0;
    width: 100%;
    text-align: center;
  }
  .input-group .input {
    border-radius: 0 0 var(--radius-xs) var(--radius-xs);
    width: 100%;
  }
}

/* ─────────────────────────────────────────────
   COURSE DETAILS — Mobile responsive
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .course-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .related-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .course-content {
    padding: 1rem;
  }
  .course-content-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
  .course-hero .course-meta {
    gap: 6px;
    flex-wrap: wrap;
  }
  /* Mobile CTA bar */
  .mobile-cta {
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 10px 16px;
    box-shadow: 0 -6px 20px rgba(0,0,0,0.08);
  }
  .mobile-cta__price {
    font-family: var(--font-mono);
    font-size: 1.05rem;
    color: var(--ink);
    white-space: nowrap;
  }
  .mobile-cta__price strong { color: var(--primary-deep); }
  .mobile-cta__price .price-old { font-size: 0.8rem; }
  .mobile-cta .btn {
    margin: 0;
    flex: 1;
    min-height: 48px;
  }
  .mobile-cta-spacer { display: block; height: 78px; }
  /* Course page grid */
  .course-page {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .course-sidebar {
    position: static;
    order: 2;
  }
  .course-main { order: 1; }
}
@media (max-width: 479.98px) {
  .course-stats { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────────
   VIDEO PLAYER — Mobile optimizations
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .player-body {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 56px);
  }
  .curriculum {
    position: fixed;
    left: 0;
    top: 60px;
    bottom: 0;
    width: 300px;
    max-width: 85vw;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    z-index: 200;
    box-shadow: var(--shadow-lg);
  }
  .player-body.curriculum-open .curriculum { transform: translateX(0); }
  .player-body.curriculum-open::after {
    content: '';
    position: fixed;
    inset: 0;
    top: 60px;
    background: rgba(0,0,0,0.4);
    z-index: 199;
  }
  .player-header { height: 56px; padding: 0 12px; }
  .player-header__menu { display: inline-flex; }
  .player-header__course strong { font-size: 0.85rem; }
  .player-header__course span { font-size: 0.72rem; }
  .player-under { padding: 14px 12px 24px; }
  .lesson-nav .btn {
    max-width: 100%;
    width: 100%;
    min-height: 48px;
  }
  .lesson-text {
    padding: 1rem;
    font-size: 0.95rem;
  }
}

/* ─────────────────────────────────────────────
   AUTH PAGES — Mobile responsive
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .auth-card {
    margin: 1.5rem 12px;
    padding: 24px 20px;
  }
  .auth-card h2 { font-size: 1.3rem; }
  .auth-card .input {
    padding: 12px;
    font-size: 16px;
    min-height: 48px;
  }
  .auth-card .btn {
    min-height: 48px;
    font-size: 1rem;
    width: 100%;
  }
}

/* ─────────────────────────────────────────────
   FOOTER — Mobile responsive
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .site-footer { border-radius: 24px 24px 0 0; }
  .footer-main {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    padding: 36px 0 24px;
  }
  .footer-brand {
    grid-column: 1 / -1;
  }
  .footer-brand p { max-width: 100%; font-size: 0.85rem; }
  .footer-col h4 { font-size: 0.8rem; }
  .footer-col a { font-size: 0.85rem; }
  .footer-bottom {
    flex-direction: column;
    gap: 12px;
    text-align: center;
    padding: 16px 0;
  }
  .footer-social { justify-content: center; }
}
@media (max-width: 479.98px) {
  .footer-main {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

/* ─────────────────────────────────────────────
   GENERAL FORMS — Mobile stacking
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .form-row {
    flex-direction: column;
    gap: 12px;
  }
  .form-group label {
    font-size: 0.9rem;
    margin-bottom: 6px;
  }
  /* All inputs touch-friendly */
  .input, .select, textarea {
    padding: 12px;
    font-size: 16px;
    min-height: 48px;
  }
  /* All buttons touch-friendly */
  button.btn, a.btn {
    min-height: 48px;
    padding: 12px 20px;
    font-size: 0.95rem;
  }
  /* Full-width buttons */
  .btn-block { width: 100%; }
  /* Modals full-screen */
  .admin-modal-overlay { padding: 0; }
  .admin-modal {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
}

/* ─────────────────────────────────────────────
   CART — Mobile responsive
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .cart-item {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .cart-item__thumb { width: 100%; height: 120px; }
  .cart-item__actions { width: 100%; justify-content: flex-end; }
  .cart-total {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }
  #checkout-form > div {
    grid-template-columns: 1fr !important;
  }
}

/* ─────────────────────────────────────────────
   INSTRUCTOR PANEL — Mobile responsive
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .instructor-card {
    flex-direction: column;
    text-align: center;
    gap: 12px;
    padding: 1rem;
  }
  .instructor-avatar {
    width: 48px;
    height: 48px;
    font-size: 1rem;
  }
}

/* ─────────────────────────────────────────────
   NOTIFICATION DROPDOWN — Mobile responsive
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .notif-drop {
    position: fixed;
    top: 56px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: 60vh;
  }
}

/* ─────────────────────────────────────────────
   ACCESSIBILITY — Focus visible for keyboard nav
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  a:focus-visible,
  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
  }
  /* Prevent text overflow */
  .admin-table td,
  .admin-table th,
  .course-card-l__body h3,
  .learning-item__body {
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ─────────────────────────────────────────────
   SM BREAKPOINT (≥576px) — Large phones landscape
   ───────────────────────────────────────────── */
@media (min-width: 576px) and (max-width: 767.98px) {
  .admin-stats { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .learning-grid { grid-template-columns: repeat(2, 1fr); }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─────────────────────────────────────────────
   MD BREAKPOINT (≥768px) — Tablet portrait
   ───────────────────────────────────────────── */
@media (min-width: 768px) and (max-width: 991.98px) {
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .admin-main { padding: 24px 20px; }
  .student-main { padding: 1.5rem 1.25rem; }
  .builder-content { padding: 20px; }
}

/* ─────────────────────────────────────────────
   MOBILE ADMIN DASHBOARD — Compact cards, expand/collapse, header alignment
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  /* Hide Recent Certificates on mobile */
  .admin-card-certificates { display: none; }
  /* Expandable cards: hide table by default, show on .expanded */
  .admin-table-expandable {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
  }
  .admin-card.expanded .admin-table-expandable {
    max-height: 600px;
  }
  /* View All button text change when expanded */
  .admin-card.expanded .admin-card-header .btn[data-action="expand-card"] {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
  }
  /* Header alignment: hamburger + title side by side */
  .admin-main {
    display: flex;
    flex-direction: column;
  }
  .admin-page-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px 0;
  }
  .admin-page-header h1 { margin: 0; }
}

/* ─────────────────────────────────────────────
   BOTTOM NAVIGATION BAR — Mobile admin only
   ───────────────────────────────────────────── */
.admin-bottom-nav {
  display: none;
}
@media (max-width: 767.98px) {
  body.admin-page .admin-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--surface);
    border-top: 1px solid var(--border-light);
    padding: 6px 0 env(safe-area-inset-bottom, 6px);
    justify-content: flex-start;
    align-items: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  body.admin-page .admin-bottom-nav::-webkit-scrollbar {
    display: none;
  }
  .admin-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 6px;
    border: none;
    background: none;
    color: var(--muted);
    font-size: 0.6rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    min-width: 52px;
    flex-shrink: 0;
    white-space: nowrap;
    transition: color var(--transition);
  }
  .admin-bottom-nav-item svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
  }
  .admin-bottom-nav-item.active {
    color: var(--primary-deep);
  }
  .admin-bottom-nav-item.active svg {
    stroke: var(--primary-deep);
  }
  .admin-main.has-bottom-nav {
    padding-bottom: 80px;
  }

  /* Sidebar brand — flex layout for logout button alignment */
  .sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 8px;
  }
  .sidebar-brand h3 { margin: 0; }
  .admin-logout-btn {
    padding: 6px 14px;
    border: 1px solid var(--danger, #ef4444);
    background: transparent;
    color: var(--danger, #ef4444);
    border-radius: var(--radius-xs);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    min-height: 32px;
  }
  .admin-logout-btn:hover {
    background: var(--danger, #ef4444);
    color: #fff;
  }
}

/* Desktop defaults: show table, hide mobile cards */
.admin-users-table-desktop { display: block; }
.admin-users-cards-mobile { display: none; }

/* ─────────────────────────────────────────────
   USER MODULE — Mobile Card Layout
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  /* Hide desktop table, show mobile cards */
  .admin-users-table-desktop { display: none; }
  .admin-users-cards-mobile { display: block; }
  /* Action bar stacking */
  .admin-users-cards-mobile .admin-filters {
    flex-direction: column;
    gap: 8px;
  }
  .admin-users-cards-mobile .admin-search {
    width: 100%;
    min-width: 0;
  }
  .admin-users-cards-mobile .admin-filter-select {
    width: 100%;
  }
  .admin-users-cards-mobile .btn-create-user-mobile {
    width: 100%;
    background: var(--primary);
    color: #fff;
    border: none;
    min-height: 44px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
  }
  /* User card */
  .user-card-mobile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
  }
  .user-avatar-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
  }
  .user-avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .user-avatar-circle.large {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
  }
  .user-card-mobile-center {
    flex: 1;
    min-width: 0;
  }
  .user-card-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 2px;
  }
  .user-card-email {
    font-size: 0.8rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .user-card-badges {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    flex-wrap: wrap;
  }
  .user-card-meta {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 2px;
  }
  .user-card-mobile-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
  }
  .user-card-mobile-actions button,
  .user-card-mobile-actions a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xs);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
  }
  .user-card-mobile-actions button:hover,
  .user-card-mobile-actions a:hover {
    background: var(--surface-2);
    color: var(--text);
  }
  .user-card-mobile-actions .btn-delete {
    color: var(--danger, #ef4444);
    border-color: var(--danger, #ef4444);
  }
  .user-card-mobile-actions svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
  }
}

/* ─────────────────────────────────────────────
   USER PROFILE — Desktop Layout
   ───────────────────────────────────────────── */
.user-profile-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.user-profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.user-profile-header h2 {
  margin: 0;
  font-size: 1.2rem;
}
.user-profile-header p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.user-profile-fields {
  border-top: 1px solid var(--border-light);
}
.user-profile-fields .field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}
.user-profile-fields .field-row:last-child {
  border-bottom: none;
}
.user-profile-fields .field-label {
  color: var(--muted);
  font-weight: 500;
}

/* ─────────────────────────────────────────────
   USER PROFILE — Mobile Card Layout
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .user-profile-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
  }
  .user-profile-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
  }
  .user-profile-header h2 {
    margin: 0;
    font-size: 1.1rem;
  }
  .user-profile-header p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
  }
  .user-profile-fields {
    border-top: 1px solid var(--border-light);
  }
  .user-profile-fields .field-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
  }
  .user-profile-fields .field-row:last-child {
    border-bottom: none;
  }
  .user-profile-fields .field-label {
    color: var(--muted);
    font-weight: 500;
  }
  .enrollment-card-mobile {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
  }
  .enrollment-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
  }
  .enrollment-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 10px;
  }
  .enrollment-card-mobile .btn-block {
    width: 100%;
    min-height: 40px;
  }
}

/* ─────────────────────────────────────────────
   USER PROGRESS — Desktop Layout
   ───────────────────────────────────────────── */
.stats-grid-mobile {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card-small {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.stat-card-small .stat-num {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.stat-card-small .stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.student-info-header {
  margin-bottom: 20px;
}
.student-info-header h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}
.student-info-header p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.curriculum-mobile {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  overflow: hidden;
}
.curriculum-module-header {
  padding: 10px 14px;
  font-weight: 600;
  font-size: 0.85rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-light);
}
.lesson-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-light);
}
.lesson-row:last-child {
  border-bottom: none;
}
.lesson-check {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.lesson-check.completed { color: var(--success); }
.lesson-check.pending { color: var(--muted); }
.lesson-name { flex: 1; }
.lesson-duration { font-size: 0.8rem; color: var(--muted); flex-shrink: 0; }
.lesson-progress-mobile {
  display: flex;
  flex-direction: column;
}
.lesson-progress-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-light);
  align-items: center;
}
.lesson-progress-row:last-child {
  border-bottom: none;
}

/* ─────────────────────────────────────────────
   USER PROGRESS — Mobile Layout
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .stats-grid-mobile {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }
  .stat-card-small {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
  }
  .stat-card-small .stat-num {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
  }
  .stat-card-small .stat-label {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 2px;
  }
  .progress-bar-full {
    width: 100%;
    height: 10px;
    background: var(--border-light);
    border-radius: 5px;
    overflow: hidden;
    margin: 8px 0;
  }
  .progress-bar-full .progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 5px;
    transition: width 0.3s ease;
  }
  .curriculum-mobile {
    margin-top: 16px;
  }
  .curriculum-module-header {
    font-weight: 600;
    font-size: 0.95rem;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
  }
  .lesson-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
  }
  .lesson-row:last-child {
    border-bottom: none;
  }
  .lesson-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
  }
  .lesson-check.completed {
    background: var(--primary);
    color: #fff;
  }
  .lesson-check.pending {
    background: var(--border-light);
    color: var(--muted);
  }
  .lesson-name {
    flex: 1;
    min-width: 0;
  }
  .lesson-duration {
    color: var(--muted);
    font-size: 0.8rem;
    flex-shrink: 0;
  }
  .lesson-progress-mobile {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-top: 12px;
  }
  .lesson-progress-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
  }
  .lesson-progress-row:last-child {
    border-bottom: none;
  }
  .student-info-header {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 12px;
  }
  .student-info-header h3 {
    margin: 0 0 4px 0;
    font-size: 1rem;
  }
  .student-info-header p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
  }
}

/* ─────────────────────────────────────────────
   REDUCED MOTION — Accessibility
   ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─────────────────────────────────────────────
   LEGAL PAGE — Privacy Policy + Terms of Service
   (single page, anchor navigation)
   ───────────────────────────────────────────── */
.legal-page { padding-bottom: 32px; }
.legal-hero {
  background: var(--footer-bg);
  color: #fff;
  padding: 44px 0 40px;
  margin-bottom: 8px;
}
.legal-hero h1 {
  font-family: var(--font-body);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #ffffff;
  margin: 0 0 26px;
}
.legal-nav { display: flex; flex-direction: column; gap: 18px; }
.legal-nav a {
  color: var(--footer-text);
  font-size: 1.12rem;
  font-weight: 500;
  text-decoration: none;
  width: fit-content;
  transition: color 0.15s ease;
}
.legal-nav a:hover { color: #ffffff; text-decoration: underline; }
.legal-nav a:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; border-radius: 2px; }
.legal-body { max-width: 860px; margin: 0 auto; padding-top: 36px; }
.legal-section { scroll-margin-top: 88px; }
.legal-section h2 {
  font-family: var(--font-body);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 10px;
  line-height: 1.35;
}
.legal-section h3 {
  font-family: var(--font-body);
  font-size: 1.04rem;
  font-weight: 700;
  color: var(--ink);
  margin: 30px 0 10px;
}
.legal-section h4 {
  font-family: var(--font-body);
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--ink);
  margin: 20px 0 8px;
}
.legal-section p {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text);
  margin: 0 0 14px;
}
.legal-section strong { color: var(--ink); }
.legal-section a { color: var(--primary); }
.legal-section a:hover { text-decoration: underline; }
.legal-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 48px 0;
}
.legal-back-top { margin-top: 22px !important; }
.legal-back-top a {
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.legal-back-top a:hover { text-decoration: underline; }
@media (max-width: 767.98px) {
  .legal-hero { padding: 32px 0 30px; }
  .legal-hero h1 { font-size: 1.2rem; margin-bottom: 20px; }
  .legal-nav { gap: 16px; }
  .legal-nav a { font-size: 1.05rem; min-height: 24px; }
  .legal-body { padding-top: 26px; }
  .legal-section h2 { font-size: 1.15rem; }
  .legal-section h3 { font-size: 1rem; }
  .legal-section p { font-size: 0.93rem; }
  .legal-divider { margin: 36px 0; }
}

/* === OTP SIGN-IN (Continue with Gmail) — DISABLED, pending Google plan.
   Everything below is commented out; remove the trailing */ to re-enable. .otp-open-btn { margin-top: 0.15rem; }
.otp-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.otp-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 22, 0.6);
}
.otp-modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.6rem 1.4rem 1.4rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.otp-modal-x {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
.otp-modal-x:hover { color: var(--text); }
.otp-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  text-align: left;
}
.otp-sub {
  font-size: 0.85rem;
  margin-bottom: 1rem;
  text-align: left;
}
.otp-accounts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.otp-account {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--text);
  text-align: left;
  transition: border-color var(--transition), background var(--transition);
}
.otp-account:hover { border-color: var(--primary); }
.otp-account[hidden] { display: none; }
.otp-account-other { background: transparent; }
.otp-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.otp-account-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.otp-code-input {
  width: 100%;
  text-align: center;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.45em;
  padding-left: 0.45em;
  margin-bottom: 0.8rem;
}
.otp-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 0.9rem;
}
.otp-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
}
.otp-link:disabled { color: var(--muted); cursor: default; }
.otp-open-btn { text-align: center; }
*/ // end DISABLED OTP styles
