/* ================================================================
   Versola Docs — layout styles
   Загружается через versola.kz/css/docs.css на docs.versola.kz
   ================================================================ */

:root {
  --bg-dark: #0d1117;
  --bg-dark-card: #161b22;
  --accent: #58a6ff;
  --accent-gradient: linear-gradient(135deg, #58a6ff, #a371f7);
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --border-dark: #30363d;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --sidebar-width: 256px;
  --topbar-height: 60px;
}

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

body {
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Top bar ─── */
.docs-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-dark);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  z-index: 1000;
  gap: 0.75rem;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  line-height: 0;
}
.sidebar-toggle:hover { color: var(--text-primary); }

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  white-space: nowrap;
}

.brand-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: inherit;
}

.topbar-sep {
  color: var(--text-secondary);
  font-size: 1.25rem;
  font-weight: 300;
  line-height: 1;
  margin: 0 0.1rem;
}

.topbar-label {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  font-weight: 500;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.topbar-right a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.15s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.topbar-right a:hover { color: var(--text-primary); }

/* ─── Layout ─── */
.docs-layout {
  display: flex;
  padding-top: var(--topbar-height);
  min-height: 100vh;
}

/* ─── Sidebar ─── */
.docs-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  overflow-y: auto;
  background: var(--bg-dark);
  border-right: 1px solid var(--border-dark);
  padding: 2rem 0 3rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border-dark) transparent;
  transition: transform 0.25s ease;
}

.docs-sidebar::-webkit-scrollbar { width: 3px; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 2px; }

/* Section toggle button */
.nav-section-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem 1.25rem;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: left;
  transition: color 0.15s;
}
.nav-section-btn:hover { color: var(--accent); }
.nav-section-btn.has-active { color: var(--accent); }

.chevron {
  flex-shrink: 0;
  transition: transform 0.2s ease;
  color: var(--text-secondary);
}
.nav-section-btn.collapsed .chevron { transform: rotate(-90deg); }

/* Items list */
.nav-items {
  list-style: none;
  padding: 0 0 0.75rem;
  margin: 0;
  overflow: hidden;
}
.nav-items.collapsed { display: none; }

.nav-items li a {
  display: block;
  padding: 0.3rem 1.25rem 0.3rem 1.75rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 2px solid transparent;
  margin-left: 0;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1.5;
}
.nav-items li a:hover { color: var(--text-primary); }
.nav-items li a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}

/* Divider between sections */
.nav-divider {
  height: 1px;
  background: var(--border-dark);
  margin: 0.75rem 1.25rem;
  opacity: 0.5;
}

/* ─── Main ─── */
.docs-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.docs-content {
  flex: 1;
  width: 100%;
  padding: 3.5rem 4rem 3.5rem 3rem;
  max-width: 780px;
}

/* ─── Prose ─── */
.prose {
  color: #c9d1d9;
  line-height: 1.85;
  font-size: 0.9375rem;
}

.prose-header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-dark);
}

.prose-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 0.75rem;
  line-height: 1.2;
}

.prose-header .page-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.65;
}

.prose h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 2.75rem 0 0.9rem;
  padding-top: 0.25rem;
}

.prose h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 2rem 0 0.6rem;
}

.prose p { margin: 0 0 1.3rem; }

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

.prose strong { color: var(--text-primary); font-weight: 600; }

.prose code {
  background: var(--bg-dark-card);
  border: 1px solid var(--border-dark);
  border-radius: 4px;
  padding: 0.15em 0.45em;
  font-family: var(--font-mono);
  font-size: 0.83em;
  color: #a371f7;
}

.prose pre {
  background: var(--bg-dark-card);
  border: 1px solid var(--border-dark);
  border-radius: 10px;
  padding: 1.35rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0 1.75rem;
  line-height: 1.65;
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-primary);
  font-size: 0.875em;
}

.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1.1rem;
  color: var(--text-secondary);
  margin: 1.75rem 0;
  background: var(--bg-dark-card);
  border-radius: 0 8px 8px 0;
}
.prose blockquote p { margin: 0; }

.prose ul, .prose ol {
  padding-left: 1.6rem;
  margin: 0 0 1.3rem;
}
.prose li { margin-bottom: 0.45rem; }

.prose table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
  margin: 1.75rem 0;
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  overflow: hidden;
}

.prose th {
  text-align: left;
  padding: 0.6rem 1.1rem;
  background: var(--bg-dark-card);
  border-bottom: 1px solid var(--border-dark);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.prose th + th,
.prose td + td {
  border-left: 1px solid var(--border-dark);
}

.prose td {
  padding: 0.7rem 1.1rem;
  border-bottom: 1px solid var(--border-dark);
  color: #c9d1d9;
  vertical-align: top;
  line-height: 1.6;
}

.prose td:nth-child(2) { white-space: nowrap; }
.prose tr:last-child td { border-bottom: none; }

.prose tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

/* ─── Page footer ─── */
.docs-page-footer {
  padding: 2rem 4rem 2rem 3rem;
  max-width: 780px;
  border-top: 1px solid var(--border-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.docs-page-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.15s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.docs-page-footer a:hover { color: var(--accent); }

/* ─── Sidebar overlay (mobile) ─── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 900;
}

/* ─── Mobile ─── */
@media (max-width: 900px) {
  .sidebar-toggle { display: flex; }

  .docs-sidebar {
    transform: translateX(-100%);
    z-index: 950;
    width: min(var(--sidebar-width), 82vw);
  }
  .docs-sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

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

  .docs-content { padding: 2.5rem 1.25rem 2.5rem; }

  .docs-page-footer { padding: 1.5rem 1.25rem; }
}

@media (max-width: 540px) {
  .docs-content { padding: 1.75rem 1rem 2rem; }
}
