:root {
  --bg: #0f1117;
  --bg-elevated: #171a22;
  --bg-hover: #1f2430;
  --border: #2a3142;
  --text: #e8ecf4;
  --text-muted: #8b95a8;
  --accent: #5b8def;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.docs-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.docs-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.docs-eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.docs-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
}

.docs-bot-link {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(96, 165, 250, 0.08);
  color: #93c5fd;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.docs-bot-link:hover {
  background: rgba(96, 165, 250, 0.14);
  border-color: rgba(147, 197, 253, 0.35);
}

.docs-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.api-docs-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 0;
  min-height: calc(100vh - 140px);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-elevated);
}

.api-docs-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  border-right: 1px solid var(--border);
  background: var(--bg);
  overflow-y: auto;
  position: sticky;
  top: 0;
  align-self: start;
  max-height: calc(100vh - 140px);
}

.api-docs-nav-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.api-docs-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.api-docs-nav-item.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}

.api-docs-nav-title {
  font-size: 13px;
  font-weight: 600;
}

.api-docs-nav-meta {
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-muted);
  word-break: break-all;
}

.api-docs-content {
  overflow-y: auto;
  max-height: calc(100vh - 140px);
  padding: 20px 24px 32px;
  scroll-behavior: smooth;
}

.api-docs-section {
  padding-bottom: 32px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 16px;
}

.api-docs-section:last-child {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.api-docs-section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.api-docs-path-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.api-docs-section-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  width: 100%;
}

.api-docs-method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.api-docs-method-get {
  border-color: rgba(56, 189, 120, 0.35);
  background: rgba(56, 189, 120, 0.08);
  color: #6ee7b7;
}

.api-docs-method-post {
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(96, 165, 250, 0.08);
  color: #93c5fd;
}

.api-docs-method-put,
.api-docs-method-patch {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
  color: #fcd34d;
}

.api-docs-method-delete {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
  color: #fca5a5;
}

.api-docs-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.api-docs-path:hover {
  background: var(--bg-hover);
  border-color: rgba(147, 197, 253, 0.35);
}

.api-docs-path.is-copied {
  border-color: rgba(56, 189, 120, 0.45);
  color: #6ee7b7;
}

.api-docs-path.is-copy-error {
  border-color: rgba(248, 113, 113, 0.45);
  color: #fca5a5;
}

.api-docs-description {
  margin: 0 0 16px;
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 720px;
}

.api-docs-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.api-docs-cost {
  margin: 0 0 12px;
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.12);
  color: #93c5fd;
  font-size: 12px;
  font-weight: 600;
}

.api-docs-template-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.api-docs-template-preview img {
  display: block;
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
}

.api-docs-loading,
.api-docs-error {
  padding: 24px;
  color: var(--text-muted);
}

.api-docs-error {
  color: #fca5a5;
}

.api-docs-block {
  margin-bottom: 16px;
}

.api-docs-block h4 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.api-docs-preview {
  margin: 0;
  padding: 18px 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.6;
}

.api-docs-preview code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.api-docs-params {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.api-docs-param {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: left;
}

button.api-docs-param {
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: background 0.15s, border-color 0.15s;
}

button.api-docs-param:hover {
  background: var(--bg-hover);
  border-color: rgba(147, 197, 253, 0.35);
}

button.api-docs-param.is-copied {
  border-color: rgba(56, 189, 120, 0.45);
}

button.api-docs-param.is-copy-error {
  border-color: rgba(248, 113, 113, 0.45);
}

.api-docs-param-static {
  cursor: default;
}

.api-docs-param-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.api-docs-param-required,
.api-docs-param-optional {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.api-docs-param-required {
  background: rgba(248, 113, 113, 0.15);
  color: #fca5a5;
}

.api-docs-param-optional {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
}

.api-docs-param-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: #93c5fd;
  word-break: break-word;
}

.api-docs-param-copy-hint {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
}

button.api-docs-param.is-copied .api-docs-param-copy-hint {
  color: #6ee7b7;
}

.api-docs-param-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

@media (max-width: 900px) {
  .api-docs-layout {
    grid-template-columns: 1fr;
  }

  .api-docs-nav {
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    flex-wrap: wrap;
  }

  .api-docs-nav-item {
    width: auto;
    flex: 1 1 180px;
  }

  .api-docs-content {
    max-height: none;
  }
}
