/* ============================================================
   CFA Level 2 — Vignette / Quiz UI Styles
   ============================================================ */

/* ============================================================
   VIGNETTE LAYOUT
   ============================================================ */
.vignette-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.vignette-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 0;
  flex: 1;
  min-height: 0;
}

/* Left Panel: Case */
.case-panel {
  border-right: 2px solid var(--border);
  height: calc(100vh - 64px - 56px);
  overflow-y: auto;
  padding: 32px;
  position: sticky;
  top: 64px;
  background: var(--bg-card);
}

/* Right Panel: Questions */
.questions-panel {
  height: calc(100vh - 64px - 56px);
  overflow-y: auto;
  padding: 28px;
  background: var(--bg);
}

/* ============================================================
   CASE HEADER
   ============================================================ */
.case-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

.case-topic-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 12px;
}

.case-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.3;
}

.case-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.case-meta-item {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ============================================================
   VIGNETTE NARRATIVE
   ============================================================ */
.vignette-text {
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text-primary);
  margin-bottom: 24px;
}

.vignette-text p {
  margin-bottom: 14px;
}

.vignette-text strong {
  font-weight: 700;
}

/* ============================================================
   EXHIBITS
   ============================================================ */
.exhibit-block {
  background: var(--neutral);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  overflow: hidden;
}

.exhibit-header {
  background: var(--primary);
  color: #fff;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.exhibit-table-wrap {
  overflow-x: auto;
}

.exhibit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-family: var(--font-mono);
}

.exhibit-table th {
  background: rgba(26, 35, 126, 0.06);
  padding: 9px 14px;
  text-align: right;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-family: var(--font-body);
  font-size: 12px;
}

.exhibit-table th:first-child {
  text-align: left;
}

.exhibit-table td {
  padding: 8px 14px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.exhibit-table td:first-child {
  text-align: left;
  font-weight: 500;
  font-family: var(--font-body);
}

.exhibit-table tr:last-child td {
  border-bottom: none;
}

.exhibit-table tr:hover td {
  background: rgba(26, 35, 126, 0.03);
}

.exhibit-table .row-total {
  font-weight: 700;
  background: rgba(26, 35, 126, 0.05);
}

.exhibit-table .row-subtotal {
  font-style: italic;
}

.exhibit-note {
  padding: 8px 16px;
  font-size: 11.5px;
  color: var(--text-muted);
  font-style: italic;
  border-top: 1px solid var(--border);
}

/* ============================================================
   QUESTIONS PANEL
   ============================================================ */
.questions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.questions-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.question-nav-dots {
  display: flex;
  gap: 6px;
}

.nav-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: all var(--transition);
}

.nav-dot.answered { background: var(--primary); }
.nav-dot.current { background: var(--accent); transform: scale(1.3); }
.nav-dot.correct { background: var(--success); }
.nav-dot.incorrect { background: var(--error); }

/* ============================================================
   QUESTION CARD
   ============================================================ */
.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  transition: all var(--transition);
}

.question-number {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

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

/* ============================================================
   ANSWER CHOICES
   ============================================================ */
.answer-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.answer-choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-card);
}

.answer-choice:hover:not(.disabled) {
  border-color: var(--accent);
  background: rgba(2, 136, 209, 0.04);
}

.answer-choice.selected {
  border-color: var(--primary);
  background: rgba(26, 35, 126, 0.05);
}

.answer-choice.correct {
  border-color: var(--success);
  background: var(--success-light);
}

.answer-choice.incorrect {
  border-color: var(--error);
  background: var(--error-light);
}

.answer-choice.correct-highlight {
  border-color: var(--success);
  background: var(--success-light);
  animation: pulse-green 0.4s ease;
}

.answer-choice.disabled {
  cursor: default;
}

.choice-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--neutral);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: all var(--transition);
}

.answer-choice.selected .choice-letter {
  background: var(--primary);
  color: #fff;
}

.answer-choice.correct .choice-letter,
.answer-choice.correct-highlight .choice-letter {
  background: var(--success);
  color: #fff;
}

.answer-choice.incorrect .choice-letter {
  background: var(--error);
  color: #fff;
}

.choice-text {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
  flex: 1;
}

/* ============================================================
   EXPLANATION BLOCK
   ============================================================ */
.explanation-block {
  margin-top: 16px;
  padding: 18px;
  background: rgba(26, 35, 126, 0.04);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  display: none;
  animation: slideDown 0.25s ease;
}

.explanation-block.show {
  display: block;
}

.explanation-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.explanation-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.explanation-los {
  font-size: 11px;
  background: var(--primary);
  color: #fff;
  padding: 2px 8px;
  border-radius: 100px;
}

.explanation-text {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-primary);
}

.explanation-formula {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
}

/* ============================================================
   QUESTION CONTROLS
   ============================================================ */
.question-controls {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  justify-content: flex-end;
}

.btn-submit-answer {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-submit-answer:hover:not(:disabled) {
  background: var(--primary-light);
}

.btn-submit-answer:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================
   VIGNETTE PROGRESS BAR (top)
   ============================================================ */
.vignette-progress-bar {
  height: 56px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 64px;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.vignette-num {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.progress-track {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}

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

.timer-display {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  background: linear-gradient(180deg, rgba(26,35,126,0.04), rgba(26,35,126,0.08));
  border: 1px solid rgba(26,35,126,0.12);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
}

.timer-display.warning {
  color: var(--warning);
  background: linear-gradient(180deg, rgba(230,81,0,0.08), rgba(230,81,0,0.14));
  border-color: rgba(230,81,0,0.2);
}

.timer-display.danger {
  color: var(--error);
  background: linear-gradient(180deg, rgba(198,40,40,0.08), rgba(198,40,40,0.14));
  border-color: rgba(198,40,40,0.24);
  animation: blink 1s step-end infinite;
}

.btn-end-exam {
  background: var(--error);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-end-exam:hover { opacity: 0.85; }

.btn-next-vignette {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-next-vignette:hover { background: var(--primary-light); }
.btn-next-vignette:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   RESULTS PAGE
   ============================================================ */
.results-hero {
  background: linear-gradient(135deg, var(--primary) 0%, #283593 100%);
  color: #fff;
  padding: 48px 0;
  text-align: center;
}

.score-circle {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 8px solid rgba(255,255,255,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  position: relative;
}

.score-number {
  font-size: 48px;
  font-weight: 900;
  line-height: 1;
}

.score-label {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  margin-top: 4px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  max-width: 800px;
  margin: 24px auto 0;
  padding: 0 24px;
}

.result-stat {
  text-align: center;
}

.result-stat-value {
  font-size: 28px;
  font-weight: 800;
}

.result-stat-label {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  margin-top: 4px;
}

/* ============================================================
   TOPIC BREAKDOWN TABLE
   ============================================================ */
.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.review-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(26,35,126,0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.review-answer-option {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.4);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
}

.breakdown-table th {
  text-align: left;
  padding: 10px 16px;
  background: var(--neutral);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.breakdown-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.breakdown-bar-cell {
  width: 200px;
}

.breakdown-bar {
  height: 8px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}

.breakdown-bar-fill {
  height: 100%;
  border-radius: 100px;
}

/* ============================================================
   FORMULA SHEET
   ============================================================ */
.formula-section {
  margin-bottom: 40px;
}

.formula-section-title {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.formula-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 12px;
  transition: all var(--transition);
}

.formula-card:hover {
  box-shadow: var(--shadow-md);
}

.formula-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.formula-render {
  padding: 14px;
  background: var(--neutral);
  border-radius: var(--radius-sm);
  text-align: center;
  margin-bottom: 10px;
  overflow-x: auto;
}

.formula-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.formula-variables {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================================
   ANALYTICS PAGE
   ============================================================ */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.analytics-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.analytics-card h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.chart-container {
  position: relative;
  height: 260px;
}

.analytics-card canvas,
.chart-container canvas {
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(26,35,126,0.01), rgba(26,35,126,0.03));
}

/* ============================================================
   LOADING / MODAL STATES
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s;
}

.modal-overlay.show { opacity: 1; }

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 36px;
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  transform: scale(0.96);
  transition: transform 0.25s;
}

.modal-overlay.show .modal-box { transform: scale(1); }

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

.modal-body {
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}

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

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-green {
  0% { transform: scale(1); }
  50% { transform: scale(1.01); box-shadow: 0 0 0 4px rgba(46,125,50,0.2); }
  100% { transform: scale(1); }
}

@keyframes blink {
  50% { opacity: 0.4; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
