/* =========================================================
   AIDE.CSS — Design System du Centre d'aide GuideON
   Style doc classique (Docusaurus-like) : plat, dense, sobre.
   Double barre de défilement indépendante (sidebar / TOC).
   ========================================================= */

:root {
    --bg-dark: #14161f;
    --primary-blue: #4d9fff;
    --secondary-blue: #3a7bd5;
    --accent-green: #4ade80;
    --text-gray: #99a1b3;
    --transition-smooth: all 0.15s ease;

    /* Variables sémantiques Documentation */
    --aide-bg-alt: #0f111a;
    --aide-card: #191c27;
    --aide-card-hover: #1e2230;
    --aide-border: #262a38;
    --aide-border-strong: #323847;
    --aide-text: #e5e8f0;
    --aide-text-dim: #99a1b3;
    --aide-text-mute: #5b6274;
}

/* Reset global — évite tout liseré blanc autour du site */
html, body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-dark);
}

/* Base structural alignment */
.aide-page * { box-sizing: border-box; }
.aide-page {
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--aide-text);
    -webkit-font-smoothing: antialiased;
    padding-top: 40px;
    min-height: 100vh;
    background-color: var(--bg-dark);
    position: relative;
    isolation: isolate; /* garde le halo derrière le contenu, comme sur la home */
}

/* Halo lumineux repris de welcome.css — fixe, discret, pas de coupure nette */
.aide-page::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(
            ellipse 1200px 800px at 50% 0%,
            rgba(0, 210, 255, 0.10) 0%,
            rgba(0, 210, 255, 0.04) 35%,
            rgba(15, 17, 26, 0) 75%
        );
}
.aide-page h1, .aide-page h2, .aide-page h3, .aide-page h4 {
    font-family: 'Poppins', sans-serif;
    letter-spacing: -0.3px;
}

/* Fondu d'entrée/sortie — rejoué à chaque changement de page
   (rechargement complet : le fondu de sortie est joué en JS avant la
   navigation, le fondu d'entrée se relance nativement à chaque chargement) */
@keyframes aideFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes aideFadeOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-10px); }
}
.aide-page {
    /* pas d'animation ici : la sidebar (incluse dans .aide-page) doit rester fixe */
}
.main {
    animation: aideFadeIn 0.4s ease-out;
}
.main.is-leaving {
    animation: aideFadeOut 0.22s ease-in forwards;
}
@media (prefers-reduced-motion: reduce) {
    .main, .main.is-leaving { animation: none; }
}

/* ===== HEADER DU CENTRE D'AIDE ===== */
.help-header {
    padding: 40px 40px 30px;
    max-width: 1320px;
    margin: 0 auto;
}
.help-header .eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--primary-blue);
    text-transform: uppercase;
    margin: 0 0 10px;
}
.help-header h1 {
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    font-weight: 700;
    color: #fff;
    margin: 0 0 12px;
}
.help-header p {
    font-size: 15px;
    color: var(--text-gray);
    margin: 0;
    max-width: 700px;
    line-height: 1.7;
}

/* Barre de recherche — plate, pas de blur */
.search-box {
    margin-top: 24px;
    max-width: 440px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    border-radius: 10px;
    background: var(--aide-card);
    border: 1px solid var(--aide-border);
    transition: var(--transition-smooth);
}
.search-box:focus-within {
    border-color: var(--primary-blue);
}
.search-box i { color: var(--aide-text-mute); font-size: 16px; }
.search-box:focus-within i { color: var(--primary-blue); }
.search-box input {
    background: none; border: none; outline: none; color: #fff;
    font-size: 14px; width: 100%; font-family: inherit;
}
.search-box input::placeholder { color: var(--aide-text-mute); }
.search-box .kbd {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    color: var(--aide-text-mute);
    background: var(--aide-bg-alt);
    border: 1px solid var(--aide-border);
    border-radius: 5px;
    padding: 2px 6px;
}

/* ===== LAYOUT MAÎTRE ===== */
.aide-layout {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 40px 100px;
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr) 220px;
    gap: 40px;
    align-items: start;
}

/* ===== SCROLLS LATÉRAUX INDÉPENDANTS ===== */
.sidebar, .toc-wrap {
    position: sticky;
    top: 40px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--aide-border) transparent;
}

.sidebar::-webkit-scrollbar, .toc-wrap::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track, .toc-wrap::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb, .toc-wrap::-webkit-scrollbar-thumb {
    background: var(--aide-border);
    border-radius: 10px;
}
.sidebar::-webkit-scrollbar-thumb:hover, .toc-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--aide-border-strong);
}

/* ===== SIDEBAR DE NAVIGATION — arborescence plate, sans carte ni glow ===== */
.sidebar {
    gap: 2px;
    padding-right: 4px;
}

.sidebar-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Cache le bouton dropdown sur desktop : le menu est toujours visible */
.sidebar-toggle {
    display: none;
}

.sidebar-head {
    padding: 0 10px 14px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--aide-border);
    flex: none;
}
.sidebar-head h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.sidebar-group {
    margin-bottom: 14px;
}
.sidebar-group-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: var(--aide-text-mute);
    text-transform: uppercase;
    padding: 6px 10px;
    display: block;
    user-select: none;
}

.sidebar-items-wrapper {
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--aide-border);
    margin-left: 12px;
}

/* Éléments de la navigation — liste plate, pas de translation ni glow */
.sys-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 14px;
    margin-left: -1px;
    border-left: 1px solid transparent;
    color: var(--text-gray);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    line-height: 1.4;
}
.sys-item i { font-size: 15px; color: var(--aide-text-mute); }
.sys-item:hover { color: #fff; background: var(--aide-card); }
.sys-item:hover i { color: var(--aide-text-dim); }

.sys-item.active {
    color: var(--primary-blue);
    font-weight: 600;
    border-left-color: var(--primary-blue);
    background: rgba(77, 159, 255, 0.08);
}
.sys-item.active i { color: var(--primary-blue); }

/* ===== TABLE DES MATIÈRES (TOC DROITE) ===== */
.toc-title {
    font-size: 11px; font-weight: 700; letter-spacing: 0.8px;
    color: var(--aide-text-mute); text-transform: uppercase; margin: 0 0 12px; padding: 0 4px;
}
.toc { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--aide-border); }
.toc a {
    display: block; padding: 6px 0 6px 14px; margin-left: -1px;
    font-size: 13px; color: var(--text-gray); text-decoration: none;
    border-left: 1px solid transparent; line-height: 1.5;
    transition: var(--transition-smooth);
}
.toc a:hover { color: #fff; }
.toc a.active {
    color: var(--primary-blue);
    border-left-color: var(--primary-blue);
    font-weight: 600;
}

/* ===== EN-TÊTE D'ARTICLE (MAIN CONTENT) ===== */
.breadcrumb { font-size: 13px; color: var(--aide-text-mute); margin-bottom: 18px; font-weight: 500; }
.breadcrumb a { color: var(--aide-text-mute); text-decoration: none; }
.breadcrumb a:hover { color: var(--text-gray); }
.breadcrumb span.sep { margin: 0 8px; color: var(--aide-border-strong); }
.breadcrumb span.here { color: var(--text-gray); }

.sys-head { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; }
.sys-icon {
    width: 50px; height: 50px; border-radius: 12px; flex: none;
    display: flex; align-items: center; justify-content: center; font-size: 22px;
    background: var(--aide-card);
    border: 1px solid var(--aide-border);
}
.sys-icon.blue { color: var(--primary-blue); border-color: rgba(77, 159, 255, 0.25); }
.sys-icon.green { color: var(--accent-green); border-color: rgba(74, 222, 128, 0.25); }

.sys-title h2 { font-size: 26px; font-weight: 700; color: #fff; margin: 0 0 4px; }
.sys-title p { font-size: 14.5px; color: var(--text-gray); margin: 0; }

.meta-row { display: flex; gap: 20px; margin: 18px 0 28px; flex-wrap: wrap; align-items: center; }
.meta-row .m { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--aide-text-mute); }
.meta-row .m i { font-size: 14px; }

.badge { font-size: 11px; font-weight: 700; padding: 4px 12px; border-radius: 6px; text-transform: uppercase; }
.badge.free { background: rgba(74, 222, 128, 0.1); color: var(--accent-green); border: 1px solid rgba(74, 222, 128, 0.2); }
.badge.gold { background: rgba(242, 184, 75, 0.1); color: #f2b84b; border: 1px solid rgba(242, 184, 75, 0.2); }

/* ===== SECTIONS ET BLOCKS DE CONTENU ===== */
.section { margin-bottom: 36px; scroll-margin-top: 60px; }
.section h3 {
    font-size: 17px; font-weight: 700; color: #fff; margin: 0 0 14px;
    display: flex; align-items: center; gap: 9px;
}
.section h3 i { font-size: 17px; color: var(--primary-blue); }
.section p { font-size: 15px; line-height: 1.75; color: var(--text-gray); margin: 0 0 14px; }
.section p b { color: #fff; font-weight: 600; }

.section p code, .section li code {
    background: var(--aide-card); padding: 2px 6px; border-radius: 5px;
    font-family: 'SFMono-Regular', Consolas, monospace; font-size: 13px; color: var(--primary-blue);
    border: 1px solid var(--aide-border);
}

/* Grille de features */
.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.feature-card {
    background: var(--aide-card); border: 1px solid var(--aide-border); border-radius: 12px;
    padding: 16px 18px; display: flex; gap: 12px; align-items: flex-start;
}
.feature-card:hover { border-color: var(--aide-border-strong); }
.feature-card i { font-size: 19px; color: var(--primary-blue); margin-top: 1px; }
.feature-card .t { font-size: 14.5px; font-weight: 700; color: #fff; margin: 0 0 3px; }
.feature-card .d { font-size: 13px; color: var(--text-gray); margin: 0; line-height: 1.55; }

/* Listes ordonnées */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li { display: flex; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--aide-border); }
.steps li:last-child { border-bottom: none; }
.steps li .num {
    counter-increment: step; flex: none; width: 26px; height: 26px; border-radius: 8px;
    background: var(--aide-card); border: 1px solid var(--aide-border);
    display: flex; align-items: center; justify-content: center;
    font-size: 12.5px; font-weight: 700; color: var(--primary-blue);
}
.steps li .num::before { content: counter(step); }
.steps li .txt .t { font-size: 14.5px; font-weight: 600; color: #fff; margin: 0 0 3px; }
.steps li .txt .d { font-size: 13.5px; color: var(--text-gray); margin: 0; line-height: 1.55; }

/* Tableaux techniques */
table.wiki-table {
    width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px;
    background: var(--aide-card); border: 1px solid var(--aide-border);
    border-radius: 12px; overflow: hidden; margin: 14px 0;
}
table.wiki-table th {
    text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
    color: var(--aide-text-mute); background: var(--aide-bg-alt); padding: 12px 16px;
    border-bottom: 1px solid var(--aide-border);
}
table.wiki-table td { padding: 12px 16px; border-top: 1px solid var(--aide-border); color: var(--text-gray); vertical-align: middle; }
table.wiki-table tr:first-child td { border-top: none; }
table.wiki-table td.code-cell { font-family: monospace; color: var(--primary-blue); font-weight: 600; }
table.wiki-table td strong { color: #fff; }

/* Boîtes informatives / Alertes — plates */
.tip-box {
    display: flex; gap: 12px; background: rgba(77, 159, 255, 0.06);
    border: 1px solid rgba(77, 159, 255, 0.2); border-left: 3px solid var(--primary-blue);
    border-radius: 8px; padding: 14px 18px; margin: 22px 0;
}
.tip-box i { color: var(--primary-blue); font-size: 18px; }
.tip-box p { margin: 0; font-size: 13.5px; color: var(--text-gray); line-height: 1.6; }
.tip-box p b { color: #fff; }

.limits-box {
    background: rgba(242, 184, 75, 0.05); border: 1px solid rgba(242, 184, 75, 0.2);
    border-left: 3px solid #f2b84b; border-radius: 8px; padding: 16px 18px; margin: 22px 0;
}
.limits-box .head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.limits-box .head i { color: #f2b84b; font-size: 16px; }
.limits-box .head span { font-size: 13px; font-weight: 700; color: #f2b84b; letter-spacing: 0.3px; }
.limits-box ul { margin: 0; padding-left: 18px; }
.limits-box li { font-size: 13.5px; color: var(--text-gray); line-height: 1.75; margin-bottom: 3px; }

/* Accordéons FAQ */
details.faq {
    background: var(--aide-card); border: 1px solid var(--aide-border);
    border-radius: 10px; padding: 2px 18px; margin-bottom: 10px;
}
details.faq[open] { border-color: var(--aide-border-strong); }
details.faq summary {
    list-style: none; cursor: pointer; padding: 13px 0; font-size: 14px; font-weight: 600; color: #fff;
    display: flex; align-items: center; justify-content: space-between; outline: none;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after {
    content: '\ea5f'; font-family: 'tabler-icons'; font-weight: 400; color: var(--aide-text-mute);
    font-size: 17px; transition: transform 0.15s ease;
}
details.faq[open] summary::after { transform: rotate(180deg); }
details.faq .a { font-size: 13.5px; color: var(--text-gray); line-height: 1.7; padding: 2px 0 16px; }

/* CTA de bas de page — plate */
.support-cta {
    margin-top: 46px; display: flex; align-items: center; justify-content: space-between;
    background: var(--aide-card); border: 1px solid var(--aide-border); border-radius: 14px;
    padding: 20px 24px; gap: 18px; flex-wrap: wrap;
}
.support-cta .t { font-size: 15px; font-weight: 700; color: #fff; margin: 0 0 3px; }
.support-cta .d { font-size: 13.5px; color: var(--text-gray); margin: 0; }
.support-cta a {
    font-size: 13px; font-weight: 700; color: #fff; background: var(--secondary-blue);
    padding: 9px 18px; border-radius: 8px; text-decoration: none;
    display: flex; align-items: center; gap: 7px; transition: var(--transition-smooth);
}
.support-cta a:hover { background: var(--primary-blue); }

hr.aide-sep { border: none; border-top: 1px solid var(--aide-border); margin: 36px 0; }

/* ===== COMPOSANTS DE SIMULATION ===== */
.preview-mock {
    background: var(--aide-bg-alt); border: 1px solid var(--aide-border); border-radius: 10px; padding: 16px 18px;
    font-size: 13.5px; color: #d8dce6; line-height: 1.65; position: relative; font-family: monospace;
}
.preview-mock .tag {
    position: absolute; top: -9px; left: 14px; background: var(--secondary-blue);
    color: #fff; font-size: 10px; font-weight: 700; padding: 2px 9px; border-radius: 5px; text-transform: uppercase;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .aide-layout { grid-template-columns: 230px minmax(0, 1fr); gap: 28px; }
    .toc-wrap { display: none; }
}
@media (max-width: 850px) {
    .help-header { padding: 28px 20px 18px; }
    .aide-layout { grid-template-columns: 1fr; padding: 0 20px 60px; gap: 30px; }

    .sidebar, .toc-wrap {
        position: static;
        max-height: none;
        overflow-y: visible;
    }
    .sidebar { display: flex; flex-direction: column; gap: 0; }

    /* Le libellé "Documentation" est redondant avec le bouton toggle en mobile */
    .sidebar-head { display: none; }

    /* Bouton d'ouverture du menu (mobile uniquement) */
    .sidebar-toggle {
        all: unset;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 13px 16px;
        background: var(--aide-card);
        border: 1px solid var(--aide-border);
        border-radius: 12px;
        color: #fff;
        font-family: 'Poppins', sans-serif;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
    }
    .sidebar-toggle i {
        font-size: 16px;
        color: var(--aide-text-mute);
        transition: transform 0.2s ease;
    }
    .sidebar-toggle[aria-expanded="true"] i { transform: rotate(180deg); }

    /* Corps du menu : replié par défaut, ouvert au clic sur le toggle */
    .sidebar-body {
        display: none;
        margin-top: 8px;
        padding: 10px;
        border: 1px solid var(--aide-border);
        border-radius: 12px;
        background: var(--aide-bg-alt);
        max-height: 60vh;
        overflow-y: auto;
    }
    .sidebar-body.is-open {
        display: flex;
        flex-direction: column;
        gap: 2px;
        animation: aideFadeIn 0.2s ease-out;
    }

    .feature-grid { grid-template-columns: 1fr; }
}
