/* ============================================================
   ONLINE EXAMINATION PORTAL - MAIN STYLESHEET
   ============================================================ */

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

:root {
  --font-main: 'Inter', sans-serif;
  --sidebar-width: 250px;
  --topbar-height: 60px;
  --primary: #1a237e;
  --accent: #3949ab;
}

body { font-family: var(--font-main); background: #f4f6fb; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page .card { animation: slideUp 0.4s ease; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   ADMIN LAYOUT - Sidebar + Main
   ============================================================ */
.admin-layout { display: flex; min-height: 100vh; overflow-x: hidden; }

.admin-sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  position: fixed;
  top: 0; left: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: 2px 0 8px rgba(0,0,0,.08);
  transition: transform .3s;
}

.admin-sidebar.collapsed { transform: translateX(-100%); }

.sidebar-header { flex-shrink: 0; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: #555;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .15s;
}

.sidebar-link:hover { background: #f0f4ff; color: var(--primary); border-left-color: var(--accent); }
.sidebar-link.active { background: #e8ecff; color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
.sidebar-icon { font-size: 16px; flex-shrink: 0; }

.sidebar-section-label {
  padding: 16px 20px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #aaa;
}

.admin-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .3s;
}

.admin-main.expanded { margin-left: 0; }

.admin-topbar {
  height: var(--topbar-height);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 999;
  box-shadow: 0 2px 4px rgba(0,0,0,.06);
}

.admin-content {
  flex: 1;
  padding: 24px;
  max-width: 1600px;
}

/* ============================================================
   STAT WIDGETS
   ============================================================ */
.stat-widget {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  border-left: 4px solid var(--w-color);
  transition: transform .2s, box-shadow .2s;
}

.stat-widget:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.1); }

.stat-icon {
  width: 50px; height: 50px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: var(--w-color);
  color: #fff;
  flex-shrink: 0;
}

.stat-value { font-size: 26px; font-weight: 700; line-height: 1; color: #1a1a2e; }
.stat-label { font-size: 12px; color: #888; font-weight: 500; margin-top: 2px; }

/* ============================================================
   AVATAR CIRCLE
   ============================================================ */
.avatar-circle {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 16px;
  width: 40px; height: 40px;
  flex-shrink: 0;
}

.small-avatar { width: 32px; height: 32px; font-size: 13px; }

/* ============================================================
   TABLES
   ============================================================ */
.table th { font-size: 12px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: #666; }
.table td { vertical-align: middle; font-size: 13.5px; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }

/* ============================================================
   PORTAL FOOTER
   ============================================================ */
.portal-footer { margin-top: auto; }
.portal-navbar .nav-link:hover { opacity: 0.8; }

/* ============================================================
   EXAM INTERFACE
   ============================================================ */
.exam-body { background: #f0f2f7; }

.exam-header {
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.exam-timer {
  background: rgba(255,255,255,.15);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 1px;
}

.exam-timer.warning { background: rgba(255,193,7,.3); animation: pulse 1s infinite; }
.exam-timer.danger { background: rgba(220,53,69,.4); animation: pulse 0.5s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }

.exam-container { min-height: calc(100vh - 60px); }
.exam-question-panel { background: #f0f2f7; }

.exam-sidebar {
  background: #fff;
  border-left: 1px solid #e5e7eb;
  min-height: calc(100vh - 60px);
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
}

/* Options */
.option-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all .15s;
  background: #fff;
  user-select: none;
}

.option-item:hover { border-color: #667eea; background: #f5f7ff; }
.option-item.selected { border-color: #1a237e; background: #e8ecff; }

.option-letter {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

.option-a { background: #3b82f6; }
.option-b { background: #8b5cf6; }
.option-c { background: #10b981; }
.option-d { background: #f59e0b; }

.option-content { flex: 1; font-size: 15px; line-height: 1.5; }
.option-check { color: #1a237e; display: none; }
.option-item.selected .option-check { display: block; }

/* Question Navigator Grid */
.question-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.q-nav-btn {
  width: 100%;
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all .15s;
}

.q-nav-btn.unanswered { background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; }
.q-nav-btn.answered { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.q-nav-btn.current { background: #1a237e; color: #fff; border: 1px solid #1a237e; }
.q-nav-btn:hover { transform: scale(1.1); }

/* Legend */
.legend { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #555; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 14px; height: 14px; border-radius: 4px; }
.legend-dot.answered { background: #d1fae5; border: 1px solid #6ee7b7; }
.legend-dot.unanswered { background: #f3f4f6; border: 1px solid #e5e7eb; }
.legend-dot.current { background: #1a237e; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.show { transform: translateX(0); }
  .admin-main { margin-left: 0; }
}

@media (max-width: 576px) {
  .admin-content { padding: 16px; }
  .stat-widget { padding: 14px; }
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.cursor-pointer { cursor: pointer; }
code { background: #f1f3f9; padding: 2px 6px; border-radius: 4px; font-size: 12px; color: #d63384; }
.question-card:hover { background: #fafbff; }
.question-select-item:hover { background: #f8f9ff; }

/* Form control focus */
.form-control:focus, .form-select:focus { border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,.15); }

/* Sidebar toggle button */
.sidebar-toggle { border: none; background: #f1f3f9; }
.sidebar-toggle:hover { background: #e2e8f0; }
