/* EduAI Principal Handbook — B/W/Red theme matching the app.
   Layout: fixed top bar + fixed left sidebar + scrollable main.
   Mobile: sidebar slides in from left, toggle from top bar.
*/

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #0f172a;
  background: #f8fafc;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: #dc2626; text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

/* ─── Top bar ─────────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: 64px;
  background: #0f172a;
  color: #fff;
  z-index: 50;
  box-shadow: 0 1px 0 rgba(0,0,0,0.1);
}
.topbar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  max-width: 1400px;
  margin: 0 auto;
}
.menu-toggle {
  display: none;
  background: transparent;
  color: #fff;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
}
.menu-toggle:hover { background: rgba(255,255,255,0.1); }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff !important;
  font-weight: 900;
  font-size: 17px;
  text-decoration: none !important;
}
.brand-mark {
  display: inline-flex;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #dc2626;
  color: #fff;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
}
.brand-name { white-space: nowrap; }

.search-wrap {
  flex: 1;
  max-width: 520px;
  margin-left: auto;
  position: relative;
}
.search-wrap input {
  width: 100%;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  transition: background 120ms, border-color 120ms;
}
.search-wrap input::placeholder { color: rgba(255,255,255,0.55); }
.search-wrap input:focus {
  background: rgba(255,255,255,0.18);
  border-color: rgba(220,38,38,0.5);
}

.search-results {
  position: absolute;
  top: 46px;
  left: 0;
  right: 0;
  list-style: none;
  margin: 0;
  padding: 6px;
  background: #fff;
  color: #0f172a;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  max-height: 60vh;
  overflow-y: auto;
  z-index: 60;
}
.search-results li {
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
}
.search-results li:hover,
.search-results li.active { background: #f1f5f9; }
.search-results .hit-section {
  font-size: 10px;
  color: #94a3b8;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}
.search-results .hit-snippet {
  color: #64748b;
  font-size: 12px;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-empty {
  padding: 16px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}

/* ─── Sidebar ─────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 64px;
  left: 0;
  bottom: 0;
  width: 280px;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  padding: 24px 0;
  z-index: 30;
}

.nav { padding: 0 14px; }
.nav-section { margin-bottom: 24px; }
.nav-section h4 {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #94a3b8;
  margin: 0 12px 8px 12px;
}
.nav-section a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: #475569;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 2px;
}
.nav-section a:hover {
  background: #f1f5f9;
  color: #0f172a;
  text-decoration: none;
}
.nav-section a.active {
  background: #fee2e2;
  color: #dc2626;
  font-weight: 700;
}

/* ─── Content ─────────────────────────────────────────────────────── */
.content {
  margin-left: 280px;
  margin-top: 64px;
  padding: 40px 48px 80px;
  max-width: 880px;
}

.page {
  scroll-margin-top: 80px;
  padding-bottom: 32px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 40px;
}
.page:last-of-type { border-bottom: none; }

h1 {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #0f172a;
  margin: 0 0 16px;
  line-height: 1.15;
}
h2 {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: #0f172a;
  margin: 0 0 16px;
  scroll-margin-top: 80px;
}
h3 {
  font-size: 17px;
  font-weight: 900;
  color: #0f172a;
  margin: 28px 0 12px;
}

p { margin: 0 0 14px; color: #334155; }
.lede { font-size: 17px; color: #475569; max-width: 640px; }

ul, ol {
  margin: 0 0 18px;
  padding-left: 20px;
  color: #334155;
}
ul li, ol li { margin-bottom: 6px; }
ol { counter-reset: list-counter; padding-left: 0; }
ol > li {
  list-style: none;
  counter-increment: list-counter;
  padding-left: 30px;
  position: relative;
  margin-bottom: 10px;
}
ol > li::before {
  content: counter(list-counter) ".";
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 900;
  color: #dc2626;
  width: 22px;
  text-align: right;
}
ol > li ul, ol > li ol { margin-top: 6px; padding-left: 20px; }
ol > li ul li { list-style: disc; counter-increment: none; padding-left: 0; }
ol > li ul li::before { display: none; }

b, strong { color: #0f172a; }

/* ─── Cards (home page quick nav) ────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 24px 0 40px;
}
.card {
  display: block;
  padding: 18px 18px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  color: inherit !important;
  text-decoration: none !important;
  transition: border-color 120ms, transform 80ms;
}
.card:hover { border-color: #dc2626; transform: translateY(-1px); }
.card h3 {
  font-size: 14px;
  margin: 0 0 6px;
  color: #0f172a;
}
.card p {
  font-size: 12px;
  color: #64748b;
  margin: 0;
  line-height: 1.5;
}

/* ─── Callouts ───────────────────────────────────────────────────── */
.callout {
  border-left: 4px solid #94a3b8;
  background: #f1f5f9;
  padding: 12px 16px;
  border-radius: 0 10px 10px 0;
  margin: 18px 0;
  font-size: 14px;
  color: #334155;
}
.callout.info { border-color: #2563eb; background: #eff6ff; color: #1e40af; }
.callout.warn { border-color: #f59e0b; background: #fef3c7; color: #92400e; }
.callout.danger { border-color: #dc2626; background: #fee2e2; color: #991b1b; }
.callout b { color: inherit; }

/* ─── Tables ─────────────────────────────────────────────────────── */
table.grid {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0 22px;
  font-size: 13.5px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}
table.grid th,
table.grid td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
}
table.grid th {
  background: #f8fafc;
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}
table.grid tr:last-child td { border-bottom: none; }

/* ─── FAQs ──────────────────────────────────────────────────────── */
details {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin: 8px 0;
  padding: 0;
  overflow: hidden;
  transition: border-color 120ms;
}
details[open] { border-color: #94a3b8; }
details > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 14px;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
details > summary::after {
  content: "+";
  font-size: 20px;
  color: #94a3b8;
  font-weight: 400;
}
details[open] > summary::after { content: "−"; color: #dc2626; }
details > summary::-webkit-details-marker { display: none; }
details > p {
  margin: 0;
  padding: 0 16px 14px;
  color: #475569;
  font-size: 13.5px;
  line-height: 1.6;
}

/* ─── Footer ─────────────────────────────────────────────────────── */
.footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid #e2e8f0;
  font-size: 12px;
  color: #94a3b8;
}
.footer p { color: inherit; }

/* ─── Mobile ─────────────────────────────────────────────────────── */
@media (max-width: 980px) {
  .menu-toggle { display: inline-flex; }
  .brand-name { display: none; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 240ms ease-out;
    width: 86%;
    max-width: 320px;
    box-shadow: 8px 0 30px rgba(0,0,0,0.2);
  }
  .sidebar.open { transform: translateX(0); }
  .content {
    margin-left: 0;
    padding: 28px 20px 60px;
  }
  h1 { font-size: 28px; }
  h2 { font-size: 22px; }
  .cards { grid-template-columns: 1fr; }
}
/* Backdrop when sidebar is open on mobile */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 64px 0 0 0;
  background: rgba(15,23,42,0.5);
  z-index: 29;
}
.sidebar-backdrop.show { display: block; }

/* ─── Scrollbar polish (webkit) ──────────────────────────────────── */
.sidebar::-webkit-scrollbar,
.search-results::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb,
.search-results::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb:hover,
.search-results::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
