/* ═══════════════════════════════════════════════
   NISM Series VA – MCQ Practice App
   Light Theme · Premium Design
   ═══════════════════════════════════════════════ */

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

/* ── Design Tokens ─────────────────────────────── */
:root {
  --primary:        #2563eb;
  --primary-dark:   #1d4ed8;
  --primary-light:  #eff6ff;
  --primary-mid:    #bfdbfe;
  --accent:         #0ea5e9;
  --success:        #16a34a;
  --success-light:  #dcfce7;
  --danger:         #dc2626;
  --danger-light:   #fee2e2;
  --warning:        #d97706;
  --warning-light:  #fef3c7;
  --neutral:        #64748b;
  --neutral-light:  #f1f5f9;

  --bg:             #f8fafc;
  --surface:        #ffffff;
  --surface-raised: #ffffff;
  --border:         #e2e8f0;
  --border-focus:   #93c5fd;

  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;

  --shadow-sm:  0 1px 3px rgba(15,23,42,0.08), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md:  0 4px 12px rgba(15,23,42,0.10), 0 2px 4px rgba(15,23,42,0.06);
  --shadow-lg:  0 10px 30px rgba(15,23,42,0.12), 0 4px 8px rgba(15,23,42,0.06);
  --shadow-xl:  0 20px 50px rgba(15,23,42,0.15);

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  --font: 'Inter', sans-serif;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Screen System ──────────────────────────────── */
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }
.hidden { display: none !important; }

/* ══════════════════════════════════════════════════
   SETUP SCREEN
   ══════════════════════════════════════════════════ */
#screen-setup {
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 50%, #e0f2fe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  min-height: 100vh;
}

.setup-container {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Logo Area */
.logo-area {
  text-align: center;
}

.logo-icon {
  font-size: 56px;
  margin-bottom: 12px;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(37,99,235,0.3));
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.logo-area h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 400;
  margin-bottom: 14px;
}

.question-bank-info {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--primary-light);
  border: 1px solid var(--primary-mid);
  color: var(--primary);
  padding: 8px 18px;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 600;
}

#total-questions-available {
  font-weight: 800;
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
  padding-right: 12px;
  border-right: 2px solid var(--primary-mid);
}

.qbi-text {
  text-align: left;
  line-height: 1.4;
}

/* Setup Card */
.setup-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.setup-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Chips */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.chip.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

/* Toggle */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--neutral-light);
  border-radius: var(--radius-md);
}

.toggle-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  cursor: pointer;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-knob {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 100px;
  transition: var(--transition);
}

.toggle-knob::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-knob { background: var(--primary); }
.toggle-switch input:checked + .toggle-knob::before { transform: translateX(20px); }

/* Start Button */
.btn-start {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(37,99,235,0.35);
  letter-spacing: 0.01em;
}

.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37,99,235,0.45);
}

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

/* ══════════════════════════════════════════════════
   QUIZ SCREEN
   ══════════════════════════════════════════════════ */
#screen-quiz {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

#screen-quiz.active {
  display: flex;
}

/* Header */
.quiz-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(248,250,252,0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.quiz-progress-area {
  flex: 1;
  min-width: 0;
}

.progress-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.progress-bar-track {
  height: 6px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 100px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Timer */
.timer-area {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 14px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  transition: var(--transition);
  white-space: nowrap;
}

.timer-area.warning { border-color: var(--warning); color: var(--warning); background: var(--warning-light); }
.timer-area.danger  { border-color: var(--danger);  color: var(--danger);  background: var(--danger-light);  animation: pulse 1s ease infinite; }

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

/* Quiz Body */
.quiz-body {
  flex: 1;
  padding: 24px 20px 16px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Question Card */
.question-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  animation: slideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.question-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.question-badge {
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 100px;
}

.paper-tag {
  background: var(--neutral-light);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid var(--border);
}

.question-text {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.65;
  margin-bottom: 22px;
}

/* Options */
.options-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  width: 100%;
  font-family: var(--font);
}

.option-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateX(3px);
}

.option-label {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--neutral-light);
  border: 2px solid var(--border);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.option-btn:hover:not(:disabled) .option-label {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.option-text {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

.option-btn.correct {
  border-color: var(--success);
  background: var(--success-light);
  color: var(--success);
}

.option-btn.correct .option-label {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.option-btn.wrong {
  border-color: var(--danger);
  background: var(--danger-light);
  color: var(--danger);
}

.option-btn.wrong .option-label {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.option-btn.show-answer:not(.correct):not(.wrong) {
  opacity: 0.55;
}

.option-btn:disabled { cursor: not-allowed; }

/* Nav Buttons */
.quiz-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.btn-nav {
  padding: 11px 24px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-nav:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.btn-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-nav-next {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-nav-next:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
  transform: translateX(3px);
}

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

.btn-skip {
  padding: 11px 20px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-skip:hover {
  border-color: var(--warning);
  color: var(--warning);
  background: var(--warning-light);
}

/* Question Dots */
.question-dots-wrapper {
  overflow-x: auto;
  padding: 4px 0;
}

.question-dots-wrapper::-webkit-scrollbar { height: 4px; }
.question-dots-wrapper::-webkit-scrollbar-track { background: transparent; }
.question-dots-wrapper::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.question-dots {
  display: flex;
  gap: 6px;
  padding: 4px;
  min-width: max-content;
}

.q-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--neutral-light);
  border: 2px solid var(--border);
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.q-dot:hover { border-color: var(--primary); color: var(--primary); }
.q-dot.current { border-color: var(--primary); background: var(--primary); color: #fff; }
.q-dot.answered { background: var(--success-light); border-color: var(--success); color: var(--success); }
.q-dot.skipped { background: var(--warning-light); border-color: var(--warning); color: var(--warning); }

/* Quiz Footer */
.quiz-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  justify-content: center;
}

.btn-submit-quiz {
  padding: 12px 36px;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(220,38,38,0.35);
}

.btn-submit-quiz:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(220,38,38,0.45);
}

/* ══════════════════════════════════════════════════
   RESULTS SCREEN
   ══════════════════════════════════════════════════ */
#screen-results {
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 60%, #e0f2fe 100%);
  padding: 32px 16px;
}

.results-container {
  max-width: 720px;
  margin: 0 auto;
}

.results-header {
  text-align: center;
  margin-bottom: 32px;
}

/* Score Ring */
.score-circle-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 20px;
}

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

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

.score-ring-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-ring-fill.pass { stroke: var(--success); }
.score-ring-fill.fail { stroke: var(--danger); }

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

.score-percent {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.score-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.results-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 20px;
}

/* Stats */
.results-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.stat-box {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  min-width: 90px;
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-name {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.stat-box.correct .stat-number { color: var(--success); }
.stat-box.wrong   .stat-number { color: var(--danger); }
.stat-box.skipped .stat-number { color: var(--warning); }
.stat-box.time-taken .stat-number { color: var(--primary); }

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

.btn-action {
  padding: 11px 22px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
}

.btn-action:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-review { border-color: var(--primary); color: var(--primary); }
.btn-retry  { border-color: var(--success); color: var(--success); }
.btn-home   { border-color: var(--neutral); color: var(--neutral); }

/* Review Section */
.review-section {
  margin-top: 32px;
}

.review-filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.review-filter {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.review-filter.active,
.review-filter:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.review-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.review-item {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

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

.review-status-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 100px;
}

.review-status-badge.correct { background: var(--success-light); color: var(--success); }
.review-status-badge.wrong   { background: var(--danger-light);  color: var(--danger);  }
.review-status-badge.skipped { background: var(--warning-light); color: var(--warning); }

.review-q-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.review-paper-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--neutral-light);
  padding: 2px 8px;
  border-radius: 100px;
}

.review-question {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 14px;
}

.review-answers {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.review-answer-box {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.4;
}

.review-answer-box strong { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 3px; }

.correct-answer { background: var(--success-light); color: var(--success); border-left: 3px solid var(--success); }
.your-answer    { background: var(--danger-light);  color: var(--danger);  border-left: 3px solid var(--danger);  }

/* ══════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(16px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

.modal-box h3 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 10px;
}

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

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

.btn-modal {
  padding: 10px 24px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-modal-cancel {
  border: 2px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
}

.btn-modal-cancel:hover { border-color: var(--neutral); background: var(--neutral-light); }

.btn-modal-confirm {
  border: none;
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 12px rgba(220,38,38,0.3);
}

.btn-modal-confirm:hover { background: #b91c1c; transform: translateY(-1px); }

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 600px) {
  .setup-card { padding: 22px 18px; }
  .logo-area h1 { font-size: 1.7rem; }
  .question-card { padding: 20px 16px; }
  .quiz-body { padding: 16px 12px 8px; }
  .results-stats { gap: 8px; }
  .stat-number { font-size: 1.5rem; }

  /* ── Nav: Skip on top (full width), Prev + Next side by side below ── */
  .quiz-nav {
    display: grid;
    grid-template-areas:
      "skip skip"
      "prev next";
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .nav-center { grid-area: skip; justify-content: center; }
  #btn-prev   { grid-area: prev; }
  #btn-next   { grid-area: next; }

  .btn-skip {
    width: 100%;
    text-align: center;
  }

  .btn-nav {
    width: 100%;
    text-align: center;
    padding: 11px 8px;
    font-size: 0.82rem;
  }

  /* ── Question dots: smaller + scrollable ── */
  .q-dot {
    width: 24px;
    height: 24px;
    font-size: 0.6rem;
  }

  .question-dots { gap: 4px; padding: 2px; }

  .question-dots-wrapper {
    margin: 0 -12px;
    padding: 4px 12px;
  }
}
