/* ============================================================
   Trustfund Pensions — CBT Candidate Design System
   Mirrors the admin design language: navy + teal, same tokens
   ============================================================ */

:root {
  /* Same palette as partials/admin.css */
  --primary-gradient: linear-gradient(135deg, #0061F7 0%, #6b5b7b 100%);
  --primary: #0061F7;
  --primary-dark: #0050d0;
  --navy: #0B2E4E;
  --navy-deep: #081F35;
  --teal: #0FA8A3;
  --teal-dark: #0B8983;
  --teal-pale: #E4F5F4;
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #17a2b8;
  --muted: #6c757d;
  --bg: #f0f2f5;
  --bg-deep: #0a1628;
  --card-bg: #ffffff;
  --border: #e9ecef;
  --border-soft: #eaeff2;
  --text: #152531;
  --text-muted: #5B6B76;
  --shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
  --shadow-2: 0 12px 40px rgba(0, 0, 0, 0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { height: 100%; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--navy-deep);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

/* ============================================================
   HERO LAYOUT (welcome, info, instructions, submit)
   ============================================================ */
.hero-section {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a1628 0%, #1a2a4a 50%, #0d1f3c 100%);
  overflow: hidden;
  padding: 40px 24px 70px;
}

@media (max-width: 720px) {
  .hero-section { padding: 30px 16px 80px; }
}

.hero-background {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.08;
  z-index: 0;
}

.particles, .floating-shapes {
  position: absolute; inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}
.particle {
  position: absolute;
  border-radius: 50%;
  background: rgba(79, 172, 254, 0.05);
  animation: floatUp linear infinite;
}
.particle:nth-child(1) { width: 300px; height: 300px; left: -100px; bottom: -100px; animation-duration: 25s; }
.particle:nth-child(2) { width: 200px; height: 200px; right: -50px; top: -50px; animation-duration: 20s; animation-delay: 5s; }
.particle:nth-child(3) { width: 150px; height: 150px; left: 50%; bottom: -50px; animation-duration: 30s; animation-delay: 10s; }
.particle:nth-child(4) { width: 100px; height: 100px; right: 20%; top: 30%; animation-duration: 18s; animation-delay: 3s; }

@keyframes floatUp {
  0%   { transform: translateY(0) scale(0.5); opacity: 0.3; }
  50%  { opacity: 0.6; }
  100% { transform: translateY(-120vh) scale(1.2); opacity: 0; }
}

.content-container {
  position: relative;
  z-index: 2;
  text-align: center;
  width: 100%;
  max-width: 720px;
  padding: 0;
}
@media (min-width: 1024px) { .content-container { max-width: 780px; } }

/* ============================================================
   BRAND MARK & LOGO (matches admin sidebar)
   ============================================================ */
.logo-container {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
}
.logo-container img {
  height: 56px;
  width: auto;
  filter: brightness(0) invert(1);
}
.logo-fallback {
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--navy);
  border: 1.5px solid var(--teal);
  border-radius: 6px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--teal);
}
.logo-name {
  font-size: 19px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.01em;
}

/* ============================================================
   BADGE (matches admin header-actions badge)
   ============================================================ */
.badge {
  display: inline-block;
  background: rgba(15, 168, 163, 0.12);
  border: 1px solid rgba(15, 168, 163, 0.35);
  padding: 7px 18px;
  border-radius: 50px;
  color: var(--teal);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.badge i { margin-right: 7px; color: var(--teal); }

/* ============================================================
   HEADINGS
   ============================================================ */
.main-heading {
  color: #fff;
  font-size: clamp(1.8rem, 4vw + 0.9rem, 2.6rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin-bottom: 16px;
}
.main-heading .highlight {
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}

.subtitle {
  color: rgba(255, 255, 255, 0.72);
  font-size: clamp(0.95rem, 0.4vw + 0.85rem, 1.1rem);
  font-weight: 400;
  line-height: 1.65;
  max-width: 620px;
  margin: 0 auto 24px;
}

/* ============================================================
   CARD (candidate-side: mirrors .panel in admin.css)
   ============================================================ */
.card, .confirm-card, .instructions-card, .form-card, .login-card, .code-card {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 28px 32px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  text-align: left;
  margin: 0 auto 22px;
  max-width: 640px;
  width: 100%;
}

.card.center, .confirm-card, .form-card.center {
  text-align: center;
}

/* ============================================================
   CONFIRM ICON
   ============================================================ */
.confirm-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(30, 122, 84, 0.15);
  border: 1.5px solid rgba(30, 122, 84, 0.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.confirm-icon svg { width: 32px; height: 32px; }
.confirm-icon.warning-icon {
  background: rgba(255, 180, 70, 0.12);
  border-color: rgba(255, 180, 70, 0.4);
}

/* ============================================================
   BUTTONS (mirror admin .btn)
   ============================================================ */
.btn, .btn-primary, .btn-home, .btn-back, .code-submit, .start-btn, .btn-header {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 26px;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.25s, background 0.2s;
  line-height: 1.2;
}

.btn-primary, .btn-home, .code-submit, .start-btn {
  background: linear-gradient(135deg, var(--primary), #00c6fb);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 97, 247, 0.35);
}
.btn-primary:hover, .btn-home:hover, .code-submit:hover, .start-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(0, 97, 247, 0.5);
  color: #fff;
}
.btn-primary:disabled, .btn-home:disabled, .code-submit:disabled, .start-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-back, .btn-outline {
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
}
.btn-back:hover, .btn-outline:hover {
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 13px; }

/* ============================================================
   FORM FIELDS
   ============================================================ */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--teal);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.field .req { color: #ff8080; }
.field input, .field select, .field textarea, .code-input {
  width: 100%;
  padding: 13px 16px;
  font-size: 14.5px;
  color: #fff;
  background: rgba(10, 22, 40, 0.65);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field input:focus, .field select:focus, .field textarea:focus, .code-input:focus {
  border-color: var(--teal);
  background: rgba(10, 22, 40, 0.9);
  box-shadow: 0 0 0 4px rgba(15, 168, 163, 0.15);
}
.field input.invalid {
  border-color: #ff6b6b;
  box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.12);
}
.field input:read-only {
  background: rgba(10, 22, 40, 0.35);
  color: rgba(255, 255, 255, 0.55);
  cursor: not-allowed;
}
.field .err {
  color: #ff8a8a;
  font-size: 12px;
  margin-top: 5px;
}
.field .hint {
  color: rgba(255, 255, 255, 0.4);
  font-size: 11.5px;
  margin-top: 5px;
}

.grid2, .grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
@media (max-width: 560px) { .grid2, .grid-2 { grid-template-columns: 1fr; } }

/* ============================================================
   ALERTS (mirror admin alert style)
   ============================================================ */
.alert, .alert-info, .alert-warning, .alert-danger, .alert-error, .info-panel {
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.55;
  margin-bottom: 18px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.alert-info, .info-panel {
  background: rgba(15, 168, 163, 0.1);
  border: 1px solid rgba(15, 168, 163, 0.28);
  color: #a9e8e4;
}
.alert-info i, .info-panel i { color: var(--teal); margin-top: 2px; flex-shrink: 0; }
.alert-warning, .warning-note {
  background: rgba(255, 180, 70, 0.1);
  border: 1px solid rgba(255, 180, 70, 0.28);
  color: #ffd58a;
}
.alert-warning i, .warning-note i { color: #ffb44a; margin-top: 2px; flex-shrink: 0; }
.alert-danger, .alert-error {
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  color: #ff9c9c;
}
.alert-danger i, .alert-error i { color: #ff6b6b; margin-top: 2px; flex-shrink: 0; }

/* ============================================================
   BOTTOM STRIP (trust badges + admin link)
   ============================================================ */
.bottom-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.45);
}
.bottom-strip .trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.bottom-strip .trust-badge i { color: var(--teal); font-size: 13px; }
.bottom-strip .sep {
  width: 1px; height: 13px;
  background: rgba(255, 255, 255, 0.14);
}
.bottom-strip .admin-link a {
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
  padding-bottom: 1px;
  transition: color 0.2s, border-color 0.2s;
}
.bottom-strip .admin-link a:hover {
  color: var(--teal);
  border-bottom-color: var(--teal);
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  position: absolute;
  bottom: 18px;
  left: 0;
  width: 100%;
  text-align: center;
  color: rgba(255, 255, 255, 0.3);
  font-size: 12px;
  z-index: 2;
  letter-spacing: 0.02em;
}
.footer a {
  color: rgba(255, 255, 255, 0.42);
  text-decoration: none;
  transition: color 0.2s;
}
.footer a:hover { color: rgba(255, 255, 255, 0.75); }
.footer .dot { margin: 0 8px; }
@media (max-height: 720px) {
  .footer { position: static; margin-top: 22px; }
}

/* ============================================================
   LOADER
   ============================================================ */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--navy-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.page-loader.hidden { opacity: 0; visibility: hidden; }
.loader-spinner, .spinner {
  width: 46px; height: 46px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   SCORE PANEL (submit.php)
   ============================================================ */
.score-panel {
  background: linear-gradient(135deg, rgba(15, 168, 163, 0.15), rgba(0, 97, 247, 0.08));
  border: 1px solid rgba(15, 168, 163, 0.28);
  border-radius: 14px;
  padding: 24px 28px;
  margin: 22px 0 20px;
  text-align: center;
}
.score-panel .score-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--teal);
  font-weight: 600;
  margin-bottom: 10px;
}
.score-panel .score-big {
  font-size: 3.4rem;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}
.score-panel .score-sub {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
}
.score-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.score-breakdown .item { text-align: center; }
.score-breakdown .num {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}
.score-breakdown .lbl {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* ============================================================
   CODE CARD (welcome page)
   ============================================================ */
.code-card {
  padding: 22px 26px 18px;
  text-align: left;
}
.code-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--teal);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.code-card-head i { color: var(--teal); font-size: 13px; }

.code-help {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.6;
  margin-bottom: 14px;
}
.code-help code {
  background: rgba(15, 168, 163, 0.08);
  border: 1px solid rgba(15, 168, 163, 0.2);
  padding: 2px 6px;
  border-radius: 5px;
  font-family: 'Consolas', 'Menlo', monospace;
  font-size: 11.5px;
  color: #a9e8e4;
}
.code-help em { color: var(--teal); font-style: normal; }

.code-input-row { display: flex; gap: 10px; }
.code-input { flex: 1; min-width: 0; }
.code-message {
  min-height: 16px;
  font-size: 12.5px;
  margin-top: 8px;
  color: #ff8a8a;
}
.code-message:empty { display: none; }
.code-message.ok { color: #7ddfb4; }

.code-alt {
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.6;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.code-alt i { color: var(--teal); margin-right: 6px; }
.code-alt a {
  color: var(--teal);
  text-decoration: none;
  border-bottom: 1px dashed rgba(15, 168, 163, 0.4);
}
.code-alt a:hover { border-bottom-color: var(--teal); }

/* ============================================================
   INSTRUCTIONS LIST (instructions.php)
   ============================================================ */
.rules {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
}
.rules li {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.55;
}
.rules li:last-child { border-bottom: none; }
.rule-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(15, 168, 163, 0.15);
  border: 1.5px solid rgba(15, 168, 163, 0.4);
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.candidate-summary {
  background: rgba(15, 168, 163, 0.08);
  border: 1px solid rgba(15, 168, 163, 0.2);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  font-size: 13.5px;
}
.candidate-summary dt {
  color: rgba(255, 255, 255, 0.5);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  align-self: center;
}
.candidate-summary dd {
  color: #fff;
  font-weight: 600;
  margin: 0;
}

/* ============================================================
   ACTION ROW (two buttons side by side)
   ============================================================ */
.action-row {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.action-row .btn-primary,
.action-row .btn-home {
  flex: 1;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .logo-container { min-height: 44px; margin-bottom: 16px; }
  .logo-container img { height: 42px; }
  .logo-name { font-size: 17px; }
  .logo-mark { width: 42px; height: 42px; font-size: 13px; }
  .badge { font-size: 10.5px; padding: 6px 14px; margin-bottom: 14px; }
  .main-heading { font-size: clamp(1.6rem, 6vw, 2rem); margin-bottom: 14px; }
  .subtitle { font-size: 0.92rem; margin-bottom: 20px; line-height: 1.6; }
  .card, .confirm-card, .instructions-card, .form-card, .login-card, .code-card {
    padding: 20px 18px;
    border-radius: 14px;
  }
  .code-input-row { flex-direction: column; }
  .code-submit { justify-content: center; width: 100%; }
  .action-row { flex-direction: column; }
  .bottom-strip { gap: 10px 14px; font-size: 11.5px; }
  .bottom-strip .sep { display: none; }
  .footer { font-size: 11px; bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .particle { animation: none !important; }
}