/* docs.css — Documentation API publique (light/dark) */

/* ========== Light theme (default) ========== */
:root, [data-theme="light"] {
    --primary: #3273dc;
    --primary-light: #eef3fc;
    --bg: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-sidebar: #f5f6f8;
    --text: #363636;
    --text-muted: #888;
    --text-code: #d63384;
    --border: #e0e0e0;
    --code-bg: #f5f5f5;
    --pre-bg: #1e1e2e;
    --pre-text: #cdd6f4;
    --table-header: #f8f9fa;
    --table-hover: #fafafa;
    --blockquote-bg: #f0f4ff;
    --link-sidebar: #363636;
    --link-sidebar-hover: #e8e8e8;
    --link-sidebar-active-bg: var(--primary);
    --link-sidebar-active-text: #fff;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* ========== Dark theme ========== */
[data-theme="dark"] {
    --primary: #5e9bff;
    --primary-light: #1a2744;
    --bg: #0d1117;
    --bg-secondary: #161b22;
    --bg-sidebar: #0d1117;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --text-code: #ff7b72;
    --border: #30363d;
    --code-bg: #161b22;
    --pre-bg: #161b22;
    --pre-text: #e6edf3;
    --table-header: #161b22;
    --table-hover: #1c2128;
    --blockquote-bg: #1a2744;
    --link-sidebar: #c9d1d9;
    --link-sidebar-hover: #1c2128;
    --link-sidebar-active-bg: var(--primary);
    --link-sidebar-active-text: #fff;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* ========== Base ========== */
* { box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    transition: background 0.2s, color 0.2s;
}
a { color: var(--primary); }

/* ========== Sidebar ========== */
.sidebar {
    position: fixed; top: 0; left: 0; width: 280px; height: 100vh;
    overflow-y: auto; background: var(--bg-sidebar);
    border-right: 1px solid var(--border); padding: 1.25rem;
    font-size: 0.85rem; z-index: 10;
    transition: background 0.2s, border-color 0.2s;
}
.sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.25rem; padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo { font-size: 1.2rem; font-weight: 700; }
.sidebar-logo span { color: var(--primary); }

.theme-toggle {
    background: var(--bg-secondary); border: 1px solid var(--border);
    color: var(--text); cursor: pointer; border-radius: 6px;
    width: 34px; height: 34px; display: flex; align-items: center;
    justify-content: center; font-size: 1rem; transition: all 0.2s;
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

.sidebar a {
    color: var(--link-sidebar); display: block; padding: 0.3rem 0.6rem;
    border-radius: 5px; text-decoration: none; transition: all 0.15s;
    line-height: 1.5;
}
.sidebar a:hover { background: var(--link-sidebar-hover); }
.sidebar a.active {
    background: var(--link-sidebar-active-bg);
    color: var(--link-sidebar-active-text);
    font-weight: 500;
}
.sidebar .section-title {
    font-weight: 700; font-size: 0.7rem; text-transform: uppercase;
    color: var(--text-muted); margin-top: 1.1rem; margin-bottom: 0.25rem;
    padding-left: 0.6rem; letter-spacing: 0.04em;
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ========== Main content ========== */
.main-with-sidebar { margin-left: 280px; }
.doc-container { max-width: 920px; margin: 0 auto; padding: 2rem 2rem 4rem; }

/* ========== Typography ========== */
.content h1 {
    font-size: 1.8rem; font-weight: 700; color: var(--text);
    border-bottom: 2px solid var(--primary); padding-bottom: 0.5rem;
    margin-top: 2.5rem; margin-bottom: 1rem;
}
.content h2 {
    font-size: 1.4rem; font-weight: 600; color: var(--primary);
    margin-top: 2.2rem; margin-bottom: 0.75rem;
}
.content h3 {
    font-size: 1.15rem; font-weight: 600; color: var(--text);
    margin-top: 1.5rem; margin-bottom: 0.5rem;
}
.content h4 { font-size: 1rem; font-weight: 600; }
.content p { line-height: 1.7; margin-bottom: 0.75rem; }
.content li { line-height: 1.6; }
.content strong { font-weight: 600; }

/* ========== Code ========== */
.content pre {
    background: var(--pre-bg); color: var(--pre-text);
    border-radius: 8px; padding: 1rem 1.25rem;
    overflow-x: auto; font-size: 0.84rem; line-height: 1.6;
    border: 1px solid var(--border); box-shadow: var(--shadow);
}
.content pre code { background: transparent; color: inherit; padding: 0; font-size: inherit; }
.content code {
    background: var(--code-bg); padding: 0.15em 0.4em;
    border-radius: 4px; font-size: 0.88em; color: var(--text-code);
}

/* ========== Tables ========== */
.content table {
    border-collapse: collapse; width: 100%; margin: 1rem 0;
    border: 1px solid var(--border); border-radius: 6px;
    overflow: hidden; font-size: 0.9rem;
}
.content table th {
    background: var(--table-header); font-weight: 600;
    text-align: left; padding: 0.55rem 0.75rem;
    border: 1px solid var(--border); color: var(--text);
}
.content table td {
    padding: 0.5rem 0.75rem; border: 1px solid var(--border);
    color: var(--text);
}
.content table tr:hover td { background: var(--table-hover); }

/* ========== Blockquote ========== */
.content blockquote {
    border-left: 4px solid var(--primary);
    background: var(--blockquote-bg);
    padding: 0.75rem 1rem; margin: 1rem 0;
    border-radius: 0 6px 6px 0;
}
.content blockquote p { margin: 0; }

/* ========== HR ========== */
.content hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* ========== Back to top ========== */
.back-to-top {
    position: fixed; bottom: 2rem; right: 2rem;
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--primary); color: #fff; border: none;
    cursor: pointer; font-size: 1.1rem; display: none;
    align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: opacity 0.2s, transform 0.2s;
    z-index: 20;
}
.back-to-top:hover { transform: translateY(-2px); }
.back-to-top.visible { display: flex; }

/* ========== Responsive ========== */
@media (max-width: 1023px) {
    .sidebar { display: none; }
    .main-with-sidebar { margin-left: 0; }
    .doc-container { padding: 1rem; }
    .mobile-bar {
        display: flex !important; position: sticky; top: 0; z-index: 10;
        background: var(--bg-sidebar); border-bottom: 1px solid var(--border);
        padding: 0.5rem 1rem; align-items: center; justify-content: space-between;
    }
}
@media (min-width: 1024px) { .mobile-bar { display: none !important; } }
