/* ── Layout ───────────────────────────────────────────────────── */
.api-docs-wrap {
    display: flex;
    min-height: calc(100vh - 64px);
}

/* Sidebar */
.api-sidebar {
    width: 270px;
    min-width: 270px;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
    border-right: 1px solid var(--border-color, #e5e7eb);
    padding: 1.5rem 0 2rem;
    background: var(--card-bg, #fff);
    scrollbar-width: thin;
}
[data-theme="dark"] .api-sidebar {
    background: #1e2130;
    border-right-color: #2d3348;
}

.api-sidebar-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted, #9ca3af);
    padding: 0.75rem 1.4rem 0.3rem;
}

.api-sidebar a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.38rem 1.4rem;
    font-size: 0.86rem;
    color: var(--text-secondary, #4b5563);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
}
.api-sidebar a:hover {
    background: var(--hover-bg, #f3f4f6);
    color: var(--text-primary, #111827);
}
.api-sidebar a.active {
    border-left-color: #27ae60;
    color: #27ae60;
    background: var(--hover-bg, #f3f4f6);
    font-weight: 600;
}
[data-theme="dark"] .api-sidebar a:hover,
[data-theme="dark"] .api-sidebar a.active {
    background: #252a3a;
}
.api-sidebar a .material-icons-outlined { font-size: 1rem; }

/* Content */
.api-content {
    flex: 1;
    padding: 2.5rem 2.5rem 4rem;
    max-width: 900px;
    overflow-x: hidden;
}
@media (max-width: 768px) {
    .api-sidebar { display: none; }
    .api-content { padding: 1.5rem 1rem 3rem; }
}

/* ── Typography ───────────────────────────────────────────────── */
.api-section {
    margin-bottom: 3.5rem;
    scroll-margin-top: 80px;
}
.api-section-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color, #e5e7eb);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.api-section-title .material-icons-outlined { font-size: 1.3rem; color: #27ae60; }

.api-subsection { margin-bottom: 2rem; }
.api-endpoint-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary, #111827);
}

/* ── Method badges ────────────────────────────────────────────── */
.method {
    display: inline-block;
    padding: 0.18em 0.6em;
    border-radius: 5px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: .05em;
    min-width: 50px;
    text-align: center;
    vertical-align: middle;
}
.method-get    { background: #d1fae5; color: #065f46; }
.method-post   { background: #dbeafe; color: #1e40af; }
.method-patch  { background: #fef3c7; color: #92400e; }
.method-delete { background: #fee2e2; color: #991b1b; }
[data-theme="dark"] .method-get    { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .method-post   { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .method-patch  { background: #451a03; color: #fbbf24; }
[data-theme="dark"] .method-delete { background: #450a0a; color: #fca5a5; }

/* ── Endpoint row ─────────────────────────────────────────────── */
.endpoint-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.4rem;
    background: var(--hover-bg, #f9fafb);
    border: 1px solid var(--border-color, #e5e7eb);
    flex-wrap: wrap;
}
[data-theme="dark"] .endpoint-row { background: #252a3a; border-color: #2d3348; }

.endpoint-path {
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.85rem;
    color: var(--text-primary, #111827);
    word-break: break-all;
}
.endpoint-desc {
    font-size: 0.8rem;
    color: var(--text-muted, #6b7280);
    margin-left: auto;
    white-space: nowrap;
}
@media (max-width: 600px) {
    .endpoint-desc { margin-left: 0; white-space: normal; }
}

/* ── Code blocks ──────────────────────────────────────────────── */
.api-code-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-muted, #9ca3af);
    margin-bottom: 0.25rem;
    margin-top: 0.9rem;
}
pre.api-code {
    background: #1e2130;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 1rem 1.2rem;
    font-size: 0.82rem;
    overflow-x: auto;
    margin-bottom: 0;
    line-height: 1.6;
}
[data-theme="light"] pre.api-code { background: #1e2130; }

/* ── Params table ─────────────────────────────────────────────── */
.params-table {
    width: 100%;
    font-size: 0.82rem;
    border-collapse: collapse;
    margin-bottom: 0.75rem;
}
.params-table th {
    text-align: left;
    font-weight: 600;
    padding: 0.4rem 0.7rem;
    background: var(--hover-bg, #f3f4f6);
    border-bottom: 2px solid var(--border-color, #e5e7eb);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.params-table td {
    padding: 0.45rem 0.7rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    vertical-align: top;
}
.params-table code {
    background: var(--hover-bg, #f3f4f6);
    border-radius: 4px;
    padding: 0.1em 0.4em;
    font-size: 0.8rem;
}
.required-badge {
    font-size: 0.68rem;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 4px;
    padding: 0.1em 0.4em;
    font-weight: 600;
    margin-left: 4px;
}
[data-theme="dark"] .params-table th { background: #252a3a; border-color: #2d3348; }
[data-theme="dark"] .params-table td { border-color: #2d3348; }
[data-theme="dark"] .params-table code { background: #2d3348; }

/* ── Alert note ───────────────────────────────────────────────── */
.api-note {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.84rem;
    color: #1e40af;
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}
[data-theme="dark"] .api-note { background: #1e3a5f; border-color: #2563eb; color: #93c5fd; }
.api-note .material-icons-outlined { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }

.api-warn {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}
[data-theme="dark"] .api-warn { background: #451a03; border-color: #b45309; color: #fbbf24; }

/* ── Header intro ─────────────────────────────────────────────── */
.api-hero {
    padding: 3rem 2.5rem 2rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    background: var(--card-bg, #fff);
}
[data-theme="dark"] .api-hero { background: #1e2130; border-color: #2d3348; }
[data-theme="dark"] .api-hero-title { color: #e5e7eb; }
.api-hero-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}
.api-hero-sub {
    font-size: 1rem;
    color: var(--text-muted, #6b7280);
    max-width: 600px;
}
.api-base-url {
    display: inline-block;
    background: #1e2130;
    color: #6ee7b7;
    border-radius: 8px;
    padding: 0.5rem 1.2rem;
    font-family: monospace;
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* ── Dark theme overrides ─────────────────────────────────────── */
[data-theme="dark"] .api-sidebar a { color: #94a3b8; }
[data-theme="dark"] .api-sidebar a:hover { color: #e2e8f0; }
[data-theme="dark"] .api-sidebar a.active { color: #4ade80; }
[data-theme="dark"] .api-section-title { color: #e5e7eb; border-color: #2d3348; }
[data-theme="dark"] .api-endpoint-title { color: #e2e8f0; }
[data-theme="dark"] .endpoint-path { color: #e2e8f0; }
[data-theme="dark"] .endpoint-desc { color: #9ca3af; }
[data-theme="dark"] .params-table th { color: #94a3b8; }
[data-theme="dark"] .params-table td { color: #e2e8f0; }
[data-theme="dark"] .params-table code { color: #a5f3fc; }
[data-theme="dark"] .required-badge { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .api-code-label { color: #9ca3af; }
