/* ==========================================================================
   PATHASHALA — Exam Take (real-time lockdown exam experience)
   One question at a time + a right-side question navigator, fullscreen
   lockdown, and violation warnings. Kept in its own file since it's specific
   to Views/Exam/Take.cshtml, same convention as flipbook.css. Everything
   reads the shared design tokens so it follows light/dark mode for free.
   ========================================================================== */

/* Immersive lockdown chrome — hides the topbar, sidebar and mobile menu trigger so the
   only way to interact with the app is through the exam itself (mirrors book-immersive's
   header hiding, but also removes the sidebar since that's a real "leave the exam" escape
   hatch that the flipbook viewer doesn't need to worry about). */
body.exam-immersive header,
body.exam-immersive .ps-sidebar,
body.exam-immersive .offcanvas {
  display: none !important;
}
body.exam-immersive .container-fluid.exam-lockdown {
  max-width: 100% !important;
}

.ps-exam-shell {
  display: flex;
  gap: var(--sp-5);
  align-items: flex-start;
}

.ps-exam-main {
  flex: 1 1 auto;
  min-width: 0;
}

.ps-exam-nav-panel {
  flex: 0 0 220px;
  position: sticky;
  top: var(--sp-4);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--sp-4);
}

.ps-exam-nav-panel h6 {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-muted);
  margin-bottom: var(--sp-3);
}

.ps-exam-nav-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--ink-secondary);
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}
.ps-exam-nav-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ps-exam-nav-legend i {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0;
}
.ps-exam-nav-legend .dot-answered { background: var(--status-success); }
.ps-exam-nav-legend .dot-unanswered { background: var(--bg-surface-muted); border: 1px solid var(--border-strong); }
.ps-exam-nav-legend .dot-current { background: var(--primary); }

.ps-exam-qgrid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.ps-exam-qnum {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-muted);
  color: var(--ink-secondary);
  font-weight: 600;
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.ps-exam-qnum:hover { transform: scale(1.06); }
.ps-exam-qnum.is-answered {
  background: var(--status-success-tint);
  border-color: var(--status-success);
  color: var(--status-success);
}
.ps-exam-qnum.is-current {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-raised);
}

.ps-exam-question-card {
  display: none;
}
.ps-exam-question-card.is-active {
  display: block;
  animation: psExamFadeIn .25s var(--ease-out) both;
}
@keyframes psExamFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ps-exam-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}
.ps-exam-controls .ps-exam-progress-text {
  color: var(--ink-secondary);
  font-size: var(--fs-sm);
}

/* ---- Start gate — shown before the student enters the fullscreen exam ---- */
.ps-exam-start-gate {
  max-width: 560px;
  margin: var(--sp-6) auto;
  text-align: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raised);
  padding: var(--sp-6);
}
.ps-exam-start-gate ul {
  text-align: left;
  color: var(--ink-secondary);
  font-size: var(--fs-sm);
  margin: var(--sp-4) 0;
}

/* ---- Violation warning overlay — shown when fullscreen/focus is lost ---- */
.ps-exam-violation-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(11, 18, 32, 0.72);
  backdrop-filter: blur(2px);
}
.ps-exam-violation-overlay.is-visible { display: flex; }
.ps-exam-violation-card {
  max-width: 420px;
  text-align: center;
  background: var(--bg-surface);
  border: 1px solid var(--status-danger);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-overlay);
  padding: var(--sp-5);
}
.ps-exam-violation-card .ps-exam-violation-icon {
  font-size: 2rem;
  color: var(--status-danger);
  margin-bottom: var(--sp-2);
}

@media (max-width: 767.98px) {
  .ps-exam-shell { flex-direction: column; }
  .ps-exam-nav-panel { position: static; flex-basis: auto; width: 100%; order: -1; }
  .ps-exam-qgrid { grid-template-columns: repeat(8, 1fr); }
}
