/* ── Docs Layout ────────────────────────────────────────────────────────────── */

/* Override body background for docs pages */
body.docs-body {
  background: var(--bg-0);
}

/* Docs wrap: sidebar + content side by side */
.docs-wrap {
  display: flex;
  min-height: 100vh;
  padding-top: 64px; /* nav height */
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.docs-sidebar {
  position: fixed;
  top: 64px;
  left: 0;
  width: 260px;
  height: calc(100vh - 64px);
  background: var(--bg-0);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 50;
  padding: 24px 0 48px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-4) transparent;
  transition: transform 0.28s ease;
}

.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-track { background: transparent; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 4px; }

/* Sidebar overview link */
.sidebar-overview {
  display: block;
  padding: 8px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 16px;
  transition: color var(--transition);
}
.sidebar-overview:hover { color: var(--cyan); }
.sidebar-overview.active { color: var(--cyan); }

/* Sidebar section group */
.sidebar-group {
  margin-bottom: 8px;
}

/* Section title label */
.sidebar-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 20px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  text-decoration: none;
  transition: color var(--transition);
  cursor: pointer;
}
.sidebar-section-title:hover { color: var(--text-1); }
.sidebar-section-title.active { color: var(--cyan); }

.sidebar-section-title .sidebar-arrow {
  margin-left: auto;
  font-size: 0.55rem;
  transition: transform 0.2s ease;
  color: var(--text-3);
}
.sidebar-group.open .sidebar-arrow { transform: rotate(180deg); }

/* Sidebar items list */
.sidebar-items {
  list-style: none;
  display: none;
  padding: 0 0 8px 0;
}
.sidebar-group.open .sidebar-items { display: block; }

.sidebar-items li a {
  display: block;
  padding: 5px 20px 5px 28px;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 2px solid transparent;
  margin-left: 18px;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.sidebar-items li a:hover {
  color: var(--text-0);
  background: rgba(255,255,255,0.03);
}
.sidebar-items li a.active {
  color: var(--cyan);
  border-left-color: var(--cyan);
  background: var(--cyan-dim);
}

/* Sidebar divider */
.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 20px;
}

/* ── Main Content ────────────────────────────────────────────────────────────── */
.docs-content {
  margin-left: 260px;
  flex: 1;
  max-width: 860px;
  padding: 40px 48px 80px;
  min-width: 0;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-3);
  margin-bottom: 32px;
  font-family: var(--mono);
}
.breadcrumb a { color: var(--text-3); }
.breadcrumb a:hover { color: var(--cyan); }
.breadcrumb-sep { color: var(--text-3); opacity: 0.5; }
.breadcrumb-current { color: var(--text-2); }

/* Page title */
.docs-page-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-0);
  margin-bottom: 12px;
  line-height: 1.2;
}
.docs-page-subtitle {
  font-size: 1rem;
  color: var(--text-2);
  margin-bottom: 40px;
  line-height: 1.6;
}

/* ── Resource Section ───────────────────────────────────────────────────────── */
.resource-section {
  padding-bottom: 56px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 56px;
}
.resource-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.resource-section h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-0);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.resource-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 28px 0 12px;
}

.resource-section p {
  font-size: 0.93rem;
  line-height: 1.7;
}

/* Anchor link on heading */
.anchor {
  font-size: 0.85rem;
  color: var(--text-3);
  opacity: 0;
  transition: opacity var(--transition);
  text-decoration: none;
}
.resource-section h2:hover .anchor { opacity: 1; }
.anchor:hover { color: var(--cyan); }

/* Resource badge — working */
.resource-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--green);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  font-family: var(--font);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Resource badge — async */
.resource-badge.async {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--yellow);
}

/* Resource description */
.resource-desc {
  color: var(--text-2);
  margin-bottom: 4px;
}

/* Resource alert box (async timing info) */
.resource-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(245, 158, 11, 0.07);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--yellow);
  margin: 16px 0 24px;
  line-height: 1.6;
}

/* ── Docs Table ──────────────────────────────────────────────────────────────── */
.docs-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 4px;
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.docs-table thead {
  background: var(--bg-3);
}

.docs-table thead th {
  padding: 11px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.docs-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.docs-table tbody tr:last-child { border-bottom: none; }
.docs-table tbody tr:hover { background: var(--bg-3); }

.docs-table td {
  padding: 10px 16px;
  color: var(--text-2);
  vertical-align: top;
  line-height: 1.55;
}

/* Field column — monospace cyan */
.docs-table td:first-child {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--cyan);
  white-space: nowrap;
}

/* Type column */
.docs-table td:nth-child(2) {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--text-3);
  white-space: nowrap;
}

/* Required checkmark */
.req {
  color: var(--green);
  font-size: 0.85rem;
}

/* Inline code in table cells */
.docs-table td code {
  font-family: var(--mono);
  font-size: 0.76rem;
  background: var(--bg-4);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--text-1);
}

/* ── Code Block ──────────────────────────────────────────────────────────────── */
.code-wrap {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  margin: 4px 0;
}

.code-wrap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-3);
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}

.code-wrap-header span {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-3);
  letter-spacing: 0.06em;
  text-transform: lowercase;
}

.code-copy-btn {
  background: var(--bg-4);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 10px;
  font-size: 0.68rem;
  color: var(--text-3);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}
.code-copy-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.code-copy-btn.copied { border-color: var(--green); color: var(--green); }

.code-wrap pre {
  margin: 0;
  padding: 0;
  background: transparent;
}

.code-wrap pre code {
  display: block;
  padding: 20px;
  font-size: 0.8rem;
  line-height: 1.75;
  overflow-x: auto;
  background: #1a1f2e !important;
  font-family: var(--mono);
}

/* Override highlight.js background to match */
.hljs {
  background: #1a1f2e !important;
}

/* ── Notes List ──────────────────────────────────────────────────────────────── */
.notes-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

.notes-list li {
  display: flex;
  gap: 10px;
  font-size: 0.87rem;
  color: var(--text-2);
  line-height: 1.6;
}

.notes-list li::before {
  content: '—';
  color: var(--text-3);
  flex-shrink: 0;
  margin-top: 1px;
}

.notes-list li code {
  font-family: var(--mono);
  font-size: 0.79rem;
  background: var(--bg-4);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--cyan);
}

/* ── Deletion Note ───────────────────────────────────────────────────────────── */
.deletion-note {
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.6;
}
.deletion-note strong {
  color: var(--red);
}

/* ── Overview Page ───────────────────────────────────────────────────────────── */
.overview-intro {
  font-size: 1rem;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 40px;
  max-width: 700px;
}

.overview-category {
  margin-bottom: 40px;
}

.overview-category h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-0);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.overview-category h2 a {
  color: var(--text-0);
  font-size: inherit;
  font-weight: inherit;
}
.overview-category h2 a:hover { color: var(--cyan); }

.overview-kinds {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.overview-kind-link {
  font-family: var(--mono);
  font-size: 0.78rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 12px;
  color: var(--cyan);
  transition: all var(--transition);
}
.overview-kind-link:hover {
  border-color: var(--cyan);
  background: var(--cyan-dim);
  color: var(--cyan);
}

/* Concept sections on overview */
.concept-block {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 20px;
}
.concept-block h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-0);
  margin-bottom: 10px;
}
.concept-block p {
  font-size: 0.88rem;
  color: var(--text-2);
  line-height: 1.65;
}
.concept-block code {
  font-family: var(--mono);
  font-size: 0.8rem;
  background: var(--bg-4);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--cyan);
}
.concept-block ul {
  list-style: none;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.concept-block ul li {
  font-size: 0.87rem;
  color: var(--text-2);
  display: flex;
  gap: 8px;
}
.concept-block ul li::before {
  content: '·';
  color: var(--cyan);
  flex-shrink: 0;
}

/* ── Mobile Sidebar Toggle ───────────────────────────────────────────────────── */
.sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 200;
  width: 48px;
  height: 48px;
  background: var(--cyan);
  color: #000;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,212,255,0.35);
  transition: background var(--transition), transform var(--transition);
  align-items: center;
  justify-content: center;
}
.sidebar-toggle:hover { background: #33ddff; transform: scale(1.05); }

/* Sidebar overlay on mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 49;
  backdrop-filter: blur(4px);
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .docs-sidebar {
    transform: translateX(-100%);
  }
  .docs-sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0,0,0,0.5);
  }
  .sidebar-overlay.open {
    display: block;
  }
  .docs-content {
    margin-left: 0;
    padding: 32px 24px 80px;
  }
  .sidebar-toggle {
    display: flex;
  }
}

@media (max-width: 600px) {
  .docs-content {
    padding: 24px 16px 80px;
  }
  .docs-page-title {
    font-size: 1.6rem;
  }
  .resource-section h2 {
    font-size: 1.3rem;
  }
  .docs-table td:first-child {
    white-space: normal;
  }
}

/* ── Inline code everywhere in docs ─────────────────────────────────────────── */
.docs-content code:not(.hljs) {
  font-family: var(--mono);
  font-size: 0.82em;
  background: var(--bg-4);
  padding: 2px 5px;
  border-radius: 3px;
  color: var(--cyan);
}

/* ── API group badge ─────────────────────────────────────────────────────────── */
.api-group-notice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 0.82rem;
  color: var(--text-2);
  margin-bottom: 32px;
}
.api-group-notice code {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--cyan);
  background: transparent;
  padding: 0;
}

/* Section divider heading */
.docs-section-divider {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 20px;
  margin: 20px 0 6px;
}
