/* Documentation layout — extends the main theme variables */

:root {
  --bg: #0f172a;
  --bg-primary: #111827;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --border: #334155;
  --text: #f1f5f9;
  --text-primary: #f3f4f6;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --success: #22c55e;
  --warning: #eab308;
  --danger: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-width: 260px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  display: flex;
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-hover);
}

/* ── Sidebar ── */

.docs-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-primary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.sidebar-brand img {
  border-radius: 6px;
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.sidebar-label {
  padding: 16px 20px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.sidebar-nav {
  list-style: none;
  padding: 0 8px;
  flex: 1;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
}

.sidebar-nav li a:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.sidebar-nav li a.active {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary);
}

.sidebar-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 16px;
}

.sidebar-footer a {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sidebar-footer a:hover {
  color: var(--text);
}

/* ── Mobile hamburger ── */

.docs-mobile-header {
  display: none;
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  align-items: center;
  gap: 12px;
}

.docs-mobile-header button {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
}

.docs-mobile-header span {
  font-weight: 600;
  font-size: 0.95rem;
}

.docs-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 45;
}

/* ── Main content ── */

.docs-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
}

.docs-content {
  max-width: 820px;
  margin: 0 auto;
  padding: 48px 40px 80px;
}

/* ── Typography ── */

.docs-content h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.docs-content .subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.docs-content h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 48px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.docs-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
}

.docs-content p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.docs-content strong {
  color: var(--text);
  font-weight: 600;
}

.docs-content ul,
.docs-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.docs-content li {
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* ── Code blocks ── */

.docs-content code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.85em;
}

.docs-content :not(pre) > code {
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-hover);
  font-size: 0.85em;
}

.docs-content pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  overflow-x: auto;
  margin-bottom: 20px;
  line-height: 1.6;
  position: relative;
}

.docs-content pre code {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.code-label {
  display: inline-block;
  padding: 2px 10px;
  background: var(--bg-tertiary);
  border-radius: 4px 4px 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: system-ui, sans-serif;
  margin-bottom: -1px;
  position: relative;
  top: 1px;
}

pre .comment { color: var(--text-muted); }
pre .cmd { color: var(--primary); }
pre .string { color: var(--success); }
pre .key { color: var(--accent-hover); }

/* ── Tables ── */

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.docs-content th,
.docs-content td {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
}

.docs-content thead {
  background: var(--bg-secondary);
}

.docs-content th {
  font-weight: 600;
  color: var(--text);
}

.docs-content td {
  color: var(--text-secondary);
}

.docs-content tr:last-child td {
  border-bottom: none;
}

/* ── Callouts ── */

.callout {
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.callout-info {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: var(--primary);
}

.callout-warning {
  background: rgba(234, 179, 8, 0.08);
  border: 1px solid rgba(234, 179, 8, 0.2);
  color: var(--warning);
}

.callout-danger {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

/* ── TOC cards (overview page) ── */

.toc-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 24px;
}

.toc-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s, transform 0.2s;
}

.toc-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.toc-card .toc-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.toc-card .toc-title {
  font-weight: 600;
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 4px;
}

.toc-card .toc-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Endpoint blocks (API page) ── */

.endpoint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.endpoint .method {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: monospace;
}

.method-get { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.method-post { background: rgba(59, 130, 246, 0.15); color: var(--primary); }
.method-put { background: rgba(234, 179, 8, 0.15); color: var(--warning); }
.method-delete { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.endpoint .path {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  color: var(--text);
}

/* ── Responsive ── */

@media (max-width: 900px) {
  .docs-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .docs-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: block;
  }

  .docs-mobile-header {
    display: flex;
  }

  .docs-sidebar.open ~ .docs-overlay {
    display: block;
  }

  .docs-main {
    margin-left: 0;
  }

  .docs-content {
    padding: 24px 16px 60px;
  }

  .toc-grid {
    grid-template-columns: 1fr;
  }
}
