/* ================================================================
   Gyanam Exam Portal — Professional Light Design System
   Clean, corporate, solid colors — no gradients, no glassmorphism
================================================================ */

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Brand colors — solid only */
  --primary: #1d4ed8;
  /* solid blue  */
  --primary-dark: #1e3a8a;
  --primary-light: #eff6ff;
  --primary-text: #1d4ed8;

  --success: #16a34a;
  --success-bg: #f0fdf4;
  --success-text: #15803d;

  --warning: #d97706;
  --warning-bg: #fffbeb;
  --warning-text: #b45309;

  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-text: #b91c1c;

  --info: #0284c7;
  --info-bg: #f0f9ff;

  /* Neutrals */
  --white: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  /* Layout */
  --sidebar-width: 240px;
  --header-height: 60px;

  /* Borders */
  --border: 1px solid #e2e8f0;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

  --transition: all 0.18s ease;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Typography ─────────────────────────────────────────────── */
h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

h4 {
  font-size: 0.9rem;
  font-weight: 600;
}

/* ── Buttons ────────────────────────────────────────────────── */
button {
  font-family: var(--font);
  cursor: pointer;
  border: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-outline {
  background: white;
  color: var(--text-primary);
  border-color: var(--gray-300);
}

.btn-outline:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.btn-success:hover {
  background: #15803d;
  border-color: #15803d;
}

.btn-warning {
  background: var(--warning);
  color: white;
  border-color: var(--warning);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--gray-100);
  color: var(--text-primary);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: white;
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body {
  padding: 1.25rem;
}

.card-footer {
  padding: 1rem 1.25rem;
  border-top: var(--border);
  background: var(--gray-50);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Form Controls ──────────────────────────────────────────── */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
  outline: none;
}

.form-input.invalid {
  border-color: var(--danger);
}

.form-error {
  color: var(--danger);
  font-size: 0.78rem;
  margin-top: 0.25rem;
  display: none;
}

.form-error.visible {
  display: block;
}

.form-textarea {
  resize: vertical;
  min-height: 90px;
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-blue {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-green {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-red {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.badge-yellow {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-gray {
  background: var(--gray-100);
  color: var(--gray-600);
}

/* ── Table ──────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead tr {
  background: var(--gray-50);
}

th {
  padding: 0.625rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: var(--border);
  white-space: nowrap;
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--text-primary);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--gray-50);
}

/* ── Stats Grid ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: white;
  border: var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-card .stat-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.stat-card-blue {
  border-left: 3px solid var(--primary);
}

.stat-card-green {
  border-left: 3px solid var(--success);
}

.stat-card-red {
  border-left: 3px solid var(--danger);
}

.stat-card-yellow {
  border-left: 3px solid var(--warning);
}

/* ── Portal Layout (Admin/ATC/DLC) ──────────────────────────── */
.portal-layout {
  display: flex;
  min-height: 100vh;
}

.portal-sidebar {
  width: var(--sidebar-width);
  background: var(--gray-900);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand-icon svg {
  width: 18px;
  height: 18px;
  color: white;
}

.sidebar-brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: white;
}

.sidebar-brand-role {
  font-size: 0.7rem;
  color: var(--gray-400);
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
}

.sidebar-nav-section {
  padding: 0.5rem 1rem 0.25rem;
  font-size: 0.65rem;
  color: var(--gray-500);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 1.25rem;
  color: var(--gray-400);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  border-radius: 0;
  text-decoration: none;
}

.sidebar-link:hover {
  color: white;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-link.active {
  color: white;
  background: var(--primary);
}

.sidebar-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.75rem;
}

.sidebar-avatar {
  width: 30px;
  height: 30px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: white;
}

.sidebar-user-role {
  font-size: 0.7rem;
  color: var(--gray-500);
}

/* ── Portal Main ────────────────────────────────────────────── */
.portal-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.portal-topbar {
  height: var(--header-height);
  background: white;
  border-bottom: var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

.portal-topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.portal-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.portal-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* ── Page Header ────────────────────────────────────────────── */
.page-header {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.page-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.page-header p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ── Section ────────────────────────────────────────────────── */
.section {
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.875rem;
}

/* ── Alert ──────────────────────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  margin-bottom: 1rem;
  border-width: 1px;
  border-style: solid;
}

.alert svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: #fecaca;
}

.alert-success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: #bbf7d0;
}

.alert-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: #fde68a;
}

.alert-info {
  background: var(--info-bg);
  color: var(--info);
  border-color: #bae6fd;
}

.alert.hidden {
  display: none;
}

/* ── Modal ──────────────────────────────────────────────────── */
#modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.45);
  align-items: center;
  justify-content: center;
}

.modal-card {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 420px;
  width: 90vw;
  padding: 1.5rem;
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.modal-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-icon svg {
  width: 20px;
  height: 20px;
}

.modal-icon.warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.modal-icon.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.modal-icon.success {
  background: var(--success-bg);
  color: var(--success);
}

.modal-icon.info {
  background: var(--info-bg);
  color: var(--info);
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
}

.modal-message {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 0.625rem;
  justify-content: flex-end;
}

.modal-btn {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.modal-btn-cancel {
  background: white;
  border-color: var(--gray-300);
  color: var(--text-secondary);
}

.modal-btn-cancel:hover {
  background: var(--gray-50);
}

.modal-btn-confirm {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.modal-btn-confirm:hover {
  background: var(--primary-dark);
}

.modal-btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.modal-btn-danger:hover {
  background: #b91c1c;
}

/* ── Security toast ─────────────────────────────────────────── */
.security-toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: #7c2d12;
  color: #fed7aa;
  border-radius: var(--radius-lg);
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 10000;
  box-shadow: var(--shadow-md);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid #c2410c;
  white-space: nowrap;
}

.security-toast.visible {
  transform: translateX(-50%) translateY(0);
}

/* ── Login Pages ────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
}

.login-left {
  flex: 1;
  background: var(--gray-900);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: white;
}

.login-left .portal-icon {
  width: 64px;
  height: 64px;
  background: var(--primary);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.login-left .portal-icon svg {
  width: 32px;
  height: 32px;
  color: white;
}

.login-left h1 {
  font-size: 1.75rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 0.5rem;
}

.login-left p {
  color: var(--gray-400);
  text-align: center;
  font-size: 0.9rem;
  max-width: 300px;
}

.login-right {
  width: 420px;
  flex-shrink: 0;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
  border-left: var(--border);
}

.login-form-box {
  width: 100%;
}

.login-form-box h2 {
  margin-bottom: 0.25rem;
}

.login-form-box p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1.75rem;
}

.login-submit {
  width: 100%;
  padding: 0.65rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.login-submit:hover:not(:disabled) {
  background: var(--primary-dark);
}

.login-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Exam Portal (Student) ──────────────────────────────────── */
.exam-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--gray-50);
}

.exam-header {
  background: white;
  border-bottom: var(--border);
  padding: 0.75rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow-sm);
}

.exam-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.exam-header-left h2 {
  font-size: 1rem;
  font-weight: 700;
}

.exam-header-left p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.exam-timer {
  font-size: 1.5rem;
  font-weight: 800;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-md);
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #bbf7d0;
  font-variant-numeric: tabular-nums;
  min-width: 100px;
  text-align: center;
  transition: var(--transition);
}

.exam-timer.warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: #fde68a;
}

.exam-timer.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #fecaca;
}

@keyframes timerPulse {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: 0.7
  }
}

.timer-pulse {
  animation: timerPulse 1s ease-in-out infinite;
}

.exam-body {
  flex: 1;
  display: flex;
  max-height: calc(100vh - 60px);
  overflow: hidden;
}

.exam-question-area {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.exam-question-area::-webkit-scrollbar {
  width: 5px;
}

.exam-question-area::-webkit-scrollbar-thumb {
  background: var(--gray-200);
  border-radius: 3px;
}

.question-card {
  max-width: 740px;
  margin: 0 auto;
  background: white;
  border: var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.question-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: var(--border);
}

.question-number {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.question-marks {
  font-size: 0.78rem;
  color: var(--success);
  font-weight: 600;
  background: var(--success-bg);
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
}

.question-text {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  background: white;
}

.option-item:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.option-item.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.option-letter {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gray-100);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: var(--transition);
}

.option-item.selected .option-letter {
  background: var(--primary);
  color: white;
}

.option-text {
  flex: 1;
  font-size: 0.925rem;
  color: var(--text-primary);
}

.exam-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: var(--border);
}

/* Palette */
.exam-palette {
  width: 280px;
  flex-shrink: 0;
  background: white;
  border-left: var(--border);
  display: flex;
  flex-direction: column;
}

.palette-header {
  padding: 1rem 1.25rem;
  border-bottom: var(--border);
}

.palette-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.palette-stats {
  display: flex;
  gap: 0.625rem;
  margin-top: 0.625rem;
}

.palette-stat {
  flex: 1;
  text-align: center;
  padding: 0.4rem;
  border-radius: var(--radius-md);
  font-size: 0.72rem;
  font-weight: 600;
}

.palette-stat .num {
  font-size: 1rem;
  font-weight: 800;
  display: block;
}

.palette-stat.answered {
  background: var(--success-bg);
  color: var(--success-text);
}

.palette-stat.marked {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.palette-stat.pending {
  background: var(--gray-100);
  color: var(--gray-600);
}

.palette-grid {
  flex: 1;
  overflow-y: auto;
  padding: 0.875rem;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
  align-content: start;
}

.palette-btn {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  background: var(--gray-100);
  color: var(--text-secondary);
  border: 1.5px solid transparent;
}

.palette-btn:hover {
  transform: scale(1.08);
}

.palette-btn.current {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.palette-btn.answered {
  background: var(--success);
  color: white;
}

.palette-btn.marked {
  background: var(--warning);
  color: white;
}

.palette-legend {
  padding: 0.875rem 1.25rem;
  border-top: var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.palette-submit {
  margin: 0.75rem;
  padding: 0.75rem;
  background: var(--danger);
  color: white;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
}

.palette-submit:hover {
  background: #b91c1c;
}

/* ── Result Screen ──────────────────────────────────────────── */
.result-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--gray-50);
}

.result-card {
  background: white;
  border: var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  max-width: 560px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.result-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

.result-icon.pass {
  background: var(--success-bg);
}

.result-icon.fail {
  background: var(--danger-bg);
}

.result-icon svg {
  width: 40px;
  height: 40px;
}

.result-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.375rem;
}

.result-subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1.75rem;
}

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.875rem;
  margin-bottom: 1.75rem;
}

.result-stat {
  background: var(--gray-50);
  border: var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: left;
}

.result-stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.result-stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  margin-top: 0.2rem;
  color: var(--text-primary);
}

.result-stat-value.pass {
  color: var(--success);
}

.result-stat-value.fail {
  color: var(--danger);
}

/* ── Exam Selection Screen ──────────────────────────────────── */
.selection-page {
  min-height: 100vh;
  background: var(--gray-50);
  padding: 2rem;
}

.selection-inner {
  max-width: 860px;
  margin: 0 auto;
}

.selection-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: var(--border);
}

.selection-topbar h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.exam-select-card {
  background: white;
  border: var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
}

.exam-select-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.exam-select-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.875rem;
}

.exam-select-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.exam-select-subject {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.exam-select-metas {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.exam-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: var(--gray-100);
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
}

.exam-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

/* ── Live Session indicator ─────────────────────────────────── */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 4px;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: 0.4
  }
}

/* ── Divider ────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: var(--border);
  margin: 1.25rem 0;
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  background: white;
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius-lg);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  color: var(--gray-300);
  margin: 0 auto 1rem;
}

.empty-state h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
}

.empty-state p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .portal-sidebar {
    display: none;
  }

  .login-left {
    display: none;
  }

  .login-right {
    width: 100%;
    border-left: none;
  }

  .exam-body {
    flex-direction: column;
    max-height: none;
  }

  .exam-palette {
    width: 100%;
    border-left: none;
    border-top: var(--border);
    max-height: 240px;
  }

  .portal-content {
    padding: 1rem;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ================================================================
   Student Dashboard — Light / Solid Theme
================================================================ */
.dashboard-wrapper {
  min-height: 100vh;
  background: #f8fafc;
  font-family: 'Inter', sans-serif;
}

.dash-header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.dash-header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.dash-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.dash-avatar {
  width: 44px;
  height: 44px;
  background: #1d4ed8;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.dash-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.dash-subtitle {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0.1rem 0 0;
}

.dash-user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dash-info-pill {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
}

.dash-logout-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 0.4rem 0.875rem;
  border-radius: 0.625rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.dash-logout-btn:hover {
  background: #fee2e2;
}

.dash-refresh-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  padding: 0.4rem 0.875rem;
  border-radius: 0.625rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.dash-refresh-btn:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.dash-refresh-btn.animate-spin-once svg {
  animation: dash-spin 0.6s ease-out;
}

@keyframes dash-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.dash-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.dash-section {
  margin-bottom: 2.5rem;
}

.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.dash-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.dash-badge {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* Exam Grid */
.exam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.exam-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.875rem;
  padding: 1.5rem;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  cursor: default;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.exam-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 16px rgba(29, 78, 216, 0.1);
  transform: translateY(-2px);
}

.exam-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.exam-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-demo {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.badge-main {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.exam-card-icon {
  font-size: 1.5rem;
}

.exam-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.25rem;
  line-height: 1.3;
}

.exam-card-subject {
  font-size: 0.82rem;
  color: #64748b;
  margin: 0 0 1rem;
}

.exam-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.exam-meta-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: #64748b;
}

.start-exam-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #1d4ed8;
  color: white;
  border: none;
  border-radius: 0.625rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.start-exam-btn:hover {
  background: #1e3a8a;
}

.exam-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  border-radius: 0.875rem;
  color: #64748b;
}

@keyframes shimmer {
  0% {
    opacity: 0.6;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.6;
  }
}

/* ── Toasts ─────────────────────────────────────────────────── */
.portal-toast {
  position: fixed;
  right: 24px;
  background: white;
  padding: 12px 18px;
  border-radius: var(--radius-xl);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  border-left: 4px solid var(--primary);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10000;
  transform: translateX(120%);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 320px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.portal-toast.visible {
  transform: translateX(0);
}

.portal-toast svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-success {
  border-left-color: var(--success);
}

.toast-success svg {
  color: var(--success);
}

.toast-error {
  border-left-color: var(--danger);
}

.toast-error svg {
  color: var(--danger);
}

.toast-warning {
  border-left-color: var(--warning);
}

.toast-warning svg {
  color: var(--warning);
}

.toast-info {
  border-left-color: var(--info);
}

.toast-info svg {
  color: var(--info);
}

/* ── Exam History Result Modal Animations ───────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
