/* ===================================================
   SecuPrep+ — CompTIA Security+ Training Platform
   Design: Dark cybersecurity theme with CompTIA gradient accents
   =================================================== */

/* ---------- CSS Variables ---------- */
:root {
  /* CompTIA-derived gradient */
  --gradient: linear-gradient(135deg, #CF4400 0%, #C8102E 25%, #A11661 50%, #7D1D7E 72%, #4E25A1 100%);
  --gradient-hover: linear-gradient(135deg, #E04D00 0%, #D91235 25%, #B8186E 50%, #8E2290 72%, #5A2DB5 100%);
  --gradient-text: linear-gradient(135deg, #FF6B2B 0%, #E8254A 30%, #C42080 55%, #9B35B8 78%, #6E3FD5 100%);

  /* Core palette */
  --bg-primary: #080B11;
  --bg-secondary: #111827;
  --bg-card: #1E293B;
  --bg-card-hover: #293548;
  --bg-surface: #334155;
  --bg-elevated: #3B4C63;

  /* CompTIA red */
  --red: #C8102E;
  --red-light: #E8254A;
  --red-glow: rgba(200, 16, 46, 0.25);

  /* Accent */
  --purple: #7D1D7E;
  --orange: #CF4400;

  /* Text */
  --text-primary: #E6EDF3;
  --text-secondary: #8B949E;
  --text-muted: #6E7681;
  --text-inverse: #0D1013;

  /* Status */
  --green: #2EA043;
  --green-light: #3FB950;
  --amber: #D29922;
  --amber-light: #E3B341;
  --danger: #F85149;

  /* Borders */
  --border: #334155;
  --border-light: #475569;
  --border-focus: #58A6FF;

  /* Spacing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 100px;

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 40px var(--red-glow);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---------- Navbar ---------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(8, 11, 18, 0.85);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  font-size: 26px;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo-highlight {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.nav-link.active {
  color: var(--text-primary);
  background: var(--bg-surface);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.streak-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  color: var(--amber-light);
  cursor: default;
}

.streak-icon { font-size: 16px; }

/* ---------- Views ---------- */
.view {
  display: none;
  padding-top: 64px;
}

.view.active {
  display: block;
  animation: fadeIn 0.35s ease;
}

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

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  max-width: 1280px;
  margin: 0 auto;
  padding: 80px 24px 60px;
  min-height: 520px;
  overflow: hidden;
}

.hero-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0);
  background-size: 32px 32px;
  opacity: 0.3;
  mask-image: radial-gradient(ellipse 70% 70% at 30% 50%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 30% 50%, black 20%, transparent 70%);
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--red-light);
  background: rgba(200, 16, 46, 0.12);
  border: 1px solid rgba(200, 16, 46, 0.25);
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  margin-bottom: 24px;
  animation: slideUp 0.5s ease 0.1s both;
}

.hero-title {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 20px;
  color: var(--text-primary);
  animation: slideUp 0.5s ease 0.2s both;
}

.gradient-text {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 480px;
  line-height: 1.7;
  margin-bottom: 36px;
  animation: slideUp 0.5s ease 0.3s both;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  animation: slideUp 0.5s ease 0.4s both;
}

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

/* Hero visual — animated shield */
.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 2;
}

.shield-container {
  position: relative;
  width: 280px;
  height: 280px;
  animation: floatIn 0.8s ease 0.3s both;
}

@keyframes floatIn {
  from { opacity: 0; transform: scale(0.85) translateY(30px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.shield {
  position: absolute;
  inset: 50px;
  background: var(--gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow), 0 0 80px rgba(125, 29, 126, 0.2);
  animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: var(--shadow-glow), 0 0 60px rgba(125, 29, 126, 0.15); }
  50% { box-shadow: 0 0 50px var(--red-glow), 0 0 100px rgba(125, 29, 126, 0.3); }
}

.shield-inner {
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  background: var(--bg-primary);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.shield-icon { font-size: 40px; }
.shield-label {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 1px;
}

/* Orbits */
.orbit {
  position: absolute;
  border: 1px solid var(--border);
  border-radius: 50%;
}

.orbit-1 {
  inset: 20px;
  border-color: rgba(200, 16, 46, 0.15);
  animation: spin 20s linear infinite;
}

.orbit-2 {
  inset: 0px;
  border-color: rgba(125, 29, 126, 0.12);
  animation: spin 30s linear infinite reverse;
}

.orbit-3 {
  inset: -20px;
  border-color: rgba(78, 37, 161, 0.08);
  animation: spin 40s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.orbit-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 12px var(--red-glow);
}

.dot-1 { top: 20px; left: 50%; transform: translateX(-50%); animation: orbitMove1 20s linear infinite; }
.dot-2 { bottom: 0; left: 20%; background: var(--purple); box-shadow: 0 0 12px rgba(125,29,126,0.4); animation: orbitMove2 30s linear infinite; }
.dot-3 { top: 50%; right: -20px; background: var(--orange); box-shadow: 0 0 12px rgba(207,68,0,0.4); animation: orbitMove3 25s linear infinite; }
.dot-4 { top: 30%; left: -10px; background: #4E25A1; box-shadow: 0 0 12px rgba(78,37,161,0.4); animation: orbitMove4 35s linear infinite; }

@keyframes orbitMove1 {
  0% { top: 20px; left: 50%; }
  25% { top: 50%; left: calc(100% - 20px); }
  50% { top: calc(100% - 20px); left: 50%; }
  75% { top: 50%; left: 20px; }
  100% { top: 20px; left: 50%; }
}

@keyframes orbitMove2 {
  0% { bottom: 0; left: 20%; }
  25% { bottom: 40%; left: 0; }
  50% { bottom: 100%; left: 40%; }
  75% { bottom: 40%; left: 100%; }
  100% { bottom: 0; left: 20%; }
}

@keyframes orbitMove3 {
  0% { top: 50%; right: -20px; }
  33% { top: -10px; right: 50%; }
  66% { top: 50%; right: calc(100% + 10px); }
  100% { top: 50%; right: -20px; }
}

@keyframes orbitMove4 {
  0% { top: 30%; left: -10px; }
  50% { top: 70%; left: calc(100% + 10px); }
  100% { top: 30%; left: -10px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14px;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.25s ease;
  padding: 10px 22px;
  text-decoration: none;
  white-space: nowrap;
}

.btn-lg {
  padding: 14px 32px;
  font-size: 15px;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 2px 12px var(--red-glow);
}

.btn-primary:hover {
  background: var(--gradient-hover);
  box-shadow: 0 4px 24px var(--red-glow);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-outline:hover {
  border-color: var(--text-muted);
  background: var(--bg-card);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(248, 81, 73, 0.3);
}

.btn-danger-outline:hover {
  background: rgba(248, 81, 73, 0.1);
  border-color: var(--danger);
}

.btn-icon {
  font-size: 14px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* ---------- Stats Row ---------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  transition: all 0.25s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.stat-card:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

/* ---------- Sections ---------- */
.section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

.section-header {
  margin-bottom: 32px;
}

.section-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.section-sub {
  font-size: 15px;
  color: var(--text-secondary);
}

/* ---------- Domain Grid (Dashboard) ---------- */
.domain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.domain-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
}

.domain-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.domain-card:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.domain-card:hover::before {
  opacity: 1;
}

.domain-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.domain-number {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--red-light);
  background: rgba(200, 16, 46, 0.12);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.domain-weight {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.domain-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.domain-progress {
  margin-top: 16px;
}

.domain-progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.domain-progress-label {
  font-size: 12px;
  color: var(--text-muted);
}

.domain-progress-pct {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.progress-bar {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* ---------- Domain List (Domains view) ---------- */
.domain-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.domain-list-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.domain-list-item:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
  transform: translateX(4px);
}

.domain-list-num {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 800;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  min-width: 48px;
  text-align: center;
}

.domain-list-info h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.domain-list-info p {
  font-size: 14px;
  color: var(--text-secondary);
}

.domain-list-meta {
  text-align: right;
  font-family: var(--font-mono);
}

.domain-list-weight {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.domain-list-weight-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---------- Quick Start Grid ---------- */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.quick-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: left;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: var(--font-sans);
  color: var(--text-primary);
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
}

.quick-card:hover {
  border-color: rgba(200, 16, 46, 0.3);
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md), 0 0 30px rgba(200, 16, 46, 0.08);
}

.quick-icon {
  font-size: 28px;
  margin-bottom: 16px;
}

.quick-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.quick-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---------- Info Grid ---------- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.info-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
  margin-bottom: 6px;
}

.info-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ---------- Exam Setup ---------- */
.setup-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 60px 24px;
}

.setup-form {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.setup-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.setup-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.toggle-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toggle-btn {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 22px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.toggle-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.toggle-btn.active {
  background: var(--gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 12px var(--red-glow);
}

.domain-checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.domain-check {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.domain-check:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.domain-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-light);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.domain-check input[type="checkbox"]:checked {
  background: var(--red);
  border-color: var(--red);
}

.domain-check input[type="checkbox"]:checked::after {
  content: '\2713';
  position: absolute;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.domain-check-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.domain-check-weight {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.setup-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ---------- Exam View ---------- */
.exam-topbar {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  z-index: 90;
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.exam-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.exam-q-counter {
  font-size: 14px;
  color: var(--text-secondary);
}

.exam-q-counter strong {
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.exam-domain-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(200, 16, 46, 0.12);
  color: var(--red-light);
  font-family: var(--font-mono);
}

.exam-topbar-center {
  flex: 1;
  padding: 0 16px;
}

.exam-progress-bar {
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  overflow: hidden;
}

.exam-progress-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.exam-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.exam-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.exam-timer.warning { color: var(--amber-light); border-color: rgba(210, 153, 34, 0.3); }
.exam-timer.danger { color: var(--danger); border-color: rgba(248, 81, 73, 0.3); animation: timerPulse 1s ease infinite; }

@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.timer-icon { font-size: 14px; }

/* ---------- Exam Body ---------- */
.exam-body {
  max-width: 840px;
  margin: 0 auto;
  padding: 100px 24px 40px;
}

.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  margin-bottom: 24px;
}

.question-text {
  font-size: 17px;
  line-height: 1.75;
  color: var(--text-primary);
  margin-bottom: 28px;
  font-weight: 500;
}

.answer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.answer-option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
}

.answer-option:hover {
  border-color: var(--border-light);
  background: var(--bg-surface);
}

.answer-option.selected {
  border-color: rgba(200, 16, 46, 0.5);
  background: rgba(200, 16, 46, 0.08);
}

.answer-option.correct {
  border-color: var(--green);
  background: rgba(46, 160, 67, 0.1);
}

.answer-option.incorrect {
  border-color: var(--danger);
  background: rgba(248, 81, 73, 0.08);
}

.answer-option.correct-reveal {
  border-color: var(--green);
  background: rgba(46, 160, 67, 0.08);
}

.answer-letter {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-elevated);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.answer-option.selected .answer-letter {
  background: var(--red);
  color: #fff;
}

.answer-option.correct .answer-letter {
  background: var(--green);
  color: #fff;
}

.answer-option.incorrect .answer-letter {
  background: var(--danger);
  color: #fff;
}

.answer-option.correct-reveal .answer-letter {
  background: var(--green);
  color: #fff;
}

/* ---------- Explanation ---------- */
.exam-explanation {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  animation: slideUp 0.3s ease;
}

.explanation-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.explanation-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
}

.explanation-icon.correct {
  background: rgba(46, 160, 67, 0.15);
  color: var(--green-light);
}

.explanation-icon.incorrect {
  background: rgba(248, 81, 73, 0.15);
  color: var(--danger);
}

.explanation-title {
  font-weight: 700;
  font-size: 16px;
}

.explanation-title.correct { color: var(--green-light); }
.explanation-title.incorrect { color: var(--danger); }

.explanation-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* ---------- Exam Navigation ---------- */
.exam-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.exam-dots {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 400px;
}

.exam-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.exam-dot.answered { background: var(--green); border-color: var(--green); }
.exam-dot.flagged { background: var(--amber); border-color: var(--amber); }
.exam-dot.current { border-color: var(--text-primary); box-shadow: 0 0 0 2px var(--text-primary); }

/* ---------- Question Navigator Drawer ---------- */
.q-navigator {
  position: fixed;
  top: 128px;
  right: -320px;
  width: 300px;
  bottom: 0;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  padding: 20px;
  transition: right 0.3s ease;
  z-index: 80;
  overflow-y: auto;
}

.q-navigator.open { right: 0; }

.q-nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.q-nav-header h3 {
  font-size: 15px;
  font-weight: 700;
}

.q-nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 20px;
}

.q-nav-btn {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.q-nav-btn:hover { border-color: var(--text-muted); }
.q-nav-btn.answered { background: rgba(46, 160, 67, 0.15); border-color: rgba(46, 160, 67, 0.3); color: var(--green-light); }
.q-nav-btn.flagged { background: rgba(210, 153, 34, 0.15); border-color: rgba(210, 153, 34, 0.3); color: var(--amber-light); }
.q-nav-btn.current { border-color: var(--red-light); box-shadow: 0 0 0 1px var(--red-light); color: var(--text-primary); }

.q-nav-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot.answered { background: var(--green); }
.legend-dot.flagged { background: var(--amber); }
.legend-dot.current { background: var(--text-primary); }

.q-nav-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  border: none;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-md), var(--shadow-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 85;
  transition: transform 0.2s ease;
}

.q-nav-toggle:hover {
  transform: scale(1.1);
}

/* ---------- Results View ---------- */
.results-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 60px 24px 80px;
  text-align: center;
}

.results-header {
  margin-bottom: 40px;
}

.results-status {
  margin-bottom: 16px;
}

.status-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 8px 24px;
  border-radius: var(--radius-pill);
}

.status-badge.pass {
  background: rgba(46, 160, 67, 0.15);
  color: var(--green-light);
  border: 1px solid rgba(46, 160, 67, 0.3);
}

.status-badge.fail {
  background: rgba(248, 81, 73, 0.12);
  color: var(--danger);
  border: 1px solid rgba(248, 81, 73, 0.3);
}

.results-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 8px;
}

.results-sub {
  font-size: 16px;
  color: var(--text-secondary);
}

/* Score Ring */
.score-ring-container {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 40px;
}

.score-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-ring-bg {
  fill: none;
  stroke: var(--bg-elevated);
  stroke-width: 10;
}

.score-ring-fill {
  fill: none;
  stroke: url(#scoreGradient);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 534;
  stroke-dashoffset: 534;
  transition: stroke-dashoffset 1.5s ease;
}

.score-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-pct {
  font-family: var(--font-mono);
  font-size: 40px;
  font-weight: 800;
  color: var(--text-primary);
}

.score-fraction {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-muted);
}

/* Results Stats */
.results-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 40px;
}

.result-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 12px;
}

.result-stat-val {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.result-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Results Domains */
.results-domains {
  text-align: left;
  margin-bottom: 40px;
}

.result-domain {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.result-domain:last-child { border-bottom: none; }

.result-domain-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.result-domain-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.result-domain-score {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}

.result-domain-score.good { color: var(--green-light); }
.result-domain-score.mid { color: var(--amber-light); }
.result-domain-score.bad { color: var(--danger); }

/* Results Actions */
.results-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- History View ---------- */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 20px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  transition: all 0.2s ease;
}

.history-item:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.history-score {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  min-width: 60px;
  text-align: center;
}

.history-score.good { color: var(--green-light); }
.history-score.mid { color: var(--amber-light); }
.history-score.bad { color: var(--danger); }

.history-info h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.history-info p {
  font-size: 13px;
  color: var(--text-muted);
}

.history-date {
  font-size: 13px;
  color: var(--text-muted);
  text-align: right;
}

.history-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-badge.pass {
  background: rgba(46, 160, 67, 0.12);
  color: var(--green-light);
}

.history-badge.fail {
  background: rgba(248, 81, 73, 0.08);
  color: var(--danger);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state p {
  margin-bottom: 24px;
  font-size: 15px;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
}

.modal-text {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ---------- SVG Gradient Defs (for score ring) ---------- */
.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
}

/* ---------- Auth View ---------- */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 64px);
  padding: 40px 24px;
}

.auth-card {
  max-width: 440px;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 36px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.auth-header { margin-bottom: 32px; }
.auth-header .section-title { font-size: 24px; margin-bottom: 8px; }
.auth-header .section-sub { font-size: 14px; }

.auth-tabs { justify-content: center; margin-bottom: 28px; }

.auth-field {
  text-align: left;
  margin-bottom: 16px;
}

.auth-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.auth-field input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  transition: border-color 0.2s ease;
  outline: none;
}

.auth-field input:focus {
  border-color: var(--border-focus);
}

.auth-field input::placeholder {
  color: var(--text-muted);
}

.auth-error {
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.3);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--danger);
  text-align: left;
}

.auth-submit-btn { width: 100%; justify-content: center; margin-top: 8px; }

.auth-forgot {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
}
.auth-forgot:hover { color: var(--text-secondary); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  color: var(--text-muted);
  font-size: 13px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  width: 100%;
  justify-content: center;
  background: #fff;
  color: #333;
  border: 1px solid var(--border);
  font-weight: 600;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
}
.btn-google:hover {
  background: #f0f0f0;
  border-color: var(--border-light);
}
.btn-google svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.auth-skip {
  margin-top: 20px;
  font-size: 13px;
}
.auth-skip a {
  color: var(--text-muted);
  text-decoration: none;
}
.auth-skip a:hover {
  color: var(--text-secondary);
  text-decoration: underline;
}

/* Nav auth elements */
.nav-auth-btn { font-size: 13px; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  cursor: default;
}

/* ---------- Wrong Answers View ---------- */
.wrong-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.wrong-stats {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text-secondary);
}
.wrong-stats span {
  color: var(--danger);
  font-weight: 700;
  font-size: 20px;
}

.wrong-bar-actions {
  display: flex;
  gap: 12px;
}

.wrong-domain-group {
  margin-bottom: 32px;
}

.wrong-domain-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.wrong-domain-header h3 {
  font-size: 16px;
  font-weight: 700;
  flex: 1;
}
.wrong-domain-count {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
}

.wrong-question-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wrong-question-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  transition: all 0.2s ease;
}
.wrong-question-item:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.wrong-question-text {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
  flex: 1;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 60px 24px 40px;
    min-height: auto;
  }

  .hero-sub { margin-left: auto; margin-right: auto; }
  .hero-actions { justify-content: center; }
  .hero-visual { display: none; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .nav-links { display: none; }

  .hero-title { font-size: 32px; }

  .stats-row { grid-template-columns: 1fr 1fr; }
  .domain-grid { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr 1fr; }
  .results-stats { grid-template-columns: repeat(2, 1fr); }

  .exam-topbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .exam-topbar-center { order: 3; flex-basis: 100%; padding: 0; }
  .exam-dots { display: none; }

  .domain-list-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .domain-list-num { text-align: left; }

  .wrong-actions-bar { flex-direction: column; text-align: center; }
  .wrong-bar-actions { justify-content: center; }
  .auth-card { padding: 36px 24px; }
  .domain-list-meta { text-align: left; }
}

@media (max-width: 480px) {
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; justify-content: center; }
  .info-grid { grid-template-columns: 1fr; }
  .results-stats { grid-template-columns: 1fr 1fr; }
  .setup-actions { flex-direction: column; }
  .setup-actions .btn { width: 100%; justify-content: center; }
}
