/* ============================================
   DOCS PAGE — sidebar + content layout
   ============================================ */

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  overflow-y: scroll;
  z-index: 100;
}


.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }

.sidebar-logo {
  padding: 0 24px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 5px;
}

.sidebar-logo span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: #ffffff;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-logo .version {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ============================================
   NAV GROUPS (Dropdown)
   ============================================ */
.nav-group {
  margin-bottom: 2px;
}

.nav-group-label {
  padding: 12px 24px 4px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

.nav-group:first-of-type .nav-group-label {
  border-top: none;
  margin-top: 0;
  padding-top: 4px;
}

.nav-group-header {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.nav-group:first-of-type .nav-group-header {
  border-top: none;
  margin-top: 0;
  padding-top: 4px;
}

.nav-group-header:hover .nav-group-title {
  color: var(--text-muted);
}

.nav-group-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color 0.15s;
}

.nav-group-arrow {
  font-size: 8px;
  color: var(--text-dim);
  transition: transform 0.2s ease, color 0.15s;
  line-height: 1;
}

.nav-group.open .nav-group-arrow {
  transform: rotate(90deg);
}

.nav-group-items {
  display: none;
  overflow: hidden;
}

.nav-group.open .nav-group-items {
  display: block;
}

/* Sub-group (nested dropdown) */
.nav-subgroup {
  margin-bottom: 1px;
}

.nav-subgroup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 24px 6px 32px;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

.nav-subgroup-header:hover .nav-subgroup-title {
  color: var(--text-muted);
}

.nav-subgroup-title {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  transition: color 0.15s;
}

.nav-subgroup-arrow {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: var(--text-dim);
  transition: transform 0.2s ease;
}

.nav-subgroup.open .nav-subgroup-arrow {
  transform: rotate(90deg);
}

.nav-subgroup-items {
  display: none;
}

.nav-subgroup.open .nav-subgroup-items {
  display: block;
}

/* Nav items */
.nav-section {
  padding: 8px 24px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.nav-item {
  display: block;
  padding: 7px 24px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}

.nav-item.indent {
  padding-left: 40px;
}

.nav-item.indent-2 {
  padding-left: 52px;
}

.nav-item:hover, .nav-item.active {
  color: var(--text);
  background: var(--surface2);
  border-left-color: #ffffff;
}

/* Main content area */
.main {
  margin-left: 260px;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 14px 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 50;
}

.breadcrumb {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb span { color: var(--text-muted); }
.breadcrumb .sep { color: var(--text-dim); }

.content {
  max-width: 820px;
  padding: 48px 48px 96px;
  margin: 0 auto;
}

/* Tutorial sections */
.tutorial-section {
  margin-bottom: 80px;
  padding-bottom: 80px;
  border-bottom: 1px solid var(--border);
}

.tutorial-section:last-child { border-bottom: none; }

.section-badge {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 3px;
  background: #ffffff;
  color: #000000;
  border: 1px solid #ffffff;
  margin-bottom: 16px;
}

h1 {
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 40px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
}

h3 {
  font-size: 14px;
  font-weight: 600;
  color: #aaaaaa;
  margin: 28px 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

p {
  color: var(--text-muted);
  margin-bottom: 16px;
  font-weight: 300;
}

p strong { color: var(--text); font-weight: 500; }

/* Code blocks */
pre {
  background: #111111;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 24px;
  overflow-x: auto;
  margin: 16px 0 24px;
  position: relative;
}

pre::before {
  content: attr(data-lang);
  position: absolute;
  top: 8px;
  right: 14px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: #e0e0e0;
  line-height: 1.7;
}

p code, li code {
  background: #1e1e1e;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12.5px;
  color: #e2e8f0;
  border: 1px solid #2a2a2a;
}

/* Syntax colors */
.kw  { color: #ff7b72; }
.fn  { color: #d2a8ff; }
.str { color: #a5d6ff; }
.cm  { color: #555555; font-style: italic; }
.num { color: #79c0ff; }
.cls { color: #ffa657; }

/* Callouts */
.callout {
  border-radius: 6px;
  padding: 16px 20px;
  margin: 20px 0;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.callout-note {
  background: rgba(74, 158, 255, 0.06);
  border: 1px solid rgba(74, 158, 255, 0.15);
  border-left: 3px solid #4a9eff;
}

.callout-warn {
  background: rgba(227, 160, 8, 0.06);
  border: 1px solid rgba(227, 160, 8, 0.15);
  border-left: 3px solid #e3a008;
}

.callout-success {
  background: rgba(63, 185, 80, 0.06);
  border: 1px solid rgba(63, 185, 80, 0.15);
  border-left: 3px solid #3fb950;
}

.callout-tip {
  background: rgba(188, 140, 255, 0.06);
  border: 1px solid rgba(188, 140, 255, 0.15);
  border-left: 3px solid #bc8cff;
}

.callout-icon {
  font-size: 0; /* hide emoji */
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

.callout-icon::before {
  content: '';
  display: block;
  width: 16px;
  height: 16px;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
}

/* info icon — blue (callout-note) */
.callout-note .callout-icon::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234a9eff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E");
}

/* warning icon — amber (callout-warn) */
.callout-warn .callout-icon::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23e3a008' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E");
}

/* check icon — green (callout-success) */
.callout-success .callout-icon::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233fb950' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/%3E%3Cpolyline points='22 4 12 14.01 9 11.01'/%3E%3C/svg%3E");
}

/* lightbulb icon — purple (callout-tip) */
.callout-tip .callout-icon::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23bc8cff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='9' y1='18' x2='15' y2='18'/%3E%3Cline x1='10' y1='22' x2='14' y2='22'/%3E%3Cpath d='M15.09 14c.18-.98.65-1.74 1.41-2.5A4.65 4.65 0 0 0 18 8 6 6 0 0 0 6 8c0 1 .23 2.23 1.5 3.5A4.61 4.61 0 0 1 8.91 14'/%3E%3C/svg%3E");
}

.callout-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.callout-note .callout-title    { color: #4a9eff; }
.callout-warn .callout-title    { color: #e3a008; }
.callout-success .callout-title { color: #3fb950; }
.callout-tip .callout-title     { color: #bc8cff; }

.callout p { margin-bottom: 0; font-size: 13.5px; line-height: 1.6; }

/* Lists */
ul, ol { padding-left: 20px; margin-bottom: 16px; }

li { color: var(--text-muted); margin-bottom: 8px; font-weight: 300; }
li strong { color: var(--text); font-weight: 500; }

/* Terminal block */
.terminal {
  background: #111111;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin: 16px 0 24px;
}

.terminal-bar {
  background: var(--surface2);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.terminal-dot { width: 10px; height: 10px; border-radius: 50%; }
.terminal-dot:nth-child(1) { background: #ff5f57; }
.terminal-dot:nth-child(2) { background: #febc2e; }
.terminal-dot:nth-child(3) { background: #28c840; }

.terminal-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 8px;
}

.terminal pre { border: none; border-radius: 0; margin: 0; background: transparent; }
.terminal pre::before { display: none; }

.prompt { color: #ffffff; }

hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

/* Tab switcher */
.tab-group {
  margin: 16px 0 24px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.tab-bar {
  display: flex;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  gap: 0;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 10px 14px 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  text-transform: uppercase;
}

.tab-btn:hover { color: var(--text-muted); }
.tab-btn.active { color: var(--text); border-bottom-color: #ffffff; }

.tab-content { padding: 20px 24px; background: #111111; }
.tab-content pre { border: none; border-radius: 0; margin: 0; background: transparent; padding: 0; }
.tab-content pre::before { display: none; }

/* Inline link */
a.inline-link {
  color: #4a9eff;
  text-decoration: none;
  border-bottom: 1px solid rgba(74,158,255,0.3);
  transition: border-color 0.15s;
}
a.inline-link:hover { border-bottom-color: #4a9eff; }


/* hamburger ซ่อนบน desktop */
.hamburger {
  display: none;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-260px);
    transition: transform 0.3s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main {
    margin-left: 0;
  }
  .topbar {
    padding: 14px 20px;
  }
  .content {
    padding: 24px 20px 64px;
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    pointer-events: none;
  }
  .sidebar-overlay.open {
    display: block;
    pointer-events: auto; 
  }
  .hamburger {
    display: block;
    background: none;
    border: none;
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    margin-right: 8px;
  }

}
