/* ══════════════════════════════════════════════════════════
   CivicLearn v2 — Design System
   Shared across all civic test products.
   
   Font:    Inter (Latin + Greek + Cyrillic — the UI is Greek, hints in sq/ru/uk)
   Palette: Deep teal accent, warm stone grays
   ══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

/* ── CSS VARIABLES ── */
:root {
  --bg:          #f6f5f2;
  --surface:     #ffffff;
  --surface-alt: #f0efeb;
  --text:        #1a1816;
  --text-mid:    #57534e;
  --text-muted:  #a8a29e;
  --border:      #e7e5e1;
  --border-lt:   #f0efed;
  --accent:      #0d7377;
  --accent-soft: rgba(13,115,119,0.06);
  --accent-mid:  rgba(13,115,119,0.14);
  --accent-glow: rgba(13,115,119,0.25);
  --correct:     #16a34a;
  --correct-bg:  #dcfce7;
  --wrong:       #dc2626;
  --wrong-bg:    #fee2e2;
  --orange:      #ea580c;
  --purple:      #7c3aed;
  --sidebar-bg:  #18181b;
  --sb-text:     #a1a1aa;
  --sb-active:   #ffffff;
  --sb-hover:    rgba(255,255,255,0.06);
  --font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius:      13px;
  --radius-sm:   10px;
  --radius-xs:   7px;
  --shadow:      0 1px 2px rgba(0,0,0,0.03);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.05);
}

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

/* ── Hide until i18n ready ── */
html.i18n-hidden [data-i18n] { visibility: hidden; }
html.i18n-hidden .i18n-hide  { display: none; }

/* ══════════════════════════════════════════════════════════
   LAYOUT — sidebar + main
   ══════════════════════════════════════════════════════════ */

.wrap {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 208px;
  min-width: 208px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  overflow-y: auto;
}

.brand {
  padding: 0 20px 24px;
  font-size: 14px;
  font-weight: 700;
  color: var(--sb-active);
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand .flag-icon {
  width: 22px; height: 15px;
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

/* ── SIDEBAR GAUGE ── */
.sidebar-gauge {
  padding: 0 20px 16px;
}

.sidebar-gauge-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.sidebar-gauge-label {
  font-size: 9px;
  color: var(--sb-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-gauge-score {
  font-size: 11px;
  font-weight: 700;
  color: var(--sb-active);
}

.sidebar-gauge-track {
  height: 4px;
  background: #333;
  border-radius: 2px;
  position: relative;
  overflow: visible;
}

.sidebar-gauge-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  border-radius: 2px;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1), background 0.4s;
  min-width: 0;
}

.sidebar-gauge-fill[data-state="red"]    { background: #b84233; }
.sidebar-gauge-fill[data-state="orange"] { background: #c47a2e; }
.sidebar-gauge-fill[data-state="green"]  { background: #0d7377; }

.sidebar-gauge-pass {
  position: absolute;
  top: -3px;
  width: 1.5px;
  height: 10px;
  background: #666;
  border-radius: 1px;
  z-index: 2;
}

.sidebar-gauge-badge {
  font-size: 9px;
  font-weight: 600;
  margin-top: 4px;
  text-align: right;
}

.sidebar-gauge-badge[data-state="pass"]  { color: #5dcaa5; }
.sidebar-gauge-badge[data-state="close"] { color: #c47a2e; }
.sidebar-gauge-badge[data-state="fail"]  { color: #e8857a; }

/* ── NAV ── */
.nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 10px;
  flex: 1;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 500;
  color: var(--sb-text);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav a:hover {
  background: var(--sb-hover);
  color: var(--sb-active);
}

.nav a.active {
  background: rgba(255,255,255,0.08);
  color: var(--sb-active);
  font-weight: 600;
}

.nav a svg {
  width: 16px; height: 16px;
  opacity: 0.55;
  flex-shrink: 0;
}

.nav a.active svg { opacity: 1; }

.nav-sep {
  height: 1px;
  background: rgba(255,255,255,0.05);
  margin: 10px 20px;
}

.spacer { flex: 1; }

/* ── LANG SWITCH ── */
.global-controls {
  padding: 0 20px;
}

.lang-switch {
  display: flex;
  gap: 5px;
}

.lang-switch button {
  padding: 4px 9px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--sb-text);
  cursor: pointer;
  transition: all 0.15s;
}

.lang-switch button.active {
  background: rgba(255,255,255,0.08);
  color: white;
  border-color: rgba(255,255,255,0.2);
}

.lang-switch button:hover:not(.active) {
  border-color: rgba(255,255,255,0.15);
  color: #d4d4d8;
}

/* ── HINT LANGUAGE picker (under the EL/EN switch; UI el only) ── */
.hint-pick {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
}
.hint-pick-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--sb-text);
}
.hint-pick-select {
  width: 100%;
  padding: 5px 8px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--font);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: #e4e4e7;
  cursor: pointer;
}
.hint-pick-select option { color: #1a1816; }
.hint-pick-select:hover { border-color: rgba(255,255,255,0.2); }
.global-controls { display: flex; flex-wrap: wrap; align-items: center; }
.global-controls .hint-pick { flex-basis: 100%; }

/* ── READING ASSIST ── */
.reading-btn {
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 14px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--sb-text);
  cursor: pointer;
  transition: all 0.15s;
  margin-left: 4px;
}

.reading-btn:hover {
  border-color: rgba(255,255,255,0.2);
}

/* ── MAIN CONTENT ── */
main {
  flex: 1;
  margin-left: 208px;
  padding: 28px 36px 40px;
  overflow-y: auto;
  min-height: 100vh;
}

/* ── PAGE HEADER ── */
.ce-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.ce-header h1 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--text);
}

.ce-header .muted {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── MOBILE ── */
.menu-toggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 60;
  background: var(--sidebar-bg);
  color: white;
  border: none;
  border-radius: var(--radius-xs);
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 45;
}

@media (max-width: 768px) {
  .menu-toggle { display: block; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  body.menu-open .sidebar { transform: translateX(0); }
  body.menu-open .overlay { display: block; }

  main {
    margin-left: 0;
    padding: 60px 16px 32px;
  }
}

/* ══════════════════════════════════════════════════════════
   PROGRESS BAR
   ══════════════════════════════════════════════════════════ */

.ce-progress-global {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 28px;
  overflow: hidden;
}

.ce-progress-global-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.4s ease;
}

/* ══════════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════════ */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.anim {
  animation: fadeUp 0.5s cubic-bezier(0.22,1,0.36,1) forwards;
  opacity: 0;
}
.d1 { animation-delay: 0.04s; }
.d2 { animation-delay: 0.09s; }
.d3 { animation-delay: 0.14s; }
.d4 { animation-delay: 0.19s; }
.d5 { animation-delay: 0.24s; }
.d6 { animation-delay: 0.29s; }

/* ══════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 28px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  transition: all 0.18s ease;
  letter-spacing: -0.01em;
}

.btn:hover { background: #0b6265; }
.btn:disabled { opacity: 0.35; cursor: default; }

.btn.secondary {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.secondary:hover {
  background: var(--border);
}

/* ══════════════════════════════════════════════════════════
   MAINTENANCE BAR (inherited from existing system)
   ══════════════════════════════════════════════════════════ */

.maintenance-bar {
  background: #fef3c7;
  border-bottom: 1px solid #fbbf24;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 500;
  color: #92400e;
  text-align: center;
}

/* ══════════════════════════════════════════════════════════
   CZ — language switch CS · UK · RU · EN visible on phones
   (the sidebar is hidden behind the ☰ menu below 769px)
   ══════════════════════════════════════════════════════════ */
.lang-switch-mobile { display: none; }

@media (max-width: 768px) {
  .lang-switch.lang-switch-mobile {
    display: flex;
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 60;
    gap: 3px;
    padding: 3px;
    background: var(--sidebar-bg);
    border-radius: var(--radius-xs);
  }
  .lang-switch.lang-switch-mobile button {
    padding: 6px 8px;
    font-size: 11px;
    border-color: transparent;
  }
}
