/* assets/css/style.css - Online Exam Portal Styles */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&display=swap');

:root {
  --bg-primary: #0d0f14;
  --bg-secondary: #13161e;
  --bg-card: #181c26;
  --bg-elevated: #1e2334;
  --accent: #e8b84b;
  --accent-dim: rgba(232,184,75,0.15);
  --accent-hover: #f0cc72;
  --red: #e85b5b;
  --green: #4caf82;
  --blue: #5b9be8;
  --purple: #9b6ee8;
  --text-primary: #eef0f5;
  --text-secondary: #8891a8;
  --text-muted: #555e78;
  --border: rgba(255,255,255,0.07);
  --border-accent: rgba(232,184,75,0.3);
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --radius: 12px;
  --radius-sm: 8px;
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
}

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

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

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }

/* ── Typography ── */
h1, h2, h3, h4, h5 { font-family: var(--font-display); line-height: 1.2; }
h1 { font-size: clamp(1.8rem, 3vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 2.5vw, 2rem); }
h3 { font-size: 1.3rem; }

/* ── Layout ── */
.wrapper { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s ease;
}
.main-content {
  margin-left: 260px;
  flex: 1;
  min-height: 100vh;
  padding: 2rem;
  max-width: calc(100vw - 260px);
}

/* ── Sidebar Brand ── */
.sidebar-brand {
  padding: 1.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.brand-icon {
  width: 40px; height: 40px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  color: var(--bg-primary);
  flex-shrink: 0;
}
.brand-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--text-primary);
}
.brand-role {
  font-size: 0.72rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}

/* ── Sidebar Nav ── */
.sidebar-nav { padding: 1rem 0; flex: 1; }
.nav-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 0.5rem 1.5rem;
  font-weight: 600;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 400;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  position: relative;
}
.nav-link:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.nav-link.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-left-color: var(--accent);
  font-weight: 500;
}
.nav-link .icon { width: 18px; text-align: center; font-size: 1rem; }
.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.user-avatar {
  width: 36px; height: 36px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 1rem;
  flex-shrink: 0;
}
.user-info .user-name { font-size: 0.875rem; font-weight: 500; color: var(--text-primary); }
.user-info .user-role { font-size: 0.75rem; color: var(--text-muted); }

/* ── Page Header ── */
.page-header {
  margin-bottom: 2rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.page-header-left { }
.page-title { color: var(--text-primary); margin-bottom: 0.25rem; }
.page-subtitle { color: var(--text-secondary); font-size: 0.9rem; font-weight: 300; }
.breadcrumb {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.8rem; color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { color: var(--text-muted); }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.75rem;
}
.card-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-primary);
}
.card-body { padding: 1.5rem; }
.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.1);
}

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--border-accent); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: 0.06;
  transform: translate(20px, -20px);
}
.stat-card.gold::before { background: var(--accent); }
.stat-card.blue::before { background: var(--blue); }
.stat-card.green::before { background: var(--green); }
.stat-card.red::before { background: var(--red); }
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 1rem;
}
.stat-card.gold .stat-icon { background: rgba(232,184,75,0.15); color: var(--accent); }
.stat-card.blue .stat-icon { background: rgba(91,155,232,0.15); color: var(--blue); }
.stat-card.green .stat-icon { background: rgba(76,175,130,0.15); color: var(--green); }
.stat-card.red .stat-icon { background: rgba(232,91,91,0.15); color: var(--red); }
.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 0.25rem;
}
.stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Table ── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.025); }
tbody td { padding: 0.9rem 1rem; color: var(--text-secondary); vertical-align: middle; }
tbody td strong { color: var(--text-primary); font-weight: 500; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.btn-danger {
  background: rgba(232,91,91,0.15);
  color: var(--red);
  border-color: rgba(232,91,91,0.3);
}
.btn-danger:hover { background: rgba(232,91,91,0.25); }
.btn-success {
  background: rgba(76,175,130,0.15);
  color: var(--green);
  border-color: rgba(76,175,130,0.3);
}
.btn-success:hover { background: rgba(76,175,130,0.25); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 1.75rem; font-size: 1rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Forms ── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-control {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.65rem 0.9rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control option { background: var(--bg-card); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ── Alerts ── */
.alert {
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: 0.5rem;
  border: 1px solid;
}
.alert-success { background: rgba(76,175,130,0.1); border-color: rgba(76,175,130,0.3); color: var(--green); }
.alert-error   { background: rgba(232,91,91,0.1); border-color: rgba(232,91,91,0.3); color: var(--red); }
.alert-warning { background: rgba(232,184,75,0.1); border-color: rgba(232,184,75,0.3); color: var(--accent); }
.alert-info    { background: rgba(91,155,232,0.1); border-color: rgba(91,155,232,0.3); color: var(--blue); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-gold    { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--border-accent); }
.badge-green   { background: rgba(76,175,130,0.15); color: var(--green); border: 1px solid rgba(76,175,130,0.3); }
.badge-red     { background: rgba(232,91,91,0.15); color: var(--red); border: 1px solid rgba(232,91,91,0.3); }
.badge-blue    { background: rgba(91,155,232,0.15); color: var(--blue); border: 1px solid rgba(91,155,232,0.3); }
.badge-gray    { background: rgba(136,145,168,0.15); color: var(--text-secondary); border: 1px solid var(--border); }

/* ── Login Page ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}
.auth-page::before {
  content: '';
  position: absolute;
  top: -200px; right: -200px;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232,184,75,0.05) 0%, transparent 70%);
}
.auth-page::after {
  content: '';
  position: absolute;
  bottom: -150px; left: -150px;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(91,155,232,0.04) 0%, transparent 70%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}
.auth-header {
  padding: 2.5rem 2rem 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.auth-logo {
  width: 56px; height: 56px;
  background: var(--accent);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  color: var(--bg-primary);
  margin: 0 auto 1rem;
}
.auth-title { font-size: 1.5rem; margin-bottom: 0.25rem; }
.auth-subtitle { color: var(--text-muted); font-size: 0.85rem; }
.auth-body { padding: 2rem; }
.auth-tabs { display: flex; margin-bottom: 1.75rem; background: var(--bg-elevated); border-radius: var(--radius-sm); padding: 3px; }
.auth-tab {
  flex: 1; text-align: center;
  padding: 0.5rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
  text-decoration: none;
}
.auth-tab.active { background: var(--bg-card); color: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,0.3); }

/* ── Exam Attempt UI ── */
.exam-layout { display: grid; grid-template-columns: 1fr 280px; gap: 1.5rem; align-items: start; }
.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1.25rem;
}
.question-number {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.question-text {
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.65;
  margin-bottom: 1.25rem;
}
.options-list { display: flex; flex-direction: column; gap: 0.6rem; }
.option-item { display: flex; align-items: center; gap: 0; }
.option-item input[type="radio"] { display: none; }
.option-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.option-label:hover { border-color: var(--border-accent); color: var(--text-primary); background: var(--accent-dim); }
.option-item input:checked + .option-label {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text-primary);
}
.option-key {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.15s;
  color: var(--text-muted);
}
.option-item input:checked + .option-label .option-key {
  background: var(--accent);
  color: var(--bg-primary);
}

/* ── Timer ── */
.timer-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: sticky;
  top: 1rem;
}
.timer-display {
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--text-primary);
  text-align: center;
  letter-spacing: 2px;
  margin: 0.75rem 0;
  line-height: 1;
}
.timer-display.warning { color: var(--accent); }
.timer-display.danger  { color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }
.timer-label { text-align: center; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.timer-progress {
  width: 100%;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  overflow: hidden;
  margin: 1rem 0;
}
.timer-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 1s linear, background 0.5s;
}
.progress-bar-warning { background: var(--accent); }
.progress-bar-danger  { background: var(--red); }
.question-nav {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
  margin-top: 1rem;
}
.q-nav-btn {
  aspect-ratio: 1;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.q-nav-btn:hover { border-color: var(--border-accent); color: var(--accent); }
.q-nav-btn.answered { background: var(--accent-dim); border-color: var(--border-accent); color: var(--accent); }
.q-nav-btn.current  { background: var(--accent); color: var(--bg-primary); border-color: var(--accent); }

/* ── Result Page ── */
.result-hero {
  text-align: center;
  padding: 3rem 2rem;
  border-radius: var(--radius);
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}
.result-hero.pass {
  background: linear-gradient(135deg, rgba(76,175,130,0.1) 0%, rgba(76,175,130,0.05) 100%);
  border: 1px solid rgba(76,175,130,0.2);
}
.result-hero.fail {
  background: linear-gradient(135deg, rgba(232,91,91,0.1) 0%, rgba(232,91,91,0.05) 100%);
  border: 1px solid rgba(232,91,91,0.2);
}
.result-score {
  font-family: var(--font-display);
  font-size: 5rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}
.result-score.pass { color: var(--green); }
.result-score.fail { color: var(--red); }
.result-meta { color: var(--text-secondary); font-size: 0.9rem; }
.answer-review { margin-top: 2rem; }
.answer-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.answer-item.correct { border-left: 3px solid var(--green); }
.answer-item.incorrect { border-left: 3px solid var(--red); }
.answer-item.skipped { border-left: 3px solid var(--text-muted); }

/* ── Utility ── */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-sm     { font-size: 0.85rem; }
.font-serif  { font-family: var(--font-display); }
.divider     { height: 1px; background: var(--border); margin: 1.5rem 0; }
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.4; }
.empty-state-title { font-family: var(--font-display); font-size: 1.3rem; color: var(--text-secondary); margin-bottom: 0.5rem; }

/* ── Grade colors ── */
.grade-aplus { color: #4caf82; }
.grade-a     { color: #5b9be8; }
.grade-b     { color: #9b6ee8; }
.grade-c     { color: var(--accent); }
.grade-d     { color: #e89b5b; }
.grade-f     { color: var(--red); }

/* ── Checkbox for assignment ── */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.5rem; }
.check-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.8rem; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: all 0.15s; }
.check-item:hover { border-color: var(--border-accent); background: var(--accent-dim); }
.check-item input[type="checkbox"]:checked ~ span { color: var(--accent); }
input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--accent);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; max-width: 100vw; padding: 1rem; }
  .exam-layout { grid-template-columns: 1fr; }
  .timer-panel { position: static; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Mobile toggle ── */
.menu-toggle {
  display: none;
  position: fixed;
  top: 1rem; left: 1rem;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
}
@media (max-width: 768px) { .menu-toggle { display: flex; } }

/* ── Overlay ── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }
