/* =========================================================
   Global Design System - All Assessment Quiz
   ---------------------------------------------------------
   - Modern, neutral SaaS aesthetic
   - Shared layout, typography, buttons, cards
   - Used by: index.php, quiz.php, show_result.php,
              admin_view.php, admin_result.php
   ========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  height: auto;
  overflow-x: hidden;
  overflow-y: visible;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #1a1a1a;
  background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 50%, #f0f4f8 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ====================== Dark Mode ====================== */

body.dark-mode {
  color: #e5e7eb;
  background: radial-gradient(circle at top left, #020617 0%, #020617 40%, #111827 100%);
}

body.dark-mode .app-header {
  background: rgba(15, 23, 42, 0.9);
  border-bottom-color: rgba(15, 23, 42, 0.9);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.9);
}

body.dark-mode .brand-title {
  color: #e5e7eb;
}

body.dark-mode .brand-subtitle {
  color: #9ca3af;
}

body.dark-mode .card {
  background: radial-gradient(circle at top left, #0b1120, #020617 60%, #020617 100%);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(15, 23, 42, 0.9);
  border-radius: 18px;
}

body.dark-mode .card-title {
  color: #f9fafb;
}

body.dark-mode .card-subtitle,
body.dark-mode .card-section-title {
  color: #9ca3af;
}

body.dark-mode .quiz-question-item {
  background: rgba(15, 23, 42, 0.96);
  border-color: #1f2937;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

body.dark-mode .quiz-question-title {
  color: #e5e7eb;
}

body.dark-mode .quiz-option {
  background: #020617;
  border-color: #1f2937;
}

body.dark-mode .quiz-option:hover {
  background: #0b1120;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.3);
}

body.dark-mode .quiz-option:has(input[type="radio"]:checked) {
  background: rgba(37, 99, 235, 0.18);
  border-color: #60a5fa;
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.4);
}

body.dark-mode .quiz-option span {
  color: #e5e7eb;
}

body.dark-mode .quiz-sidebar-card {
  background: radial-gradient(circle at top left, #020617, #020617 65%, #020617 100%);
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(31, 41, 55, 0.9);
}

body.dark-mode .timer-shell {
  background: linear-gradient(135deg, #b91c1c 0%, #f97316 100%);
  box-shadow: 0 6px 18px rgba(248, 113, 113, 0.5);
}

body.dark-mode .timer-value {
  text-shadow: 0 0 10px rgba(248, 113, 113, 0.7);
}

body.dark-mode .timer-display {
  color: #f97316;
}

body.dark-mode .progress-dot {
  background: #020617;
  border-color: #1f2937;
  color: #9ca3af;
}

body.dark-mode .progress-dot:hover {
  background: #020617;
  border-color: #3b82f6;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.6);
}

body.dark-mode .progress-dot-answered {
  background: rgba(37, 99, 235, 0.3);
  border-color: #60a5fa;
  color: #e5e7eb;
}

body.dark-mode .progress-dot-current {
  background: #3b82f6;
  border-color: #93c5fd;
  box-shadow:
    0 0 0 3px rgba(37, 99, 235, 0.55),
    0 0 30px rgba(59, 130, 246, 0.9);
}

body.dark-mode .pill-counter {
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  border-color: #1f2937;
}

body.dark-mode .badge-neutral {
  background: rgba(30, 64, 175, 0.2);
  color: #bfdbfe;
}

body.dark-mode .quiz-header-meta .chip {
  background: rgba(15, 23, 42, 0.9);
  border-color: #1f2937;
  color: #d1d5db;
}

body.dark-mode .warning-banner {
  background: linear-gradient(135deg, #7f1d1d 0%, #b91c1c 100%);
  box-shadow: 0 4px 16px rgba(127, 29, 29, 0.9);
}

body.dark-mode .table thead {
  background: #020617;
  color: #e5e7eb;
}

body.dark-mode .table tbody tr:nth-child(odd) {
  background: rgba(15, 23, 42, 0.9);
}

body.dark-mode .table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.85);
}

body.dark-mode .table tbody tr:hover {
  background: rgba(30, 64, 175, 0.4);
}

body.dark-mode .status-chip-pass {
  background: rgba(22, 163, 74, 0.2);
  color: #bbf7d0;
}

body.dark-mode .status-chip-fail {
  background: rgba(248, 113, 113, 0.25);
  color: #fecaca;
}

body.dark-mode .kpi-card {
  background: radial-gradient(circle at top left, #020617, #020617 60%, #020617 100%);
  border-color: #1f2937;
}

body.dark-mode .kpi-label {
  color: #9ca3af;
}

body.dark-mode .kpi-value {
  color: #e5e7eb;
}

body.dark-mode .app-main {
  background: transparent;
}

/* Theme toggle button */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: #4b5563;
  transition: all 0.18s ease;
}

.theme-toggle-btn:hover {
  background: #111827;
  color: #f9fafb;
  border-color: #111827;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.35);
}

.theme-toggle-icon {
  font-size: 14px;
}

.theme-toggle-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

body.dark-mode .theme-toggle-btn {
  background: #020617;
  color: #e5e7eb;
  border-color: #1f2937;
}

body.dark-mode .theme-toggle-btn:hover {
  background: #f9fafb;
  color: #111827;
  border-color: #e5e7eb;
}

/* Registration page: no scrolling, centered layout */
body.app-shell-registration .app-shell {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Admin pages: ensure full page scrolling - body must be scrollable */
body.app-shell:not(.app-shell-registration):not(.app-shell-quiz) {
  height: auto;
  min-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

/* ---------------- Core Layout Shell ---------------- */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: visible;
  position: relative;
}

/* Admin pages: allow .app-shell to grow beyond viewport - don't trap overflow */
body.app-shell:not(.app-shell-registration):not(.app-shell-quiz) .app-shell {
  height: auto;
  min-height: 100vh;
  overflow-y: visible;
  overflow-x: hidden;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(20px) saturate(180%);
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Quiz page: header should scroll with content (non-sticky) */
.app-shell-quiz .app-header {
  position: static;
  top: auto;
}

.app-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-pill {
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
  border: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand-title {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-size: 13px;
  color: #6b7280;
  font-weight: 400;
}

.header-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #6b7280;
  font-size: 13px;
}

.header-meta-pill {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #fee2e2;
  background: #fef2f2;
  color: #dc2626;
  font-weight: 600;
}

.app-main {
  flex: 1;
  padding: 24px 16px 60px;
  margin-top: 0;
  margin-bottom: 40px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: visible;
  min-height: auto;
}

/* Admin pages: ensure .app-main doesn't trap overflow and allows natural page scrolling */
body.app-shell:not(.app-shell-registration):not(.app-shell-quiz) .app-main {
  overflow-y: visible;
  flex: 0 1 auto;
  /* don't force growth - let content determine height */
}

.app-shell-quiz .app-main {
  align-items: flex-start;
  overflow-y: auto;
}

/* Registration page: prevent scrolling, center content */
body.app-shell-registration .app-main {
  overflow: hidden;
  padding: 20px 16px;
}

.app-main-inner {
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
}

/* Registration page: center card vertically */
body.app-shell-registration .app-main-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
}

/* ---------------- Utility Tokens ---------------- */

.text-muted {
  color: #6b7280;
}

.text-danger {
  color: #b91c1c;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.badge-neutral {
  background: #e5e7eb;
  color: #111827;
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-danger {
  background: #fee2e2;
  color: #b91c1c;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(260px, 1fr);
  gap: 24px;
}

@media (max-width: 900px) {
  .app-main {
    padding-top: 20px;
  }

  .app-header-inner {
    padding-inline: 16px;
    flex-wrap: wrap;
  }

  .layout-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .header-meta {
    display: none;
  }

  .warning-banner {
    font-size: 12px;
    padding: 8px 12px;
  }

  .modal-dialog {
    max-width: 90%;
    margin: 20px;
  }
}

/* ---------------- Cards & Surfaces ---------------- */

.card {
  position: relative;
  border-radius: 16px;
  background: #ffffff;
  margin-top: 12px;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 8px 24px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(0, 0, 0, 0.04);
  padding: 32px;
  width: 100%;
  max-width: 680px;
  overflow: hidden;
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.card:hover {
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.1),
    0 12px 32px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.06);
}

/* Registration page: adjust card spacing */
body.app-shell-registration .card {
  margin-top: 0;
  margin-bottom: 0;
}

/* Admin result pages: wider card for better table display */
body.app-shell:not(.app-shell-registration):not(.app-shell-quiz) .card {
  max-width: 1120px;
}

.card-header {
  margin-bottom: 24px;
}

.card-header .badge {
  margin-top: 0;
  margin-bottom: 12px;
  display: inline-block;
}

/* Registration page: tighter header spacing */
body.app-shell-registration .card-header {
  margin-bottom: 14px;
}

.card-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #1a1a1a;
  line-height: 1.3;
  margin: 0;
}

.card-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: #6b7280;
}

.card-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: #64748b;
  margin-bottom: 12px;
}

.card-divider {
  border: 0;
  border-top: 1px solid #e2e8f0;
  margin: 18px 0;
}

.quiz-main-card .card-divider {
  margin-bottom: 0;
}

/* ---------------- Forms ---------------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
}

/* Registration page: tighter spacing */
body.app-shell-registration .form-grid {
  gap: 16px 18px;
}

@media (max-width: 720px) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #4b5563;
  margin-bottom: 6px;
}

.form-control,
.form-select {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  padding: 10px 12px;
  font-size: 14px;
  color: #0f172a;
  background-color: #f9fafb;
  transition: border-color 0.16s ease, box-shadow 0.16s ease,
    background-color 0.16s ease, transform 0.08s ease;
}

.form-control::placeholder {
  color: #9ca3af;
}

.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: #2563eb;
  background-color: #ffffff;
  box-shadow:
    0 0 0 1px rgba(37, 99, 235, 0.45),
    0 8px 18px rgba(37, 99, 235, 0.18);
}

.form-control[readonly] {
  background-color: #e5e7eb;
  cursor: not-allowed;
  color: #6b7280;
}

.form-error {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 500;
  color: #b91c1c;
}

.form-hint {
  margin-top: 3px;
  font-size: 11px;
  color: #6b7280;
}

.form-footer {
  margin-top: 22px;
}

/* Registration page: tighter footer spacing */
body.app-shell-registration .form-footer {
  margin-top: 18px;
}

/* Native validation visuals */
input:not(:placeholder-shown):invalid {
  border-color: #dc2626;
}

input:not(:placeholder-shown):valid:not([readonly]) {
  border-color: #16a34a;
}

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  border: none;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.16s ease,
    background 0.16s ease, opacity 0.12s ease;
}

.btn-primary {
  width: 100%;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  box-shadow:
    0 4px 12px rgba(37, 99, 235, 0.4),
    0 2px 4px rgba(37, 99, 235, 0.2);
  border: none;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    0 6px 16px rgba(37, 99, 235, 0.5),
    0 4px 8px rgba(37, 99, 235, 0.3);
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow:
    0 10px 26px rgba(15, 23, 42, 0.75),
    0 0 0 1px rgba(30, 64, 175, 0.75);
}

.btn-outline {
  color: #374151;
  background: #ffffff;
  border: 2px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-outline:hover:not(:disabled) {
  background: #f9fafb;
  border-color: #d1d5db;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 12px;
}

/* ---------------- Quiz Layout ---------------- */

.quiz-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(260px, 1fr);
  gap: 24px;
  align-items: flex-start;
  padding-top: 24px;
}

@media (max-width: 1024px) {
  .quiz-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

.quiz-main-card {
  position: relative;
  overflow: visible;
  margin-top: 32px !important;
  align-self: flex-start;
}

.quiz-main-card form {
  overflow: visible !important;
  position: relative;
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.quiz-main-card .quiz-question-block {
  overflow: visible !important;
  position: relative;
  min-height: auto !important;
}

.quiz-main-card .quiz-question-block.active .quiz-question-item:first-child {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.quiz-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 13px;
  margin-top: 16px;
  color: #6b7280;
}

.quiz-header-meta .chip {
  padding: 4px 10px;
  border-radius: 6px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  font-weight: 500;
  color: #4b5563;
}

.quiz-question-block {
  display: none;
}

.quiz-question-block.active,
.question-block.active {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  overflow: visible !important;
}

.quiz-question-block.active .quiz-question-item,
.question-block.active .quiz-question-item {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.quiz-question-item {
  padding: 28px 24px;
  border-radius: 12px;
  background: #ffffff;
  border: 1.5px solid #e5e7eb;
  margin-bottom: 24px;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.quiz-question-item:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.quiz-question-title {
  font-size: 17px;
  font-weight: 500;
  color: #1a1a1a;
  margin-bottom: 20px;
  line-height: 1.6;
  letter-spacing: -0.01em;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-top: 12px;
  border-radius: 10px;
  border: 2px solid #e5e7eb;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.quiz-option:hover {
  background: #f8fafc;
  border-color: #3b82f6;
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.quiz-option:has(input[type="radio"]:checked) {
  background: #eff6ff;
  border-color: #3b82f6;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.quiz-option input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: #3b82f6;
  cursor: pointer;
  flex-shrink: 0;
}

.quiz-option span {
  font-size: 15px;
  color: #374151;
  line-height: 1.5;
}

.quiz-option-selected {
  background: #e0f2fe;
  border-color: #2563eb;
}

.quiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 2px solid #f3f4f6;
}

.quiz-nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill-counter {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
}

.quiz-sidebar-card {
  position: sticky;
  top: 20px;
  align-self: flex-start;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Ensure sidebar scrolls independently */
.quiz-layout {
  align-items: flex-start;
}

.timer-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.timer-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 600;
}

.timer-value {
  font-variant-numeric: tabular-nums;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.timer-display {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #dc2626;
  font-size: 16px;
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.progress-dot {
  height: 36px;
  width: 36px;
  border-radius: 8px;
  border: 2px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.progress-dot:hover {
  background: #f3f4f6;
  border-color: #3b82f6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.progress-dot:active {
  transform: scale(0.95);
}

.progress-dot-answered {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1e40af;
  font-weight: 600;
}

.progress-dot-current {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3), 0 4px 12px rgba(59, 130, 246, 0.2);
  background: #3b82f6;
  border-color: #2563eb;
  color: #ffffff;
  font-weight: 700;
  transform: scale(1.05);
}

.quiz-sidebar-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
  font-size: 12px;
  color: #6b7280;
}

/* ---------------- Results & Admin ---------------- */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 900px) {
  .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .kpi-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.kpi-card {
  border-radius: 12px;
  padding: 14px 14px 12px;
  background: #0f172a;
  color: #e5e7eb;
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.6),
    0 0 0 1px rgba(30, 64, 175, 0.7);
}

.kpi-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #9ca3af;
}

.kpi-value {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 650;
}

.kpi-sub {
  margin-top: 4px;
  font-size: 12px;
  color: #9ca3af;
}

.table-shell {
  width: 100%;
  border-radius: 12px;
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  max-height: 600px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead {
  background: radial-gradient(circle at 0 0, #eff6ff, #e0e7ff);
  position: sticky;
  top: 0;
  z-index: 10;
}

.table th,
.table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  color: #4b5563;
}

.table tbody tr:hover {
  background: #f9fafb;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}

.status-chip-pass {
  background: #dcfce7;
  color: #166534;
}

.status-chip-fail {
  background: #fee2e2;
  color: #b91c1c;
}

.pill-role {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: #eff6ff;
  color: #1d4ed8;
}

/* Admin filters */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.filter-bar-label {
  font-size: 12px;
  font-weight: 600;
  color: #4b5563;
}

.filter-input {
  min-width: 180px;
}

/* ---------------- Misc ---------------- */

.warning-banner {
  position: sticky;
  top: 0;
  z-index: 35;
  padding: 12px 16px;
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.warning-banner strong {
  font-weight: 700;
}

/* Modal overlay and dialog */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.modal-overlay.active {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-dialog {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  max-width: 480px;
  width: 100%;
  padding: 0;
  animation: slideUp 0.3s ease-out;
  overflow: hidden;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #fee2e2, #fef2f2);
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: #b91c1c;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title::before {
  content: "⚠️";
  font-size: 24px;
}

.modal-body {
  padding: 24px;
}

.modal-message {
  font-size: 15px;
  line-height: 1.6;
  color: #374151;
  margin-bottom: 20px;
}

.modal-message strong {
  color: #b91c1c;
  font-weight: 700;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.modal-btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.modal-btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
}

.modal-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.modal-btn-secondary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-weight: 700;
  padding: 12px 28px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-btn-secondary:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.empty-state {
  padding: 24px;
  border-radius: 12px;
  border: 1px dashed #cbd5f5;
  background: #f9fafb;
  text-align: center;
  font-size: 14px;
  color: #6b7280;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  background: #e5e7eb;
  color: #374151;
}

.muted-link {
  color: #2563eb;
  text-decoration: none;
}

.muted-link:hover {
  text-decoration: underline;
}

/* =========================================================
   ADMIN PAGE SCROLLING FIX (Hotfix)
   ---------------------------------------------------------
   Issue: Admin pages not scrolling - content never exceeds viewport
   Root cause: .app-main uses justify-content: center which centers content
               and prevents document height from growing beyond 100vh
   Solution: Remove flex centering for admin pages, allow natural vertical flow
   ========================================================= */

/* Admin pages: disable flex centering so page can grow vertically */
body.app-shell:not(.app-shell-registration):not(.app-shell-quiz) .app-main {
  justify-content: flex-start !important;
  /* remove horizontal centering - allow natural flow */
  align-items: flex-start !important;
  /* ensure top alignment */
}

/* =========================================================
   CONFIRMATION PAGE STYLES
   ========================================================= */

.confirmation-card {
  max-width: 700px;
  margin: 60px auto;
  text-align: center;
}

.confirmation-card .card-header {
  padding: 48px 40px;
}

.confirmation-card .badge-success {
  background: #10b981;
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 24px;
}

.confirmation-card .card-title {
  font-size: 28px;
  line-height: 1.3;
  margin-bottom: 16px;
  color: #0f172a;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.confirmation-card .card-subtitle {
  font-size: 16px;
  line-height: 1.6;
  color: #475569;
  margin-bottom: 0;
}