/* =========================================================
   QUIZ PAGE — REDESIGN
   Same class names the JS already targets (.quiz-container,
   .quiz-timer, .quiz-progress, .quiz-card, .option-btn,
   .quiz-actions, #prevBtn/#nextBtn/#finishBtn) plus a handful
   of new ones for the top bar / progress bar / option cards.
   No IDs were renamed, so timer, navigation, and scoring JS
   need zero changes.
========================================================= */

/* .quiz-container used to be transparent — just padding, no
   background — so the timer/progress row floated directly on
   whatever the page background happens to be, with nothing tying
   it visually to the question card below it. Giving it the same
   soft-panel treatment as .practice-card (lavender surface, thin
   border) makes it read as one contained unit, and lets the white
   .quiz-card pop as the actual focal point inside it — same
   panel-vs-card relationship Practice Arena uses. */
.quiz-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
  background: #faf9fd;
  border: 1px solid #efeef7;
  border-radius: 22px;
  box-sizing: border-box;
}

/* =========================
   TOP BAR
========================= */

.quiz-topbar {
  margin-bottom: 20px;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.quiz-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #111827;
  margin: 0;
}

.quiz-timer {
  background: #7c3aed;
  color: white;
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.25);
}

.quiz-progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.quiz-progress {
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
}

/* Progress bar */
.quiz-progress-track {
  width: 100%;
  height: 8px;
  background: #ede9fe;
  border-radius: 999px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #a78bfa);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* =========================
   QUESTION CARD
   Toned down to the same shadow/border scale used by
   .marketplace-card / .quiz-card (My Quizzes) / .practice-card —
   it was noticeably heavier than every other card in the app
   (0 10px 35px vs. everyone else's 0 8px 20px), which is part of
   what made this page feel like it belonged to a different app.
========================= */

.quiz-card {
  background: white;
  border-radius: 18px;
  padding: 26px;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 8px 20px rgba(0, 0, 0, 0.05);
  border: 1px solid #f1f1f1;
  margin-bottom: 20px;
}

.quiz-question {
  font-size: clamp(1.1rem, 2.4vw, 1.4rem);
  line-height: 1.6;
  margin-bottom: 20px;
  color: #111827;
  font-weight: 700;
}

/* =========================
   OPTIONS (card style)
========================= */

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.option-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  border: 2px solid #e5e7eb;
  background: white;
  padding: 16px 18px;
  border-radius: 16px;
  font-size: 15px;
  color: #1f2937;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.15s ease,
    box-shadow 0.2s ease;
}

.option-btn:hover {
  border-color: #a78bfa;
  background: #faf9ff;
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(124, 58, 237, 0.08);
}

.option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f3f4f6;
  color: #6b7280;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.option-text {
  flex: 1;
  line-height: 1.5;
}

/* Selected: colored border + light background, per spec
   (no more solid purple fill / white text). */
.option-btn.selected {
  border-color: #7c3aed;
  background: #f5f3ff;
  color: #4c1d95;
}

.option-btn.selected .option-letter {
  background: #7c3aed;
  color: white;
}

/* =========================
   QUESTION IMAGE
   (shared .quiz-question-image class from quizImages.css
   still applies — no change needed there.)
========================= */

/* =========================
   NAVIGATION
========================= */

.quiz-actions {
  display: flex;
  gap: 14px;
}

.quiz-actions button {
  flex: 1;
  border: none;
  padding: 16px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
}

#prevBtn {
  background: #ffffff;
  color: #374151;
  border: 1px solid #e5e7eb;
}

#prevBtn:hover:not(:disabled) {
  background: #f3f4f6;
}

#nextBtn,
#finishBtn {
  background: #7c3aed;
  color: white;
}

#nextBtn:hover,
#finishBtn:hover {
  background: #6d28d9;
}

.quiz-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =========================================================
   QUESTION NAVIGATOR
========================================================= */

/* Desktop: sidebar sits beside the quiz; mobile: hidden,
   replaced by the toggle button + drawer below. */
.quiz-layout {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 4px 20px 50px;
  box-sizing: border-box;
}

.quiz-layout .quiz-container {
  flex: 1;
  margin: 0;
}

.question-navigator-sidebar {
  flex-shrink: 0;
  width: 220px;
  background: white;
  border-radius: 20px;
  padding: 20px;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 8px 20px rgba(0, 0, 0, 0.05);
  border: 1px solid #f1f1f1;
  position: sticky;
  top: 20px;
}

.navigator-title {
  margin: 0 0 14px 0;
  font-size: 0.95rem;
  color: #111827;
}

.navigator-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.nav-question-btn {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.15s ease,
    box-shadow 0.2s ease;
}

.nav-question-btn:hover {
  transform: translateY(-2px);
}

.nav-question-btn.nav-current {
  background: #3b82f6;
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.nav-question-btn.nav-answered {
  background: #22c55e;
  color: white;
}

.nav-question-btn.nav-unanswered {
  background: #e5e7eb;
  color: #4b5563;
}

.navigator-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #6b7280;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-dot.nav-current {
  background: #3b82f6;
}

.legend-dot.nav-answered {
  background: #22c55e;
}

.legend-dot.nav-unanswered {
  background: #e5e7eb;
}

/* Mobile "Questions" toggle — was a plain gray-outlined button
   sitting inline above the question card. Two problems: (1) it
   looked like ambient label text, not something tappable, and
   (2) once someone scrolled down into a long question, it
   scrolled out of view with nothing to bring it back — that's
   most of why it wasn't getting clicked. Fixed as a floating
   pill, pinned to the viewport so it's reachable at any scroll
   position, filled in the same purple used for every other
   primary action, with a live "answered so far" count so it
   reads as a real control instead of a label. */
.nav-toggle-btn {
  display: none;
  align-items: center;
  gap: 10px;
  border: none;
  background: #7c3aed;
  color: white;
  padding: 14px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(124, 58, 237, 0.35);
  transition:
    background 0.2s ease,
    transform 0.15s ease;
}

.nav-toggle-btn:hover {
  background: #6d28d9;
}

.nav-toggle-btn:active {
  transform: scale(0.97);
}

.nav-toggle-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

/* Mobile drawer overlay — hidden on desktop */
.navigator-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
}

.navigator-overlay[hidden] {
  display: none;
}

.navigator-drawer {
  width: 85%;
  max-width: 340px;
  height: 100%;
  background: white;
  padding: 22px;
  overflow-y: auto;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
  animation: navigator-slide-in 0.25s ease;
}

@keyframes navigator-slide-in {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.navigator-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.navigator-drawer-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.navigator-close-btn {
  border: none;
  background: #f3f4f6;
  color: #374151;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 768px) {
  .quiz-layout {
    display: block;
    padding: 0 14px 40px;
  }

  .question-navigator-sidebar {
    display: none;
  }

  .nav-toggle-btn {
    display: inline-flex;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 400;
    margin-bottom: 0;
  }

  .navigator-drawer .navigator-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .quiz-container {
    padding: 16px;
    border-radius: 18px;
  }

  .quiz-card {
    padding: 20px;
    border-radius: 16px;
  }

  .quiz-header {
    gap: 10px;
  }

  .quiz-title {
    font-size: 1.1rem;
  }

  .quiz-timer {
    padding: 8px 14px;
    font-size: 14px;
  }

  .option-btn {
    padding: 14px;
  }

  .quiz-actions {
    flex-direction: column;
  }
}
