/*
  TeachCopilot Admin Manual - documentation stylesheet.
  Design read: technical reference documentation for developers and self-hosters.
  Two-pane docs layout (sticky sidebar + content column), neutral zinc base,
  single electric-blue accent, restrained motion, dark mode via
  prefers-color-scheme with a manual override toggle.
*/

:root {
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;

  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #eff6ff;

  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-inset: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;

  --callout-note-bg: #eff6ff;
  --callout-note-border: #93c5fd;
  --callout-warn-bg: #fffbeb;
  --callout-warn-border: #fcd34d;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);

  --radius: 10px;
  --radius-sm: 6px;

  --sidebar-w: 272px;
  --content-max: 780px;
  --header-h: 60px;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --accent: #60a5fa;
  --accent-strong: #93c5fd;
  --accent-soft: #0d1b32;

  --bg: #0b1120;
  --bg-subtle: #0f172a;
  --bg-inset: #131f35;
  --surface: #0f172a;
  --border: #1e293b;
  --border-strong: #334155;

  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;

  --callout-note-bg: #0d1b32;
  --callout-note-border: #1d4ed8;
  --callout-warn-bg: #201a08;
  --callout-warn-border: #92702a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);

  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #60a5fa;
    --accent-strong: #93c5fd;
    --accent-soft: #0d1b32;

    --bg: #0b1120;
    --bg-subtle: #0f172a;
    --bg-inset: #131f35;
    --surface: #0f172a;
    --border: #1e293b;
    --border-strong: #334155;

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;

    --callout-note-bg: #0d1b32;
    --callout-note-border: #1d4ed8;
    --callout-warn-bg: #201a08;
    --callout-warn-border: #92702a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);

    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

img {
  max-width: 100%;
  display: block;
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}

.topbar__mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.topbar__title {
  font-size: 14.5px;
}
.topbar__title small {
  display: block;
  font-weight: 400;
  font-size: 12px;
  color: var(--text-tertiary);
}

.topbar__spacer {
  flex: 1;
}

.topbar__home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.topbar__home:hover {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
  color: var(--text-primary);
  text-decoration: none;
}

.topbar__search {
  display: none;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.icon-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.menu-btn {
  display: grid;
}

@media (min-width: 960px) {
  .menu-btn {
    display: none;
  }
}

@media (max-width: 640px) {
  .topbar__home {
    padding: 0 10px;
    font-size: 12px;
  }
}

.icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .icon-moon {
  display: none;
}
:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: none;
}
:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: block;
}

/* ---------- Shell / layout ---------- */

.shell {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: var(--header-h);
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: calc(100dvh - var(--header-h));
  overflow-y: auto;
  padding: 24px 16px 40px;
  border-right: 1px solid var(--border);
}

.sidebar__group {
  margin-bottom: 22px;
}

.sidebar__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 0 10px;
  margin: 0 0 6px;
}

.sidebar__link {
  display: block;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.35;
}
.sidebar__link:hover {
  background: var(--bg-inset);
  color: var(--text-primary);
  text-decoration: none;
}
.sidebar__link.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.sidebar-scrim {
  display: none;
}

@media (max-width: 959px) {
  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    z-index: 45;
    background: var(--bg);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-md);
  }
  .shell.nav-open .sidebar {
    transform: translateX(0);
  }
  .shell.nav-open .sidebar-scrim {
    display: block;
    position: fixed;
    inset: var(--header-h) 0 0 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 44;
  }
}

.content {
  flex: 1;
  min-width: 0;
  padding: 48px 32px 96px;
  display: flex;
  justify-content: center;
}

.content__inner {
  width: 100%;
  max-width: var(--content-max);
}

@media (max-width: 640px) {
  .content {
    padding: 32px 18px 72px;
  }
}

/* ---------- Article typography ---------- */

.doc-header {
  margin-bottom: 8px;
}

.doc-header h1 {
  font-size: 2.25rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  font-weight: 700;
}

.doc-header p.lede {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 65ch;
  margin: 0 0 20px;
}

.verified-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 13px;
  color: var(--text-tertiary);
  padding: 12px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.verified-strip strong {
  color: var(--text-secondary);
  font-weight: 600;
}

article section {
  scroll-margin-top: calc(var(--header-h) + 16px);
}

article h2 {
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  font-weight: 700;
  margin: 56px 0 14px;
  padding-top: 4px;
}

article > section:first-of-type h2 {
  margin-top: 28px;
}

article h3 {
  font-size: 1.15rem;
  font-weight: 650;
  margin: 34px 0 10px;
}

article h4 {
  font-size: 0.95rem;
  font-weight: 650;
  margin: 24px 0 8px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

article p {
  margin: 0 0 16px;
  color: var(--text-primary);
  max-width: 68ch;
}

article ul,
article ol {
  margin: 0 0 16px;
  padding-left: 22px;
  max-width: 68ch;
}
article li {
  margin-bottom: 6px;
}
article li::marker {
  color: var(--text-tertiary);
}

.path-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}
.path-badge b {
  color: var(--text-tertiary);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  padding: 0.1em 0.4em;
  border-radius: 5px;
  color: var(--text-primary);
}

pre {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
  margin: 0 0 20px;
}
pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13.5px;
  line-height: 1.6;
}

figure {
  margin: 0 0 28px;
}
figure img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
figcaption {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-tertiary);
  text-align: center;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 0 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead th {
  text-align: left;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: top;
}
tbody tr:last-child td {
  border-bottom: none;
}
tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--bg-subtle) 55%, transparent);
}
td code {
  white-space: nowrap;
}

.callout {
  border-left: 3px solid var(--callout-note-border);
  background: var(--callout-note-bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin: 0 0 20px;
  font-size: 14.5px;
  color: var(--text-primary);
}
.callout p {
  margin: 0 0 8px;
  max-width: none;
}
.callout p:last-child {
  margin-bottom: 0;
}
.callout--warn {
  border-left-color: var(--callout-warn-border);
  background: var(--callout-warn-bg);
}
.callout--quote {
  font-style: italic;
  color: var(--text-secondary);
}

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-inset);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.badge--ok {
  background: color-mix(in srgb, #16a34a 14%, transparent);
  color: #16a34a;
  border-color: color-mix(in srgb, #16a34a 30%, transparent);
}
.badge--no {
  background: color-mix(in srgb, #dc2626 14%, transparent);
  color: #dc2626;
  border-color: color-mix(in srgb, #dc2626 30%, transparent);
}

hr.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 44px 0;
}

.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.page-nav a {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.page-nav a:hover {
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}
.page-nav a.next {
  text-align: right;
  margin-left: auto;
}
.page-nav span {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 32px 60px;
  color: var(--text-tertiary);
  font-size: 13px;
  max-width: var(--content-max);
  margin: 0 auto;
}
footer.site-footer a {
  color: var(--text-secondary);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  z-index: 100;
}
.skip-link:focus {
  left: 16px;
  top: 12px;
}

/* Toggle switch style rendering used inline in tables/screenshots explanation, purely decorative */
.kbd {
  font-family: var(--font-mono);
  font-size: 12px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  background: var(--bg-subtle);
}
