/* ──────────────────────────────────────────────────────────────────────────
   SRCH Candidate Exam Portal — Sky-Blue Theme
   Font: Inter (Google Fonts, loaded via <link> in HTML <head>)
   Icons: Font Awesome 6 (loaded via <link> in HTML <head>)
   ────────────────────────────────────────────────────────────────────────── */

:root {
  /* Sky-blue brand palette */
  --brand:         #0EA5E9;   /* Bright sky-blue accents */
  --brand-dark:    #0284C7;   /* Primary buttons, key accents */
  --brand-deeper:  #075985;   /* Top bar, strong text, headers */
  --brand-light:   #BAE6FD;   /* Soft borders, dividers */
  --brand-lighter: #E0F2FE;   /* Card highlights, soft fills */
  --brand-mid:     #38BDF8;   /* Mid accents, secondary borders */

  /* Semantic colours */
  --danger:        #DC2626;
  --danger-bg:     #FEE2E2;
  --danger-text:   #991B1B;
  --success:       #10B981;
  --success-bg:    #D1FAE5;
  --success-text:  #065F46;
  --warning:       #F59E0B;
  --warning-bg:    #FEF3C7;
  --warning-text:  #92400E;

  /* Text */
  --text:          #0F172A;
  --text-muted:    #64748B;

  /* Surface */
  --page-bg:       #F0F9FF;   /* Very light sky tint for the page background */
  --card-bg:       #FFFFFF;

  /* Shadows */
  --shadow-sm:     0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md:     0 4px 12px rgba(7, 89, 133, 0.08);
  --shadow-lg:     0 8px 24px rgba(7, 89, 133, 0.12);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--page-bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Top bar ──────────────────────────────────────────────────────────── */
.topbar {
  background: var(--brand-deeper);
  color: #fff;
  padding: 14px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.topbar-title h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.topbar-title p {
  font-size: 11px;
  opacity: 0.8;
  margin-top: 1px;
  letter-spacing: 0.02em;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
#topbar-user  { font-size: 13px; opacity: 0.9; font-weight: 500; }

/* ── Page container ──────────────────────────────────────────────────── */
.page { max-width: 960px; margin: 0 auto; padding: 26px 18px; }
.hidden { display: none !important; }

/* ── Cards ───────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 24px 26px;
  margin-bottom: 18px;
  border: 1px solid var(--brand-lighter);
  transition: box-shadow 0.2s ease;
}
.card:hover {
  /* Disabled to avoid distraction — re-enable if you want hover lift on every card
     box-shadow: var(--shadow-lg); */
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(1px); }

.btn-primary {
  background: var(--brand-dark);
  color: #fff;
  box-shadow: 0 1px 2px rgba(2, 132, 199, 0.25);
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-deeper);
  box-shadow: 0 2px 6px rgba(7, 89, 133, 0.35);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 1px 2px rgba(220, 38, 38, 0.25);
}
.btn-danger:hover:not(:disabled) {
  background: #B91C1C;
  box-shadow: 0 2px 6px rgba(153, 27, 27, 0.35);
}

.btn-success {
  background: var(--success);
  color: #fff;
  box-shadow: 0 1px 2px rgba(16, 185, 129, 0.25);
}
.btn-success:hover:not(:disabled) {
  background: #059669;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.35);
}

.btn-secondary {
  background: #fff;
  color: var(--brand-deeper);
  border: 1px solid var(--brand-light);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--brand-lighter);
  border-color: var(--brand-mid);
}

.btn-sm { padding: 6px 13px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Form controls ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--brand-deeper);
  letter-spacing: 0.01em;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--brand-light);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: all 0.15s ease;
  background: #fff;
  color: var(--text);
}
.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #94A3B8;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--brand-dark);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group select   { cursor: pointer; background-color: #fff; }

/* ── Section titles ──────────────────────────────────────────────────── */
.section-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--brand-deeper);
  border-left: 4px solid var(--brand-dark);
  padding-left: 12px;
  letter-spacing: -0.005em;
}

/* ── Tabs ────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 22px;
  border-bottom: 2px solid var(--brand-lighter);
  flex-wrap: wrap;
}
.tab-btn {
  padding: 10px 18px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.tab-btn:hover { color: var(--brand-deeper); }
.tab-btn.active {
  color: var(--brand-deeper);
  border-bottom-color: var(--brand-dark);
}

/* ── Tables ──────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  padding: 11px 14px;
  background: var(--brand-lighter);
  color: var(--brand-deeper);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--brand-light);
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--brand-lighter);
  vertical-align: top;
}
tr:hover td { background: rgba(224, 242, 254, 0.4); }

/* ── Badges ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.b-pass     { background: var(--success-bg); color: var(--success-text); }
.b-fail     { background: var(--danger-bg);  color: var(--danger-text); }
.b-pending  { background: var(--warning-bg); color: var(--warning-text); }
.b-dq       { background: var(--danger-bg);  color: var(--danger-text); }
.b-examiner { background: var(--brand-lighter); color: var(--brand-deeper); }

/* ── Timer bar ───────────────────────────────────────────────────────── */
.timer-bar {
  background: var(--card-bg);
  border: 1px solid var(--brand-light);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.timer-bar.sticky {
  position: sticky;
  top: 70px;
  z-index: 50;
  box-shadow: var(--shadow-md);
}
.timer-bar.sticky * {
  pointer-events: auto;
}
.timer-bar.sticky button {
  position: relative;
  z-index: 51;
}
.timer-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.timer-val {
  font-size: 24px;
  font-weight: 700;
  color: var(--brand-deeper);
  font-variant-numeric: tabular-nums;
}
.timer-val.warn { color: var(--danger); }
.progress-outer {
  background: var(--brand-lighter);
  border-radius: 4px;
  height: 8px;
  margin-top: 5px;
  width: 180px;
  overflow: hidden;
}
.progress-inner {
  background: var(--brand-dark);
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* ── MCQ Options ─────────────────────────────────────────────────────── */
.option-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.option-list li label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border: 1.5px solid var(--brand-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s ease;
  background: #fff;
}
.option-list li label:hover {
  background: var(--brand-lighter);
  border-color: var(--brand-mid);
}
.option-list li input[type=radio] {
  margin-top: 3px;
  accent-color: var(--brand-dark);
  cursor: pointer;
}
.option-list li.selected label {
  background: var(--brand-lighter);
  border-color: var(--brand-dark);
  box-shadow: 0 0 0 1px var(--brand-dark);
}

/* ── Question navigation pills ───────────────────────────────────────── */
.q-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 18px;
}
.q-nav button {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--brand-light);
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-deeper);
  transition: all 0.15s ease;
}
.q-nav button:hover { background: var(--brand-lighter); border-color: var(--brand-mid); }
.q-nav button.answered {
  background: var(--brand-dark);
  color: #fff;
  border-color: var(--brand-dark);
}
.q-nav button.current {
  border-color: var(--warning);
  outline: 2px solid var(--warning);
  outline-offset: 1px;
}

/* ── Violation banner ────────────────────────────────────────────────── */
.violation-banner {
  background: var(--danger-bg);
  border: 1.5px solid var(--danger);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  margin-bottom: 16px;
  color: var(--danger-text);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── A4 answer sheet (Short Answer) ──────────────────────────────────── */
.a4-shell {
  background: var(--brand-lighter);
  border-radius: var(--radius-lg);
  padding: 18px;
  border: 1px solid var(--brand-light);
}
.a4-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}
.a4-page-indicator {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-deeper);
}
.a4-page-nav { display: flex; gap: 6px; align-items: center; }
.a4-page-nav button {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--brand-mid);
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-deeper);
  transition: all 0.15s ease;
}
.a4-page-nav button:hover     { background: var(--brand-lighter); border-color: var(--brand-dark); }
.a4-page-nav button:disabled  { opacity: 0.4; cursor: not-allowed; }
.a4-paper {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(7, 89, 133, 0.12);
  border: 1px solid #C8D8E2;
  width: 100%;
  aspect-ratio: 210 / 297;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.a4-paper textarea {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  font-size: 14px;
  line-height: 32px;
  padding: 48px 56px 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: transparent;
  background-image: repeating-linear-gradient(
    transparent, transparent 31px,
    var(--brand-light) 31px, var(--brand-light) 32px);
  background-position: 0 48px;
}
.a4-paper-footer {
  background: var(--brand-lighter);
  border-top: 1px solid var(--brand-light);
  padding: 6px 14px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}
.a4-pages-strip {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.a4-thumb {
  width: 44px;
  height: 62px;
  border-radius: 3px;
  border: 2px solid var(--brand-light);
  background: #fff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.a4-thumb.active      { border-color: var(--brand-dark); color: var(--brand-dark); }
.a4-thumb.has-content { border-color: var(--brand-mid); }
.a4-thumb.add-page    {
  border-style: dashed;
  font-size: 20px;
  color: var(--brand-mid);
}
.a4-thumb.add-page:hover {
  border-color: var(--brand-dark);
  color: var(--brand-dark);
  background: var(--brand-lighter);
}

/* ── Modals ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 16px;
}
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 520px;
  width: 100%;
  border: 1px solid var(--brand-light);
  box-shadow: var(--shadow-lg);
}
.modal-center { text-align: center; }
.modal-center h2 {
  font-size: 20px;
  margin-bottom: 10px;
  color: var(--danger);
}
.modal-center p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
}
.modal-detail {
  max-width: 720px;
  max-height: 85vh;
  overflow-y: auto;
  text-align: left;
}
.modal-detail h2 {
  font-size: 18px;
  color: var(--brand-deeper);
  margin-bottom: 16px;
}

/* ── Score buttons (examiner SA review) ──────────────────────────────── */
.score-btn {
  background: #fff;
  border: 1.5px solid var(--brand-light);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s ease;
  min-width: 38px;
}
.score-btn:hover {
  background: var(--brand-lighter);
  border-color: var(--brand-mid);
  color: var(--brand-deeper);
}
.score-btn.active {
  background: var(--brand-dark);
  color: #fff;
  border-color: var(--brand-dark);
}

/* ── Notes ───────────────────────────────────────────────────────────── */
.note-box {
  background: #F8FAFC;
  border: 1px solid var(--brand-lighter);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 10px;
}

/* ── Role selector (login page) ──────────────────────────────────────── */
.role-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.role-btn {
  padding: 14px 22px;
  border-radius: var(--radius-md);
  border: 2px solid var(--brand-light);
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  transition: all 0.15s ease;
  min-width: 130px;
  text-align: center;
}
.role-btn:hover {
  border-color: var(--brand-mid);
  background: var(--brand-lighter);
}
.role-btn.selected {
  border-color: var(--brand-dark);
  background: var(--brand-lighter);
  color: var(--brand-deeper);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* ── Result score circle ─────────────────────────────────────────────── */
.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 0 auto 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 700;
  border: 6px solid var(--brand-dark);
  color: var(--brand-dark);
  background: #fff;
  box-shadow: var(--shadow-md);
}
.score-circle.fail {
  border-color: var(--danger);
  color: var(--danger);
}

/* ── Misc helpers ────────────────────────────────────────────────────── */
.flex-end {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.err-msg {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 8px;
  display: none;
  font-weight: 500;
}
.muted {
  color: var(--text-muted);
  font-size: 13px;
}
hr.divider {
  border: none;
  border-top: 1px solid var(--brand-lighter);
  margin: 14px 0;
}
.sa-review-block {
  border: 1px solid var(--brand-light);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 14px;
  background: var(--brand-lighter);
}

/* ── Scrollbar polish (Webkit) ───────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--brand-lighter); }
::-webkit-scrollbar-thumb {
  background: var(--brand-mid);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover { background: var(--brand-dark); }

/* ── Print niceties ──────────────────────────────────────────────────── */
@media print {
  .topbar, .tabs, .btn, .modal-overlay { display: none !important; }
  body { background: #fff; }
}
/* ── Time alert toast ───────────────────────────────────────────────── */
.time-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  padding: 14px 22px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  justify-content: center;
}
.time-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.time-toast.level-1 { background: var(--warning-bg); color: var(--warning-text); border: 1.5px solid var(--warning); }
.time-toast.level-2 { background: #FFEDD5; color: #9A3412; border: 1.5px solid #EA580C; }
.time-toast.level-3 { background: var(--danger-bg); color: var(--danger-text); border: 1.5px solid var(--danger); }

/* Timer colour states (mirror toast levels) */
.timer-val.t-level-1 { color: var(--warning); }
.timer-val.t-level-2 { color: #EA580C; }
.timer-val.t-level-3 { color: var(--danger); animation: timer-pulse 1s ease-in-out infinite; }

@keyframes timer-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.6; }
}
/* ── Calculator widget ──────────────────────────────────────────────── */
.calc-widget {
  position: fixed;
  top: 80px;
  right: 16px;
  width: 240px;
  background: #fff;
  border: 1px solid var(--brand-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  user-select: none;
  font-family: 'Inter', -apple-system, sans-serif;
}
.calc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--brand-deeper);
  color: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  cursor: grab;
  font-size: 13px;
  font-weight: 600;
}
.calc-header:active { cursor: grabbing; }
.calc-header .calc-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.calc-display {
  padding: 10px 16px;
  background: #F8FAFC;
  border-bottom: 1px solid var(--brand-lighter);
  font-variant-numeric: tabular-nums;
}
.calc-history {
  font-size: 12px;
  text-align: right;
  color: var(--text-muted);
  min-height: 18px;
  overflow-x: auto;
  white-space: nowrap;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.calc-current {
  font-size: 24px;
  font-weight: 700;
  text-align: right;
  color: var(--text);
  min-height: 32px;
  overflow-x: auto;
  white-space: nowrap;
  margin-top: 2px;
}
.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--brand-lighter);
  padding: 1px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
}
.calc-btn {
  background: #fff;
  border: none;
  padding: 14px 0;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
}
.calc-btn:hover    { background: var(--brand-lighter); }
.calc-btn:active   { background: var(--brand-light); }
.calc-btn.op       { color: var(--brand-dark); font-weight: 700; }
.calc-btn.clear    { color: var(--danger); }
.calc-btn.equals   { background: var(--brand-dark); color: #fff; }
.calc-btn.equals:hover  { background: var(--brand-deeper); }
.calc-btn.equals:active { background: var(--brand-deeper); }
.calc-btn.wide     { grid-column: span 2; }
/* ── Preserve admin-entered line breaks in question text ─────────────── */
.preserve-lines {
  white-space: pre-wrap;
  word-wrap: break-word;
}