/* ═══════════════════════════════════════════════════════════════════
   GLUCOGAZE DOCS — Single stylesheet for index.html
   ═══════════════════════════════════════════════════════════════════ */

/* Variables */
:root {
    --bg: #0c0e12;
    --primary: #14171d;
    --secondary: #1a1e26;
    --border: #2a303c;
    --border-hover: #3a4150;
    --text: #e6e9ef;
    --text-muted: #8b92a0;
    --status-success: #7ed06b;
    --status-success-dim: rgba(126, 208, 107, 0.2);
    --alert-success-dim: rgba(126, 208, 107, 0.15);
    --alert-info: #68bfd3;
    --alert-info-dim: rgba(104, 191, 211, 0.15);
    --alert-warning-dim: rgba(250, 208, 31, 0.15);
    --accent: #7ed06b;
    --accent-dim: rgba(126, 208, 107, 0.15);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: 12px;
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.25rem;
    --space-2xl: 1.5rem;
    --space-3xl: 2rem;
    --gap-xs: 0.25rem;
    --gap-sm: 0.5rem;
    --gap-md: 0.75rem;
    --gap-lg: 1rem;
    --gap-xl: 1.5rem;
    --gap-2xl: 2rem;
    --font-xs: 0.75rem;
    --font-sm: 0.85rem;
    --font-md: 0.95rem;
    --font-lg: 1.25rem;
    --font-xl: 1.5rem;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;
    --transition-fast: 0.15s;
    --transition-base: 0.2s;
    --z-header: 100;
    --z-dropdown: 200;
    --z-modal: 300;
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
    --gradient: linear-gradient(90deg, #1e3c72, #2a5298, #00b09b, #96c93d);
}

/* Reset & base */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'DM Sans', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* Page layout */
.docs-page { display: flex; flex-direction: column; min-height: 100vh; }

/* Header — full-width background, content constrained to match layout */
.docs-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    width: 100%;
    background: var(--primary);
    border-bottom: 1px solid var(--border);
}
.docs-header-inner {
    display: flex;
    align-items: center;
    gap: var(--gap-lg);
    padding: var(--space-md) var(--space-lg);
    width: 100%;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
}
.docs-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-sm);
    color: var(--text-muted);
    border-radius: var(--radius-md);
}
.docs-sidebar-toggle:hover { color: var(--accent); background: var(--secondary); }
.docs-sidebar-toggle svg { width: 22px; height: 22px; }
.docs-logo {
    font-size: 1.25rem;
    font-weight: var(--weight-bold);
    letter-spacing: -0.03em;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}
.docs-logo:hover { opacity: 0.9; }
.docs-version {
    font-size: var(--font-xs);
    font-weight: var(--weight-medium);
    color: var(--text-muted);
    padding: var(--space-xs) var(--space-sm);
    background: var(--secondary);
    border-radius: var(--radius-sm);
}
.docs-footer .docs-version { margin-left: var(--space-sm); padding: 0; background: none; }
.docs-header-link { margin-left: auto; font-size: var(--font-sm); font-weight: var(--weight-medium); color: var(--text-muted); text-decoration: none; }
.docs-header-link:hover { color: var(--accent); }

/* Layout */
.docs-layout {
    display: flex;
    flex: 1;
    width: 100%;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
    align-self: center;
}

/* Sidebar */
.docs-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--primary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    position: sticky;
    top: 57px;
    max-height: calc(100vh - 57px);
}
.docs-sidebar-inner { padding: var(--space-xl); }
.docs-search { margin-bottom: var(--space-2xl); }
.search-label { display: block; font-size: var(--font-xs); font-weight: var(--weight-semibold); color: var(--text-muted); margin-bottom: var(--space-sm); }
.search-input-wrap { position: relative; }
.docs-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: var(--space-sm);
    background: var(--primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    max-height: 320px;
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
    z-index: var(--z-dropdown);
    display: none;
}
.docs-search-results.visible { display: block; }
.docs-search-results a.search-result-item {
    display: flex;
    flex-direction: column;
    gap: var(--gap-xs);
    padding: var(--space-lg);
    font-size: var(--font-sm);
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    line-height: 1.4;
}
.docs-search-results a.search-result-item:last-child { border-bottom: none; }
.docs-search-results a.search-result-item:hover { background: var(--secondary); color: var(--accent); }
.docs-search-results .search-result-title { font-weight: var(--weight-semibold); font-size: var(--font-md); color: var(--text); }
.docs-search-results .search-result-meta { font-size: var(--font-xs); color: var(--text-muted); }
.docs-search-results a:hover .search-result-meta { color: inherit; opacity: 0.9; }
.docs-search-results .search-no-results { padding: var(--space-xl); color: var(--text-muted); font-size: var(--font-sm); }
.search-icon {
    position: absolute;
    left: var(--space-lg);
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}
.search-input {
    width: 100%;
    padding: var(--space-md) var(--space-lg) var(--space-md) 2.75rem;
    font-family: inherit;
    font-size: var(--font-sm);
    color: var(--text);
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition-base);
}
.search-input::placeholder { color: var(--text-muted); opacity: 0.7; }
.search-input:hover { border-color: var(--border-hover); }
.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

/* Nav */
.docs-nav-section { margin-bottom: var(--space-2xl); }
.docs-nav-section-title {
    display: block;
    font-size: var(--font-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: var(--space-md);
}
.docs-nav-list { list-style: none; padding: 0; margin: 0; }
.docs-nav-list li { margin-bottom: var(--space-xs); }
.docs-nav-list a {
    display: block;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-sm);
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: color var(--transition-fast), background var(--transition-fast);
}
.docs-nav-list a:hover { color: var(--text); background: var(--secondary); }
.docs-nav-list a.active { color: var(--accent); background: var(--accent-dim); font-weight: var(--weight-medium); }

/* Main content */
.docs-main {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: var(--gap-2xl);
    min-width: 0;
    padding: var(--space-3xl) var(--space-2xl) var(--space-3xl);
}
.docs-content { flex: 1; min-width: 0; max-width: 720px; }
.docs-body { min-height: 200px; }
.docs-breadcrumb { font-size: var(--font-xs); color: var(--text-muted); margin-bottom: var(--space-xl); }
.docs-breadcrumb a { color: var(--text-muted); text-decoration: none; }
.docs-breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { margin: 0 var(--space-sm); opacity: 0.6; }
.docs-version-badge {
    display: inline-block;
    padding: var(--space-xs) var(--space-md);
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid rgba(126, 208, 107, 0.3);
    border-radius: var(--radius-md);
    font-size: var(--font-xs);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-xl);
}
.docs-content-header { margin-bottom: var(--space-3xl); }
.docs-content-header h1 {
    font-size: 2rem;
    font-weight: var(--weight-bold);
    color: var(--text);
    margin-bottom: var(--space-md);
    letter-spacing: -0.02em;
}
.docs-lead { font-size: var(--font-lg); color: var(--text-muted); line-height: 1.6; margin: 0; }

/* Body typography */
.docs-body h2 {
    font-size: var(--font-xl);
    font-weight: var(--weight-semibold);
    color: var(--text);
    margin: var(--space-3xl) 0 var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
    scroll-margin-top: 6rem;
}
.docs-body h2:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
.docs-body h3 { font-size: var(--font-lg); font-weight: var(--weight-semibold); color: var(--text); margin: var(--space-2xl) 0 var(--space-md); }
.docs-body p { color: var(--text-muted); font-size: var(--font-md); line-height: 1.4; margin-bottom: var(--space-lg); }
.docs-body ul, .docs-body ol { color: var(--text-muted); font-size: var(--font-md); padding-left: var(--space-2xl); margin: 0 0 var(--space-lg); line-height: 1.7; }
.docs-body li { margin-bottom: var(--space-sm); }
.docs-body li::marker { color: var(--accent); }
.docs-body strong { color: var(--text); }
.docs-body a { color: var(--accent); text-decoration: none; }
.docs-body a:hover { text-decoration: underline; }
.docs-body code {
    background: var(--secondary);
    color: var(--text-muted);
    padding: 0.2em 0.5em;
    border-radius: var(--radius-sm);
    font-size: var(--font-md);
}
.docs-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin: var(--space-lg) 0;
}

/* Code blocks */
.docs-code-block-wrap { position: relative; margin: var(--space-lg) 0; }
.docs-code-copy {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: var(--primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}
.docs-code-copy:hover { color: var(--accent); border-color: var(--accent); }
.docs-code-copy svg { width: 16px; height: 16px; }
.docs-code-copy.copied { color: var(--status-success); border-color: var(--status-success); }
.docs-code-copy.copied svg { opacity: 0; }
.docs-code-copy.copied::after {
    content: '✓';
    position: absolute;
    inset: 0;
    line-height: 32px;
    text-align: center;
    font-size: 1rem;
    font-weight: bold;
}
.docs-code-block {
    display: block;
    width: 100%;
    box-sizing: border-box;
    background: var(--secondary);
    color: var(--text-muted);
    padding: var(--space-lg);
    border-radius: var(--radius-sm);
    font-size: var(--font-md);
    overflow-x: auto;
    margin: 0;
    white-space: pre-wrap;
}
.docs-code-block code { font-size: inherit; color: inherit; background: none; padding: 0; border: none; line-height: 1.6; }

/* Callouts — header row (icon + label e.g. Tip:), then body full width below */
.docs-callout {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    margin: var(--space-lg) 0;
    border: 1px solid;
    width: 100%;
    box-sizing: border-box;
}
.docs-callout-header {
    display: flex;
    align-items: center;
    gap: var(--gap-sm);
    margin-bottom: var(--space-sm);
    flex-shrink: 0;
}
.docs-callout-header svg { flex-shrink: 0; width: 20px; height: 20px; min-width: 20px; min-height: 20px; }
.docs-callout-header strong { margin-bottom: 0; }
.docs-callout-body {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    flex: 1 1 auto;
}
.docs-callout-body p { max-width: none; }
.docs-callout-body > p:first-of-type { margin-top: 0; }
.docs-callout a { color: inherit; text-decoration: underline; }
.docs-callout p, .docs-callout li { color: inherit; }
.docs-callout strong { display: block; margin-bottom: var(--space-xs); color: var(--text); }
.docs-callout-info { background: var(--alert-info-dim); border-color: rgba(104, 191, 211, 0.4); color: var(--alert-info); }
.docs-callout-info svg { fill: var(--alert-info); color: var(--alert-info); width: 25px; height: 25px; min-width: 25px; min-height: 25px; }
.docs-callout-success { background: var(--alert-success-dim); border-color: rgba(126, 208, 107, 0.4); color: var(--status-success); }
.docs-callout-success svg { color: var(--status-success); }
.docs-callout-warning { background: var(--alert-warning-dim); border-color: rgba(250, 208, 31, 0.4); color: var(--status-warning); }
.docs-callout-warning svg { color: var(--status-warning); }
.docs-loading, .docs-error { color: var(--text-muted); font-size: var(--font-md); }
.docs-error a { color: var(--accent); }

/* Tables */
.docs-body table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: var(--space-lg) 0;
    font-size: var(--font-sm);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.docs-body th, .docs-body td { padding: var(--space-md) var(--space-lg); text-align: left; border: 1px solid var(--border); }
.docs-body th:first-child { border-top-left-radius: var(--radius-lg); }
.docs-body th:last-child { border-top-right-radius: var(--radius-lg); }
.docs-body tr:last-child td:first-child { border-bottom-left-radius: var(--radius-lg); }
.docs-body tr:last-child td:last-child { border-bottom-right-radius: var(--radius-lg); }
.docs-body th { background: var(--secondary); color: var(--text); font-weight: var(--weight-semibold); }
.docs-body td { color: var(--text-muted); }

/* Blockquote & hr */
.docs-body blockquote {
    margin: var(--space-lg) 0;
    padding: var(--space-lg) var(--space-xl);
    background: var(--secondary);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
}
.docs-body blockquote p:last-child { margin-bottom: 0; }
.docs-body hr { border: none; border-top: 1px solid var(--border); margin: var(--space-3xl) 0; }

/* Content footer & nav links */
.docs-content-footer { margin-top: var(--space-3xl); padding-top: var(--space-2xl); border-top: 1px solid var(--border); }
.docs-nav-link {
    display: inline-flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space-md) var(--space-lg);
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text);
    text-decoration: none;
    transition: border-color var(--transition-base), background var(--transition-base);
}
.docs-nav-link:hover { border-color: var(--accent); background: var(--accent-dim); }
.docs-nav-link-label { font-size: var(--font-xs); font-weight: var(--weight-semibold); color: var(--text-muted); }
.docs-nav-link-title { font-size: var(--font-md); font-weight: var(--weight-medium); }

/* Table of contents */
.docs-toc { width: 220px; flex-shrink: 0; }
.docs-toc-inner { position: sticky; top: 6rem; }
.docs-toc-title {
    display: block;
    font-size: var(--font-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}
.docs-toc-nav { display: flex; flex-direction: column; gap: var(--gap-sm); }
.docs-toc-nav a {
    font-size: var(--font-sm);
    color: var(--text-muted);
    text-decoration: none;
    padding-left: var(--space-md);
    border-left: 2px solid transparent;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}
.docs-toc-nav a:hover { color: var(--accent); }
.docs-toc-nav a.active { color: var(--accent); border-left-color: var(--accent); }

/* Footer */
/* Footer — full-width background, content constrained and centered to match layout */
.docs-footer {
    margin-top: auto;
    width: 100%;
    padding: var(--space-2xl) var(--space-lg) var(--space-xl);
    background: var(--primary);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
}
.docs-footer-inner {
    width: 100%;
    max-width: 1600px;
}
.docs-footer-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--gap-xl);
    margin-bottom: var(--space-lg);
}
.docs-footer-logo {
    font-size: var(--font-lg);
    font-weight: var(--weight-bold);
    letter-spacing: -0.03em;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}
.docs-footer-logo:hover { opacity: 0.9; }
.docs-footer-nav { display: flex; gap: var(--gap-xl); flex-wrap: wrap; }
.docs-footer-nav a { font-size: var(--font-sm); color: var(--text-muted); text-decoration: none; }
.docs-footer-nav a:hover { color: var(--accent); }
.docs-footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--gap-md);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
}
.docs-footer-copyright { font-size: var(--font-sm); color: var(--text-muted); }
/* Overlay */
.docs-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-modal) - 1);
    opacity: 0;
    transition: opacity var(--transition-base);
}
.docs-overlay.visible { display: block; opacity: 1; }

/* Responsive */
@media (max-width: 1200px) { .docs-toc { display: none; } }
@media (max-width: 900px) {
    .docs-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: var(--z-modal);
        width: 100%;
        max-width: 320px;
        height: 100vh;
        max-height: none;
        transform: translateX(-100%);
        transition: transform var(--transition-base);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    }
    .docs-sidebar.open { transform: translateX(0); }
    .docs-sidebar-toggle { display: block; }
    .docs-main { padding: var(--space-2xl) var(--space-lg); }
    .docs-content-header h1 { font-size: 1.5rem; }
    .docs-lead { font-size: var(--font-md); }
}
@media (max-width: 600px) {
    .docs-header-inner { padding: var(--space-md) var(--space-lg); }
    .docs-main { padding: var(--space-xl) var(--space-md); }
    .docs-footer { padding: var(--space-xl) var(--space-lg); }
    .docs-footer-top { flex-direction: column; align-items: flex-start; }
    .docs-footer-bottom { flex-direction: column-reverse; align-items: flex-start; }
}
