.docs-layout {
  display: flex;
  margin-top: 80px; /* offset for header */
  min-height: calc(100vh - 80px);
}

.docs-sidebar {
  width: 280px;
  background: var(--bg-surface);
  border-right: 1px solid var(--gray-200);
  padding: var(--space-xl) var(--space-lg);
  position: sticky;
  top: 80px;
  height: calc(100vh - 80px);
  overflow-y: auto;
  flex-shrink: 0;
}

.docs-content {
  flex: 1;
  padding: var(--space-2xl);
  max-width: 900px;
  background: var(--bg-main);
}

.docs-section {
  display: none;
  animation: fadeIn 0.3s ease forwards;
}

.docs-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.nav-group-title {
  font-size: 0.875rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
  margin-top: var(--space-md);
}

.sidebar-nav a {
  display: block;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  transition: all var(--transition);
}

.sidebar-nav a:hover {
  background: var(--gray-100);
  color: var(--brand-primary);
}

.sidebar-nav a.active {
  background: rgba(255, 140, 0, 0.1);
  color: var(--brand-primary);
}

.docs-content h1 {
  margin-bottom: var(--space-lg);
  color: var(--brand-primary);
  border-bottom: 2px solid var(--gray-200);
  padding-bottom: var(--space-sm);
}

.docs-content h2 {
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
}

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

.docs-content ul, .docs-content ol {
  margin-bottom: var(--space-lg);
  padding-left: var(--space-xl);
  color: var(--text-secondary);
}

.docs-content li {
  margin-bottom: var(--space-sm);
}

.alert {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
}

.alert-info {
  background: rgba(0, 188, 212, 0.1);
  color: var(--brand-secondary);
  border: 1px solid rgba(0, 188, 212, 0.2);
}

/* ─── Mobile: hide sidebar, show floating TOC button ─── */
@media (max-width: 992px) {
  /* Sidebar is hidden — replaced by floating TOC */
  .docs-sidebar {
    display: none;
  }

  .docs-content {
    padding: var(--space-lg);
  }
}

/* ─── Floating TOC trigger button ─── */
.toc-fab {
  display: none; /* shown only on mobile via media query */
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 900;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  box-shadow: 0 4px 20px rgba(255, 140, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.toc-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(255, 140, 0, 0.6);
}

/* Only show on mobile */
@media (min-width: 993px) {
  .toc-fab {
    display: none !important;
  }
}

/* ─── TOC modal overlay ─── */
.toc-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 950;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: flex-end;
  justify-content: center;
}

.toc-overlay.open {
  display: flex;
  animation: tocOverlayIn 0.25s ease forwards;
}

@keyframes tocOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.toc-modal {
  background: var(--bg-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 75vh;
  overflow-y: auto;
  padding: var(--space-xl) var(--space-lg) var(--space-2xl);
  animation: tocSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes tocSlideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.toc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.toc-modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brand-primary);
}

.toc-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--text-muted);
  line-height: 1;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color 0.2s;
}

.toc-close-btn:hover {
  color: var(--text-primary);
}

/* Cloned nav inside modal */
.toc-modal .sidebar-nav {
  gap: var(--space-sm);
}
