/* ─────────────────────────────────────────────────────────────────────────────
   IELTSNexa shared theme — the single source of truth for design tokens
   and the site navigation bar.

   Load AFTER /css/fonts.css and BEFORE any page-local <style> block:
     <link rel="stylesheet" href="/css/fonts.css">
     <link rel="stylesheet" href="/css/theme.css">

   Canonical names are the Gen-2 ("paper / editorial") names used by
   home + libraries. Legacy aliases are provided so older pages keep
   working while they migrate — do NOT use alias names in new code.
   Full rules: docs/UI-DESIGN.md
   ──────────────────────────────────────────────────────────────────────────── */

:root {
  /* ── Brand core ── */
  --charcoal:   #2B2D42;   /* nav, headings, primary buttons */
  --ink:        #1A1A2A;   /* body text */
  --muted:      #6B6B78;   /* secondary text */
  --faint:      #9A9BAD;   /* tertiary text, disabled */
  --coral:      #D4614B;   /* CTAs, accents, active states */
  --coral-dark: #B84F3A;   /* coral hover */
  --coral-soft: #FAEAE7;   /* coral tint backgrounds */

  /* ── Surfaces ── */
  --paper:      #FBF9F4;   /* page background */
  --surface:    #FFFFFF;   /* cards, panels */
  --rule:       #E5E2E2;   /* borders, dividers */
  --rule-soft:  #F4F1EC;   /* subtle fills, table heads */

  /* ── Status colors (library progress: dots, row tints) ── */
  --status-done: #6B8F71;  /* sage — completed */
  --status-in:   #C99846;  /* gold — in progress */

  /* ── Semantic verdict scale (reports, correctness, band tones) ── */
  --ok:    #16A34A; --ok-text:   #15803D; --ok-bg:   #E9F8EF;
  --warn:  #E0922F; --warn-text: #B45309; --warn-bg: #FCF3DF;
  --bad:   #DC2626; --bad-text:  #C81E1E; --bad-bg:  #FCE9E9;
  --error: #DC2626;        /* validation errors / wrong answers only */

  /* ── Radius / elevation ── */
  --radius-sm: 4px; --radius-md: 8px; --radius-lg: 12px; --radius-xl: 16px;
  --shadow-sm: 0 1px 3px rgba(20,20,40,.05);
  --shadow-md: 0 4px 16px rgba(43,45,66,.08);
  --shadow-lg: 0 18px 50px -20px rgba(20,20,40,.30);

  /* ── Legacy aliases (Gen-1 names → canonical values). Migration only. ── */
  --primary:       var(--charcoal);
  --primary-light: #EEEEF3;
  --primary-mid:   var(--faint);
  --accent:        var(--coral);
  --accent-dark:   var(--coral-dark);
  --accent-light:  var(--coral-soft);
  --bg:            var(--paper);
  --border:        var(--rule);
  --text:          var(--ink);
  --text-primary:  var(--ink);
  --green:         var(--status-done);
  --amber:         var(--status-in);
  --success:       var(--ok);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Canonical site nav (same markup as home/libraries; rendered by /js/nav.js
   on app pages). Height 64px, charcoal, sticky.
   ──────────────────────────────────────────────────────────────────────────── */
.nav { position: sticky; top: 0; z-index: 100; background: var(--charcoal); }
.nav-inner { display: flex; align-items: center; gap: 40px; height: 64px; max-width: 1280px; margin: 0 auto; padding: 0 32px; }
.nav-logo { font-family: 'Inter Tight', 'Inter', sans-serif; font-size: 18px; font-weight: 700; color: #fff; letter-spacing: -0.01em; text-decoration: none; flex-shrink: 0; }
.nav-logo span { color: var(--coral); }
.nav-links { display: flex; gap: 28px; list-style: none; margin: 0 0 0 8px; padding: 0; }
.nav-links a { font-size: 14px; font-weight: 500; color: rgba(255,255,255,0.7); text-decoration: none; transition: color .15s ease; }
.nav-links a:hover, .nav-links a.active { color: #fff; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav-btn { font-size: 13px; font-weight: 600; font-family: inherit; padding: 0 16px; height: 40px; line-height: 40px; border-radius: 8px; border: none; cursor: pointer; text-decoration: none; display: inline-block; }
.nav-btn-signup { background: var(--coral); color: #fff; }
.nav-btn-login { background: transparent; color: rgba(255,255,255,.85); border: 1.5px solid rgba(255,255,255,.3); }
.nav-btn-login:hover { border-color: #fff; color: #fff; }

.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); border-radius: 8px; padding: 0 14px 0 8px; height: 40px; cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 500; color: rgba(255,255,255,0.9); }
.user-btn:hover { border-color: rgba(255,255,255,0.5); background: rgba(255,255,255,0.15); }
.user-avatar { width: 28px; height: 28px; background: var(--coral); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.user-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn .chevron { color: rgba(255,255,255,0.5); transition: transform .15s ease; flex-shrink: 0; }
.user-btn[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.user-dropdown { display: none; position: absolute; top: calc(100% + 8px); right: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; min-width: 192px; overflow: hidden; box-shadow: var(--shadow-md); z-index: 200; }
.user-dropdown.open { display: block; }
.user-dropdown a, .user-dropdown button { display: block; width: 100%; padding: 12px 16px; font-family: inherit; font-size: 14px; font-weight: 500; color: var(--ink); text-decoration: none; background: transparent; border: none; text-align: left; cursor: pointer; transition: background .15s ease, color .15s ease; }
.user-dropdown a:hover, .user-dropdown button:hover { background: var(--paper); color: var(--coral); }
.user-dropdown button { border-top: 1px solid var(--rule-soft); }

@media (max-width: 900px) {
  .nav-inner { height: 56px; padding: 0 16px; gap: 16px; }
  .nav-links { display: none; }
  .nav-right { gap: 6px; }
}
