/* ============================================================
   THPT 2026 — Dark Premium Design System
   ============================================================ */

/* Base */
:root {
  --bg-primary: #080a0d;
  --bg-secondary: #0d0f12;
  --bg-tertiary: #12151a;
  --bg-card: #141820;
  --bg-card-hover: #1a1f28;
  --border-subtle: rgba(255,255,255,0.04);
  --border-light: rgba(255,255,255,0.06);
  --border-medium: rgba(255,255,255,0.08);
  --text-primary: #e8eaed;
  --text-secondary: #9aa0a8;
  --text-muted: #5f6570;
  --accent: #6366f1;
  --accent-glow: rgba(99,102,241,0.15);
  --gold: #eab308;
  --danger: #ef4444;
  --success: #22c55e;
  --warn: #f97316;
}

* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.12); }

::selection { background: rgba(99,102,241,0.3); color: #fff; }

body {
  background: var(--bg-primary);
  background-image: 
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(99,102,241,0.06), transparent),
    radial-gradient(ellipse 50% 40% at 80% 50%, rgba(139,92,246,0.03), transparent);
}

/* Glass layers */
.header-glass {
  background: rgba(13,15,18,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.sidebar-glass {
  background: rgba(13,15,18,0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* Nav items */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  transition: all 0.15s ease;
  text-decoration: none;
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
}
.nav-item.active {
  background: rgba(99,102,241,0.1);
  color: #a5b4fc;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 1.25rem;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99,102,241,0.2), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}
.card:hover::before { opacity: 1; }

.card-featured {
  border-color: rgba(99,102,241,0.15);
  background: linear-gradient(135deg, rgba(99,102,241,0.05), var(--bg-card));
}
.card-featured::before { opacity: 1; }

/* Difficulty badges */
.diff-easy { background: rgba(34,197,94,0.1); color: #4ade80; border: 1px solid rgba(34,197,94,0.15); }
.diff-medium { background: rgba(249,115,22,0.1); color: #fb923c; border: 1px solid rgba(249,115,22,0.15); }
.diff-hard { background: rgba(239,68,68,0.1); color: #f87171; border: 1px solid rgba(239,68,68,0.15); }
.diff-extreme { background: rgba(168,85,247,0.1); color: #c084fc; border: 1px solid rgba(168,85,247,0.15); }

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: white;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca, #4f46e5);
  box-shadow: 0 4px 20px rgba(99,102,241,0.3);
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.15s;
  border: 1px solid var(--border-light);
  cursor: pointer;
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.15s;
  border: none;
  cursor: pointer;
}
.btn-ghost:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }

/* Step indicator */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
}
.step-dot {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  border: 2px solid var(--border-medium);
  background: var(--bg-secondary);
  color: var(--text-muted);
  position: relative;
  z-index: 1;
  transition: all 0.3s;
}
.step-dot.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  box-shadow: 0 0 20px rgba(99,102,241,0.4);
}
.step-dot.completed {
  border-color: var(--success);
  background: var(--success);
  color: white;
}
.step-line {
  flex: 1;
  height: 2px;
  background: var(--border-medium);
  transition: background 0.3s;
}
.step-line.completed { background: var(--success); }

/* Highlight keywords in problem text */
.math-keyword {
  position: relative;
  color: #a5b4fc;
  background: rgba(99,102,241,0.08);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  cursor: help;
  border-bottom: 1px dashed rgba(99,102,241,0.4);
  transition: all 0.15s;
}
.math-keyword:hover {
  background: rgba(99,102,241,0.15);
  color: #c7d2fe;
}

.trap-keyword {
  color: #f87171;
  background: rgba(239,68,68,0.08);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  border-bottom: 1px dashed rgba(239,68,68,0.4);
}

.data-keyword {
  color: #4ade80;
  background: rgba(34,197,94,0.08);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  border-bottom: 1px dashed rgba(34,197,94,0.4);
}

/* Tooltip */
.tooltip-math {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1d28;
  border: 1px solid var(--border-medium);
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.75rem;
  color: var(--text-primary);
  white-space: nowrap;
  z-index: 50;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.math-keyword:hover .tooltip-math { opacity: 1; }

/* Timer bar */
.timer-bar {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}
.timer-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #818cf8);
  border-radius: 2px;
  transition: width 1s linear;
}
.timer-bar-fill.warning { background: linear-gradient(90deg, var(--warn), #fbbf24); }
.timer-bar-fill.danger { background: linear-gradient(90deg, var(--danger), #fb7185); }

/* Answer options */
.answer-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-subtle);
  border-radius: 0.625rem;
  cursor: pointer;
  transition: all 0.15s;
}
.answer-option:hover {
  background: rgba(255,255,255,0.04);
  border-color: var(--border-medium);
}
.answer-option.selected {
  background: rgba(99,102,241,0.08);
  border-color: rgba(99,102,241,0.3);
}
.answer-option.correct {
  background: rgba(34,197,94,0.08);
  border-color: rgba(34,197,94,0.3);
}
.answer-option.incorrect {
  background: rgba(239,68,68,0.06);
  border-color: rgba(239,68,68,0.25);
}

.answer-letter {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-light);
  flex-shrink: 0;
  transition: all 0.15s;
}
.answer-option.selected .answer-letter {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.answer-option.correct .answer-letter {
  background: var(--success);
  border-color: var(--success);
  color: white;
}
.answer-option.incorrect .answer-letter {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

/* Progress ring */
.progress-ring {
  transform: rotate(-90deg);
}
.progress-ring-circle {
  transition: stroke-dashoffset 0.5s ease;
}

/* Trap analysis */
.trap-card {
  background: linear-gradient(135deg, rgba(239,68,68,0.04), rgba(249,115,22,0.04));
  border: 1px solid rgba(239,68,68,0.1);
  border-radius: 0.75rem;
  padding: 1rem;
}

/* Math expression display */
.math-display {
  background: rgba(99,102,241,0.04);
  border: 1px solid rgba(99,102,241,0.1);
  border-radius: 0.625rem;
  padding: 1rem 1.25rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9375rem;
  color: #c7d2fe;
  text-align: center;
}

/* Stats grid */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
}
.stat-number {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, #e8eaed, #9aa0a8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Theme option */
.theme-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.15s;
}
.theme-option:hover { border-color: var(--border-medium); background: rgba(255,255,255,0.02); }
.theme-option.active { border-color: rgba(99,102,241,0.4); background: rgba(99,102,241,0.05); }

/* Animation */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.2); }
  50% { box-shadow: 0 0 20px 4px rgba(99,102,241,0.15); }
}

.animate-fadeInUp { animation: fadeInUp 0.3s ease-out forwards; }
.animate-fadeIn { animation: fadeIn 0.2s ease-out forwards; }
.animate-slideInLeft { animation: slideInLeft 0.3s ease-out forwards; }

.stagger-1 { animation-delay: 0.05s; opacity: 0; }
.stagger-2 { animation-delay: 0.1s; opacity: 0; }
.stagger-3 { animation-delay: 0.15s; opacity: 0; }
.stagger-4 { animation-delay: 0.2s; opacity: 0; }
.stagger-5 { animation-delay: 0.25s; opacity: 0; }
.stagger-6 { animation-delay: 0.3s; opacity: 0; }

/* Question number grid */
.q-num {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 600;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.15s;
}
.q-num:hover { border-color: var(--border-medium); background: rgba(255,255,255,0.05); }
.q-num.current { border-color: var(--accent); background: rgba(99,102,241,0.15); color: #a5b4fc; }
.q-num.answered { background: rgba(99,102,241,0.1); border-color: rgba(99,102,241,0.2); color: #a5b4fc; }
.q-num.correct { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.2); color: #4ade80; }
.q-num.incorrect { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.2); color: #f87171; }

/* Theme: Hardcore */
[data-theme="hardcore"] {
  --bg-primary: #050505;
  --bg-secondary: #0a0a0a;
  --bg-tertiary: #0f0f0f;
  --bg-card: #0e0e0e;
  --bg-card-hover: #141414;
  --accent: #dc2626;
  --accent-glow: rgba(220,38,38,0.15);
}

/* Theme: Calm */
[data-theme="calm"] {
  --bg-primary: #0c1117;
  --bg-secondary: #0f161e;
  --bg-tertiary: #131c26;
  --bg-card: #131c26;
  --bg-card-hover: #182330;
  --accent: #0d9488;
  --accent-glow: rgba(13,148,136,0.15);
}

/* Theme: Minimal */
[data-theme="minimal"] {
  --bg-primary: #0e0e0e;
  --bg-secondary: #121212;
  --bg-tertiary: #171717;
  --bg-card: #171717;
  --bg-card-hover: #1c1c1c;
  --accent: #737373;
  --accent-glow: rgba(115,115,115,0.15);
}

/* Theme: Glass */
[data-theme="glass"] {
  --bg-primary: #0a0a1a;
  --bg-secondary: #0e0e24;
  --bg-tertiary: #12122e;
  --bg-card: rgba(18,18,46,0.6);
  --bg-card-hover: rgba(24,24,56,0.7);
  --accent: #8b5cf6;
  --accent-glow: rgba(139,92,246,0.2);
}
[data-theme="glass"] .card,
[data-theme="glass"] .stat-card {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Responsive */
@media (max-width: 1024px) {
  #sidebar {
    position: fixed;
    top: 3.5rem;
    left: 0;
    bottom: 0;
    z-index: 45;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  #sidebar.open {
    display: flex;
    transform: translateX(0);
  }
}

/* Print-like question text */
.question-text {
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--text-primary);
}

/* Semantic map table */
.semantic-table th {
  text-align: left;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}
.semantic-table td {
  padding: 0.625rem 0.75rem;
  font-size: 0.8125rem;
  border-bottom: 1px solid var(--border-subtle);
}

/* KaTeX override for dark theme */
.katex { color: #c7d2fe !important; }
.katex .mord, .katex .mbin, .katex .mrel, .katex .mop { color: #c7d2fe !important; }
