/* ============================================================
   URI™ — Main Stylesheet
   Palette: Indigo #2D3A8C | Saffron #FF7518 | Success #16a34a
   Font: Inter (body) + Nunito (headings)
   ============================================================ */

:root {
  --primary:      #2D3A8C;
  --primary-dark: #1e2a6e;
  --accent:       #FF7518;
  --success:      #16a34a;
  --warning:      #d97706;
  --danger:       #dc2626;
  --info:         #2563eb;
  --gray-50:      #f9fafb;
  --gray-100:     #f3f4f6;
  --gray-200:     #e5e7eb;
  --gray-400:     #9ca3af;
  --gray-600:     #4b5563;
  --gray-800:     #1f2937;
  --radius:       8px;
  --radius-lg:    12px;
  --shadow:       0 2px 12px rgba(0,0,0,.07);
}

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

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

body {
  font-family: 'Inter', sans-serif;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  min-height: 100vh;
}

h1,h2,h3,h4 { font-family: 'Nunito', sans-serif; font-weight: 700; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Topnav ─────────────────────────────────────────────── */
.topnav {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1.5rem;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.brand-uri {
  font-family: 'Nunito', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -.01em;
}
.nav-links { display: flex; align-items: center; gap: 1.25rem; font-size: .9rem; }
.nav-links a { color: var(--gray-600); font-weight: 500; }
.nav-links a:hover { color: var(--primary); text-decoration: none; }

.btn-primary {
  background: var(--primary);
  color: #fff !important;
  padding: .45rem 1.1rem;
  border-radius: var(--radius);
  font-weight: 600;
  transition: background .15s;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-admin {
  background: var(--accent);
  color: #fff !important;
  padding: .4rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
}
.btn-logout { color: var(--danger) !important; }

/* ── Main content ───────────────────────────────────────── */
.main-content { max-width: 1120px; margin: 0 auto; padding: 1.75rem 1rem; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .9rem;
  font-weight: 500;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}

/* ── Stats grid ─────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card  { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 1.1rem 1.25rem; }
.stat-val   { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: .8rem; color: var(--gray-400); margin-top: .2rem; text-transform: uppercase; letter-spacing: .05em; }

/* ── URI Score gauge ────────────────────────────────────── */
.uri-gauge-wrap { text-align: center; padding: 1.25rem; }
.uri-gauge-val  { font-size: 3rem; font-weight: 800; color: var(--primary); line-height: 1; }
.uri-gauge-sub  { font-size: .8rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: .06em; margin-top: .25rem; }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th { background: var(--gray-50); padding: .6rem .75rem; text-align: left; font-size: .72rem; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--gray-200); }
td { padding: .75rem; border-bottom: 1px solid var(--gray-100); color: var(--gray-800); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

/* ── Badges ─────────────────────────────────────────────── */
.badge { display: inline-block; font-size: .7rem; font-weight: 600; padding: 2px 9px; border-radius: 20px; }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-amber  { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem 1rem; border-radius: var(--radius); font-size: .875rem; font-weight: 500; cursor: pointer; border: 1px solid transparent; transition: all .15s; }
.btn-sm { padding: .3rem .75rem; font-size: .8rem; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-danger  { background: var(--danger);  color: #fff; border-color: var(--danger); }
.btn-danger:hover  { background: #b91c1c; }
.btn-outline { background: transparent; border-color: var(--gray-200); color: var(--gray-600); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .85rem; font-weight: 500; color: var(--gray-600); margin-bottom: .35rem; }
.form-control {
  width: 100%; padding: .55rem .8rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: 'Inter', sans-serif;
  transition: border-color .15s;
  background: #fff;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(45,58,140,.1); }
.form-hint { font-size: .75rem; color: var(--gray-400); margin-top: .3rem; }

/* ── Auth pages ──────────────────────────────────────────── */
.auth-wrap { display: flex; align-items: center; justify-content: center; min-height: 80vh; padding: 1rem; }
.auth-card { background: #fff; border: 1px solid var(--gray-200); border-radius: 16px; padding: 2rem; max-width: 420px; width: 100%; box-shadow: var(--shadow); }
.auth-title { font-size: 1.5rem; font-weight: 700; color: var(--primary); margin-bottom: .25rem; }
.auth-sub   { font-size: .875rem; color: var(--gray-400); margin-bottom: 1.5rem; }

/* ── Test-take UI ────────────────────────────────────────── */
.test-layout  { display: grid; grid-template-columns: 1fr 280px; gap: 0; min-height: 100vh; }
.test-qpanel  { padding: 1.5rem; border-right: 1px solid var(--gray-200); }
.test-sidebar { background: var(--gray-50); padding: 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.q-text       { font-size: 1rem; line-height: 1.7; color: var(--gray-800); margin-bottom: 1.25rem; }
.option-list  { list-style: none; display: flex; flex-direction: column; gap: .6rem; }
.option-item  { display: flex; align-items: flex-start; gap: .75rem; padding: .75rem; border: 1px solid var(--gray-200); border-radius: var(--radius); cursor: pointer; transition: all .15s; }
.option-item:hover          { border-color: var(--primary); background: #f0f3ff; }
.option-item.selected       { border-color: var(--primary); background: #e8ecf8; }
.option-item.correct        { border-color: var(--success); background: #dcfce7; }
.option-item.wrong          { border-color: var(--danger);  background: #fee2e2; }
.option-key   { width: 28px; height: 28px; border-radius: 50%; background: var(--gray-100); display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 600; flex-shrink: 0; }
.q-palette    { display: grid; grid-template-columns: repeat(5,1fr); gap: 5px; margin-top: .75rem; }
.pal-btn      { aspect-ratio:1; display:flex; align-items:center; justify-content:center; font-size: .78rem; font-weight: 600; border-radius: 6px; cursor: pointer; border: 1px solid var(--gray-200); background: #fff; color: var(--gray-600); }
.pal-btn.answered { background: var(--success); color: #fff; border-color: var(--success); }
.pal-btn.skipped  { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.pal-btn.current  { background: var(--primary); color: #fff; border-color: var(--primary); }
.timer-box    { background: var(--primary); color: #fff; text-align: center; padding: .6rem; border-radius: var(--radius); font-size: 1.3rem; font-weight: 700; font-family: monospace; margin-bottom: 1rem; }
.timer-box.warning { background: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.7} }

/* ── Footer ──────────────────────────────────────────────── */
.site-footer { text-align: center; padding: 1.5rem; font-size: .8rem; color: var(--gray-400); border-top: 1px solid var(--gray-200); margin-top: 3rem; }
.site-footer a { color: var(--success); }

/* ── Responsive ──────────────────────────────────────────── */
@media(max-width:768px) {
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .test-layout { grid-template-columns: 1fr; }
  .test-sidebar { position: fixed; bottom: 0; left: 0; right: 0; height: auto; max-height: 40vh; border-top: 1px solid var(--gray-200); }
  .nav-links { gap: .75rem; font-size: .82rem; }
}
@media(max-width:480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topnav { padding: .6rem 1rem; }
}
