/* ===== Exam Page — Light Medical Theme ===== */

.exam-page {
  min-height: 100vh;
  background: var(--bg-body);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  padding-bottom: 3rem;
}

.exam-page img {
  max-width: 100%;
}

.exam-hero-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.exam-hero-footer .exam-meta {
  margin-top: 0;
}

.exam-lang-switcher {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
}

@media (max-width: 576px) {
  .exam-hero-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .exam-lang-switcher {
    margin-left: 0;
    justify-content: flex-end;
  }
}

/* --- Hero --- */

.exam-hero {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 1.75rem;
  box-shadow: 0 4px 24px rgba(8, 145, 178, 0.08);
  margin-bottom: 1.5rem;
}

.exam-hero-image {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 1.25rem;
  box-shadow: 0 6px 20px rgba(8, 145, 178, 0.15);
}

.exam-hero-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--primary-gradient);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(8, 145, 178, 0.25);
  margin-bottom: 0.75rem;
}

.exam-hero-icon i {
  color: #fff;
  font-size: 26px;
}

.exam-hero-title {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.exam-hero-description {
  color: var(--text-secondary);
  font-size: 0.975rem;
  line-height: 1.55;
}

.exam-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.exam-meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 999px;
  font-size: 0.825rem;
  font-weight: 600;
}

.exam-meta-badge i {
  font-size: 0.9rem;
}

/* --- Timer --- */

.exam-timer-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 0.75rem 1rem;
  box-shadow: 0 4px 18px rgba(8, 145, 178, 0.1);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.exam-timer-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.95rem;
}

.exam-timer-label i {
  color: var(--primary);
}

.exam-timer-digits {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-variant-numeric: tabular-nums;
}

.exam-timer-digits .digit {
  min-width: 44px;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
}

.exam-timer-digits .sep {
  color: var(--text-muted);
  font-weight: 700;
}

.exam-timer-bar.is-unpinned {
  position: static;
}

.exam-timer-pin {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--card-border);
  background: var(--input-bg);
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition-speed);
  padding: 0;
  flex-shrink: 0;
}

.exam-timer-pin:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.exam-timer-pin.is-pinned {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.exam-timer-pin.is-pinned:hover {
  filter: brightness(1.05);
}

.exam-timer-pin .fa-thumb-tack {
  transition: transform var(--transition-speed);
}

.exam-timer-pin:not(.is-pinned) .fa-thumb-tack {
  transform: rotate(45deg);
  opacity: 0.7;
}

.exam-timer-bar.is-warning {
  background: #fff7ed;
  border-color: #fed7aa;
}

.exam-timer-bar.is-warning .digit {
  background: #ffedd5;
  border-color: #fdba74;
  color: #9a3412;
}

.exam-timer-bar.is-warning .exam-timer-label,
.exam-timer-bar.is-warning .exam-timer-label i {
  color: #9a3412;
}

/* --- Cards --- */

.exam-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(8, 145, 178, 0.06);
  margin-bottom: 1.25rem;
  transition: box-shadow 0.25s ease, transform 0.2s ease;
}

.exam-card:hover {
  box-shadow: 0 6px 28px rgba(8, 145, 178, 0.1);
}

.exam-card-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.exam-card-title i {
  color: var(--primary);
}

/* --- Participant card --- */

.participant-input {
  border-radius: 10px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-primary);
  padding: 0.65rem 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.participant-input:focus {
  outline: none;
  border-color: var(--input-focus-border);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
  background: #fff;
}

.participant-label {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 0.35rem;
}

/* --- Question card --- */

.question-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(8, 145, 178, 0.06);
  margin-bottom: 1.25rem;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.question-card.is-answered {
  border-color: var(--primary-light);
}

.question-card.is-invalid {
  border-color: #dc3545;
  box-shadow: 0 4px 20px rgba(220, 53, 69, 0.15);
}

.question-card.is-invalid .answers-panel {
  border-color: #fca5a5;
  background: linear-gradient(180deg, #fff5f5 0%, #fff0f0 100%);
}

.question-card.is-invalid .question-number {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  box-shadow: 0 3px 10px rgba(220, 38, 38, 0.3);
}

.answers-panel .invalid-feedback {
  color: #dc2626;
  font-weight: 500;
  margin-top: 0.5rem;
  display: block;
}

.participant-input.is-invalid {
  border-color: #dc3545;
  background: #fff;
}

.participant-input.is-invalid:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

.question-header {
  display: flex;
  gap: 0.85rem;
  margin-bottom: 1rem;
  align-items: flex-start;
}

.question-number-wrap {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
}

.question-number {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-gradient);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 3px 10px rgba(8, 145, 178, 0.25);
}

.question-required-asterisk {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35);
  cursor: help;
}

.question-body {
  flex: 1;
  min-width: 0;
}

.question-content {
  color: var(--text-primary);
  font-size: 1.05rem;
  line-height: 1.55;
  word-break: break-word;
}

.question-required {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: #b91c1c;
  font-weight: 600;
  margin-top: 0.4rem;
}

.question-image {
  display: block;
  margin: 0 auto 1rem;
  max-height: 260px;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(8, 145, 178, 0.1);
}

/* --- Question panel --- */

.question-panel {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  box-shadow: 0 4px 16px rgba(8, 145, 178, 0.12);
}

.question-panel .question-content {
  margin: 0;
}

/* --- Answers panel --- */

.answers-panel {
  background: linear-gradient(180deg, #f8fafc 0%, #f0f9ff 100%);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1rem;
  margin-top: 1rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 4px 14px rgba(8, 145, 178, 0.1);
}

.answers-panel > *:last-child {
  margin-bottom: 0;
}

/* --- Answer options (close type) --- */

.answer-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: var(--input-bg);
  margin-bottom: 0.6rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.answer-option:hover {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 3px 10px rgba(8, 145, 178, 0.08);
}

.answer-option input[type="radio"],
.answer-option input[type="checkbox"] {
  margin-top: 0.2rem;
  accent-color: var(--primary);
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.answer-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 3px 12px rgba(8, 145, 178, 0.18);
}

.answer-option-body {
  flex: 1;
  min-width: 0;
  color: var(--text-primary);
  line-height: 1.5;
  word-break: break-word;
}

.answer-option-image {
  display: block;
  max-height: 140px;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

/* --- Open answer (textarea) --- */

.answer-open {
  width: 100%;
  min-height: 120px;
  padding: 0.8rem 1rem;
  border: 1px solid var(--input-border);
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 0.975rem;
  line-height: 1.55;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.answer-open:focus {
  outline: none;
  border-color: var(--input-focus-border);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
  background: #fff;
}

/* --- Submit bar --- */

.exam-submit-bar {
  display: flex;
  justify-content: center;
  padding-top: 1rem;
}

.btn-submit-exam {
  background: var(--primary-gradient);
  border: none;
  border-radius: 12px;
  padding: 0.85rem 2.25rem;
  font-weight: 600;
  color: #fff;
  font-size: 1.05rem;
  box-shadow: 0 6px 18px rgba(8, 145, 178, 0.3);
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-submit-exam:hover {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(8, 145, 178, 0.4);
}

.btn-submit-exam:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* --- Time warning alert --- */

.exam-warning {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  font-weight: 500;
  position: relative;
}

.exam-warning-body {
  flex: 1;
  min-width: 0;
}

.exam-warning-close {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: #9a3412;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0;
  flex-shrink: 0;
  transition: background var(--transition-speed);
}

.exam-warning-close:hover {
  background: rgba(154, 52, 18, 0.12);
}

.exam-warning > i {
  font-size: 1.15rem;
}

/* --- Submit Confirm Modal --- */

.exam-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: examModalFade 0.2s ease;
}

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

.exam-modal {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 2rem 1.75rem;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 20px 50px rgba(8, 145, 178, 0.25);
  text-align: center;
}

.exam-modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--primary-gradient);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(8, 145, 178, 0.3);
  margin-bottom: 1rem;
}

.exam-modal-icon i {
  color: #fff;
  font-size: 28px;
}

.exam-modal-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.exam-modal-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.exam-modal-summary {
  display: grid;
  gap: 0.5rem;
  text-align: left;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.exam-modal-summary:empty {
  display: none;
}

.exam-modal-summary .summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.exam-modal-summary .summary-row i {
  color: var(--primary);
  margin-right: 0.35rem;
}

.exam-modal-summary .summary-value {
  font-weight: 600;
  color: var(--text-primary);
}

.exam-modal-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.exam-modal .btn-submit-exam {
  box-shadow: 0 4px 14px rgba(8, 145, 178, 0.3);
}

/* --- Submitted screen --- */

.exam-submitted {
  background: var(--card-bg);
  border: 1px solid #bbf7d0;
  border-radius: 18px;
  padding: 3rem 1.5rem;
  text-align: center;
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.12);
}

.exam-submitted-icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
  margin-bottom: 1rem;
}

.exam-submitted-icon i {
  color: #fff;
  font-size: 38px;
}

.exam-submitted-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.exam-submitted-text {
  color: var(--text-secondary);
}

/* --- Score block --- */

.exam-score-block {
  margin: 1.25rem auto 0;
  max-width: 320px;
  padding: 1rem 1.25rem;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.exam-score-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.exam-score-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary-dark);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.exam-score-divider {
  color: var(--text-muted);
  font-weight: 500;
  margin: 0 0.25rem;
}

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

.exam-score-percent {
  margin-top: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.exam-score-status {
  margin-top: 0.65rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.exam-score-status.is-pass {
  background: #d1fae5;
  color: #065f46;
}

.exam-score-status.is-fail {
  background: #fee2e2;
  color: #991b1b;
}

/* --- Review mode (read-only, correct/incorrect markers) --- */

.exam-page.is-review #submitExamBtn,
.exam-page.is-review .exam-submit-bar {
  display: none !important;
}

.exam-page.is-review .answer-input {
  pointer-events: none;
}

.exam-page.is-review .participant-input {
  pointer-events: none;
  background: var(--input-bg);
}

.answer-option.is-correct {
  border-color: #10b981;
  background: #ecfdf5;
  box-shadow: 0 3px 12px rgba(16, 185, 129, 0.18);
}

.answer-option.is-correct .answer-option-body::after {
  content: "\f00c";
  font-family: FontAwesome;
  color: #065f46;
  margin-left: 0.5rem;
  font-weight: 900;
}

.answer-option.is-wrong {
  border-color: #dc2626;
  background: #fef2f2;
  box-shadow: 0 3px 12px rgba(220, 38, 38, 0.15);
}

.answer-option.is-wrong .answer-option-body::after {
  content: "\f00d";
  font-family: FontAwesome;
  color: #991b1b;
  margin-left: 0.5rem;
  font-weight: 900;
}

.question-score-badge {
  margin-left: auto;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 0.8rem;
  font-weight: 700;
}

.question-score-badge.is-fail {
  background: #fee2e2;
  color: #991b1b;
}

.question-score-badge.is-pass {
  background: #d1fae5;
  color: #065f46;
}

.question-header {
  align-items: center;
}

/* --- Responsive --- */

@media (max-width: 768px) {
  .exam-hero {
    padding: 1.25rem;
  }

  .exam-hero-title {
    font-size: 1.4rem;
  }

  .exam-hero-image {
    max-height: 220px;
  }

  .question-card,
  .exam-card {
    padding: 1.15rem;
  }

  .exam-timer-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  .exam-timer-digits {
    justify-content: center;
  }

  .btn-submit-exam {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .exam-timer-digits .digit {
    min-width: 38px;
    font-size: 1rem;
  }
}
