/* Mostafa Soliman portal design system
   Navy academic UI. Logical properties follow the page direction. */

:root {
  --navy: #142b59;
  --navy-800: #1b3a73;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-light: #eff6ff;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #172033;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --shadow: 0 1px 2px rgba(20, 43, 89, 0.05), 0 8px 24px rgba(20, 43, 89, 0.04);
  --radius: 16px;
  --sidebar: 272px;
  --topbar: 68px;
  --font: "Inter", "Segoe UI", sans-serif;
  --font-ar: "Cairo", "Inter", "Segoe UI", sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

html[lang^="ar"] body { font-family: var(--font-ar); }

img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.skip-link {
  position: absolute;
  inset-inline-start: 12px;
  top: -40px;
  background: var(--navy);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 80;
}
.skip-link:focus { top: 12px; }

/* Shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  flex: none;
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 16px;
  overflow: auto;
  z-index: 40;
}
.sidebar-backdrop { display: none; }
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 18px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  object-fit: contain;
  flex: none;
  background: transparent;
}
.brand-word {
  display: block;
  color: #2563eb;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  white-space: nowrap;
}
.sidebar .brand {
  background: #fff;
  border-radius: 14px;
  padding: 8px 12px;
  margin-bottom: 8px;
}
.nav-label {
  margin: 14px 10px 6px;
  color: rgba(255,255,255,0.46);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.nav-link, .nav-button {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(255,255,255,0.78);
  text-align: start;
}
.nav-link:hover, .nav-button:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-link.is-active { background: rgba(255,255,255,0.14); color: #fff; font-weight: 700; }
.sidebar-foot { margin-top: auto; padding-top: 8px; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--navy);
  flex: none;
}
.icon-btn:hover { background: var(--blue-light); }
.search {
  flex: 1;
  max-width: 460px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.search input {
  border: 0;
  outline: none;
  width: 100%;
  background: transparent;
  min-width: 0;
}
.top-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.lang-switch {
  display: flex;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.lang-switch button {
  border: 0;
  background: transparent;
  min-width: 40px;
  height: 34px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 700;
}
.lang-switch button.is-active { background: var(--navy); color: #fff; }
.profile { position: relative; }
.profile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 10px 0 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.avatar, .avatar-lg {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue-light);
  color: var(--navy);
  display: grid;
  place-items: center;
  font-weight: 800;
  overflow: hidden;
  flex: none;
}
.avatar img, .avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.15rem; }
.profile-name { font-weight: 700; font-size: 0.92rem; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 8px);
  width: 230px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 6px;
}
.menu[hidden] { display: none; }
.menu a, .menu button {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: start;
}
.menu a:hover, .menu button:hover { background: var(--blue-light); }

.page { width: min(1120px, calc(100% - 40px)); margin: 24px auto 48px; }
.welcome { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 0.88rem; }
.welcome h1 { margin: 0; font-size: 1.7rem; line-height: 1.25; letter-spacing: -0.02em; color: var(--navy); }
.lead { margin: 6px 0 0; color: var(--muted); max-width: 46ch; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 84px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat:hover { border-color: #bfdbfe; }
.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--blue-light);
  color: var(--blue);
}
.stat-icon.success { background: var(--success-bg); color: #047857; }
.stat-icon.warning { background: var(--warning-bg); color: #b45309; }
.stat strong { display: block; font-size: 1.3rem; line-height: 1.1; color: var(--text); }
.stat strong small { font-size: 0.75rem; font-weight: 600; color: var(--muted); margin-inline-start: 4px; }
.stat span { color: var(--muted); font-size: 0.84rem; }

.split { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 12px; margin-bottom: 12px; }
.stack { display: grid; gap: 12px; }
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.panel h2, .section-title { margin: 0; font-size: 1.05rem; color: var(--navy); }
.section-title { margin: 18px 0 10px; }

.empty { text-align: center; padding: 22px 12px 8px; }
.empty .icon-blob {
  width: 52px;
  height: 52px;
  margin: 0 auto 10px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--blue-light);
  color: var(--blue);
}
.empty h3 { margin: 0 0 4px; font-size: 1rem; }
.empty p { margin: 0 auto 14px; max-width: 42ch; color: var(--muted); }

.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.action {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-weight: 700;
  color: var(--navy);
}
.action:hover { background: var(--blue-light); border-color: #bfdbfe; }
.action .stat-icon { width: 36px; height: 36px; }

.achieve {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
}
.achieve p { margin: 4px 0 0; color: var(--muted); }

.bottom-nav {
  display: none;
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 25;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav a, .bottom-nav button {
  flex: 1;
  min-height: 48px;
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}
.bottom-nav a.is-active { color: var(--blue); }

/* Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { background: var(--surface); color: var(--navy); border-color: var(--border); }
.btn-secondary:hover { background: var(--blue-light); }
.btn-ghost { background: transparent; color: var(--navy); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field span, .field label { font-weight: 700; font-size: 0.88rem; }
.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 44px;
}
.textarea { min-height: 120px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--blue); outline: 2px solid #bfdbfe; }
.field-error { color: var(--danger); font-size: 0.82rem; font-weight: 600; }
.input.is-invalid { border-color: var(--danger); }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--blue-light);
  color: var(--blue-dark);
  font-size: 0.75rem;
  font-weight: 800;
}
.badge.success { background: var(--success-bg); color: #047857; }
.badge.warning { background: var(--warning-bg); color: #b45309; }
.badge.danger { background: var(--danger-bg); color: #b91c1c; }

.progress { height: 8px; background: #e8eef9; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--blue); border-radius: inherit; }

.tabs { display: flex; gap: 6px; padding: 4px; background: #eef2f7; border-radius: 14px; width: fit-content; max-width: 100%; overflow: auto; }
.tabs button, .tabs a { min-height: 36px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 700; white-space: nowrap; }
.tabs .is-active { background: var(--surface); color: var(--navy); box-shadow: var(--shadow); }

.table-wrap { width: 100%; overflow: auto; border: 1px solid var(--border); border-radius: 14px; }
table.data { width: 100%; border-collapse: collapse; background: var(--surface); }
table.data th, table.data td { padding: 12px 14px; text-align: start; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data th { font-size: 0.78rem; color: var(--muted); background: #f8fafc; }

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); font-size: 0.85rem; margin-bottom: 10px; }
.crumbs a { color: var(--blue); }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.pagination .is-active { background: var(--navy); color: #fff; border-color: var(--navy); }

.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(23, 32, 51, 0.48); }
.modal-card { position: relative; width: min(440px, 100%); background: var(--surface); border-radius: 18px; padding: 22px; box-shadow: 0 24px 60px rgba(20, 43, 89, 0.2); }
.modal-card h2 { margin: 0 0 8px; color: var(--navy); font-size: 1.15rem; }
.modal-card p { margin: 0; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.toast-stack { position: fixed; inset-inline-end: 16px; bottom: 16px; z-index: 80; display: grid; gap: 8px; }
.toast { min-width: 220px; max-width: 320px; background: var(--navy); color: #fff; border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }

.skeleton { background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 37%, #eef2f7 63%); background-size: 400% 100%; animation: shimmer 1.2s ease infinite; border-radius: 12px; }
.skeleton-line { height: 14px; margin-bottom: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.tooltip { position: relative; }
.tooltip::after {
  content: attr(data-tip);
  position: absolute;
  inset-inline-start: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}
[dir="rtl"] .tooltip::after { transform: translateX(50%); }
.tooltip:hover::after, .tooltip:focus-visible::after { opacity: 1; }

.icon { width: 20px; height: 20px; flex: none; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.sidebar.is-collapsed { width: 84px; }
.learn-top { display: flex; align-items: center; gap: 12px; background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px; position: sticky; top: 0; z-index: 20; }
.learn-top .brand { padding: 0; }
.learn-back { width: 36px; height: 36px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; color: var(--navy); }
.learn-back svg { width: 18px; height: 18px; }
[dir="rtl"] .learn-back svg { transform: scaleX(-1); }
.learn-progress { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.learn-progress .progress { width: 128px; }
.learn-body { display: flex; min-height: calc(100vh - 58px); background: var(--bg); }
.curriculum { width: 288px; flex: none; background: var(--surface); border-inline-end: 1px solid var(--border); overflow: auto; }
.curriculum h2 { margin: 0; padding: 16px; font-size: 0.72rem; letter-spacing: 0.06em; color: var(--muted); }
.section-label, .quiz-label { margin: 0; padding: 12px 16px; background: var(--bg); border-block: 1px solid var(--border); font-size: 0.72rem; font-weight: 800; color: var(--navy); }
.lesson-link { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--bg); color: var(--text); }
.lesson-link:hover { background: var(--blue-light); }
.lesson-link.is-current { background: var(--blue-light); box-shadow: inset -3px 0 0 var(--blue); }
[dir="ltr"] .lesson-link.is-current { box-shadow: inset 3px 0 0 var(--blue); }
.lesson-dot { width: 28px; height: 28px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-light); color: var(--blue); flex: none; font-size: 0.75rem; font-weight: 800; }
.lesson-link.is-current .lesson-dot { background: var(--blue); color: #fff; }
.lesson-link strong { display: block; font-size: 0.92rem; color: var(--navy); }
.lesson-link small { display: block; margin-top: 2px; }
.lesson-link small:empty { display: none; }
.lesson-link small.badge { display: inline-flex; margin-top: 4px; }
.learn-main { flex: 1; min-width: 0; overflow: auto; background: var(--bg); }
.learn-stage { width: min(1040px, calc(100% - 32px)); margin: 24px auto 40px; display: grid; gap: 16px; }
.player-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 12px; }
.player-wrap { position: relative; padding-top: 56.25%; background: var(--navy); border-radius: 14px; overflow: hidden; }
.player-wrap video { position: absolute; inset: 0; width: 100%; height: 100%; background: var(--navy); }
.video-watermark { position: absolute; z-index: 3; pointer-events: none; user-select: none; color: rgba(255,255,255,.72); font-size: .72rem; font-weight: 700; text-shadow: 0 1px 2px rgba(20,43,89,.45); white-space: nowrap; transition: top 1.4s ease, left 1.4s ease; }
.speed-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 4px 2px; color: var(--muted); font-size: .78rem; font-weight: 700; }
.speed-bar strong { color: var(--navy); }
.speed-btn { border: 1px solid var(--border); border-radius: 10px; min-height: 32px; padding: 4px 10px; background: var(--surface); color: var(--navy); font-weight: 800; font-size: .75rem; cursor: pointer; }
.speed-btn:hover { background: var(--blue-light); }
.speed-btn.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }
.lecture-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 14px 16px; }
.lecture-bar h1 { margin: 0; font-size: 1.25rem; color: var(--navy); }
#bookmarkBtn.is-on { background: var(--blue-light); border-color: #bfdbfe; color: var(--blue-dark); }
#completeBtn.is-active { background: var(--navy); border-color: var(--navy); color: #fff; }
@media (min-width: 961px) {
  #lessonsBtn { display: none; }
}
@media (max-width: 960px) {
  .curriculum { display: none; }
  .curriculum.is-open { display: block; position: fixed; inset: 58px 0 0 0; z-index: 30; width: min(320px, 88vw); box-shadow: var(--shadow); }
}
.sidebar.is-collapsed .brand-word,
.sidebar.is-collapsed .brand-text,
.sidebar.is-collapsed .nav-label,
.sidebar.is-collapsed .nav-link span,
.sidebar.is-collapsed .nav-button span { display: none; }
.sidebar.is-collapsed .brand, .sidebar.is-collapsed .nav-link, .sidebar.is-collapsed .nav-button { justify-content: center; }

@media (max-width: 1100px) {
  .stats, .actions { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    transform: translate3d(-105%, 0, 0);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }
  [dir="rtl"] .sidebar { transform: translate3d(105%, 0, 0); }
  .sidebar.is-open { transform: none; }
  .sidebar-backdrop.is-visible { display: block; position: fixed; inset: 0; background: rgba(23, 32, 51, 0.45); z-index: 35; }
  .bottom-nav { display: flex; }
  .page { width: min(1120px, calc(100% - 28px)); margin-bottom: 96px; }
  .profile-name { display: none; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 12px; }
  .welcome h1 { font-size: 1.35rem; }
  .stats, .actions { grid-template-columns: 1fr 1fr; }
  .achieve { align-items: flex-start; flex-direction: column; }
  .search { max-width: none; }
}
@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr; }
  .topbar .search { display: none; }
}

/* Public site and shared page tools */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 72px;
  padding: 0 28px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .brand { padding: 0; color: var(--navy); }
.site-header .brand small { color: var(--muted); }
.header-end { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.site-nav { display: flex; align-items: center; gap: 8px; }
.site-nav a { min-height: 40px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 10px; color: var(--navy); font-weight: 700; }
.site-nav a:hover { background: var(--blue-light); }
.menu-toggle { display: none; }
.hero { width: min(1120px, calc(100% - 40px)); margin: 28px auto 12px; display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 28px; align-items: center; }
.hero h1 { margin: 8px 0; font-size: clamp(2rem, 4vw, 3.3rem); line-height: 1.25; color: var(--navy); letter-spacing: -0.03em; }
.kicker { display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 6px 10px; border-radius: 999px; background: var(--blue-light); color: var(--blue-dark); font-weight: 800; font-size: 0.82rem; }
.hero-art {
  min-height: 360px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 20% 20%, rgba(37,99,235,0.16), transparent 42%),
    linear-gradient(160deg, #eff6ff, #ffffff 55%, #e0eaff);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.hero-art svg.doodle { position: absolute; color: var(--navy); opacity: 0.55; }
.hero-card {
  position: absolute;
  inset-inline-start: 24px;
  bottom: 24px;
  background: #fff;
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.wrap { width: min(1120px, calc(100% - 40px)); margin: 0 auto 28px; }
.section-head { margin: 28px 0 14px; }
.section-head h2 { margin: 0; color: var(--navy); font-size: 1.6rem; }
.section-head p { margin: 6px 0 0; color: var(--muted); }
.stage-grid, .method-grid, .quote-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.method-grid { grid-template-columns: repeat(3, 1fr); }
.stage, .quote, .method {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.stage h3, .method h3, .quote h3 { margin: 8px 0 4px; color: var(--navy); }
.stage p, .method p, .quote p { margin: 0; color: var(--muted); }
.quote p { overflow-wrap: break-word; }
.quote footer { margin-top: 12px; font-weight: 800; color: var(--text); }
.faq details { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 800; color: var(--navy); }
.faq p { color: var(--muted); margin: 8px 0 0; }
.site-footer { background: var(--navy); color: rgba(255,255,255,0.78); padding: 36px 0 20px; margin-top: 20px; }
.footer-grid { width: min(1120px, calc(100% - 40px)); margin: 0 auto; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 18px; }
.site-footer a { color: #fff; }
.site-footer h2 { margin: 0 0 8px; font-size: 1rem; }
.site-footer ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.legal { width: min(1120px, calc(100% - 40px)); margin: 16px auto 0; border-top: 1px solid rgba(255,255,255,0.12); padding-top: 12px; font-size: 0.82rem; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(460px, 100%); background: #fff; border: 1px solid var(--border); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); }
.auth-card h1 { margin: 8px 0; color: var(--navy); font-size: 1.6rem; }
.auth-card .field { margin-bottom: 12px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .input, .toolbar .select { width: auto; min-width: 160px; flex: 1; }
.list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.list.is-list { grid-template-columns: 1fr; }
.stage.is-active { border-color: var(--blue); background: var(--blue-light); }
[hidden] { display: none !important; }
.notice { border: 1px solid #bfdbfe; background: var(--blue-light); color: var(--navy); border-radius: 12px; padding: 10px 12px; margin-top: 10px; }
.choice { display: flex; gap: 8px; }
.choice label { flex: 1; border: 1px solid var(--border); border-radius: 12px; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; }
.choice input { accent-color: var(--blue); }
@media (max-width: 700px) {
  .list { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .hero, .stage-grid, .method-grid, .quote-grid, .footer-grid { grid-template-columns: 1fr; }
  .menu-toggle { display: grid; }
  .site-nav { display: none; position: absolute; inset-inline: 12px; top: 68px; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 8px; flex-direction: column; align-items: stretch; box-shadow: var(--shadow); }
  .site-nav.is-open { display: flex; }
  .hero-art { min-height: 220px; }
}

.quiz-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.quiz-metrics .stat { margin: 0; }
.quiz-metrics .stat strong { font-size: 1.6rem; color: var(--navy); }
.quiz-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.quiz-nav button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--navy); font-weight: 800; }
.quiz-nav button.is-answered { background: var(--blue-light); border-color: #bfdbfe; }
.quiz-nav button.is-current { background: var(--blue); border-color: var(--blue); color: #fff; }
.quiz-choice { width: 100%; display: flex; align-items: center; gap: 10px; text-align: start; min-height: 52px; margin-top: 8px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 700; }
.quiz-choice:hover { background: var(--blue-light); border-color: #bfdbfe; }
.quiz-choice.is-selected { background: var(--blue-light); border-color: var(--blue); color: var(--navy); }
.quiz-choice.is-correct { background: var(--success-bg); border-color: var(--success); color: #047857; }
.quiz-choice.is-wrong { background: var(--danger-bg); border-color: var(--danger); color: #b91c1c; }
.quiz-letter { width: 28px; height: 28px; border-radius: 10px; display: grid; place-items: center; background: var(--bg); color: var(--navy); flex: none; font-size: 0.78rem; }
.quiz-choice.is-selected .quiz-letter, .quiz-nav button.is-current { color: #fff; }
.quiz-choice.is-selected .quiz-letter { background: var(--blue); }
.quiz-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; }
.quiz-review { display: grid; gap: 12px; }
.quiz-review .panel { border-color: var(--border); }
.quiz-review .panel.is-correct { border-color: var(--success); }
.quiz-review .panel.is-wrong { border-color: var(--danger); }
.quiz-points { margin: 8px 0 0; color: var(--muted); font-size: 0.78rem; font-weight: 700; }
.quiz-review .quiz-choice { cursor: default; }
.quiz-review .quiz-choice:hover { background: var(--surface); border-color: var(--border); }
.quiz-review .quiz-choice.is-correct, .quiz-review .quiz-choice.is-correct:hover { background: var(--success-bg); border-color: var(--success); }
.quiz-review .quiz-choice.is-wrong, .quiz-review .quiz-choice.is-wrong:hover { background: var(--danger-bg); border-color: var(--danger); }
@media (max-width: 640px) {
  .quiz-metrics { grid-template-columns: 1fr; }
}

/* --- Added when wiring to the Laravel backend --- */
.lang-switch { width: fit-content; }
.lang-switch a { display: grid; place-items: center; min-width: 40px; height: 34px; border-radius: 9px; color: var(--muted); font-weight: 700; text-decoration: none; }
.lang-switch a.is-active { background: var(--navy); color: #fff; }
.auth-card .btn { width: 100%; }
.auth-card .tabs { width: 100%; margin-bottom: 14px; }
.auth-card .tabs button { flex: 1; }
.auth-card form[hidden] { display: none; }
.divider { text-align: center; color: var(--muted); margin: 14px 0; }
[hidden] { display: none !important; }
.code-input { text-align: center; font-size: 1.8rem; letter-spacing: .35em; font-family: monospace; }

/* Long legal / policy documents rendered inside the public shell */
.legal-doc { padding-top: 28px; padding-bottom: 40px; }
.legal-doc h1 { color: var(--navy); font-size: 1.9rem; margin: 18px 0 8px; }
.legal-doc h2 { color: var(--navy); font-size: 1.25rem; margin: 26px 0 8px; }
.legal-doc h3 { color: var(--navy); font-size: 1.05rem; margin: 18px 0 6px; }
.legal-doc p, .legal-doc li { color: var(--text); line-height: 1.8; }
.legal-doc ul, .legal-doc ol { padding-inline-start: 22px; margin: 8px 0 14px; }
.legal-doc li { margin-bottom: 6px; }
.legal-doc hr { border: 0; border-top: 1px solid var(--border); margin: 36px 0; }
.legal-doc a { color: var(--blue); }
.legal-doc table { width: 100%; border-collapse: collapse; }
.legal-doc th, .legal-doc td { border: 1px solid var(--border); padding: 8px 10px; text-align: start; }
.legal-doc .site-nav-fix { display: none; }

/* Sign-in: social buttons and divider */
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; margin: 18px 0 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.divider span { white-space: nowrap; }
.social-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-social { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 0 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff; color: var(--navy); font-weight: 700; text-decoration: none; transition: box-shadow .15s, border-color .15s; }
.btn-social:hover { border-color: #cbd5e1; box-shadow: var(--shadow); }
.btn-social svg { flex: none; }
.auth-card .lang-switch { margin: 18px auto 0; }
@media (max-width: 420px) { .social-row { grid-template-columns: 1fr; } }

/* Vertical rhythm and form grid (alignment pass) */
.page > * + * { margin-top: 16px; }
.page > h1 { margin: 0 0 4px; font-size: 1.7rem; color: var(--navy); line-height: 1.25; }
.page > h1 + .lead { margin-top: 0; }
.page > .section-title { margin-top: 26px; margin-bottom: 0; }
.stats { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; margin-bottom: 4px; }
.panel .field, .auth-card .field { margin-bottom: 14px; }
.form-grid .field { margin: 0 0 14px; }
.panel > h2:first-child { margin-top: 0; }
.panel h2 + .field, .panel h2 + .form-grid, .panel h2 + p { margin-top: 10px; }
.panel .btn { margin-top: 4px; }
.panel .quiz-actions .btn, .quiz-actions .btn { margin-top: 0; }
.quiz-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar > .btn { margin-top: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.field select.select, .field input.input, .field textarea.textarea { width: 100%; }
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .list { grid-template-columns: 1fr; }
}

/* Lesson page: classes toggled by the player script */
.hidden { display: none !important; }
.flex { display: flex; }
.opacity-60 { opacity: .6; }
.player-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
#lectureQuestionOverlay { position: absolute; inset: 0; z-index: 20; align-items: center; justify-content: center; background: rgba(15, 23, 42, .82); padding: 16px; }
#lectureQuestionOverlay .lq-card { background: #fff; border-radius: 16px; width: 100%; max-width: 460px; padding: 20px; max-height: 100%; overflow: auto; }
#lectureQuestionOverlay #lqQuestionText { font-weight: 800; color: var(--navy); margin: 0 0 12px; }
#lectureQuestionOverlay #lqQuestionImage { max-height: 160px; max-width: 100%; border-radius: 12px; margin-bottom: 12px; object-fit: contain; }
.notice.is-error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.speed-btn.is-active, #bookmarkBtn.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }
.badge.success { background: var(--success-bg); color: #047857; }
.badge.danger { background: var(--danger-bg); color: #b91c1c; }
.learn-prevnext { gap: 12px; align-items: stretch; flex-wrap: nowrap; }
.learn-quizzes-mobile { display: none; }
body.embed .learn-top, body.embed .curriculum { display: none; }
@media (max-width: 960px) {
  .curriculum { display: none; position: fixed; inset: 58px 0 0 auto; z-index: 30; width: min(320px, 88vw); box-shadow: var(--shadow); }
  .curriculum.is-open { display: block; }
  .learn-quizzes-mobile { display: block; }
  .learn-top { flex-wrap: wrap; }
  .learn-progress { margin-inline-start: 0; width: 100%; }
  .learn-prevnext { flex-direction: column; }
}

/* Quiz taking */
.quiz-choice input[type=radio] { accent-color: var(--blue); margin-inline-end: 4px; }
.text-red-600 { color: #dc2626; }
.font-bold { font-weight: 800; }
.q-card .quiz-choice { cursor: pointer; }

.legal-doc a.btn, .site-footer a { text-decoration: none; }
.legal-doc a.btn-primary { color: #fff; }
.legal-doc a.btn-secondary { color: var(--navy); }
