/* ================================================================
   AEBS Assessment Portal — Main Stylesheet
   Design: Institutional · Deep Navy + Warm Gold
   Fonts: Cormorant Garamond (display) + DM Sans (UI)
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --navy:        #0D1B2A;
  --navy-mid:    #1A2E45;
  --navy-light:  #243B55;
  --gold:        #C49A3C;
  --gold-light:  #E5B84D;
  --gold-pale:   #F5E8C8;
  --surface:     #F8F7F4;
  --surface-2:   #EDECEA;
  --border:      #D8D5CF;
  --text-dark:   #1A1916;
  --text-mid:    #4A4845;
  --text-muted:  #8A8784;
  --success:     #1A6B3C;
  --danger:      #9B2335;
  --warning:     #A0620B;
  --info:        #0F5A8A;
  --sidebar-w:   256px;
  --header-h:    64px;
  --radius:      8px;
  --radius-lg:   14px;
  --shadow-sm:   0 1px 3px rgba(13,27,42,.08);
  --shadow-md:   0 4px 16px rgba(13,27,42,.12);
}

/* ── Reset / Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--surface);
  color: var(--text-dark);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy-mid); text-decoration: none; transition: color .15s; }
a:hover { color: var(--gold); }

h1, h2, h3, h4, h5 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.25;
}

/* ── Auth Pages ─────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

.auth-brand {
  width: 45%;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  position: relative;
  overflow: hidden;
}

.auth-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(196,154,60,.18) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(196,154,60,.10) 0%, transparent 45%);
}

.auth-brand-inner { position: relative; z-index: 1; text-align: center; }

.auth-brand .brand-logo {
  width: 72px; height: 72px;
  background: var(--gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem;
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--navy);
}

.auth-brand h1 {
  color: #fff;
  font-size: 2.2rem;
  margin-bottom: .5rem;
}

.auth-brand p {
  color: rgba(255,255,255,.6);
  font-size: .95rem;
}

.auth-form-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
}

.auth-form-box {
  width: 100%;
  max-width: 420px;
}

.auth-form-box h2 {
  font-size: 1.9rem;
  margin-bottom: .3rem;
}

.auth-form-box .subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: .9rem;
}

/* ── Shell Layout ───────────────────────────────────────────── */
.shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--navy);
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform .25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-brand .s-logo {
  width: 38px; height: 38px;
  background: var(--gold);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  color: var(--navy);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.sidebar-brand .s-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}

.sidebar-brand .s-sub {
  font-size: .72rem;
  color: rgba(255,255,255,.45);
  letter-spacing: .04em;
}

.sidebar-role-badge {
  margin: .75rem 1.25rem .25rem;
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: .8;
}

.sidebar-nav { flex: 1; padding: .5rem 0; overflow-y: auto; }

.nav-section-label {
  padding: 1.2rem 1.25rem .3rem;
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.28);
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem 1.25rem;
  color: rgba(255,255,255,.65);
  font-size: .88rem;
  font-weight: 400;
  transition: all .15s;
  border-radius: 0;
  position: relative;
}

.sidebar-nav a i { font-size: 1rem; width: 20px; flex-shrink: 0; }

.sidebar-nav a:hover {
  color: #fff;
  background: rgba(255,255,255,.06);
}

.sidebar-nav a.active {
  color: #fff;
  background: rgba(196,154,60,.15);
  font-weight: 500;
}

.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--gold);
  border-radius: 0 3px 3px 0;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar-footer .user-row {
  display: flex;
  align-items: center;
  gap: .65rem;
}

.user-avatar {
  width: 34px; height: 34px;
  background: var(--navy-mid);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  font-weight: 500;
  color: rgba(255,255,255,.8);
  flex-shrink: 0;
}

.user-info .name { font-size: .82rem; font-weight: 500; color: #fff; }
.user-info .role { font-size: .72rem; color: rgba(255,255,255,.4); }

.logout-btn {
  margin-left: auto;
  color: rgba(255,255,255,.35) !important;
  padding: .25rem !important;
  font-size: 1rem;
}

.logout-btn:hover { color: var(--gold) !important; }

/* ── Main Content ───────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar .page-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--navy);
  flex: 1;
}

.topbar .topbar-actions { display: flex; align-items: center; gap: .75rem; }

.content { padding: 2rem; flex: 1; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card-header h5 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
}

.card-body { padding: 1.5rem; }

/* ── Stat Cards ─────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; }

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.stat-icon.navy   { background: rgba(13,27,42,.08); color: var(--navy); }
.stat-icon.gold   { background: rgba(196,154,60,.12); color: var(--gold); }
.stat-icon.green  { background: rgba(26,107,60,.1); color: var(--success); }
.stat-icon.red    { background: rgba(155,35,53,.1); color: var(--danger); }

.stat-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}

.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: .2rem; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; font-size: .87rem; }

.data-table thead th {
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 500;
  font-size: .75rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .7rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody tr { border-bottom: 1px solid var(--surface-2); transition: background .1s; }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface); }
.data-table td { padding: .8rem 1rem; vertical-align: middle; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .25rem .65rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .02em;
}

.badge-success { background: rgba(26,107,60,.1);  color: var(--success); }
.badge-danger  { background: rgba(155,35,53,.1);  color: var(--danger);  }
.badge-warning { background: rgba(160,98,11,.1);  color: var(--warning); }
.badge-info    { background: rgba(15,90,138,.1);  color: var(--info);    }
.badge-gold    { background: var(--gold-pale);    color: #7A5F1A;        }
.badge-navy    { background: rgba(13,27,42,.08);  color: var(--navy);    }
.badge-muted   { background: var(--surface-2);    color: var(--text-muted); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .52rem 1.1rem;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: .87rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.btn-primary:hover { background: var(--navy-mid); color: #fff; }

.btn-gold {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
  font-weight: 600;
}
.btn-gold:hover { background: var(--gold-light); border-color: var(--gold-light); color: var(--navy); }

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-mid);
}
.btn-outline:hover { border-color: var(--navy); color: var(--navy); background: var(--surface); }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #7A1B29; }

.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-icon { padding: .45rem; border-radius: var(--radius); }

/* ── Forms ──────────────────────────────────────────────────── */
.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-mid);
  margin-bottom: .35rem;
}

.form-control, .form-select {
  display: block;
  width: 100%;
  padding: .6rem .85rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: .9rem;
  color: var(--text-dark);
  transition: border-color .15s, box-shadow .15s;
}

.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--navy-mid);
  box-shadow: 0 0 0 3px rgba(26,46,69,.1);
}

textarea.form-control { resize: vertical; min-height: 100px; }

.form-text { font-size: .78rem; color: var(--text-muted); margin-top: .3rem; }
.form-check-input:checked { background-color: var(--navy); border-color: var(--navy); }

/* ── Exam Interface ──────────────────────────────────────────── */
.exam-shell {
  min-height: 100vh;
  background: var(--navy);
  display: flex;
  flex-direction: column;
}

.exam-topbar {
  background: var(--navy);
  border-bottom: 1px solid rgba(255,255,255,.1);
  padding: .85rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
}

.exam-topbar .exam-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: #fff;
}

.timer-box {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px;
  padding: .45rem 1rem;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: .05em;
  min-width: 110px;
  justify-content: center;
}

.timer-box.warning { border-color: #E5A020; color: #E5A020; background: rgba(229,160,32,.08); }
.timer-box.critical { border-color: #C94040; color: #C94040; background: rgba(201,64,64,.1); animation: pulse-red 1s ease-in-out infinite; }

@keyframes pulse-red { 0%,100% { box-shadow: 0 0 0 0 rgba(201,64,64,.3); } 50% { box-shadow: 0 0 0 6px rgba(201,64,64,0); } }

.exam-body { flex: 1; display: flex; }

.exam-sidebar {
  width: 220px;
  background: rgba(255,255,255,.04);
  border-right: 1px solid rgba(255,255,255,.08);
  padding: 1.25rem;
  overflow-y: auto;
  flex-shrink: 0;
}

.exam-sidebar h6 {
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
  margin-bottom: .75rem;
}

.q-nav-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.q-nav-btn {
  aspect-ratio: 1;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 6px;
  background: transparent;
  color: rgba(255,255,255,.5);
  font-size: .8rem;
  cursor: pointer;
  transition: all .15s;
  display: flex; align-items: center; justify-content: center;
}

.q-nav-btn:hover { border-color: var(--gold); color: var(--gold); }
.q-nav-btn.answered { background: rgba(196,154,60,.2); border-color: var(--gold); color: var(--gold); }
.q-nav-btn.current { background: var(--gold); border-color: var(--gold); color: var(--navy); font-weight: 700; }
.q-nav-btn.flagged { border-color: #E55; color: #E55; }

.exam-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  max-width: 860px;
}

.question-card {
  background: #fff;
  border-radius: 14px;
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.question-meta {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}

.q-number {
  width: 32px; height: 32px;
  background: var(--navy);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.q-type-badge {
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.q-marks { margin-left: auto; font-size: .8rem; color: var(--text-muted); }

.question-text {
  font-size: 1rem;
  color: var(--text-dark);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.mcq-options { display: flex; flex-direction: column; gap: .6rem; }

.mcq-option {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}

.mcq-option:hover { border-color: var(--navy); background: var(--surface); }
.mcq-option input[type="radio"] { margin-top: 2px; flex-shrink: 0; accent-color: var(--navy); }
.mcq-option.selected { border-color: var(--navy); background: rgba(13,27,42,.04); }

/* ── Modals ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,27,42,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(3px);
}

.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 2rem;
  max-width: 440px;
  width: 90%;
  text-align: center;
}

.modal-box .modal-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  margin: 0 auto 1.25rem;
}

.modal-icon.warning { background: rgba(160,98,11,.1); color: var(--warning); }
.modal-icon.danger  { background: rgba(155,35,53,.1); color: var(--danger);  }

/* ── Violation Banner ───────────────────────────────────────── */
#violation-banner {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  background: var(--danger);
  color: #fff;
  text-align: center;
  padding: .65rem 1rem;
  font-weight: 500;
  font-size: .9rem;
  z-index: 9999;
  animation: slide-down .3s ease;
}

@keyframes slide-down { from { transform: translateY(-100%); } to { transform: translateY(0); } }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: .85rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: .88rem;
  margin-bottom: 1rem;
}

.alert-success { background: rgba(26,107,60,.08); border-color: rgba(26,107,60,.2); color: var(--success); }
.alert-danger  { background: rgba(155,35,53,.08); border-color: rgba(155,35,53,.2); color: var(--danger); }
.alert-warning { background: rgba(160,98,11,.08); border-color: rgba(160,98,11,.2); color: var(--warning); }
.alert-info    { background: rgba(15,90,138,.08); border-color: rgba(15,90,138,.2); color: var(--info); }

/* ── Progress Bar ───────────────────────────────────────────── */
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--gold); border-radius: 99px; transition: width .4s ease; }
.progress-bar.green { background: var(--success); }
.progress-bar.red   { background: var(--danger); }

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: .35; }
.empty-state h5 { font-size: 1.2rem; margin-bottom: .5rem; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.3); }
  .main { margin-left: 0; }
  .auth-brand { display: none; }
  .auth-form-wrap { padding: 2rem 1.25rem; }
  .exam-sidebar { display: none; }
  .content { padding: 1.25rem; }
}

/* ── Utility ─────────────────────────────────────────────────── */
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.mt-1 { margin-top: .25rem; } .mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; } .mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: .25rem; } .mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; } .mb-4 { margin-bottom: 1rem; }
.mb-0 { margin-bottom: 0; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.fw-500 { font-weight: 500; }
.small { font-size: .82rem; }
.w-100 { width: 100%; }
.g-3 { gap: .75rem; }
.g-4 { gap: 1rem; }
.row { display: flex; flex-wrap: wrap; margin: -.5rem; }
.row > * { padding: .5rem; }
.col-6 { width: 50%; }
.col-12 { width: 100%; }
@media (min-width: 768px) { .col-md-3 { width: 25%; } .col-md-4 { width: 33.333%; } .col-md-6 { width: 50%; } .col-md-8 { width: 66.666%; } }
