/* CDA Quiz Page Styles */

/* Layout */
.quiz-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  min-height: 100vh;
}

/* Sidebar */
.quiz-sidebar {
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  padding: 1.5rem 1rem;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
}
.sidebar-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray-400); margin-bottom: 1rem; }
.sidebar-legend { margin-bottom: 1.2rem; display: flex; flex-direction: column; gap: 0.4rem; }
.legend-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--gray-500); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-dot.unanswered { background: var(--gray-200); border: 1.5px solid var(--gray-400); }
.legend-dot.answered { background: var(--blue); }
.legend-dot.flagged { background: var(--amber); }

#question-nav {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.nav-dot {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 5px;
  border: none;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s;
}
.nav-dot:hover { transform: scale(1.1); }
.nav-unanswered { background: var(--gray-200); color: var(--gray-700); }
.nav-answered { background: var(--blue); color: var(--white); }
.nav-flagged { background: var(--amber); color: var(--white); }

/* Quiz Header */
.quiz-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.quiz-header-left { display: flex; align-items: center; gap: 1rem; }
.quiz-title-sm { font-weight: 700; font-size: 0.95rem; }
.timer-wrap { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; }
.timer-icon { font-size: 1rem; }
#timer { font-weight: 700; font-size: 1rem; font-variant-numeric: tabular-nums; color: var(--gray-700); }
#timer.timer-warning { color: var(--amber); }
#timer.timer-danger { color: var(--red); }

.progress-wrap { display: flex; align-items: center; gap: 0.8rem; flex: 1; min-width: 200px; }
#progress-label { font-size: 0.82rem; color: var(--gray-500); white-space: nowrap; }
.progress-track { flex: 1; height: 6px; background: var(--gray-200); border-radius: 100px; overflow: hidden; }
#progress-bar { height: 100%; background: var(--green); border-radius: 100px; width: 0; transition: width 0.3s; }

/* Main Content */
.quiz-main { padding: 2rem 1.5rem 4rem; }

/* Competency Headers */
.comp-header {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.8rem 1rem;
  background: var(--white);
  border-left: 4px solid var(--blue);
  border-radius: 0 8px 8px 0;
  margin: 2rem 0 1rem;
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: var(--shadow);
}
.comp-tag {
  background: var(--blue); color: var(--white);
  padding: 0.15rem 0.6rem;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.comp-header:first-child { margin-top: 0; }

/* Question Cards */
.question-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  scroll-margin-top: 120px;
}
.question-meta {
  display: flex; align-items: center; gap: 0.6rem;
  margin-bottom: 0.8rem;
}
.q-number {
  background: var(--blue); color: var(--white);
  padding: 0.15rem 0.6rem;
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 700;
}
.q-area {
  font-size: 0.78rem; color: var(--gray-500);
  background: var(--gray-100);
  padding: 0.15rem 0.6rem;
  border-radius: 100px;
}
.flag-btn {
  margin-left: auto;
  background: none; border: none;
  font-size: 1.1rem; cursor: pointer;
  color: var(--gray-300); padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: color 0.15s;
}
.flag-btn:hover { color: var(--amber); }
.flag-btn.flagged { color: var(--amber); }

.question-text {
  font-size: 1rem; font-weight: 600; line-height: 1.55;
  margin-bottom: 1rem; color: var(--gray-900);
}

.options { display: flex; flex-direction: column; gap: 0.6rem; }
.opt {
  display: flex; align-items: flex-start; gap: 0.8rem;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 7px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.opt:hover { border-color: var(--blue); background: var(--blue-light); }
.opt.selected { border-color: var(--blue); background: var(--blue-light); }
.opt.correct { border-color: var(--green) !important; background: var(--green-light) !important; }
.opt.wrong { border-color: var(--red) !important; background: var(--red-light) !important; }
.opt-letter {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--gray-100); color: var(--gray-700);
  font-size: 0.78rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.opt.selected .opt-letter { background: var(--blue); color: var(--white); }
.opt.correct .opt-letter { background: var(--green); color: var(--white); }
.opt.wrong .opt-letter { background: var(--red); color: var(--white); }
.opt-text { font-size: 0.93rem; line-height: 1.45; padding-top: 2px; }

.explanation {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  background: #EFF6FF;
  border-left: 3px solid var(--blue);
  border-radius: 0 6px 6px 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #1E3A8A;
}
.explanation strong { margin-right: 0.3rem; }

/* Submit */
.submit-section {
  text-align: center;
  padding: 2.5rem 0 1rem;
  position: sticky;
  bottom: 0;
  background: linear-gradient(transparent, var(--gray-50) 30%);
  padding-top: 3rem;
}
#submit-btn {
  padding: 1rem 3rem;
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--blue);
  color: var(--white);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: background 0.15s, transform 0.1s;
}
#submit-btn:hover:not(:disabled) { background: var(--blue-dark); transform: translateY(-1px); }
#submit-btn:disabled { cursor: default; }

/* Results */
#results {
  display: none;
  max-width: 700px;
  margin: 0 auto 3rem;
  scroll-margin-top: 100px;
}
.results-card {
  text-align: center;
  padding: 2.5rem 2rem;
  border-radius: 14px;
  margin-bottom: 1.5rem;
}
.results-card.passed { background: var(--green-light); border: 2px solid var(--green); }
.results-card.failed { background: var(--amber-light); border: 2px solid var(--amber); }
.results-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.results-card h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: 0.5rem; }
.score-big { font-size: 4rem; font-weight: 900; line-height: 1; margin: 0.5rem 0; }
.results-card.passed .score-big { color: var(--green); }
.results-card.failed .score-big { color: var(--amber); }
.score-sub { font-size: 1rem; color: var(--gray-500); }

.comp-breakdown {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.comp-breakdown h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1.2rem; }
.comp-score { margin-bottom: 1rem; }
.comp-score-label { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 0.3rem; color: var(--gray-700); }
.comp-score-bar { height: 8px; background: var(--gray-100); border-radius: 100px; overflow: hidden; }
.comp-score-fill { height: 100%; border-radius: 100px; transition: width 0.6s ease; }

.review-note { text-align: center; font-size: 0.9rem; color: var(--gray-500); margin-bottom: 1rem; }

/* Email Gate */
.email-gate {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
  text-align: center;
  border: 2px solid var(--blue);
}
.email-gate-icon { font-size: 2.5rem; margin-bottom: 0.8rem; }
.email-gate h3 { font-size: 1.15rem; font-weight: 800; margin-bottom: 0.5rem; color: var(--gray-900); }
.email-gate p { font-size: 0.9rem; color: var(--gray-500); margin-bottom: 1.3rem; line-height: 1.5; max-width: 480px; margin-left: auto; margin-right: auto; }
.email-gate-form { display: flex; gap: 0.5rem; max-width: 440px; margin: 0 auto 0.5rem; }
.email-gate-form input {
  flex: 1; padding: 0.7rem 1rem;
  border: 1.5px solid var(--gray-200); border-radius: 7px;
  font-size: 0.95rem; outline: none;
  transition: border-color 0.15s;
}
.email-gate-form input:focus { border-color: var(--blue); }
.email-gate-form button {
  padding: 0.7rem 1.2rem;
  background: var(--blue); color: var(--white);
  border: none; border-radius: 7px;
  font-size: 0.9rem; font-weight: 700;
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s;
}
.email-gate-form button:hover:not(:disabled) { background: var(--blue-dark); }
.email-gate-form button:disabled { opacity: 0.6; cursor: default; }
.email-error { color: var(--red); font-size: 0.82rem; margin-top: 0.3rem; }
.email-skip { margin-top: 0.7rem; font-size: 0.8rem; }
.email-skip a { color: var(--gray-400); }
.email-skip a:hover { color: var(--gray-600); }

/* Mobile */
@media (max-width: 768px) {
  .quiz-layout { grid-template-columns: 1fr; }
  .quiz-sidebar { display: none; }
  .quiz-header { padding: 0.6rem 1rem; }
  .quiz-main { padding: 1rem 0.75rem 3rem; }
  .question-card { padding: 1.1rem; }
}
