/* ═══════════════════════════════════════════
   TOKENS
═══════════════════════════════════════════ */
:root {
  --blue:        #2d3fd4;
  --blue-dark:   #1a2db0;
  --blue-deep:   #132490;
  --blue-light:  #eef1fb;
  --orange:      #f47221;
  --orange-dark: #d9610d;
  --yellow:      #f5c400;

  --bg:          #f4f6fb;
  --surface:     #ffffff;
  --surface-2:   #eef1f8;
  --border:      #dde3f0;
  --border-h:    #b8c4df;

  --text:        #0d1b3e;
  --muted:       #5a6a8a;
  --light:       #8fa0bf;

  --success:     #059669;
  --physics:     #0891b2;

  --r-xs: 4px;
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 18px;
  --nav-h: 66px;
}

/* ═══════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex; flex-direction: column;
  overflow-x: hidden;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
main { flex: 1; }

/* ═══════════════════════════════════════════
   NAV
═══════════════════════════════════════════ */
.nav {
  position: sticky; top: 0; z-index: 200;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2.5rem;
  box-shadow: 0 1px 4px rgba(45,63,212,.06);
}
.nav__logo {
  font-size: 1.25rem; font-weight: 900; color: var(--blue);
  letter-spacing: -0.03em; flex-shrink: 0;
}
.nav__links {
  display: flex; gap: 0.2rem; list-style: none; align-items: center;
}
.nav__links a {
  color: var(--muted); font-size: 0.8rem; font-weight: 500;
  padding: 0.45rem 0.9rem; border-radius: var(--r-sm);
  transition: color .15s, background .15s; white-space: nowrap;
}
.nav__links a:hover  { color: var(--blue); background: var(--blue-light); text-decoration: none; }
.nav__links a.active { color: var(--blue); background: var(--blue-light); font-weight: 700; }
.nav__cta {
  background: var(--orange); color: #fff !important;
  font-weight: 700 !important; font-size: 0.8rem !important;
  padding: 0.5rem 1.25rem !important; border-radius: var(--r-sm) !important;
  box-shadow: 0 3px 10px rgba(244,114,33,.3);
  transition: background .15s, transform .15s !important;
}
.nav__cta:hover { background: var(--orange-dark) !important; transform: translateY(-1px); text-decoration: none !important; }

.nav__hamburger {
  display: none; flex-direction: column; gap: 5px;
  width: 36px; height: 36px; background: none;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  cursor: pointer; padding: 7px 8px;
}
.nav__hamburger span { display: block; height: 2px; background: var(--text); border-radius: 2px; }

/* ═══════════════════════════════════════════
   BREADCRUMB
═══════════════════════════════════════════ */
.breadcrumb {
  max-width: 1120px; margin: 0 auto;
  padding: 1rem 1.75rem 0;
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.75rem; color: var(--light);
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--blue); text-decoration: none; }
.breadcrumb strong { color: var(--text); font-weight: 700; }

/* ═══════════════════════════════════════════
   PAGE SHELL
═══════════════════════════════════════════ */
.page { max-width: 1120px; margin: 0 auto; padding: 1.25rem 1.75rem 5rem; }

/* ═══════════════════════════════════════════
   HERO
═══════════════════════════════════════════ */
.hero {
  background: linear-gradient(135deg, var(--blue-deep) 0%, var(--physics) 100%);
  border-radius: var(--r-lg);
  padding: 2rem 2.5rem;
  margin-bottom: 1.5rem;
  position: relative; overflow: hidden;
  animation: fadeUp .45s ease both;
}
/* decorative circles */
.hero::before, .hero::after {
  content: ''; position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.06); pointer-events: none;
}
.hero::before { width: 340px; height: 340px; top: -100px; right: -80px; }
.hero::after  { width: 160px; height: 160px; bottom: -60px; right: 220px; }

.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
  color: rgba(255,255,255,.9); font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.25rem 0.8rem; border-radius: 20px; margin-bottom: 0.65rem;
}
.hero__title {
  font-size: 2rem; font-weight: 900; color: #fff;
  letter-spacing: -0.04em; line-height: 1.1;
}
.hero__title span { color: var(--yellow); }
.hero__sub {
  color: rgba(255,255,255,.72); font-size: 0.85rem;
  margin-top: 0.45rem; line-height: 1.6; max-width: 540px;
}
.hero__row {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1.5rem; flex-wrap: wrap; margin-top: 1.5rem;
}
.hero__stats { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.hero__stat {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--r-sm); padding: 0.55rem 1.05rem;
  display: flex; flex-direction: column; gap: 0.1rem;
}
.hero__stat-val { font-size: 1.3rem; font-weight: 900; color: #fff; line-height: 1; }
.hero__stat-lbl { font-size: 0.62rem; color: rgba(255,255,255,.65); font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; }
.hero__actions { display: flex; gap: 0.65rem; align-items: center; flex-wrap: wrap; }

/* primary CTA */
.btn-orange {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--orange); color: #fff !important; font-weight: 800; font-size: 0.875rem;
  padding: 0.7rem 1.6rem; border-radius: var(--r-sm);
  box-shadow: 0 4px 16px rgba(244,114,33,.45);
  transition: background .15s, transform .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn-orange:hover { background: var(--orange-dark); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(244,114,33,.45); text-decoration: none !important; }

.btn-ghost-white {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: rgba(255,255,255,.85) !important; font-weight: 600; font-size: 0.82rem;
  padding: 0.65rem 1.3rem; border-radius: var(--r-sm);
  border: 1px solid rgba(255,255,255,.3);
  transition: background .15s, color .15s;
}
.btn-ghost-white:hover { background: rgba(255,255,255,.1); color: #fff !important; text-decoration: none !important; }

/* ═══════════════════════════════════════════
   SUBJECT SWITCHER TABS
═══════════════════════════════════════════ */
.subject-tabs {
  display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap;
  animation: fadeUp .45s .06s ease both;
}
.subject-tab {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 1.1rem; border-radius: var(--r-sm);
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: 0.8rem; font-weight: 700; color: var(--muted);
  cursor: pointer; transition: all .15s; text-decoration: none;
}
.subject-tab:hover { border-color: var(--blue); color: var(--blue); text-decoration: none; }
.subject-tab--active {
  background: var(--blue-light); border-color: var(--blue); color: var(--blue);
}
.subject-tab--physics.subject-tab--active  { background: #ecfeff; border-color: var(--physics); color: var(--physics); }
.subject-tab__count {
  background: rgba(0,0,0,.08); border-radius: 20px;
  padding: 0.1rem 0.5rem; font-size: 0.65rem; font-weight: 800;
}

/* ═══════════════════════════════════════════
   LAYOUT: sidebar + cards
═══════════════════════════════════════════ */
.layout {
  display: grid; grid-template-columns: 240px 1fr;
  gap: 1.5rem; align-items: start;
   width: 100%; min-width: 0;
}

/* ═══════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════ */
.sidebar {
  position: sticky; top: calc(var(--nav-h) + 1rem);
  display: flex; flex-direction: column; gap: 1rem;
  animation: fadeUp .45s .1s ease both;
}
.scard {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: 0 2px 8px rgba(45,63,212,.04);
  min-width: 0; max-width: 100%;
}
.scard__head {
  padding: 0.7rem 1rem;
  background: linear-gradient(90deg, var(--blue-deep), var(--blue));
  font-size: 0.68rem; font-weight: 800; color: rgba(255,255,255,.9);
  letter-spacing: 0.08em; text-transform: uppercase;
  display: flex; align-items: center; justify-content: space-between;
}
.scard__head span {
  background: rgba(255,255,255,.15); border-radius: 20px;
  padding: 0.12rem 0.55rem; font-size: 0.62rem;
}

/* unit jump list */
.unit-jump { padding: 0.5rem 0; max-height: 420px; overflow-y: auto; }
.unit-jump::-webkit-scrollbar { width: 4px; }
.unit-jump::-webkit-scrollbar-track { background: transparent; }
.unit-jump::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.unit-jump-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.45rem 1rem; font-size: 0.78rem; color: var(--muted);
  transition: background .12s, color .12s; cursor: pointer;
}
.unit-jump-item:hover { background: var(--surface-2); color: var(--text); }
.unit-jump-item__num {
  width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.62rem; font-weight: 800; color: var(--light);
  transition: all .12s;
}
.unit-jump-item:hover .unit-jump-item__num { background: var(--physics); border-color: var(--physics); color: #fff; }
.unit-jump-item__name { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit-jump-item__q {
  font-size: 0.65rem; font-weight: 800; color: var(--physics);
  background: #ecfeff; border: 1px solid #a5f3fc;
  border-radius: 20px; padding: 0.1rem 0.45rem; flex-shrink: 0;
}

/* progress summary */
.prog-item {
  padding: 0.85rem 1rem;
  display: flex; align-items: center; gap: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.prog-item:last-child { border-bottom: none; }
.prog-icon { font-size: 1.3rem; flex-shrink: 0; }
.prog-label { font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.prog-val { font-size: 1.05rem; font-weight: 900; color: var(--text); line-height: 1; }

/* ═══════════════════════════════════════════
   SEARCH / FILTER BAR
═══════════════════════════════════════════ */
.toolbar {
  display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem;
  animation: fadeUp .45s .12s ease both;
  flex-wrap: wrap;
}
.toolbar__search {
  flex: 1; min-width: 200px; position: relative;
}
.toolbar__search input {
  width: 100%; height: 40px; padding: 0 1rem 0 2.5rem;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); font-family: inherit; font-size: 0.82rem;
  color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.toolbar__search input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(45,63,212,.1); }
.toolbar__search input::placeholder { color: var(--light); }
.toolbar__search-icon {
  position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
  color: var(--light); font-size: 0.9rem; pointer-events: none;
}
.toolbar__count {
  font-size: 0.75rem; color: var(--muted); white-space: nowrap; font-weight: 600;
}
.toolbar__syllabus {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 1rem; border-radius: var(--r-sm);
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: 0.78rem; font-weight: 700; color: var(--muted);
  transition: all .15s; white-space: nowrap;
}
.toolbar__syllabus:hover { border-color: var(--blue); color: var(--blue); text-decoration: none; }

/* ═══════════════════════════════════════════
   UNIT CARDS
═══════════════════════════════════════════ */
.units { display: flex; flex-direction: column; gap: 0.85rem; animation: fadeUp .45s .14s ease both; }

.unit-card {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--physics);
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: 0 2px 8px rgba(45,63,212,.03);
  transition: box-shadow .15s, border-color .15s;
  scroll-margin-top: calc(var(--nav-h) + 1rem);
  width: 100%; min-width: 0;
}
.unit-card:hover { box-shadow: 0 4px 20px rgba(8,145,178,.1); }

/* Unit header row */
.unit-card__head {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 1rem 1.25rem;
  cursor: pointer; user-select: none;
  transition: background .12s;
}
.unit-card__head:hover { background: #f8faff; }

.unit-num {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--blue-deep), var(--physics));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 900; color: #fff; letter-spacing: -0.02em;
}
.unit-info { flex: 1; min-width: 0; }
.unit-title {
  font-size: 0.9rem; font-weight: 800; color: var(--text);
  letter-spacing: -0.01em; line-height: 1.3;
  white-space: normal; word-break: break-word;
}
.unit-meta {
  display: flex; align-items: center; gap: 0.5rem; margin-top: 0.2rem;
}
.unit-subtopic-count {
  font-size: 0.68rem; color: var(--light); font-weight: 600;
}

/* Question count CTA pill */
.unit-q-btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: var(--physics); color: #fff !important;
  font-size: 0.75rem; font-weight: 800;
  padding: 0.45rem 1rem; border-radius: 20px;
  transition: background .15s, transform .15s, box-shadow .15s;
  white-space: nowrap; flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(8,145,178,.3);
  text-decoration: none;
}
.unit-q-btn:hover { background: #0e7490; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(8,145,178,.4); text-decoration: none; }
.unit-q-btn__count { font-size: 1rem; line-height: 1; }

/* progress bar under unit head */
.unit-progress {
  height: 3px; background: var(--surface-2);
  border-radius: 0; overflow: hidden;
}
.unit-progress__bar {
  height: 100%; background: linear-gradient(90deg, var(--physics), #22d3ee);
  border-radius: 0;
  transition: width .8s ease;
}

/* chevron */
.unit-chevron {
  font-size: 0.75rem; color: var(--light); transition: transform .2s; flex-shrink: 0;
}
.unit-card.open .unit-chevron { transform: rotate(180deg); }

/* Subtopics list */
.unit-body {
  border-top: 1px solid var(--border);
  display: none; /* toggled by JS */
  padding: 0.5rem 0;
  background: #fcfdff;
}
.unit-card.open .unit-body { display: block; }

.subtopic {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.55rem 1.25rem 0.55rem 1.15rem;
  transition: background .12s;
  border-left: 2px solid transparent;
}
.subtopic:hover { background: var(--blue-light); border-left-color: var(--blue); }

.subtopic__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--border); flex-shrink: 0; transition: background .12s;
}
.subtopic:hover .subtopic__dot { background: var(--physics); }

.subtopic__text {
  font-size: 0.82rem; color: var(--muted); flex: 1;
  transition: color .12s;
}
.subtopic:hover .subtopic__text { color: var(--text); }

/* ═══════════════════════════════════════════
   ZERO-RESULT STATE
═══════════════════════════════════════════ */
.empty-state {
  display: none; text-align: center;
  padding: 3rem 1rem; color: var(--light);
}
.empty-state__icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state__msg { font-size: 0.9rem; font-weight: 600; color: var(--muted); }

/* ═══════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════ */
.footer {
  border-top: 1px solid var(--border); background: var(--surface);
  padding: 1.5rem 2.5rem;
}
.footer__inner {
  max-width: 1120px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; flex-wrap: wrap;
  font-size: 0.775rem; color: var(--muted);
}
.footer__inner strong { color: var(--blue); font-weight: 800; }

/* ═══════════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */
@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; flex-direction: row; flex-wrap: wrap; }
  .scard { flex: 1 1 260px; }
}

@media (max-width: 680px) {
  .nav { padding: 0 1rem; }
  .nav__links { display: none; }
  .nav__hamburger { display: flex; }
  .page { padding: 1rem 1rem 4rem; }
  .breadcrumb { padding: 0.75rem 1rem 0; }
  .footer { padding: 1.25rem 1rem; }

  /* ── Hero: stack fully ── */
  .hero { padding: 1.4rem 1.1rem; }
  .hero__title { font-size: 1.5rem; }
  .hero__sub { font-size: 0.82rem; max-width: 100%; }

  /* Hero row: stack stats above buttons */
  .hero__row {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-top: 1.1rem;
  }

  /* Stats: 3 per row using flex */
  .hero__stats { gap: 0.5rem; }
  .hero__stat {
    flex: 1 1 calc(33% - 0.5rem);
    min-width: 72px;
    padding: 0.45rem 0.55rem;
    text-align: center; align-items: center;
  }
  .hero__stat-val { font-size: 1.05rem; }
  .hero__stat-lbl { font-size: 0.55rem; }

  /* Action buttons: row, full width each */
  .hero__actions { width: 100%; gap: 0.5rem; }
  .btn-orange      { flex: 1; justify-content: center; font-size: 0.82rem; padding: 0.65rem 1rem; }
  .btn-ghost-white { flex: 1; justify-content: center; font-size: 0.78rem; padding: 0.6rem 0.85rem; }

  /* ── Subject tabs: smaller, hide count ── */
  .subject-tabs { gap: 0.35rem; }
  .subject-tab { padding: 0.45rem 0.75rem; font-size: 0.75rem; }
  .subject-tab__count { display: none; }

  /* ── Sidebar: single column ── */
  .sidebar { flex-direction: column; }
  .scard   { flex: none; width: 100%; }

  /* ── Unit card mobile fixes ── */
  .unit-card__head {
    padding: 0.85rem 0.85rem;
    gap: 0.6rem;
    flex-wrap: wrap;
  }
  .unit-num { width: 32px; height: 32px; border-radius: 8px; font-size: 0.65rem; }
  .unit-title { font-size: 0.82rem; white-space: normal; word-break: break-word; }
  .unit-q-btn { font-size: 0.68rem; padding: 0.38rem 0.65rem; gap: 0.3rem; }
  .unit-q-btn__count { font-size: 0.875rem; }
  .unit-q-btn .unit-q-btn__arrow { display: none; }
  .unit-chevron { font-size: 0.65rem; }

  /* ── Toolbar ── */
  .toolbar { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .toolbar__count { font-size: 0.72rem; }
  .toolbar__syllabus { display: none; }

  /* ── Subtopics ── */
  .subtopic { padding: 0.5rem 1rem 0.5rem 0.85rem; }
  .subtopic__text { font-size: 0.78rem; }
}

/* Extra-small phones */
@media (max-width: 390px) {
  .unit-card__head { padding: 0.75rem; gap: 0.5rem; }
  .unit-q-btn { padding: 0.35rem 0.55rem; font-size: 0.65rem; }
  .unit-num { width: 28px; height: 28px; font-size: 0.6rem; }
  .hero__stat { flex: 1 1 calc(50% - 0.5rem); }
}

/* ═══════════════════════════════════════
   NO SIDEBAR ON PHONES / TABLETS
   The sidebar is for computer screens only. On small screens (portrait or
   landscape) it is hidden so the topics are what the student sees first.
═══════════════════════════════════════ */
@media (max-width: 960px), (pointer: coarse) and (max-height: 520px) {
  .sidebar { display: none !important; }
  .layout { grid-template-columns: 1fr !important; display: block; }
}


/* ── How-to-use hint above the unit list ── */
.units-hint{display:flex; align-items:flex-start; gap:.7rem; background:#eef1fb; border:1px solid #dde3f0; border-radius:12px; padding:.8rem 1rem; margin:0 0 1rem}
.units-hint__icon{font-size:1.05rem; line-height:1.4}
.units-hint p{margin:0; font-size:.82rem; line-height:1.6; color:#5a6a8a}
.units-hint__chip{display:inline-block; font-weight:800; font-size:.74rem; color:#fff; background:#2d3fd4; padding:1px 9px; border-radius:999px; white-space:nowrap}
.units-hint__arrow{display:inline-block; font-size:.7rem; color:#2d3fd4; border:1.5px solid #b8c4df; border-radius:6px; padding:0 6px; background:#fff}
