/* ════════════════════════════════════════════════════════
   Take Quiz — Full Exam Layout
   ════════════════════════════════════════════════════════ */

.quiz-page {
  min-height: 100vh;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
}

/* Loading / Error / Success states */
.loading-center { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 80vh; gap: 16px; }
.loading-text { font-size: 14px; color: var(--text-muted); }
.error-state, .success-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 80vh; gap: 16px; text-align: center; }
.error-state h2, .success-state h2 { color: var(--text-primary); font-size: 22px; margin: 0; }
.success-state p { color: var(--text-muted); }

/* ════════════════════════════════════════════════════════
   Top Header Bar
   ════════════════════════════════════════════════════════ */

.quiz-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.quiz-brand {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.brand-icon {
  font-size: 22px !important;
  color: var(--accent-primary);
}
.brand-name {
  font-size: 16px; font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

.topbar-divider {
  width: 1px; height: 28px;
  background: var(--border-color);
}

.quiz-title-block {}
.quiz-title-text {
  font-size: 15px; font-weight: 700;
  color: var(--text-primary); margin: 0 0 2px;
}
.quiz-subtitle {
  font-size: 12px; color: var(--text-muted);
}

.topbar-right { display: flex; align-items: center; gap: 10px; }

/* Violation Badge */
.violation-badge {
  display: flex; align-items: center; gap: 6px;
  background: var(--warning-light); border: 1px solid var(--warning-border);
  color: var(--warning); padding: 7px 14px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 700; transition: all 0.3s;
}
.violation-badge .material-symbols-rounded { font-size: 16px; }
.violation-badge.critical {
  background: var(--danger-light); border-color: var(--danger-border);
  color: var(--danger); animation: pulse 1s infinite;
}

/* Fullscreen indicator */
.fullscreen-indicator {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-md);
  border: 1px solid var(--border-color); background: var(--bg-tertiary);
  color: var(--text-muted); transition: all 0.3s; cursor: default;
}
.fullscreen-indicator.active {
  border-color: var(--success-border); background: var(--success-light); color: var(--success);
}
.fullscreen-indicator .material-symbols-rounded { font-size: 18px; }

/* Timer */
.timer {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  padding: 8px 18px; border-radius: var(--radius-md); transition: all 0.3s;
}
.timer .material-symbols-rounded { font-size: 18px; color: var(--text-muted); }
.timer.warning { border-color: var(--warning-border); background: var(--warning-light); }
.timer.danger  { border-color: var(--danger-border);  background: var(--danger-light);  animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.7; } }
.timer-value { color: var(--text-primary); font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer.warning .timer-value { color: var(--warning); }
.timer.danger  .timer-value { color: var(--danger); }

/* Progress Bar (thin strip under header) */
.quiz-progress-bar {
  width: 100%; height: 3px;
  background: var(--bg-tertiary); flex-shrink: 0;
}
.quiz-progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  transition: width 0.4s ease;
}

/* ════════════════════════════════════════════════════════
   3-Column Exam Layout
   ════════════════════════════════════════════════════════ */

.exam-layout {
  display: grid;
  grid-template-columns: 240px 1fr 260px;
  gap: 0;
  flex: 1;
  min-height: 0;
  align-items: start;
}

/* ── Shared Panel Card ── */
.left-panel-card,
.right-panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.right-panel-card { gap: 12px; }

.panel-section-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--text-muted);
}

/* ════════════════════════════════════════════════════════
   Left Panel
   ════════════════════════════════════════════════════════ */

.exam-left-panel {
  padding: 20px 14px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 52px;  /* height of topbar + progress bar */
}

.info-stat {
  display: flex; align-items: center; gap: 12px;
}
.info-stat-icon {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.info-stat-icon .material-symbols-rounded { font-size: 20px; }
.info-stat-icon.blue   { background: var(--accent-primary-light); }
.info-stat-icon.blue .material-symbols-rounded { color: var(--accent-primary); }
.info-stat-icon.green  { background: var(--success-light); }
.info-stat-icon.green .material-symbols-rounded { color: var(--success); }
.info-stat-icon.orange { background: var(--warning-light); }
.info-stat-icon.orange .material-symbols-rounded { color: var(--warning); }
.info-stat-icon.purple { background: rgba(124, 92, 252, 0.12); }
.info-stat-icon.purple .material-symbols-rounded { color: #7c5cfc; }

.info-stat-value {
  font-size: 20px; font-weight: 700; color: var(--text-primary); line-height: 1;
}
.info-stat-label {
  font-size: 11px; color: var(--text-muted); margin-top: 2px;
}
.warn-text   { color: var(--warning) !important; }
.danger-text { color: var(--danger) !important; }

/* Completion bar */
.progress-card { }
.completion-bar-wrap {
  display: flex; align-items: center; gap: 10px;
}
.completion-bar-track {
  flex: 1; height: 8px; border-radius: 99px;
  background: var(--bg-tertiary); overflow: hidden;
}
.completion-bar-fill {
  height: 100%; border-radius: 99px;
  background: var(--accent-gradient);
  transition: width 0.4s ease;
}
.completion-pct {
  font-size: 12px; font-weight: 700; color: var(--text-secondary);
  white-space: nowrap;
}
.completion-hint {
  font-size: 11px; color: var(--text-muted); margin: 0; line-height: 1.5;
}

/* ════════════════════════════════════════════════════════
   Center — Main Question Area
   ════════════════════════════════════════════════════════ */

.exam-main {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: calc(100vh - 56px);
}

/* Question Card */
.question-card { margin: 0; }
.q-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 18px;
  flex-wrap: wrap;
}
.q-badge {
  background: var(--accent-primary-light); color: var(--accent-primary);
  padding: 5px 12px; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 13px;
}
.q-counter-inline {
  margin-left: auto;
  font-size: 12px; color: var(--text-muted); font-weight: 500;
}
.q-text {
  color: var(--text-primary); font-size: 17px; font-weight: 600;
  line-height: 1.65; margin: 0 0 24px;
}

.options-list { display: flex; flex-direction: column; gap: 10px; }
.option-btn {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 14px 18px;
  background: var(--bg-input); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); color: var(--text-primary);
  font-size: 14px; cursor: pointer;
  transition: all 0.2s; text-align: left; font-family: inherit;
}
.option-btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.option-btn.selected {
  background: var(--accent-primary-light);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(79, 110, 247, 0.15);
}
.option-letter {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: var(--bg-tertiary); display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
  color: var(--text-secondary); transition: all 0.2s;
}
.option-btn.selected .option-letter { background: var(--accent-primary); color: #fff; }
.option-text { flex: 1; }
.check-icon  { color: var(--accent-primary); font-size: 20px; }

/* Navigation */
.quiz-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
}
.btn-submit {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; border-radius: var(--radius-md);
  background: var(--success); color: #fff; border: none;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: inherit;
}
.btn-submit:hover:not(:disabled) {
  background: color-mix(in srgb, var(--success) 85%, black);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.35);
}
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-submit .material-symbols-rounded { font-size: 18px; }
.w-full { width: 100%; justify-content: center; }

/* ════════════════════════════════════════════════════════
   Right Panel — Question Navigator
   ════════════════════════════════════════════════════════ */

.exam-right-panel {
  padding: 20px 20px 20px 14px;
  position: sticky;
  top: 52px;
}

/* Legend */
.nav-legend {
  display: flex; flex-direction: column; gap: 8px;
}
.legend-item {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-secondary);
}
.legend-dot {
  width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.legend-dot.answered  { background: var(--success-light); border: 1.5px solid var(--success-border); }
.legend-dot.active    { background: var(--accent-primary-light); border: 1.5px solid var(--accent-primary); }
.legend-dot.unanswered{ background: var(--bg-tertiary); border: 1.5px solid var(--border-color); }

.nav-divider {
  height: 1px; background: var(--border-color); margin: 2px 0;
}

/* Question Grid */
.question-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.grid-dot {
  width: 100%; aspect-ratio: 1;
  border-radius: 8px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
  transition: all 0.18s ease;
}
.grid-dot:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-primary-light);
  transform: scale(1.08);
}
.grid-dot.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
  box-shadow: 0 3px 10px rgba(79, 110, 247, 0.4);
  transform: scale(1.05);
}
.grid-dot.answered {
  background: var(--success-light);
  border-color: var(--success-border);
  color: var(--success);
}
.grid-dot.active.answered {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

.right-submit-wrap {
  margin-top: 4px;
}

/* ════════════════════════════════════════════════════════
   Anti-Cheat Warning Modal
   ════════════════════════════════════════════════════════ */

.ac-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; padding: 24px;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.ac-modal {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-xl);
  padding: 40px 36px; max-width: 460px; width: 100%;
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.ac-icon-wrap {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--warning-light); border: 2px solid var(--warning-border);
  display: flex; align-items: center; justify-content: center; transition: all 0.3s;
}
.ac-icon-wrap.danger { background: var(--danger-light); border-color: var(--danger-border); }
.ac-icon { font-size: 36px !important; color: var(--warning); }
.ac-icon-wrap.danger .ac-icon { color: var(--danger); }
.ac-title { color: var(--text-primary); font-size: 20px; font-weight: 700; margin: 0; line-height: 1.3; }
.ac-message { color: var(--text-secondary); font-size: 14px; line-height: 1.7; margin: 0; }

.ac-violation-dots { display: flex; gap: 10px; align-items: center; justify-content: center; }
.ac-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg-tertiary); border: 2px solid var(--border-color); transition: all 0.3s;
}
.ac-dot.filled { background: var(--danger); border-color: var(--danger); box-shadow: 0 0 8px rgba(239,68,68,0.4); }
.ac-dot-label { color: var(--text-muted); font-size: 12px; margin: -4px 0 0; }

.ac-dismiss-btn { width: 100%; justify-content: center; gap: 8px; font-size: 14px; padding: 12px 24px; border-radius: var(--radius-md); }
.ac-note { color: var(--text-muted); font-size: 12px; margin: 0; line-height: 1.5; }
.ac-submitting { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--text-muted); font-size: 14px; }

/* ════════════════════════════════════════════════════════
   Responsive
   ════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .exam-layout { grid-template-columns: 200px 1fr 220px; }
}

@media (max-width: 900px) {
  .exam-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .exam-left-panel,
  .exam-right-panel { position: static; padding: 16px; }
  .exam-left-panel  { order: 2; }
  .exam-main        { order: 1; padding: 16px; }
  .exam-right-panel { order: 3; }
  .left-panel-card, .right-panel-card { flex-direction: row; flex-wrap: wrap; gap: 12px; }
  .info-stat { flex: 1 1 120px; }
  .question-grid { grid-template-columns: repeat(8, 1fr); }
}

@media (max-width: 600px) {
  .quiz-topbar { padding: 10px 16px; gap: 10px; }
  .quiz-title-text { font-size: 13px; }
  .quiz-subtitle { display: none; }
  .q-text { font-size: 15px; }
  .exam-main { padding: 12px; }
  .quiz-nav { gap: 10px; }
  .quiz-nav .btn { font-size: 13px; padding: 8px 16px; }
  .question-grid { grid-template-columns: repeat(6, 1fr); }
  .ac-modal { padding: 28px 20px; }
}
