/* CricVeda API Docs — matches cricsynthsite design system */

/* ── Layout ── */
.docs-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    align-items: start;
}

/* ── Sidebar ── */
.docs-sidebar {
    width: 260px;
    height: calc(100vh - 96px);
    overflow-y: auto;
    background: var(--color-bg-secondary);
    border-right: 1px solid var(--color-border);
    padding: 2rem 0;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}
.docs-sidebar--fixed {
    position: fixed;
    top: 96px;
    left: 0;
    z-index: 100;
}


.sidebar-section {
    padding: 0 1.5rem;
    margin-bottom: 2rem;
}

.sidebar-heading {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

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

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: var(--color-accent-glow);
    color: var(--color-text-primary);
}
.sidebar-nav a.active { color: var(--color-accent-secondary); }

.method-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--color-accent-secondary);
    flex-shrink: 0;
}

/* ── Product section headings ── */
.sidebar-product-heading {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.sidebar-product-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sidebar-product-dot--live { background: #10b981; }
.sidebar-product-dot--soon { background: var(--color-text-muted); }

.sidebar-coming-soon {
    font-size: 0.75rem !important;
    color: var(--color-text-muted) !important;
    border: 1px dashed var(--color-border) !important;
    border-radius: var(--radius-sm) !important;
    padding: 0.35rem 0.6rem !important;
    margin-top: 0.15rem;
    cursor: default;
}
.sidebar-coming-soon:hover {
    color: var(--color-accent-secondary) !important;
    border-color: rgba(99,102,241,0.3) !important;
    background: transparent !important;
}

/* ── Main content ── */
.docs-main {
    grid-column: 2;
    padding: 3rem 4rem;
    max-width: 860px;
    min-height: 100vh;
}

/* ── Section headers ── */
.docs-section { margin-bottom: 4rem; scroll-margin-top: 112px; }
.docs-section-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 0.5rem;
}
.docs-section-desc {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
    line-height: 1.7;
    margin-bottom: 2rem;
}

/* ── Endpoint cards ── */
.endpoint-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: border-color var(--transition-fast);
}
.endpoint-card:hover { border-color: var(--color-border-accent); }

.endpoint-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    user-select: none;
}
.endpoint-header::-webkit-details-marker { display: none; }

.method-get {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    flex-shrink: 0;
}

.endpoint-path {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    font-weight: 500;
    min-width: 0;
    word-break: break-all;
    overflow-wrap: anywhere;
}

.endpoint-summary {
    font-size: 0.8rem;
    color: var(--color-text-tertiary);
    margin-left: auto;
}

.endpoint-body { padding: 0 1.25rem 1.25rem; border-top: 1px solid var(--color-border); }
.endpoint-body p { font-size: 0.875rem; color: var(--color-text-secondary); line-height: 1.6; margin: 1rem 0; }

/* ── Params table ── */
.params-table { width: 100%; border-collapse: collapse; font-size: 0.825rem; margin: 1rem 0; }
.params-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
}
.params-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--color-border-subtle); vertical-align: top; }
.params-table tr:last-child td { border-bottom: none; }
.param-name { font-family: 'JetBrains Mono', monospace; color: var(--color-accent-secondary); font-size: 0.8rem; }
.param-type { color: var(--color-text-muted); font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; }
.param-required { color: #f87171; font-size: 0.7rem; font-weight: 600; }
.param-optional { color: var(--color-text-muted); font-size: 0.7rem; }
.param-desc { color: var(--color-text-secondary); }

/* ── Code blocks ── */
.code-tabs { margin: 1rem 0; }
.code-tab-list {
    display: flex;
    gap: 2px;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    padding: 4px 4px 0;
    border: 1px solid var(--color-border);
    border-bottom: none;
}
.code-tab-btn {
    padding: 0.35rem 0.85rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-tertiary);
    background: transparent;
    border: none;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    transition: color var(--transition-fast), background var(--transition-fast);
}
.code-tab-btn.active,
.code-tab-btn:hover { color: var(--color-text-primary); background: var(--color-bg-secondary); }

.code-panel {
    display: none;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    padding: 1rem 1.25rem;
    overflow-x: auto;
}
.code-panel.active { display: block; }

.code-panel pre {
    margin: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.65;
    color: var(--color-text-secondary);
}
.code-panel .kw { color: var(--color-accent-secondary); }
.code-panel .str { color: #a3e635; }
.code-panel .cm { color: var(--color-text-muted); font-style: italic; }
.code-panel .num { color: #fb923c; }
.code-panel .fn { color: #38bdf8; }

/* ── Response example ── */
.response-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin: 1rem 0 0.4rem;
}

/* ── Info boxes ── */
.info-box {
    display: flex;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    line-height: 1.6;
    margin: 1.25rem 0;
}
.info-box.info { background: rgba(99,102,241,0.08); border: 1px solid rgba(99,102,241,0.2); color: var(--color-text-secondary); }
.info-box.warn { background: rgba(251,191,36,0.07); border: 1px solid rgba(251,191,36,0.2); color: #fbbf24; }
.info-box svg { flex-shrink: 0; margin-top: 2px; }

/* ── Auth key display ── */
.key-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.825rem;
    color: var(--color-text-primary);
    margin: 1rem 0;
}
.key-display span { color: var(--color-text-muted); }

/* ── Playground CTA ── */
.playground-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--color-accent-gradient);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    margin: 1.5rem 0;
}
.playground-cta:hover { opacity: 0.9; transform: translateY(-1px); }

/* ── Top bar ── */
.docs-topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 1.5rem;
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
    align-items: center;
    justify-content: space-between;
}

/* ── Mobile sidebar toggle button ── */
.docs-sidebar-toggle {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
    border-top: 1px solid var(--color-border);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    cursor: pointer;
    width: 100%;
    text-align: left;
    letter-spacing: 0.03em;
}
.docs-sidebar-toggle svg {
    transition: transform 0.25s ease;
    flex-shrink: 0;
}
.docs-sidebar-toggle.open svg {
    transform: rotate(90deg);
}

/* ── Mobile ── */
@media (max-width: 768px) {
    .docs-layout {
        grid-template-columns: 1fr;
        display: block;
    }

    .docs-sidebar-toggle {
        display: flex;
    }

    .docs-sidebar {
        position: static;
        height: auto;
        display: none;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        padding: 1rem 0;
    }

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

    .docs-main {
        padding: 1.25rem 1rem;
    }

    .docs-section-title {
        font-size: 1.25rem;
    }

    .params-table {
        font-size: 0.72rem;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .params-table th,
    .params-table td {
        padding: 0.45rem 0.5rem;
        white-space: normal;
    }

    /* Endpoint header: stack path below GET badge on narrow screens */
    .endpoint-header {
        flex-wrap: wrap;
        gap: 0.4rem;
        padding: 0.75rem 1rem;
    }

    .endpoint-path {
        font-size: 0.75rem;
        word-break: break-all;
        overflow-wrap: anywhere;
        flex: 1 1 100%;   /* push path to its own row */
        min-width: 0;
    }

    .endpoint-summary {
        display: none;    /* hide summary text on mobile — path is enough */
    }

    .endpoint-body {
        padding: 0 1rem 1rem;
        overflow-x: hidden;
    }

    /* Scrollable code panels */
    .code-panel {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .code-panel pre {
        font-size: 0.7rem;
        white-space: pre;   /* keep pre formatting but let the panel scroll */
        word-break: normal;
    }

    /* Response example panels */
    .code-panel.active[style*="border-radius"] {
        overflow-x: auto;
    }

    /* Key display */
    .key-display {
        font-size: 0.72rem;
        word-break: break-all;
    }

    /* Docs main content horizontal containment */
    .docs-main {
        overflow-x: hidden;
    }

    .docs-section {
        overflow-x: hidden;
    }
}

/* ── Collapsible product groups ── */
.sidebar-product-group {
    border-bottom: 1px solid var(--color-border);
    padding: 0 1.25rem;
}
.sidebar-product-group:last-of-type { border-bottom: none; }

.sidebar-product-summary {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.85rem 0;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.sidebar-product-summary::-webkit-details-marker { display: none; }

.sidebar-product-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-primary);
    flex: 1;
}

.sidebar-product-badge {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 99px;
}
.sidebar-product-badge--live {
    background: rgba(16,185,129,0.12);
    color: #10b981;
}
.sidebar-product-badge--soon {
    background: rgba(148,163,184,0.1);
    color: var(--color-text-muted);
}

.sidebar-chevron {
    flex-shrink: 0;
    color: var(--color-text-muted);
    transition: transform 0.2s ease;
}
details[open] > .sidebar-product-summary .sidebar-chevron {
    transform: rotate(180deg);
}

.sidebar-product-group .sidebar-nav {
    padding-bottom: 0.75rem;
}

.sidebar-category-label {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    padding: 0.6rem 0.75rem 0.2rem;
    list-style: none;
}
