/* =============================================================
   docs.css — GitBook/Docusaurus-style docs layout
   Requires: dark-theme.css (CSS variables)
   ============================================================= */

/* ── Reset / base ─────────────────────────────────────────── */
.docs-body {
    margin: 0;
    overflow-x: hidden;
}

/* ── Top navigation bar ──────────────────────────────────── */
.docs-topnav {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 56px;
    background: rgba(10, 18, 28, 0.97);
    border-bottom: 1px solid rgba(79, 195, 247, 0.12);
    backdrop-filter: blur(12px);
}

.docs-topnav-inner {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 20px;
    gap: 16px;
}

.docs-topnav-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.docs-topnav-center {
    flex: 1;
    max-width: 480px;
    margin: 0 auto;
}

.docs-topnav-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.docs-mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: color 0.2s;
}

.docs-mobile-toggle:hover { color: var(--accent-blue); }

.docs-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--accent-blue);
    font-weight: 700;
    font-size: 1rem;
}

.docs-brand i { font-size: 1.1rem; }
.docs-brand:hover { color: #81d4fa; }

.docs-brand-sep {
    color: rgba(255,255,255,0.2);
    font-size: 1.2rem;
    font-weight: 300;
}

.docs-brand-section {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.docs-brand-section:hover { color: var(--text-primary); }

/* Search */
.docs-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.docs-search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    pointer-events: none;
}

.docs-search {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 7px 48px 7px 34px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.docs-search:focus {
    border-color: rgba(79, 195, 247, 0.4);
    background: rgba(255,255,255,0.08);
}

.docs-search::placeholder { color: var(--text-secondary); }

.docs-search-kbd {
    position: absolute;
    right: 10px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    padding: 1px 5px;
    pointer-events: none;
}

/* Top-right nav links */
.docs-topnav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.docs-topnav-link:hover { color: var(--accent-blue); }

.docs-topnav-btn {
    background: var(--accent-blue);
    color: #000;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 6px;
    transition: background 0.2s;
}

.docs-topnav-btn:hover { background: #81d4fa; color: #000; }

/* ── Main wrapper ─────────────────────────────────────────── */
.docs-wrapper {
    display: flex;
    min-height: calc(100vh - 56px);
}

/* ── Left sidebar ─────────────────────────────────────────── */
.docs-sidebar {
    width: 260px;
    min-width: 260px;
    background: #0c1520;
    border-right: 1px solid rgba(255,255,255,0.06);
    position: sticky;
    top: 56px;
    height: calc(100vh - 56px);
    overflow-y: auto;
    flex-shrink: 0;
}

/* Scrollbar */
.docs-sidebar::-webkit-scrollbar { width: 3px; }
.docs-sidebar::-webkit-scrollbar-track { background: transparent; }
.docs-sidebar::-webkit-scrollbar-thumb { background: rgba(79,195,247,0.15); border-radius: 2px; }

.docs-nav { padding: 20px 0 40px; }

.docs-nav-section { margin-bottom: 4px; }

.docs-nav-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(139, 155, 180, 0.5);
    padding: 14px 20px 4px;
}

.docs-nav-link {
    display: block;
    padding: 6px 20px 6px 28px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    border-left: 2px solid transparent;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.docs-nav-link:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.04);
}

.docs-nav-link.active {
    color: var(--accent-blue);
    border-left-color: var(--accent-blue);
    background: rgba(79, 195, 247, 0.07);
    font-weight: 600;
}

/* ── Main content area ────────────────────────────────────── */
.docs-main {
    flex: 1;
    min-width: 0;
    overflow-x: hidden;
}

.docs-content-wrap {
    max-width: 780px;
    padding: 40px 48px 80px;
    margin: 0 auto;
}

/* Breadcrumb */
.docs-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.docs-breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.docs-breadcrumb a:hover { color: var(--accent-blue); }
.docs-breadcrumb i { font-size: 0.65rem; opacity: 0.5; }

/* ── Article typography ───────────────────────────────────── */
.docs-article h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    line-height: 1.2;
}

.docs-article h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--accent-blue);
    margin: 44px 0 14px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(79,195,247,0.1);
    scroll-margin-top: 80px;
}

.docs-article h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 28px 0 10px;
    scroll-margin-top: 80px;
}

.docs-article p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.doc-lead {
    font-size: 1.05rem !important;
    color: var(--text-primary) !important;
    line-height: 1.7 !important;
    margin-bottom: 28px !important;
}

/* Lists */
.docs-article ul,
.docs-article ol {
    color: var(--text-secondary);
    padding-left: 24px;
    margin-bottom: 16px;
    line-height: 1.75;
    font-size: 0.95rem;
}

.docs-article li { margin-bottom: 6px; }
.docs-article li strong { color: var(--text-primary); }

/* Tables */
.docs-article table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 0.875rem;
}

.docs-article table thead tr {
    background: rgba(79,195,247,0.08);
    border-bottom: 1px solid rgba(79,195,247,0.2);
}

.docs-article table th {
    text-align: left;
    padding: 10px 14px;
    color: var(--accent-blue);
    font-weight: 600;
    white-space: nowrap;
}

.docs-article table td {
    padding: 9px 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: top;
}

.docs-article table tr:hover td {
    background: rgba(255,255,255,0.02);
}

/* Inline code */
.docs-article code {
    background: rgba(79,195,247,0.1);
    color: #81d4fa;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: 'Fira Code', 'Consolas', 'Courier New', monospace;
    border: 1px solid rgba(79,195,247,0.15);
}

/* Code blocks */
.code-block-wrap {
    position: relative;
    margin: 20px 0;
}

.docs-article pre {
    background: #080f1a;
    border: 1px solid rgba(79,195,247,0.12);
    border-radius: 10px;
    padding: 20px 22px;
    overflow-x: auto;
    margin: 0;
    line-height: 1.6;
}

.docs-article pre code {
    background: none;
    border: none;
    padding: 0;
    color: #a8d8f0;
    font-size: 0.83rem;
}

/* Scrollbar on pre */
.docs-article pre::-webkit-scrollbar { height: 4px; }
.docs-article pre::-webkit-scrollbar-track { background: transparent; }
.docs-article pre::-webkit-scrollbar-thumb { background: rgba(79,195,247,0.2); border-radius: 2px; }

/* Copy button */
.code-copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(79,195,247,0.1);
    border: 1px solid rgba(79,195,247,0.2);
    color: var(--text-secondary);
    border-radius: 6px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    transition: background 0.2s, color 0.2s;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s, color 0.2s;
}

.code-block-wrap:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover { background: rgba(79,195,247,0.2); color: var(--accent-blue); }

/* Links */
.docs-article a {
    color: var(--accent-blue);
    text-decoration: none;
    border-bottom: 1px solid rgba(79,195,247,0.3);
    transition: border-color 0.2s;
}

.docs-article a:hover { border-color: var(--accent-blue); }

/* Callouts */
.doc-callout {
    border-radius: 8px;
    padding: 14px 18px;
    margin: 24px 0;
    font-size: 0.9rem;
    line-height: 1.7;
}

.doc-callout strong { display: block; margin-bottom: 4px; }

.doc-callout-info {
    background: rgba(79,195,247,0.07);
    border: 1px solid rgba(79,195,247,0.2);
    color: #90caf9;
}

.doc-callout-warn {
    background: rgba(255,213,79,0.07);
    border: 1px solid rgba(255,213,79,0.25);
    color: #ffe082;
}

.doc-callout-danger {
    background: rgba(239,83,80,0.07);
    border: 1px solid rgba(239,83,80,0.25);
    color: #ef9a9a;
}

/* ── Prev / Next pager ────────────────────────────────────── */
.docs-pager {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 64px;
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,0.07);
}

.docs-pager-btn {
    display: flex;
    flex-direction: column;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    text-decoration: none;
    transition: border-color 0.2s, background 0.2s;
    min-width: 180px;
    max-width: 280px;
}

.docs-pager-btn:hover {
    border-color: rgba(79,195,247,0.3);
    background: rgba(79,195,247,0.05);
    text-decoration: none;
}

.docs-pager-prev { align-items: flex-start; }
.docs-pager-next { align-items: flex-end; margin-left: auto; }

.docs-pager-dir {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.docs-pager-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-blue);
}

/* ── Right table of contents ──────────────────────────────── */
.docs-toc {
    width: 220px;
    min-width: 220px;
    flex-shrink: 0;
    padding: 40px 0 40px 24px;
    position: sticky;
    top: 56px;
    height: calc(100vh - 56px);
    overflow-y: auto;
}

.docs-toc::-webkit-scrollbar { width: 3px; }
.docs-toc::-webkit-scrollbar-track { background: transparent; }
.docs-toc::-webkit-scrollbar-thumb { background: rgba(79,195,247,0.1); }

.docs-toc-title {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(139,155,180,0.5);
    margin-bottom: 12px;
}

#tocNav { display: flex; flex-direction: column; gap: 0; }

.toc-link {
    display: block;
    padding: 4px 0 4px 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-left: 2px solid transparent;
    line-height: 1.4;
    transition: color 0.15s, border-color 0.15s;
}

.toc-link:hover { color: var(--text-primary); }

.toc-link.active {
    color: var(--accent-blue);
    border-left-color: var(--accent-blue);
}

.toc-link-h3 {
    padding-left: 22px;
    font-size: 0.75rem;
    opacity: 0.85;
}

/* ── Mobile overlay ───────────────────────────────────────── */
.docs-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 998;
    backdrop-filter: blur(2px);
}

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

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1280px) {
    .docs-toc { display: none; }
    .docs-content-wrap { max-width: 860px; }
}

@media (max-width: 960px) {
    .docs-sidebar {
        position: fixed;
        top: 56px;
        left: 0;
        height: calc(100vh - 56px);
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

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

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

    .docs-topnav-center { display: none; }
}

@media (max-width: 640px) {
    .docs-content-wrap { padding: 24px 20px 60px; }

    .docs-topnav-right .docs-topnav-link { display: none; }

    .docs-pager { flex-direction: column; }
    .docs-pager-btn { max-width: 100%; }
    .docs-pager-next { margin-left: 0; align-items: flex-start; }

    .docs-article h1 { font-size: 1.6rem; }
    .docs-article h2 { font-size: 1.15rem; }

    .docs-article table { font-size: 0.8rem; }
    .docs-article table th,
    .docs-article table td { padding: 7px 10px; }
}
