/* GitBook-inspired Clean Minimalist Documentation Theme */
:root {
  --bg-app: #0f1117;
  --bg-sidebar: #0c0d12;
  --bg-surface: #151722;
  --bg-surface-subtle: #1a1d2b;
  --bg-code: #12141d;
  --border: #232636;
  --border-focus: #3b82f6;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-subtle: rgba(59, 130, 246, 0.1);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sidebar-w: 260px;
  --toc-w: 220px;
  --header-h: 56px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  height: var(--header-h);
  background: var(--bg-app);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-logo {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}

.brand-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.2px;
}

.brand-version {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-box {
  position: relative;
  width: 240px;
}

.search-box input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px 6px 32px;
  font-size: 13px;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s;
}

.search-box input:focus {
  border-color: var(--border-focus);
}

.search-box svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.header-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
}

.header-link:hover {
  color: var(--text-main);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

/* Layout */
.app-layout {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
}

/* Left Sidebar */
.sidebar {
  width: var(--sidebar-w);
  height: calc(100vh - var(--header-h));
  position: sticky;
  top: var(--header-h);
  overflow-y: auto;
  padding: 20px 16px 40px;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}

.nav-group {
  margin-bottom: 24px;
}

.nav-group-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  padding: 0 10px;
  margin-bottom: 6px;
}

.nav-list {
  list-style: none;
}

.nav-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  transition: all 0.12s ease;
}

.nav-item a:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}

.nav-item a.active {
  color: var(--accent);
  background: var(--accent-subtle);
  font-weight: 500;
}

.badge-tag {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 600;
}

.badge-post { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-put { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-del { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.badge-get { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-ram { background: rgba(168, 85, 247, 0.15); color: #c084fc; }

/* Main Reading Area */
.content-area {
  flex: 1;
  min-width: 0;
  padding: 36px 36px 80px;
  max-width: 880px;
}

/* Right TOC */
.toc-sidebar {
  width: var(--toc-w);
  height: calc(100vh - var(--header-h));
  position: sticky;
  top: var(--header-h);
  overflow-y: auto;
  padding: 36px 20px 40px;
  flex-shrink: 0;
}

.toc-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
  border-left: 1px solid var(--border);
}

.toc-list li a {
  display: block;
  padding-left: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.12s;
}

.toc-list li a:hover, .toc-list li a.active {
  color: var(--text-main);
  border-left: 2px solid var(--accent);
  margin-left: -1px;
}

/* Typography */
h1.page-title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-main);
  margin-bottom: 10px;
}

p.page-lead {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 24px;
}

h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--text-main);
  margin-top: 40px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 24px;
  margin-bottom: 10px;
}

p, ul, ol {
  color: var(--text-muted);
  margin-bottom: 16px;
}

ul, ol {
  padding-left: 20px;
}

li {
  margin-bottom: 6px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  padding: 2px 5px;
  border-radius: 4px;
  color: #e2e8f0;
}

/* Action Section Blocks */
.action-block {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.action-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.action-title {
  font-size: 18px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-main);
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  margin: 16px 0 24px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

th {
  background: var(--bg-surface);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  vertical-align: top;
}

tr:last-child td {
  border-bottom: none;
}

.field-name {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #38bdf8;
}

.field-type {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #c084fc;
}

.field-req {
  font-size: 11px;
  color: #f87171;
  font-weight: 600;
}

.field-opt {
  font-size: 11px;
  color: var(--text-dim);
}

/* Code Blocks */
.code-block {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 16px 0 24px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.12s;
}

.copy-btn:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-main);
  border-color: var(--text-dim);
}

pre {
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: #e2e8f0;
  max-width: 100%;
  box-sizing: border-box;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* Callouts / Notes */
.callout {
  padding: 14px 16px;
  border-radius: 6px;
  background: var(--bg-surface);
  border-left: 3px solid var(--accent);
  margin: 18px 0;
  font-size: 13.5px;
}

.callout p {
  margin: 0;
  color: var(--text-muted);
}

.callout strong {
  color: var(--text-main);
}

.callout.tip {
  border-left-color: var(--success);
}

.callout.warn {
  border-left-color: var(--warning);
}

/* Playground (Clean API Tester) */
.playground-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin: 24px 0 36px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.playground-grid {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  width: 100%;
  min-width: 0;
}

.pg-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  width: 100%;
}

.pg-col .code-block {
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.pg-col pre {
  max-height: 270px;
  overflow: auto;
  font-size: 12.5px;
  line-height: 1.45;
  padding: 12px 14px;
  width: 100%;
  box-sizing: border-box;
}

.pg-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pg-input, .pg-select, .pg-textarea {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text-main);
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
  outline: none;
}

.pg-textarea {
  resize: vertical;
  min-height: 52px;
}

.pg-input:focus, .pg-select:focus, .pg-textarea:focus {
  border-color: var(--border-focus);
}

.pg-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.pg-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
}

.btn-run {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  align-self: flex-start;
}

.btn-run:hover {
  background: var(--accent-hover);
}

.pg-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 10px;
}

.pg-tab-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.pg-tab-btn.active {
  color: var(--text-main);
  background: var(--bg-surface-subtle);
}

.response-viewer {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  overflow: auto;
  max-height: 100px;
  width: 100%;
  box-sizing: border-box;
}

/* Toast */
.toast-box {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 1000;
}

/* Mobile Responsive */
@media (max-width: 1080px) {
  .toc-sidebar {
    display: none;
  }
}

@media (max-width: 820px) {
  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: -100%;
    width: 260px;
    background: var(--bg-sidebar);
    z-index: 90;
    transition: left 0.2s ease;
  }
  .sidebar.open {
    left: 0;
  }
  .menu-toggle {
    display: block;
  }
  .content-area {
    padding: 24px 20px 60px;
  }
  .playground-grid {
    grid-template-columns: 1fr;
  }
}
