/* ── DOCS SHARED STYLE ──────────────────────────────────
   Single source of truth untuk semua halaman docs.
   Import via: <link rel="stylesheet" href="docs-style.css">
   ────────────────────────────────────────────────────── */

/* ── RESET & BASE ── */
:root { --brand: #00674F; --text: #37352f; --text-secondary: #787774; --bg: #fff; --bg-alt: #f7f7f5; --bg-code: #191919; --border: #e9e9e7; }
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: var(--text); line-height: 1.9; font-size: 16px; margin: 0; padding: 0; -webkit-text-size-adjust: 100%; }
h1 { font-size: 32px; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.5px; }
h2 { font-size: 24px; font-weight: 600; margin: 56px 0 12px; }
h3 { font-size: 18px; font-weight: 600; margin: 36px 0 8px; }
p { margin: 12px 0; }
ul, ol { margin: 12px 0; padding-left: 24px; }
li { margin: 6px 0; }
hr { border: none; height: 1px; background: var(--border); margin: 48px 0; }

/* ── CODE ── */
pre { background: var(--bg-code); color: #e0e0e0; padding: 16px; border-radius: 8px; overflow-x: auto; font-size: 13px; line-height: 1.6; margin: 16px 0; -webkit-overflow-scrolling: touch; }
code { background: var(--bg-alt); padding: 2px 6px; border-radius: 3px; font-size: 13px; font-family: 'SF Mono', Menlo, monospace; color: #c7254e; word-break: break-word; }
pre code { background: none; padding: 0; color: #e0e0e0; word-break: normal; }

/* ── SYNTAX HIGHLIGHTING ── */
.keyword { color: #c678dd; }
.string { color: #98c379; }
.comment { color: #5c6370; font-style: italic; }
.function { color: #61afef; }
.number { color: #d19a66; }
.atom { color: #56b6c2; }

/* ── CALLOUTS ── */
.callout { padding: 16px 20px; border-radius: 6px; margin: 20px 0; font-size: 15px; }
.callout-green { background: #f0faf6; }
.callout-red { background: #fdf2f2; }
.callout-yellow { background: #fef9ee; }
.callout-gray { background: var(--bg-alt); }
.callout strong { display: block; margin-bottom: 4px; }

/* ── TABLES (responsive) ── */
table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
th { text-align: left; padding: 8px 12px; font-size: 12px; font-weight: 500; color: var(--text-secondary); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 16px 0; border-radius: 8px; }
.table-wrap table { margin: 0; }

/* ── COMPARISON GRID ── */
.comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.comparison > div { padding: 16px; border-radius: 8px; }
.comparison .before { background: #fdf2f2; }
.comparison .after { background: #f0faf6; }

/* ── CHAPTER NAV ── */
.chapter-nav { display: flex; justify-content: space-between; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border); gap: 16px; }
.chapter-nav a { text-decoration: none; color: var(--brand); font-weight: 600; font-size: 15px; }
.chapter-nav a:hover { text-decoration: underline; }

/* ── SIDEBAR ── */
.docs-sidebar {
  position: fixed; top: 0; left: 0; width: 260px; height: 100vh;
  overflow-y: auto; background: #fbfbfa; border-right: 1px solid #e5e7eb;
  padding: 16px 0; z-index: 100;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 13px;
}
.docs-sidebar::-webkit-scrollbar { width: 0; }
.docs-sidebar-brand {
  padding: 0 16px 16px; display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: #111827;
}
.docs-sidebar-brand span { font-size: 15px; font-weight: 700; letter-spacing: -0.3px; }
.docs-nav-group { margin-bottom: 4px; }
.docs-nav-label {
  padding: 8px 16px 4px; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.8px; color: #9ca3af;
}
.docs-nav-link {
  display: block; padding: 7px 16px; color: #374151; text-decoration: none;
  font-weight: 500; font-size: 13px; transition: all 0.1s;
}
.docs-nav-link:hover { color: #111827; background: #f3f4f6; }
.docs-nav-link.active { color: #00674F; font-weight: 600; background: rgba(0,103,79,0.06); border-right: 2px solid #00674F; }
.docs-nav-divider { height: 1px; background: #e5e7eb; margin: 8px 16px; }

/* ── COLLAPSIBLE MENU ── */
.docs-nav-parent {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 16px; color: #374151; font-weight: 600; font-size: 13px;
  cursor: pointer; user-select: none; transition: all 0.1s;
  text-decoration: none; border: none; background: none; width: 100%;
}
.docs-nav-parent:hover { color: #111827; background: #f3f4f6; }
.docs-nav-parent.has-active { color: #00674F; }
.docs-nav-parent .chevron {
  width: 14px; height: 14px; color: #9ca3af; transition: transform 0.2s; flex-shrink: 0;
}
.docs-nav-parent.open .chevron { transform: rotate(90deg); }
.docs-nav-children { display: none; padding-bottom: 4px; }
.docs-nav-children.open { display: block; }
.docs-nav-child {
  display: block; padding: 5px 16px 5px 32px; color: #6b7280; text-decoration: none;
  font-size: 12px; font-weight: 400; transition: all 0.1s;
}
.docs-nav-child:hover { color: #374151; background: #f3f4f6; }
.docs-nav-child.active { color: #00674F; font-weight: 600; }

/* ── MAIN CONTENT ── */
.docs-main { margin-left: 260px; min-height: 100vh; padding: 40px 48px 100px; }
.docs-content { max-width: 720px; }

/* ── MOBILE NAV ── */
.docs-hamburger {
  display: none; position: fixed; top: 12px; left: 12px; z-index: 200;
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid #e5e7eb;
  background: #fff; cursor: pointer; align-items: center; justify-content: center;
}
.docs-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 90; }

/* ══════════════════════════════════════════════════════
   RESPONSIVE — TABLET (max 1024px)
   ══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .docs-main { padding: 32px 32px 80px; }
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (max 768px)
   ══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Sidebar: hidden, slide in from left */
  .docs-sidebar { transform: translateX(-100%); transition: transform 0.2s; }
  .docs-sidebar.open { transform: translateX(0); }

  /* Main: full width */
  .docs-main { margin-left: 0; padding: 56px 20px 80px; }

  /* Hamburger: visible */
  .docs-hamburger { display: flex; }
  .docs-overlay.open { display: block; }

  /* Typography: scale down */
  h1 { font-size: 24px; }
  h2 { font-size: 20px; margin: 40px 0 10px; }
  h3 { font-size: 16px; margin: 28px 0 6px; }

  /* Code: smaller + horizontal scroll */
  pre { font-size: 12px; padding: 12px; }
  code { font-size: 12px; }

  /* Tables: horizontal scroll wrapper */
  table { font-size: 13px; display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th { padding: 6px 8px; font-size: 11px; }
  td { padding: 6px 8px; min-width: 80px; }

  /* Comparison grid: stack vertically */
  .comparison { grid-template-columns: 1fr; }

  /* Callouts: tighter */
  .callout { padding: 12px 16px; font-size: 14px; }

  /* Chapter nav: stack if too tight */
  .chapter-nav { flex-direction: column; gap: 12px; }
  .chapter-nav a { font-size: 14px; }

  /* HR: smaller margin */
  hr { margin: 32px 0; }
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE — SMALL PHONE (max 400px)
   ══════════════════════════════════════════════════════ */
@media (max-width: 400px) {
  .docs-main { padding: 52px 16px 60px; }
  h1 { font-size: 22px; }
  pre { font-size: 11px; padding: 10px; }
  table { font-size: 12px; }
}
