/* API Docs — v2 layout (inside solver shell) */

.docs-root {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
}

.docs-root .docs-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    width: 100%;
}

/* TOC sidebar — sticky inside main, NOT fixed to viewport left */
.docs-root .docs-sidebar {
    width: 252px;
    flex-shrink: 0;
    position: sticky;
    top: 12px;
    max-height: calc(100dvh - 100px);
    overflow-y: auto;
    padding: 16px 0;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(14, 14, 22, 0.85);
    backdrop-filter: blur(12px);
}

.docs-root .docs-sidebar-section {
    margin-bottom: 20px;
}

.docs-root .docs-sidebar-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--v2-text-faint, #6b6b7b);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0 16px;
    margin-bottom: 8px;
}

.docs-root .docs-sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.docs-root .docs-sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: var(--v2-text-muted, #9494a8);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    border-left: 2px solid transparent;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.docs-root .docs-sidebar-link:hover {
    color: var(--v2-text, #f4f4f8);
    background: rgba(255, 255, 255, 0.04);
}

.docs-root .docs-sidebar-link.active {
    color: var(--v2-accent, #5eead4);
    background: rgba(94, 234, 212, 0.08);
    border-left-color: var(--v2-accent, #5eead4);
}

.docs-root .docs-sidebar-link i {
    font-size: 1rem;
    opacity: 0.85;
}

.docs-root .docs-body {
    flex: 1;
    min-width: 0;
    padding: 0;
}

.docs-root .docs-content {
    width: 100%;
}

/* Mobile TOC overlay */
.docs-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}

.docs-sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* Sections */
.doc-section {
    margin-bottom: 48px;
    scroll-margin-top: 88px;
}

.doc-section .page-header {
    display: block !important;
    margin-bottom: 28px;
}

.doc-section .page-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0 0 10px;
    line-height: 1.2;
}

.doc-section .page-subtitle {
    color: var(--v2-text-muted, #9494a8);
    font-size: 0.95rem;
    line-height: 1.65;
    margin: 0;
}

.section-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.02em;
}

.section-title i { color: var(--v2-accent, #5eead4); }

.section-desc {
    color: var(--v2-text-muted, #9494a8);
    font-size: 0.9rem;
    line-height: 1.7;
    margin: 0 0 20px;
}

.section-desc code {
    background: rgba(0, 0, 0, 0.35);
    padding: 2px 7px;
    border-radius: 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82em;
    color: var(--v2-accent, #5eead4);
}

/* Service pills */
.docs-services {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.docs-service-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
}

.docs-service-pill.turnstile { border-color: rgba(94, 234, 212, 0.25); color: #5eead4; }
.docs-service-pill.ocr { border-color: rgba(244, 114, 182, 0.25); color: #f472b6; }
.docs-service-pill.billing { border-color: rgba(167, 139, 250, 0.25); color: #a78bfa; }

/* Info boxes */
.info-box {
    display: flex;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 0.88rem;
    line-height: 1.6;
}

.info-box.tip {
    background: rgba(94, 234, 212, 0.08);
    border: 1px solid rgba(94, 234, 212, 0.2);
}

.info-box.warning {
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.info-box i { font-size: 1.25rem; flex-shrink: 0; margin-top: 2px; }
.info-box.tip i { color: #5eead4; }
.info-box.warning i { color: #fbbf24; }

.info-box-content code {
    background: rgba(0, 0, 0, 0.35);
    padding: 2px 7px;
    border-radius: 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    color: var(--v2-accent, #5eead4);
}

/* Endpoint cards */
.endpoint-card {
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(14, 14, 22, 0.65);
    overflow: hidden;
    margin-bottom: 20px;
}

.endpoint-card.ocr { border-color: rgba(244, 114, 182, 0.2); }
.endpoint-card.pool { border-color: rgba(167, 139, 250, 0.2); }

.endpoint-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.2);
}

.method-badge {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.02em;
}

.method-badge.get { background: rgba(94, 234, 212, 0.15); color: #5eead4; }
.method-badge.post { background: rgba(167, 139, 250, 0.15); color: #a78bfa; }

.endpoint-url {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.78rem, 2vw, 0.88rem);
    color: var(--v2-text, #f4f4f8);
    word-break: break-all;
    flex: 1;
    min-width: 0;
}

.endpoint-body { padding: 20px; }

.endpoint-desc {
    color: var(--v2-text-muted, #9494a8);
    font-size: 0.88rem;
    line-height: 1.6;
    margin: 0 0 18px;
}

/* Tables */
.params-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--v2-text-faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.params-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 0.85rem;
}

.params-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.params-table-wrap .params-table { margin-bottom: 0; }

.params-table th,
.params-table td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: top;
}

.params-table th {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--v2-text-faint);
    background: rgba(0, 0, 0, 0.25);
}

.param-name {
    font-family: 'JetBrains Mono', monospace;
    color: #5eead4;
    font-size: 0.82rem;
}

.param-type {
    display: inline-block;
    font-size: 0.68rem;
    padding: 2px 8px;
    background: rgba(167, 139, 250, 0.12);
    color: #a78bfa;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
}

.param-required {
    display: inline-block;
    font-size: 0.62rem;
    padding: 2px 6px;
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: 600;
}

.param-optional {
    display: inline-block;
    font-size: 0.62rem;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--v2-text-faint);
    border-radius: 4px;
    margin-left: 6px;
}

/* Code blocks */
.code-block {
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.4);
    overflow: hidden;
    margin-bottom: 16px;
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.code-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--v2-text-muted);
}

.code-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--v2-text-muted);
    font-size: 0.72rem;
    cursor: pointer;
    font-family: inherit;
}

.code-content {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.code-content pre {
    margin: 0;
    padding: 16px 18px;
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.75rem, 1.8vw, 0.82rem);
    line-height: 1.65;
    color: #e2e8f0;
    white-space: pre;
    min-width: min-content;
}

.code-content .keyword { color: #c084fc; }
.code-content .string { color: #5eead4; }
.code-content .property { color: #93c5fd; }
.code-content .boolean { color: #f472b6; }
.code-content .number { color: #fbbf24; }
.code-content .comment { color: #64748b; }

.response-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.response-badge.success {
    background: rgba(52, 211, 153, 0.12);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.25);
}

/* Override legacy layout rules inside v2 shell */
.docs-root .layout,
.docs-root .sidebar,
.docs-root .main-content {
    all: unset;
}

.v2-page-content--docs .page-header {
    display: block !important;
}

@media (max-width: 960px) {
    .docs-root .docs-layout {
        flex-direction: column;
    }

    .docs-root .docs-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(280px, 88vw);
        max-height: none;
        z-index: 501;
        border-radius: 0;
        transform: translateX(-105%);
        transition: transform 0.28s ease;
    }

    .docs-root .docs-sidebar.open {
        transform: translateX(0);
    }

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

    .docs-root .docs-body {
        width: 100%;
    }
}

@media (min-width: 961px) {
    .solver-topbar .mobile-menu-btn {
        display: none;
    }
}

@media (max-width: 960px) {
    .solver-topbar .mobile-menu-btn {
        display: inline-flex;
    }
}

@media (max-width: 520px) {
    .endpoint-header { padding: 12px 14px; }
    .endpoint-body { padding: 14px; }
    .code-content pre { padding: 12px 14px; font-size: 0.72rem; }
}
