@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@300;400;500;600&display=swap');

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

:root {
  --navy: #0f1b2d;
  --navy-light: #1a2f4a;
  --navy-mid: #243d5c;
  --accent: #e8892b;
  --accent-light: #f0a455;
  --cream: #f7f3ee;
  --cream-dark: #ede8e0;
  --white: #ffffff;
  --text: #0f1b2d;
  --text-muted: #5a6e85;
  --success: #1a7a4a;
  --success-bg: #e8f5ee;
  --danger: #c0392b;
  --danger-bg: #fdf0ee;
  --border: #d6cfc5;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 16px rgba(15,27,45,0.08);
  --shadow-lg: 0 8px 40px rgba(15,27,45,0.14);
}

html { font-size: 16px; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

h1, h2, h3 { font-family: 'DM Serif Display', serif; line-height: 1.2; }
h1 { font-size: 2.4rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.3rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-light); }

/* ── NAV ── */
.nav {
  background: var(--navy);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  font-family: 'DM Serif Display', serif;
  color: var(--white);
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-brand span { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-links a {
  color: rgba(255,255,255,0.75);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}
.nav-links a:hover, .nav-links a.active {
  background: rgba(255,255,255,0.12);
  color: var(--white);
}
.nav-links a.logout {
  background: rgba(232,137,43,0.15);
  color: var(--accent-light);
}
.nav-links a.logout:hover { background: rgba(232,137,43,0.25); }

/* ── LAYOUT ── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.page { padding: 2.5rem 0 4rem; }

/* ── HERO ── */
.hero {
  background: var(--navy);
  color: var(--white);
  padding: 4rem 0 3rem;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  right: -80px;
  top: -80px;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(232,137,43,0.07);
  pointer-events: none;
}
.hero h1 { color: var(--white); margin-bottom: 0.75rem; }
.hero p { color: rgba(255,255,255,0.7); font-size: 1.1rem; max-width: 540px; }
.hero-meta { display: flex; gap: 2rem; margin-top: 1.5rem; }
.hero-stat { display: flex; flex-direction: column; }
.hero-stat strong { font-size: 1.6rem; color: var(--accent); font-family: 'DM Serif Display', serif; }
.hero-stat span { font-size: 0.8rem; color: rgba(255,255,255,0.55); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── CARDS ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card-body { padding: 1.75rem; }
.card-footer { padding: 1rem 1.75rem; background: var(--cream); border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }

.quiz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; margin-top: 2rem; }
.quiz-card-tag { display: inline-flex; align-items: center; gap: 6px; background: var(--cream-dark); color: var(--text-muted); font-size: 0.78rem; font-weight: 500; padding: 4px 10px; border-radius: 20px; margin-bottom: 0.75rem; }
.quiz-card-title { font-size: 1.2rem; margin-bottom: 0.5rem; }
.quiz-card-desc { color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  line-height: 1;
}
.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { background: var(--accent-light); color: var(--white); }
.btn-navy { background: var(--navy); color: var(--white); }
.btn-navy:hover { background: var(--navy-light); color: var(--white); }
.btn-outline { background: transparent; color: var(--navy); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--navy); background: var(--cream); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid #f5c6c0; }
.btn-danger:hover { background: var(--danger); color: var(--white); }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── FORMS ── */
.form-group { margin-bottom: 1.25rem; }
label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text); margin-bottom: 0.4rem; letter-spacing: 0.02em; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,137,43,0.12);
}
textarea { resize: vertical; min-height: 90px; }

/* ── ALERT ── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.9rem; margin-bottom: 1.25rem; display: flex; align-items: center; gap: 8px; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #f5c6c0; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #b8e0ca; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; background: var(--white); }
thead { background: var(--navy); color: var(--white); }
th { padding: 13px 16px; text-align: left; font-size: 0.82rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
td { padding: 13px 16px; font-size: 0.9rem; border-bottom: 1px solid var(--cream-dark); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--cream); }

/* ── BADGE ── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.76rem; font-weight: 600; }
.badge-pass { background: var(--success-bg); color: var(--success); }
.badge-fail { background: var(--danger-bg); color: var(--danger); }
.badge-neutral { background: var(--cream-dark); color: var(--text-muted); }

/* ── QUIZ ATTEMPT ── */
.attempt-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 2rem; align-items: start; }
.timer-box {
  background: var(--navy);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  position: sticky;
  top: 80px;
  color: var(--white);
}
.timer-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(255,255,255,0.5); margin-bottom: 0.5rem; }
.timer-display { font-family: 'DM Serif Display', serif; font-size: 3rem; color: var(--accent); line-height: 1; }
.timer-display.warning { color: #f87171; }
.timer-quiz-name { font-size: 0.85rem; color: rgba(255,255,255,0.6); margin-top: 0.75rem; }
.timer-progress { width: 100%; height: 4px; background: rgba(255,255,255,0.15); border-radius: 2px; margin-top: 1rem; overflow: hidden; }
.timer-progress-bar { height: 100%; background: var(--accent); transition: width 1s linear; }

.question-card { background: var(--white); border-radius: var(--radius); padding: 1.75rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); }
.question-num { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); margin-bottom: 0.6rem; }
.question-text { font-size: 1.05rem; font-weight: 500; margin-bottom: 1.25rem; color: var(--text); }
.options { display: flex; flex-direction: column; gap: 10px; }
.option-label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.95rem;
}
.option-label:hover { border-color: var(--accent); background: rgba(232,137,43,0.04); }
.option-label input[type=radio] { accent-color: var(--accent); width: 17px; height: 17px; flex-shrink: 0; }
.option-label:has(input:checked) { border-color: var(--accent); background: rgba(232,137,43,0.07); font-weight: 500; }

/* ── RESULT ── */
.result-hero { background: var(--navy); color: var(--white); padding: 3rem 0; text-align: center; }
.result-score { font-family: 'DM Serif Display', serif; font-size: 5rem; color: var(--accent); line-height: 1; }
.result-label { font-size: 1.1rem; color: rgba(255,255,255,0.65); margin-top: 0.5rem; }
.result-breakdown { margin-top: 2.5rem; }
.breakdown-item {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--border);
}
.breakdown-item.correct { border-left-color: var(--success); }
.breakdown-item.incorrect { border-left-color: var(--danger); }
.breakdown-q { font-weight: 600; margin-bottom: 0.6rem; }
.breakdown-answers { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.88rem; }
.breakdown-yours { color: var(--text-muted); }
.breakdown-correct-ans { color: var(--success); font-weight: 500; }

/* ── LOGIN ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy); }
.login-card { background: var(--white); border-radius: var(--radius); padding: 2.5rem; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.login-logo { font-family: 'DM Serif Display', serif; font-size: 1.5rem; color: var(--navy); margin-bottom: 0.25rem; }
.login-logo span { color: var(--accent); }
.login-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 2rem; }

/* ── ADMIN STATS ── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; margin-bottom: 2.5rem; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.stat-num { font-family: 'DM Serif Display', serif; font-size: 2.5rem; color: var(--navy); }
.stat-label { font-size: 0.82rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }

/* ── EMPTY STATE ── */
.empty { text-align: center; padding: 4rem 2rem; color: var(--text-muted); }
.empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.4; }
.empty h3 { color: var(--text); margin-bottom: 0.5rem; }

/* ── PAGE HEADER ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem; }
.page-title { font-size: 1.7rem; }
.breadcrumb { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }

/* ── FORM CARD ── */
.form-card { background: var(--white); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); max-width: 640px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.section-title { font-size: 1rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 1rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--border); }

/* ── QUESTION FORM ── */
.answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.answer-opt { display: flex; align-items: center; gap: 8px; background: var(--cream); border-radius: var(--radius-sm); padding: 10px 12px; }
.answer-opt-num { background: var(--navy); color: var(--white); width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700; flex-shrink: 0; }
.answer-opt input { background: var(--white); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  h1 { font-size: 1.8rem; }
  .attempt-wrap { grid-template-columns: 1fr; }
  .timer-box { position: static; }
  .form-row, .answer-grid { grid-template-columns: 1fr; }
  .nav { padding: 0 1rem; }
  .hero { padding: 2.5rem 0 2rem; }
}
