/* =============================================
   Documentation page styles
   ============================================= */

/* Back link in header */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  transition: color .2s;
}
.back-link:hover { color: var(--accent) }
.back-link svg { transition: transform .2s }
.back-link:hover svg { transform: translateX(-3px) }

/* Layout: sidebar + content */
.docs-layout {
  display: flex;
  min-height: 100vh;
  padding-top: 64px;
}

/* ---- Sidebar ---- */
.docs-sidebar {
  position: fixed;
  top: 64px;
  left: 0;
  width: 260px;
  height: calc(100vh - 64px);
  overflow-y: auto;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 32px 0;
  z-index: 100;
}

.docs-sidebar::-webkit-scrollbar { width: 4px }
.docs-sidebar::-webkit-scrollbar-track { background: transparent }
.docs-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 4px }

.sidebar-heading {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-dim);
  padding: 20px 24px 8px;
}
.sidebar-heading:first-child { padding-top: 0 }

.sidebar-link {
  display: block;
  font-size: .84rem;
  font-weight: 500;
  color: var(--text);
  padding: 7px 24px;
  border-left: 2px solid transparent;
  transition: all .15s;
}
.sidebar-link:hover {
  color: var(--text-bright);
  background: rgba(255,255,255,.03);
}
.sidebar-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-glow);
}

/* Sidebar toggle (mobile) */
.docs-sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-bright);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  transition: background .2s;
}
.docs-sidebar-toggle:hover { background: var(--bg-card-hover) }
.docs-sidebar-toggle.active { background: var(--accent); color: #fff }

/* ---- Main content ---- */
.docs-content {
  flex: 1;
  margin-left: 260px;
  padding: 48px 0 80px;
  min-width: 0;
  overflow-x: hidden;
}
.docs-container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 40px;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Sections */
.docs-content section {
  margin-bottom: 64px;
  scroll-margin-top: 80px;
}

.docs-content h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800;
  color: var(--text-bright);
  margin-bottom: 16px;
}
.docs-intro {
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.75;
  max-width: 640px;
  margin-bottom: 36px;
}
.docs-content h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.docs-content h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-top: 28px;
  margin-bottom: 10px;
}
.docs-content p {
  font-size: .92rem;
  color: var(--text);
  line-height: 1.75;
  margin-bottom: 14px;
}
.docs-content ul,
.docs-content ol {
  padding-left: 20px;
  margin-bottom: 16px;
}
.docs-content li {
  font-size: .92rem;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 6px;
  list-style: disc;
}
.docs-content ol li {
  list-style: decimal;
}
.docs-content a {
  color: var(--accent);
  font-weight: 500;
  transition: color .15s;
}
.docs-content a:hover {
  color: var(--accent-hover);
}
.docs-content strong {
  color: var(--text-bright);
  font-weight: 600;
}
.docs-content em {
  color: var(--text-dim);
}
.docs-content code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: .82rem;
  background: rgba(255,255,255,.06);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
}

/* ---- Highlight grid (overview) ---- */
.docs-highlight-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}
.docs-highlight {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all .2s;
}
.docs-highlight:hover {
  border-color: rgba(212,136,42,.2);
  background: var(--bg-card-hover);
}
.docs-highlight-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: 14px;
}
.docs-highlight h4 {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 6px;
}
.docs-highlight p {
  font-size: .82rem;
  color: var(--text-dim);
  line-height: 1.55;
  margin-bottom: 0;
}

/* ---- Tables ---- */
.docs-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  max-width: 100%;
}
.docs-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.docs-table-wrap thead {
  background: var(--bg-secondary);
}
.docs-table-wrap th {
  text-align: left;
  font-weight: 600;
  color: var(--text-bright);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.docs-table-wrap td {
  color: var(--text);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  line-height: 1.55;
}
.docs-table-wrap tr:last-child td { border-bottom: none }
.docs-table-wrap tr:hover td { background: rgba(255,255,255,.02) }

/* ---- Callout ---- */
.docs-callout {
  background: var(--bg-card);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px 20px;
  margin-bottom: 20px;
  font-size: .88rem;
  color: var(--text);
  line-height: 1.65;
}

/* ---- Example block ---- */
.docs-example {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.docs-example-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 14px !important;
}
.docs-example-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.docs-example-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .85rem;
  color: var(--text);
}
.docs-example-row span:first-child {
  font-weight: 600;
  color: var(--text-bright);
  min-width: 90px;
}
.docs-example-row span:nth-child(2) {
  color: var(--accent);
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}
.docs-example-result {
  font-size: .82rem;
  color: var(--text-dim);
  margin-bottom: 0 !important;
}

/* ---- Responsive ---- */
@media (max-width: 960px) {
  .docs-sidebar {
    position: fixed;
    left: -280px;
    width: 280px;
    top: 0;
    height: 100vh;
    padding-top: 80px;
    transition: left .3s ease;
    z-index: 300;
    box-shadow: none;
  }
  .docs-sidebar.open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,.5);
  }
  .docs-sidebar-toggle {
    display: flex;
  }
  .docs-content {
    margin-left: 0;
  }
  .docs-container {
    padding: 0 24px;
  }
  .docs-highlight-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .docs-container {
    padding: 0 16px;
  }
  .docs-content {
    padding: 32px 0 64px;
  }
  .docs-table-wrap th,
  .docs-table-wrap td {
    padding: 8px 12px;
    font-size: .8rem;
  }
  .docs-content code {
    word-break: break-all;
  }
  .docs-example {
    padding: 16px;
  }
  .docs-example-row {
    flex-wrap: wrap;
    gap: 4px 8px;
  }
  .docs-example-row span:first-child {
    min-width: auto;
  }
  .docs-callout {
    padding: 14px 16px;
  }
  .docs-content h2 {
    font-size: 1.2rem;
  }
}
