/* ============================================================
   API Developer Portal — Documentation Theme
   ============================================================ */

:root {
    --color-primary: #ff6000;
    --color-primary-light: #fff3eb;
    --color-primary-dark: #e55500;
    --color-bg: #ffffff;
    --color-bg-sidebar: #f8f9fa;
    --color-bg-header: #ffffff;
    --color-border: #e5e7eb;
    --color-text: #1a1a2e;
    --color-text-muted: #6b7280;
    --color-text-light: #9ca3af;
    --sidebar-width: 280px;
    --header-height: 60px;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,.06);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
}

/* ── Layout ─────────────────────────────────────────────── */

.layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.layout-body {
    display: flex;
    flex: 1;
    margin-top: var(--header-height);
}

/* ── Header ─────────────────────────────────────────────── */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--color-bg-header);
    border-bottom: 1px solid var(--color-border);
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-inner {
    display: flex;
    align-items: center;
    height: 100%;
    max-width: 100%;
    padding: 0 24px;
    gap: 24px;
}

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

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--color-primary);
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    border-radius: 8px;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo-text strong {
    font-size: 15px;
    color: var(--color-primary);
}

.logo-text small {
    font-size: 11px;
    color: var(--color-text-muted);
}

.header-search {
    flex: 1;
    max-width: 480px;
    position: relative;
}

.header-search .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-light);
    pointer-events: none;
}

.header-search input,
.sidebar-search input {
    width: 100%;
    padding: 9px 14px 9px 40px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-size: 14px;
    background: #f3f4f6;
    outline: none;
    transition: border-color .2s, background .2s;
}

.sidebar-search input {
    padding: 8px 12px;
    border-radius: var(--radius);
    background: #fff;
}

.header-search input:focus,
.sidebar-search input:focus {
    border-color: var(--color-primary);
    background: #fff;
}

.header-nav {
    display: flex;
    gap: 16px;
    flex-shrink: 0;
}

.nav-link {
    font-size: 14px;
    color: var(--color-text-muted);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: color .2s, background .2s;
}

.nav-link:hover {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

/* ── Sidebar ────────────────────────────────────────────── */

.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--color-bg-sidebar);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    z-index: 50;
    overflow: hidden;
}

.sidebar-header {
    padding: 16px 16px 12px;
    flex-shrink: 0;
}

.sidebar-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    color: var(--color-text-light);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.sidebar-search input {
    padding-left: 12px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px 16px;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

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

.nav-group-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 8px 10px;
    background: none;
    border: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
    border-radius: var(--radius);
    text-align: left;
    transition: background .15s;
}

.nav-group-toggle:hover { background: rgba(0,0,0,.04); }

.nav-group-toggle .chevron {
    transition: transform .2s;
    flex-shrink: 0;
}

.nav-group.collapsed .chevron { transform: rotate(-90deg); }
.nav-group.collapsed .nav-items { display: none; }

.nav-items {
    list-style: none;
    padding: 2px 0 4px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px 7px 14px;
    font-size: 13px;
    color: var(--color-text-muted);
    text-decoration: none;
    border-radius: var(--radius);
    border-left: 3px solid transparent;
    transition: all .15s;
    margin-bottom: 1px;
}

.nav-item:hover {
    color: var(--color-text);
    background: rgba(0,0,0,.04);
}

.nav-item.active {
    color: var(--color-primary-dark);
    background: var(--color-primary-light);
    border-left-color: var(--color-primary);
    font-weight: 500;
}

.nav-item.hidden { display: none; }

.nav-item-title { flex: 1; line-height: 1.3; }

.method-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 3px;
    flex-shrink: 0;
    letter-spacing: .02em;
}

.method-get    { background: #dbeafe; color: #1d4ed8; }
.method-post   { background: #dcfce7; color: #15803d; }
.method-put    { background: #fef9c3; color: #a16207; }
.method-delete { background: #fee2e2; color: #b91c1c; }

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.version-badge {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary);
    background: var(--color-primary-light);
    padding: 3px 10px;
    border-radius: 12px;
}

/* ── Main Content ───────────────────────────────────────── */

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 32px 48px 64px;
    max-width: calc(100% - var(--sidebar-width));
    min-height: calc(100vh - var(--header-height));
}

.endpoint-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 28px;
}

.method-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 4px;
    flex-shrink: 0;
}

.endpoint-url {
    flex: 1;
    font-size: 14px;
    color: #334155;
    word-break: break-all;
    background: none;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: 13px;
    flex-shrink: 0;
    transition: all .15s;
}

.copy-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.copy-btn.copied {
    border-color: #15803d;
    color: #15803d;
}

/* ── Doc Content ────────────────────────────────────────── */

.doc-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 24px;
    line-height: 1.3;
}

.doc-body {
    font-size: 15px;
    color: #374151;
    margin-bottom: 32px;
}

.doc-body h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 28px 0 12px;
    color: var(--color-text);
}

.doc-body h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 20px 0 8px;
    color: var(--color-text);
}

.doc-body p { margin-bottom: 12px; }

.doc-body ul, .doc-body ol {
    margin: 8px 0 16px 24px;
}

.doc-body li { margin-bottom: 6px; }

.doc-body strong { color: var(--color-text); }

.doc-body code {
    font-size: 13px;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    color: #be185d;
}

.doc-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
}

.doc-body th,
.doc-body td {
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    text-align: left;
}

.doc-body th {
    background: #f8fafc;
    font-weight: 600;
}

.doc-body .info-box {
    padding: 14px 16px;
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 16px 0;
    font-size: 14px;
}

.doc-body .warning-box {
    padding: 14px 16px;
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 16px 0;
    font-size: 14px;
}

/* ── Code Section ───────────────────────────────────────── */

.code-section {
    margin-bottom: 32px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #1e293b;
    color: #94a3b8;
}

.code-lang {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.code-header .copy-btn {
    background: transparent;
    border-color: #475569;
    color: #94a3b8;
    font-size: 12px;
    padding: 4px 10px;
}

.code-header .copy-btn:hover {
    border-color: #94a3b8;
    color: #e2e8f0;
}

.code-section pre {
    margin: 0 !important;
    border-radius: 0 !important;
    max-height: 520px;
    overflow: auto;
}

.code-section pre code {
    font-size: 13.5px !important;
    line-height: 1.65 !important;
}

/* ── Search highlight ───────────────────────────────────── */

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

/* ── Mobile menu button ─────────────────────────────────── */

.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--color-text);
    position: relative;
}

.mobile-menu-btn .icon-close { display: none; }
.mobile-menu-btn.is-open .icon-menu { display: none; }
.mobile-menu-btn.is-open .icon-close { display: block; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: var(--header-height) 0 0 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 60;
}

.sidebar-overlay.visible {
    display: block;
}

body.menu-open {
    overflow: hidden;
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 70;
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

    .main-content {
        margin-left: 0;
        max-width: 100%;
        padding: 24px 16px 48px;
    }

    .header-search { display: none; }

    .header-nav { display: none; }

    .mobile-menu-btn {
        display: flex;
    }

    .header-inner {
        padding: 0 16px;
        gap: 12px;
    }

    .logo-text small { display: none; }
}

@media (min-width: 901px) {
    .mobile-menu-btn { display: none !important; }
    .sidebar-overlay { display: none !important; }
}
