
:root {
  --bg-primary: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #475569;
  --accent-blue: #0284c7;
  --accent-blue-dark: #0369a1;
  --accent-purple: #7c3aed;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-rose: #dc2626;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.65;
}

/* ── SVG Icons ─────────────────────────────────────── */
.icon-svg {
  width: 1.15rem;
  height: 1.15rem;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.icon-alert { color: #ffffff; }

/* ── Navbar ─────────────────────────────────────────── */
.top-navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: #0f172a;
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: #7dd3fc;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  background: #334155;
  color: #e2e8f0;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: background 0.15s ease;
}
.btn:hover { background: #475569; color: #ffffff; }

.btn-primary {
  background: var(--accent-blue);
  color: #ffffff !important;
}
.btn-primary:hover { background: var(--accent-blue-dark); }

/* ── Layout ─────────────────────────────────────────── */
.container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1.25rem 4rem 1.25rem;
}

/* ── Header Card ─────────────────────────────────────── */
.header-card {
  background: #1e40af;
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
}

.header-card .badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #3b82f6;
  color: #ffffff;
  border-radius: 9999px;
  margin-bottom: 0.75rem;
}

.header-card h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: #ffffff;
}

.header-card p {
  color: #bfdbfe;
  font-size: 1rem;
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 2px solid #3b82f6;
  font-size: 0.88rem;
  color: #bfdbfe;
}

.stats-row span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.stats-row a { color: #93c5fd; }

/* ── Section Titles ──────────────────────────────────── */
.section-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.3rem;
  font-weight: 700;
  margin: 2.5rem 0 1.25rem 0;
  color: var(--text-main);
  padding-bottom: 0.5rem;
  border-bottom: 3px solid #0284c7;
}

.section-title .icon-svg {
  width: 1.4rem;
  height: 1.4rem;
  color: var(--accent-blue);
}

/* ── Formula Cards ───────────────────────────────────── */
.formula-card {
  background: #dbeafe;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.formula-card h4 {
  color: #1e40af;
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.formula-card p, .formula-card ul {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  color: #1e3a8a;
}

.formula-card ul { padding-left: 1.25rem; }

.formula-highlight {
  background: #eff6ff;
  border-radius: 6px;
  padding: 0.85rem 1rem;
  margin: 0.75rem 0;
  font-size: 1.05rem;
  overflow-x: auto;
  color: #1e3a8a;
}

/* ── Question Boxes ──────────────────────────────────── */
.question-box {
  background: #ffffff;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.question-header {
  padding: 1rem 1.25rem;
  background: #0f172a;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.question-header strong { color: #e2e8f0; }

.q-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: #7c3aed;
  color: #ffffff;
}

.question-body {
  padding: 1.25rem;
  font-size: 1rem;
  color: #1e293b;
  background: #f8fafc;
}

details.solution-toggle {
  background: #f0fdf4;
}

details.solution-toggle summary {
  padding: 0.85rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  color: #065f46;
  background: #d1fae5;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

details.solution-toggle summary:hover {
  background: #a7f3d0;
}

.solution-content {
  padding: 1.25rem;
  background: #f0fdf4;
  font-size: 0.95rem;
  color: #134e4a;
}

.solution-step {
  margin-bottom: 0.85rem;
  padding-left: 0.75rem;
  border-left: 3px solid #059669;
}

/* ── Trap Cards ──────────────────────────────────────── */
.trap-card {
  background: #dc2626;
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.trap-card h4 {
  color: #ffffff;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.trap-card p {
  color: #fecaca;
  font-size: 0.92rem;
}

/* ── Quiz Cards ──────────────────────────────────────── */
.quiz-card {
  background: #fef9c3;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.quiz-card p { color: #713f12; }

.quiz-card details summary {
  cursor: pointer;
  color: #92400e;
  font-weight: 600;
  font-size: 0.88rem;
  margin-top: 0.75rem;
}

.quiz-card details .quiz-ans {
  margin-top: 0.5rem;
  padding: 0.6rem 0.85rem;
  background: #fde68a;
  border-radius: 6px;
  color: #78350f;
  font-size: 0.92rem;
}

/* ── Bottom Nav ──────────────────────────────────────── */
.bottom-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3rem;
  padding-top: 1.5rem;
}

/* ── Print ───────────────────────────────────────────── */
@media print {
  body { background: #ffffff !important; color: #000000 !important; }
  .top-navbar, .bottom-nav, .btn, .nav-actions { display: none !important; }
  .header-card { background: #1e3a8a !important; color: #ffffff !important; }
  .header-card h1 { color: #ffffff !important; }
  .header-card p { color: #bfdbfe !important; }
  .formula-card { background: #dbeafe !important; page-break-inside: avoid; }
  .question-box { page-break-inside: avoid; }
  .trap-card { background: #fca5a5 !important; page-break-inside: avoid; }
  .quiz-card { background: #fef9c3 !important; }
  details { display: block !important; }
  details summary { display: none !important; }
  .solution-content { display: block !important; }
}
