/* ===========================================================================
   ChatGenius Docs — shared stylesheet
   Header/footer come from design-system.min.css. This file owns the docs
   layout, the cross-doc sidebar nav, article content styles, and the hub page.
   =========================================================================== */

:root {
    --docs-sidebar-width: 280px;
    --code-bg: #0d0d0d;
    --code-border: rgba(255,255,255,0.08);
    --code-text: #e2e8f0;
    --code-comment: #6b7a99;
    --code-key: #7c73f0;
    --code-string: #7ee787;
    --code-number: #f7b96e;
    --tag-required: rgba(239,68,68,0.15);
    --tag-required-text: #f87171;
    --tag-optional: rgba(255,255,255,0.07);
    --tag-optional-text: rgba(255,255,255,0.45);
    --docs-accent: #7c73f0;
}

/* ── Layout wrapper (below header) ── */
.docs-layout {
    display: flex;
    max-width: 1280px;
    margin: 0 auto;
    min-height: calc(100vh - 60px);
}

/* ── Sidebar ── */
.docs-sidebar {
    width: var(--docs-sidebar-width);
    flex-shrink: 0;
    padding: 2rem 0 4rem;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
    border-right: 1px solid rgba(255,255,255,0.06);
}
.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-track { background: transparent; }
.docs-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* "All docs" link at the top of the rail */
.sidebar-home {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 1rem 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: color 0.15s, background 0.15s;
}
.sidebar-home:hover { color: #fff; background: rgba(255,255,255,0.04); }
.sidebar-home svg { flex-shrink: 0; }

.sidebar-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
    padding: 1.25rem 1.5rem 0.5rem;
}

.sidebar-link {
    display: block;
    padding: 0.35rem 1.5rem;
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.15s, background 0.15s;
    border-left: 2px solid transparent;
}
.sidebar-link:hover { color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.03); }
.sidebar-link.active { color: var(--docs-accent); border-left-color: var(--docs-accent); background: rgba(80,70,229,0.06); }
.sidebar-link.sub { padding-left: 2.25rem; font-size: 0.825rem; }

/* Cross-doc article links in the rail */
.sidebar-doc {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.4rem 1.5rem;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 0.875rem;
    border-left: 2px solid transparent;
    transition: color 0.15s, background 0.15s;
}
.sidebar-doc:hover { color: rgba(255,255,255,0.95); background: rgba(255,255,255,0.03); }
.sidebar-doc.current {
    color: #fff;
    font-weight: 600;
    border-left-color: var(--docs-accent);
    background: rgba(80,70,229,0.08);
}
.sidebar-doc.coming-soon {
    color: rgba(255,255,255,0.28);
    cursor: default;
    pointer-events: none;
}
.soon-tag {
    flex-shrink: 0;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.35);
}

/* In-page TOC nested under the active article */
.sidebar-toc {
    margin: 0.25rem 0 0.5rem;
    padding: 0.25rem 0 0.5rem 0;
    border-left: 1px solid rgba(255,255,255,0.07);
    margin-left: 1.5rem;
}
.sidebar-toc .sidebar-link { padding-left: 1rem; border-left: none; }
.sidebar-toc .sidebar-link.sub { padding-left: 1.85rem; }
.sidebar-toc .sidebar-link.active { border-left: none; background: none; }
.sidebar-toc .toc-group {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.28);
    padding: 0.75rem 1rem 0.3rem;
}

/* ── Main content ── */
.docs-main {
    flex: 1;
    min-width: 0;
    padding: 3rem 3rem 6rem;
}

/* ── Page header ── */
.docs-page-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.docs-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.35);
    margin-bottom: 1rem;
}
.docs-breadcrumb a { color: rgba(255,255,255,0.45); text-decoration: none; }
.docs-breadcrumb a:hover { color: rgba(255,255,255,0.7); }
.docs-page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.75rem;
    line-height: 1.2;
}
.docs-page-header p {
    font-size: 1.05rem;
    color: rgba(255,255,255,0.55);
    max-width: 640px;
}
.addon-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.4rem 0.9rem;
    background: rgba(80,70,229,0.12);
    border: 1px solid rgba(80,70,229,0.3);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--docs-accent);
    font-weight: 500;
}
.docs-page-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}
.btn-markdown-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    border-radius: 8px;
    border: 1px solid rgba(124,115,240,0.45);
    background: rgba(124,115,240,0.14);
    color: #ddd9ff;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-markdown-download:hover {
    background: rgba(124,115,240,0.22);
    border-color: rgba(124,115,240,0.7);
    color: #fff;
}
.btn-markdown-download:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.docs-page-actions .action-note {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.45);
}

/* ── Section titles ── */
.docs-section {
    margin-bottom: 4rem;
    scroll-margin-top: 80px;
}
.docs-section h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.docs-section h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    margin: 2rem 0 0.75rem;
}
.docs-section p {
    color: rgba(255,255,255,0.65);
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.7;
}
.docs-section ul, .docs-section ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}
.docs-section li {
    color: rgba(255,255,255,0.65);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 0.25rem;
}
.docs-section a { color: var(--docs-accent); text-decoration: none; }
.docs-section a:hover { text-decoration: underline; }

/* Tier gate note shown inline in a section heading, e.g. "(Creator and up)" */
.docs-tier-note {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--docs-accent);
    background: rgba(80,70,229,0.1);
    border: 1px solid rgba(80,70,229,0.25);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* ── Callout boxes ── */
.callout {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin: 1.25rem 0;
    font-size: 0.9rem;
    line-height: 1.6;
}
.callout-icon { flex-shrink: 0; font-size: 1rem; margin-top: 1px; }
.callout p { margin: 0; font-size: 0.9rem; }
.callout-info  { background: rgba(80,70,229,0.08);  border: 1px solid rgba(80,70,229,0.2);  color: rgba(255,255,255,0.7); }
.callout-warning { background: rgba(245,197,24,0.07); border: 1px solid rgba(245,197,24,0.2); color: rgba(255,255,255,0.7); }
.callout-tip   { background: rgba(52,168,83,0.07);   border: 1px solid rgba(52,168,83,0.2);  color: rgba(255,255,255,0.7); }
/* Claude-branded accent (Anthropic clay), used on the AI Instruction Builder page */
.callout-claude { background: rgba(217,119,87,0.08); border: 1px solid rgba(217,119,87,0.30); color: rgba(255,255,255,0.72); }
.callout-claude .callout-icon { color: #D97757; }

/* ── Claude banner + badge (matches the ai_config "Describe Your AI" card) ── */
.docs-claude-banner {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin: 1.5rem 0;
    padding: 1rem 1.125rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #FAF9F5 0%, #FFFFFF 80%);
    border: 1px solid #ECEAE0;
    border-left: 3px solid #CC785C;
}
.docs-claude-banner__icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(204,120,92,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.docs-claude-banner__icon img { width: 26px; height: 26px; display: block; }
.docs-claude-banner__body { display: flex; flex-direction: column; }
/* Scoped under .docs-claude-banner so they beat the global ".docs-section p" white-text rule */
.docs-claude-banner .docs-claude-banner__title { color: #1F1F1F; font-weight: 600; font-size: 1rem; margin: 0 0 0.2rem; line-height: 1.2; }
.docs-claude-banner .docs-claude-banner__sub { color: #555; font-size: 0.82rem; margin: 0; line-height: 1.5; }
.docs-claude-banner .docs-claude-banner__sub a { color: #B8624A; font-weight: 500; }
.docs-claude-badge {
    display: inline-block;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #B8624A;
    background: rgba(204,120,92,0.12);
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    vertical-align: middle;
    margin-left: 0.45rem;
}

/* ── Code blocks ── */
.code-block {
    margin: 1.25rem 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--code-border);
}
.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: rgba(255,255,255,0.04);
    border-bottom: 1px solid var(--code-border);
}
.code-lang {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.copy-btn {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.35);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}
.copy-btn:hover { color: rgba(255,255,255,0.8); background: rgba(255,255,255,0.07); }
pre {
    background: var(--code-bg);
    padding: 1.25rem;
    overflow-x: auto;
    margin: 0;
    font-size: 0.845rem;
    line-height: 1.65;
}
pre::-webkit-scrollbar { height: 4px; }
pre::-webkit-scrollbar-track { background: transparent; }
pre::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
code {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Menlo, Monaco, monospace;
    color: var(--code-text);
}
.inline-code {
    font-family: 'SF Mono', 'Fira Code', Menlo, Monaco, monospace;
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.9);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

/* Syntax colors */
.ck { color: var(--code-key); }
.cs { color: var(--code-string); }
.cn { color: var(--code-number); }
.cc { color: var(--code-comment); }

/* ── Endpoint block ── */
.endpoint-block {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 8px;
    margin: 1rem 0;
    font-family: 'SF Mono', 'Fira Code', Menlo, Monaco, monospace;
    font-size: 0.875rem;
    overflow-x: auto;
}
.method-badge {
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.04em;
}
.method-post { background: rgba(80,70,229,0.25); color: var(--docs-accent); }

/* ── Parameter tables ── */
.param-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0 1.5rem;
    font-size: 0.875rem;
}
.param-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    color: rgba(255,255,255,0.4);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.param-table td {
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.65);
    vertical-align: top;
}
.param-table tr:last-child td { border-bottom: none; }
.param-table td:first-child { color: rgba(255,255,255,0.85); font-family: 'SF Mono', Menlo, monospace; font-size: 0.82rem; }
.tag-required { display: inline-block; padding: 1px 6px; background: var(--tag-required); color: var(--tag-required-text); border-radius: 4px; font-size: 0.7rem; font-weight: 600; }
.tag-optional { display: inline-block; padding: 1px 6px; background: var(--tag-optional); color: var(--tag-optional-text); border-radius: 4px; font-size: 0.7rem; font-weight: 600; }

/* ── Tabs ── */
.code-tabs { margin: 1.25rem 0; }
.tab-buttons {
    display: flex;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.tab-btn {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: rgba(255,255,255,0.4);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
}
.tab-btn:hover { color: rgba(255,255,255,0.7); }
.tab-btn.active { color: var(--docs-accent); border-bottom-color: var(--docs-accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-panel .code-block { margin-top: 0; border-top-left-radius: 0; }

/* ── Status codes ── */
.status-grid { display: flex; flex-direction: column; gap: 0.5rem; margin: 1rem 0; }
.status-row { display: flex; align-items: baseline; gap: 0.75rem; font-size: 0.875rem; }
.status-code { flex-shrink: 0; font-family: monospace; font-weight: 700; padding: 2px 8px; border-radius: 4px; font-size: 0.8rem; }
.s2xx { background: rgba(52,168,83,0.15);  color: #34a853; }
.s4xx { background: rgba(239,68,68,0.15);  color: #f87171; }
.s5xx { background: rgba(245,158,11,0.15); color: #fbbf24; }
.status-desc { color: rgba(255,255,255,0.6); }

/* ── Overview cards ── */
.overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1.25rem 0;
}
.overview-card {
    padding: 1.25rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
}
.overview-card h4 { font-size: 0.9rem; font-weight: 700; color: #fff; margin-bottom: 0.4rem; display: flex; align-items: center; gap: 0.5rem; }
.overview-card p { font-size: 0.85rem; color: rgba(255,255,255,0.5); margin: 0; }

/* ── Retry schedule table ── */
.retry-table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: 0.875rem; }
.retry-table th { text-align: left; padding: 0.5rem 0.75rem; color: rgba(255,255,255,0.4); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; border-bottom: 1px solid rgba(255,255,255,0.08); }
.retry-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid rgba(255,255,255,0.04); color: rgba(255,255,255,0.65); }
.retry-table tr:last-child td { border-bottom: none; }

.docs-divider { border: none; border-top: 1px solid rgba(255,255,255,0.06); margin: 3rem 0; }

/* ── Responsive video embed ── */
.docs-video {
    margin: 1.5rem 0;
    max-width: 640px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}
.docs-video-frame {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
}
.docs-video-frame iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.docs-video-caption {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.45);
    margin-top: 0.5rem;
}

/* ── Numbered step list ── */
.docs-steps {
    list-style: none;
    counter-reset: docstep;
    padding-left: 0;
    margin: 1.25rem 0;
}
.docs-steps > li {
    position: relative;
    counter-increment: docstep;
    padding-left: 3rem;
    margin-bottom: 1.5rem;
    color: rgba(255,255,255,0.65);
    font-size: 0.95rem;
    line-height: 1.7;
}
.docs-steps > li::before {
    content: counter(docstep);
    position: absolute;
    left: 0;
    top: -2px;
    width: 1.9rem;
    height: 1.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(80,70,229,0.15);
    border: 1px solid rgba(80,70,229,0.35);
    color: var(--docs-accent);
    font-size: 0.85rem;
    font-weight: 700;
}
.docs-steps > li strong { color: #fff; }

/* ── Support callout (shared footer-of-article block) ── */
.docs-help-box {
    margin-top: 4rem;
    padding: 1.5rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}
.docs-help-box .help-title { font-weight: 600; font-size: 0.95rem; color: #fff; margin-bottom: 0.25rem; }
.docs-help-box .help-sub { font-size: 0.875rem; color: rgba(255,255,255,0.5); }
.docs-help-box a {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    background: rgba(80,70,229,0.15);
    border: 1px solid rgba(80,70,229,0.3);
    color: var(--docs-accent);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
}

/* ===========================================================================
   Docs hub (index.php)
   =========================================================================== */
.docs-hub {
    max-width: 1080px;
    margin: 0 auto;
    padding: 4rem 1.5rem 6rem;
}
.docs-hub-hero { text-align: center; margin-bottom: 3.5rem; }
.docs-hub-hero .docs-breadcrumb { justify-content: center; }
.docs-hub-hero h1 {
    font-size: 2.6rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
    margin-bottom: 1rem;
}
.docs-hub-hero p {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.55);
    max-width: 580px;
    margin: 0 auto;
}
.docs-search-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.75rem;
    padding: 0.55rem 1rem;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    background: rgba(255,255,255,0.02);
    color: rgba(255,255,255,0.45);
    font-size: 0.85rem;
}

.docs-hub-category { margin-bottom: 3rem; }
.docs-hub-category h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.01em;
    margin-bottom: 1.1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.docs-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 1rem;
}
.docs-card {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 1.25rem 1.35rem;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    background: rgba(255,255,255,0.02);
    text-decoration: none;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
a.docs-card:hover {
    transform: translateY(-2px);
    border-color: rgba(124,115,240,0.45);
    background: rgba(124,115,240,0.06);
}
.docs-card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.98rem;
    font-weight: 600;
    color: #fff;
}
.docs-card p {
    font-size: 0.85rem;
    line-height: 1.55;
    color: rgba(255,255,255,0.5);
    margin: 0;
}
.docs-card.is-soon { cursor: default; }
.docs-card.is-soon .docs-card-title { color: rgba(255,255,255,0.45); }
.docs-card.is-soon p { color: rgba(255,255,255,0.3); }
.docs-card .arrow { color: var(--docs-accent); opacity: 0; transition: opacity 0.18s ease, transform 0.18s ease; }
a.docs-card:hover .arrow { opacity: 1; transform: translateX(2px); }

/* ── Mobile ── */
@media (max-width: 900px) {
    .docs-sidebar { display: none; }
    .docs-main { padding: 2rem 1.25rem 4rem; }
    .overview-grid { grid-template-columns: 1fr; }
    .docs-page-actions { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 600px) {
    .docs-page-header h1 { font-size: 1.5rem; }
    .docs-hub-hero h1 { font-size: 2rem; }
    .btn-markdown-download { width: 100%; justify-content: center; }
}
