/* ============================================================
   Examen Auto B — mobile-first stylesheet
   ============================================================ */
:root {
  --bg: #0f172a;
  --bg-soft: #1e293b;
  --card: #1a2337;
  --card-2: #22304b;
  --border: #2e3d5c;
  --text: #e8eef7;
  --muted: #93a3bd;
  --accent: #38bdf8;
  --accent-2: #22d3ee;
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, 0.12);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, 0.12);
  --amber: #fbbf24;
  --amber-bg: rgba(251, 191, 36, 0.12);
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 500px at 80% -10%, #1b2c4d 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 22px; padding-bottom: 48px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.05rem; }
.brand-badge {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06263a; font-weight: 800; font-size: 1.05rem;
}
.brand-text span { color: var(--accent); }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.site-nav a, .site-nav button.nav-btn {
  color: var(--text); text-decoration: none; font-size: 0.92rem; font-weight: 600;
  padding: 8px 12px; border-radius: 9px; border: none; background: transparent;
  cursor: pointer; font-family: inherit; white-space: nowrap;
}
.site-nav a:hover, .site-nav button.nav-btn:hover { background: var(--bg-soft); color: var(--accent); }
.site-nav a.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #06263a; }
.site-nav a.btn-primary:hover { filter: brightness(1.08); color: #06263a; }
.nav-user { font-size: 0.85rem; color: var(--muted); padding: 0 8px; }
.nav-toggle { display: none; margin-left: auto; background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); border-radius: 9px; font-size: 1.2rem; padding: 6px 12px; cursor: pointer; }

@media (max-width: 720px) {
  .site-nav {
    display: none; position: absolute; top: 60px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 4px;
    background: var(--bg-soft); border-bottom: 1px solid var(--border); padding: 10px 16px;
  }
  .site-nav.open { display: flex; }
  .nav-toggle { display: block; }
  .nav-user { padding: 8px 12px; }
}

/* ---------- generic elements ---------- */
h1 { font-size: 1.7rem; line-height: 1.25; margin: 0 0 10px; }
h2 { font-size: 1.25rem; margin: 0 0 10px; }
h3 { font-size: 1.05rem; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 0.9rem; }
small { color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 1rem; font-weight: 700;
  padding: 13px 20px; border-radius: 12px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: filter 0.15s, transform 0.05s;
  min-height: 48px;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #06263a; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--bg-soft); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-success { background: var(--green); color: #04301f; }
.btn-danger { background: var(--red); color: #3d0606; }
.btn-block { width: 100%; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; color: var(--text); }
.field input, .field select {
  width: 100%; padding: 13px 14px; font-size: 1rem;
  background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border); border-radius: 11px; outline: none;
  font-family: inherit; min-height: 48px;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.field .hint { font-size: 0.82rem; color: var(--muted); margin-top: 4px; }

.error-box {
  background: var(--red-bg); border: 1px solid rgba(248, 113, 113, 0.4);
  color: var(--red); padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 0.92rem;
}
.success-box {
  background: var(--green-bg); border: 1px solid rgba(52, 211, 153, 0.4);
  color: var(--green); padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 0.92rem;
}

/* ---------- hero / home ---------- */
.hero { text-align: center; padding: 28px 8px 8px; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.7rem); }
.hero .tagline { color: var(--muted); font-size: 1.05rem; max-width: 640px; margin: 0 auto 22px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.fact-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin: 24px 0;
}
.fact {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 12px; text-align: center;
}
.fact .num { font-size: 1.7rem; font-weight: 800; color: var(--accent); }
.fact .lbl { font-size: 0.85rem; color: var(--muted); }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 20px 0; }
.feature { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.feature .ico { font-size: 1.5rem; }
.feature h3 { margin-top: 8px; }
.feature p { color: var(--muted); font-size: 0.92rem; margin: 0; }

/* ---------- auth forms ---------- */
.auth-wrap { max-width: 420px; margin: 24px auto; }
.auth-wrap .card { padding: 26px; }
.auth-switch { text-align: center; margin-top: 14px; color: var(--muted); font-size: 0.92rem; }
.auth-switch a { color: var(--accent); }

/* ---------- dashboard ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat .num { font-size: 1.5rem; font-weight: 800; }
.stat .lbl { font-size: 0.82rem; color: var(--muted); }
.stat.green .num { color: var(--green); }
.stat.blue .num { color: var(--accent); }
.stat.amber .num { color: var(--amber); }

.bar-row { margin-bottom: 12px; }
.bar-head { display: flex; justify-content: space-between; font-size: 0.88rem; margin-bottom: 5px; }
.bar-track { height: 10px; background: var(--bg-soft); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--green)); border-radius: 99px; transition: width 0.5s; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }
td a { color: var(--accent); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 0.78rem; font-weight: 700; }
.badge-pass { background: var(--green-bg); color: var(--green); }
.badge-fail { background: var(--red-bg); color: var(--red); }
.badge-warn { background: var(--amber-bg); color: var(--amber); }
.badge-info { background: rgba(56, 189, 248, 0.14); color: var(--accent); }

.empty { text-align: center; padding: 36px 12px; color: var(--muted); }
.empty .big { font-size: 2.2rem; margin-bottom: 8px; }

/* ---------- exam runner ---------- */
.exam-top {
  position: sticky; top: 60px; z-index: 40;
  background: rgba(15, 23, 42, 0.92); backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius);
  padding: 10px 14px; margin: -22px -16px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.exam-top .progress { font-weight: 700; }
.exam-top .timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.15rem; }
.exam-top .timer.warn { color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }

.question-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.question-text { font-size: 1.12rem; font-weight: 600; margin-bottom: 18px; line-height: 1.5; }
.opt-list { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px; text-align: left;
  width: 100%; padding: 14px; font-size: 1rem; line-height: 1.45;
  background: var(--bg-soft); color: var(--text);
  border: 2px solid var(--border); border-radius: 12px; cursor: pointer;
  font-family: inherit; transition: border-color 0.15s, background 0.15s;
  min-height: 52px;
}
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt:disabled { cursor: default; }
.opt .letter {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; font-weight: 800;
  background: var(--card-2); color: var(--accent); font-size: 0.9rem;
}
.opt.correct { border-color: var(--green); background: var(--green-bg); }
.opt.correct .letter { background: var(--green); color: #04301f; }
.opt.wrong { border-color: var(--red); background: var(--red-bg); }
.opt.wrong .letter { background: var(--red); color: #3d0606; }
.opt.dim { opacity: 0.55; }

.feedback {
  margin-top: 16px; border-radius: 12px; padding: 14px 16px;
  border: 1px solid var(--border); background: var(--card-2);
}
.feedback.good { border-color: rgba(52, 211, 153, 0.5); }
.feedback.bad { border-color: rgba(248, 113, 113, 0.5); }
.feedback .fb-title { font-weight: 800; margin-bottom: 6px; font-size: 0.95rem; }
.feedback.good .fb-title { color: var(--green); }
.feedback.bad .fb-title { color: var(--red); }
.feedback p { margin: 0 0 6px; font-size: 0.95rem; }

.exam-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.exam-actions .btn { flex: 1; min-width: 150px; }

/* ---------- results ---------- */
.result-banner { text-align: center; padding: 26px 18px; }
.result-banner .verdict { font-size: 1.6rem; font-weight: 800; margin: 10px 0 4px; }
.result-banner.pass { border-color: rgba(52, 211, 153, 0.55); }
.result-banner.pass .verdict { color: var(--green); }
.result-banner.fail { border-color: rgba(248, 113, 113, 0.55); }
.result-banner.fail .verdict { color: var(--red); }
.score-ring { position: relative; width: 130px; height: 130px; margin: 0 auto 6px; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .score-val {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 1.6rem; font-weight: 800;
}

.review-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.review-item .rq { font-weight: 600; margin-bottom: 8px; }
.review-item .ra { font-size: 0.92rem; margin-bottom: 6px; }
.review-item .ra b { font-weight: 700; }
.ra-user-ok { color: var(--green); }
.ra-user-bad { color: var(--red); }
.review-item .expl { font-size: 0.9rem; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 8px; margin-top: 8px; }

/* ---------- practice picker ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.cat-card { text-align: left; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; color: var(--text); font-family: inherit; font-size: 0.98rem; }
.cat-card:hover { border-color: var(--accent); }
.cat-card.selected { border-color: var(--accent); background: var(--card-2); }
.cat-card .n { display: block; color: var(--muted); font-size: 0.82rem; margin-top: 4px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px);
  background: var(--card-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 12px; padding: 13px 20px; box-shadow: var(--shadow);
  opacity: 0; transition: transform 0.3s, opacity 0.3s; z-index: 100; max-width: 90vw; text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.err { border-color: rgba(248, 113, 113, 0.6); color: var(--red); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 22px 0 30px; background: rgba(15, 23, 42, 0.6); }
.site-footer p { margin: 0 0 8px; font-size: 0.85rem; color: var(--muted); }

@media (min-width: 720px) {
  .question-text { font-size: 1.2rem; }
  .card { padding: 24px; }
  .exam-top { border-radius: var(--radius); margin: -22px 0 20px; }
}
