/* ── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent:       #2563eb;
  --accent-light: #eff6ff;
  --accent-mid:   #bfdbfe;
  --green:        #16a34a;
  --green-light:  #f0fdf4;
  --text:         #1e293b;
  --muted:        #64748b;
  --border:       #e2e8f0;
  --bg:           #f8fafc;
  --sidebar-w:    230px;
  --content-max:  720px;
  font-size: 16px;
}

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

/* ── Layout ────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 2rem 0 2rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  padding: 0 1.25rem 1.5rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.sidebar-order-label {
  padding: 0.6rem 1.25rem 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.sidebar-logo span {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.15rem;
}

nav ul {
  list-style: none;
  padding: 0 0.5rem;
}

nav ul li a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 7px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.88rem;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 2px;
}

nav ul li a:hover {
  background: var(--accent-light);
  color: var(--accent);
}

nav ul li a.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

nav ul li a.visited .nav-num {
  background: var(--green);
  color: #fff;
}

.nav-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

nav ul li a.active .nav-num {
  background: var(--accent);
  color: #fff;
}

.nav-label { flex: 1; }

/* ── Main content ──────────────────────────────────────────── */
.main {
  flex: 1;
  padding: 3rem 2.5rem 4rem;
  max-width: calc(var(--content-max) + 5rem);
}

.stage-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.subtitle {
  font-size: 1.05rem;
  color: var(--muted);
  margin-bottom: 2rem;
  max-width: 560px;
}

h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 2.5rem 0 0.75rem;
  color: var(--text);
}

h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
  color: var(--text);
}

p { margin-bottom: 1rem; max-width: var(--content-max); }

ul, ol {
  padding-left: 1.4rem;
  margin-bottom: 1rem;
  max-width: var(--content-max);
}

li { margin-bottom: 0.3rem; }

strong { font-weight: 700; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  max-width: var(--content-max);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
  max-width: var(--content-max);
}

.card-grid .card {
  margin-bottom: 0;
}

.card .card-num {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.card .card-label {
  font-size: 0.82rem;
  color: var(--muted);
}

/* ── Marks table ───────────────────────────────────────────── */
.marks-table {
  width: 100%;
  max-width: var(--content-max);
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.marks-table th {
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  text-align: left;
  font-weight: 600;
}

.marks-table th:last-child,
.marks-table td:last-child { text-align: center; }

.marks-table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
}

.marks-table tr:nth-child(even) td { background: #fafafa; }

.marks-table tr.total-row td {
  font-weight: 700;
  background: var(--accent-light);
}

/* ── Concepts grid ─────────────────────────────────────────── */
.concepts-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: var(--content-max);
  margin-bottom: 1.5rem;
}

.concept-pill {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--accent-mid);
  border-radius: 20px;
  padding: 0.3rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

a.concept-pill:hover {
  background: var(--accent);
  color: #fff;
}

/* ── Checklist ─────────────────────────────────────────────── */
.checklist-wrap {
  max-width: var(--content-max);
  margin-bottom: 2rem;
}

.checklist-section {
  margin-bottom: 1.75rem;
}

.checklist-section-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 0.5rem 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0.5rem;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border);
}

.checklist-item:last-child { border-bottom: none; }

.checklist-item:hover { background: var(--bg); }

.checklist-item.done {
  background: var(--green-light);
}

.checklist-item input[type="checkbox"] {
  margin-top: 0.2rem;
  width: 17px;
  height: 17px;
  accent-color: var(--green);
  flex-shrink: 0;
  cursor: pointer;
}

.checklist-item-text {
  flex: 1;
  font-size: 0.9rem;
}

.checklist-item-text strong { display: block; margin-bottom: 0.15rem; }

.checklist-item-text .note {
  font-size: 0.82rem;
  color: var(--muted);
}

.checklist-item.done .checklist-item-text strong {
  text-decoration: line-through;
  color: var(--muted);
}

/* ── Save button ───────────────────────────────────────────── */
.save-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--text);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 2rem;
}

.save-btn:hover { background: #0f172a; }

/* ── Structure sections ────────────────────────────────────── */
.structure-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  max-width: var(--content-max);
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.section-num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  min-width: 28px;
}

.section-body h3 { margin-top: 0; }

.word-count {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.6rem;
  border-radius: 20px;
  margin-bottom: 0.5rem;
}

/* ── Example / PDF images ──────────────────────────────────── */
.pdf-pages {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 680px;
}

.pdf-pages img {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}

/* ── CLASPP ────────────────────────────────────────────────── */
.claspp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  max-width: var(--content-max);
  margin-bottom: 1.5rem;
}

.claspp-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
}

.claspp-letter {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.claspp-card h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

.claspp-card p {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

/* ── Coming soon ───────────────────────────────────────────── */
.coming-soon {
  background: #fff;
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 3rem 2rem;
  text-align: center;
  color: var(--muted);
  max-width: var(--content-max);
}

.coming-soon .cs-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.coming-soon h2 { color: var(--muted); margin: 0 0 0.5rem; font-size: 1rem; }
.coming-soon p { margin: 0; font-size: 0.9rem; }

/* ── Example paragraph ─────────────────────────────────────── */
.example-block {
  background: var(--accent-light);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 1rem 1.25rem;
  margin: 1rem 0 1.5rem;
  max-width: var(--content-max);
  font-size: 0.9rem;
  font-style: italic;
  color: #1e3a8a;
}

/* ── Callout ───────────────────────────────────────────────── */
.callout {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  max-width: var(--content-max);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.callout.info {
  background: var(--accent-light);
  border-color: var(--accent-mid);
  color: #1e3a8a;
}

/* ── Next button ───────────────────────────────────────────── */
.next-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 3rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  transition: background 0.15s;
}

.next-btn:hover { background: #1d4ed8; }
.next-btn .arrow { font-size: 1.1rem; }

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .layout { flex-direction: column; }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 1rem 0 0.5rem;
  }

  .sidebar-logo { padding: 0 1rem 0.75rem; }

  nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 0.5rem 0.5rem;
  }

  nav ul li a { padding: 0.4rem 0.6rem; font-size: 0.8rem; }

  .main { padding: 1.5rem 1.25rem 3rem; }

  h1 { font-size: 1.5rem; }
}
