/* NAV-CRYPTO-ENV-01 2026-06-12 : environnement crypto — sidebar permanente réductible.
   Desktop ≥769px : colonne fixe à gauche (largeur pleine ou icônes seules, état persisté localStorage,
   classe `liofo-crypto-sidebar-collapsed` posée sur <html> par js/liofo-crypto-sidebar.js avant le rendu).
   Mobile ≤768px : tiroir off-canvas (poignée au bord gauche + voile), aucune largeur volée au contenu. */

:root {
    --liofo-crypto-sidebar-w: 218px;
    --liofo-crypto-sidebar-w-collapsed: 72px;
    --liofo-crypto-sb-edge-w: var(--liofo-nav-branch-edge-w, 3px);
    --liofo-crypto-sb-surface: transparent;
}

/* NAV-CRYPTO-ENV-01C 2026-06-12 — QA Thomas : pas de fond gris sur la colonne ni sur les entrées */
.liofo-crypto-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    width: var(--liofo-crypto-sidebar-w);
    box-sizing: border-box;
    padding: 14px 10px 16px;
    background: transparent;
    border-right: none;
    box-shadow: none;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    z-index: 1200;
    transition: width 0.25s ease, transform 0.25s ease;
}

.liofo-crypto-sidebar-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 6px 12px;
    border-bottom: none;
    margin-bottom: 12px;
    background: transparent;
}

.liofo-crypto-sidebar-head-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex: 0 0 auto;
}

.liofo-crypto-sidebar-head-label {
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.4px;
    white-space: nowrap;
    flex: 1 1 auto;
    min-width: 0;
}

.liofo-crypto-sidebar-toggle {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.25s ease;
}

.liofo-crypto-sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.26);
}

.liofo-crypto-sidebar-toggle .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.liofo-crypto-sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
}

.liofo-crypto-sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.liofo-crypto-sidebar-item > a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 8px 10px 8px 12px;
    border-radius: 0;
    color: #fff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 400;
    line-height: 1;
    white-space: nowrap;
    /* NAV-CRYPTO-ENV-01B/01C — fond transparent, seul liseré gauche coloré */
    background: transparent !important;
    border: none;
    border-left: var(--liofo-crypto-sb-edge-w) solid var(--liofo-crypto-sb-item-accent, #0cc0df);
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
}

/* NAV-CRYPTO-ENV-01B 2026-06-12 — accent Liofo distinct par page crypto */
.liofo-crypto-sidebar-item:nth-child(1) > a { --liofo-crypto-sb-item-accent: #00bf63; }
.liofo-crypto-sidebar-item:nth-child(2) > a { --liofo-crypto-sb-item-accent: #0cc0df; }
.liofo-crypto-sidebar-item:nth-child(3) > a { --liofo-crypto-sb-item-accent: #ff66c4; }
.liofo-crypto-sidebar-item:nth-child(4) > a { --liofo-crypto-sb-item-accent: #3db2ff; }
.liofo-crypto-sidebar-item:nth-child(5) > a { --liofo-crypto-sb-item-accent: #5650c9; }
.liofo-crypto-sidebar-item:nth-child(6) > a { --liofo-crypto-sb-item-accent: #10b981; }
.liofo-crypto-sidebar-item:nth-child(7) > a { --liofo-crypto-sb-item-accent: #0ea5e9; }

.liofo-crypto-sidebar-item > a:hover {
    background: transparent !important;
    border: none;
    border-left: var(--liofo-crypto-sb-edge-w) solid var(--liofo-crypto-sb-item-accent, #0cc0df);
    filter: brightness(1.12);
}

.liofo-crypto-sidebar-item.is-current > a {
    background: transparent !important;
    border: none;
    border-left: calc(var(--liofo-crypto-sb-edge-w) + 1px) solid var(--liofo-crypto-sb-item-accent, #0cc0df);
    font-weight: 400;
    filter: brightness(1.18);
}

.liofo-crypto-sidebar-item > a:focus-visible,
.liofo-crypto-sidebar-toggle:focus-visible,
.liofo-crypto-sidebar-mobile-handle:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.38);
    outline-offset: 2px;
}

.liofo-crypto-sidebar-icon {
    width: 26px;
    height: 26px;
    object-fit: contain;
    flex: 0 0 26px;
    display: block;
}

.liofo-crypto-sidebar-label {
    display: flex;
    align-items: center;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* NAV-CRYPTO-ENV-01B 2026-06-12 : effet d'enfoncement au clic — sans ombre ni fond (liens transparents) */
.liofo-crypto-sidebar-item > a:active,
.liofo-crypto-sidebar-toggle:active,
.liofo-crypto-sidebar-mobile-handle:active {
    transform: translateY(1px) scale(0.985);
    filter: brightness(0.88);
    box-shadow: none;
    transition-duration: 0.05s;
}

/* === Desktop ≥769px : colonne permanente, contenu décalé puis centré dans la zone restante === */

@media screen and (min-width: 769px) {
    /* Le décalage est porté par #outer-wrap (header + main + footer suivent d'un seul tenant) */
    body.liofo-crypto-env #outer-wrap {
        box-sizing: border-box;
        padding-left: var(--liofo-crypto-sidebar-w);
        transition: padding-left 0.25s ease;
    }

    html.liofo-crypto-sidebar-collapsed body.liofo-crypto-env #outer-wrap {
        padding-left: var(--liofo-crypto-sidebar-w-collapsed);
    }

    /* État réduit : icônes seules */
    html.liofo-crypto-sidebar-collapsed .liofo-crypto-sidebar {
        width: var(--liofo-crypto-sidebar-w-collapsed);
        padding-left: 8px;
        padding-right: 8px;
    }

    html.liofo-crypto-sidebar-collapsed .liofo-crypto-sidebar-head {
        justify-content: center;
        gap: 6px;
        padding-left: 0;
        padding-right: 0;
        flex-direction: column;
    }

    html.liofo-crypto-sidebar-collapsed .liofo-crypto-sidebar-head-label,
    html.liofo-crypto-sidebar-collapsed .liofo-crypto-sidebar-label {
        display: none;
    }

    html.liofo-crypto-sidebar-collapsed .liofo-crypto-sidebar-item {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    html.liofo-crypto-sidebar-collapsed .liofo-crypto-sidebar-item > a {
        justify-content: center;
        align-items: center;
        width: 100%;
        padding: 10px 0;
        min-height: 48px;
        border-left: none;
        background: transparent !important;
    }

    html.liofo-crypto-sidebar-collapsed .liofo-crypto-sidebar-icon {
        width: 34px;
        height: 34px;
        flex: 0 0 34px;
        margin: 0 auto;
    }

    html.liofo-crypto-sidebar-collapsed .liofo-crypto-sidebar-toggle-icon {
        display: inline-block;
        transform: scaleX(-1);
    }

    /* Poignée + voile : réservés au tiroir mobile */
    .liofo-crypto-sidebar-mobile-handle,
    .liofo-crypto-sidebar-scrim {
        display: none;
    }
}

/* === Mobile ≤768px : tiroir off-canvas (le contenu garde 100 % de la largeur) === */

@media screen and (max-width: 768px) {
    body.liofo-crypto-env #outer-wrap {
        padding-left: 0;
    }

    .liofo-crypto-sidebar {
        width: min(80vw, 300px);
        transform: translateX(-105%);
        z-index: 10500;
    }

    html.liofo-crypto-sidebar-open .liofo-crypto-sidebar {
        transform: translateX(0);
    }

    /* Le bouton de réduction n'a pas de sens en tiroir mobile */
    .liofo-crypto-sidebar-toggle {
        display: none;
    }

    /* L'état réduit desktop ne s'applique pas au tiroir */
    html.liofo-crypto-sidebar-collapsed .liofo-crypto-sidebar-label,
    html.liofo-crypto-sidebar-collapsed .liofo-crypto-sidebar-head-label {
        display: inline;
    }

    .liofo-crypto-sidebar-mobile-handle {
        position: fixed;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 26px;
        height: 56px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid rgba(255, 255, 255, 0.14);
        border-left: none;
        border-radius: 0 12px 12px 0;
        background: rgba(8, 10, 16, 0.92);
        color: #fff;
        font-size: 15px;
        line-height: 1;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        box-shadow: 4px 0 14px rgba(0, 0, 0, 0.3);
        z-index: 10010;
        transition: background 0.2s ease, transform 0.2s ease, filter 0.2s ease;
    }

    html.liofo-crypto-sidebar-open .liofo-crypto-sidebar-mobile-handle {
        display: none;
    }

    .liofo-crypto-sidebar-mobile-handle:active {
        transform: translateY(-50%) translateX(1px);
    }

    .liofo-crypto-sidebar-scrim {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.62);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 10490;
    }

    html.liofo-crypto-sidebar-open .liofo-crypto-sidebar-scrim {
        display: block;
    }
}

/* === Accessibilité mouvement === */

@media (prefers-reduced-motion: reduce) {
    .liofo-crypto-sidebar,
    .liofo-crypto-sidebar-toggle,
    .liofo-crypto-sidebar-item > a,
    .liofo-crypto-sidebar-mobile-handle,
    body.liofo-crypto-env #outer-wrap {
        transition: none !important;
    }

    .liofo-crypto-sidebar-item > a:active,
    .liofo-crypto-sidebar-toggle:active {
        transform: none;
    }

    .liofo-crypto-sidebar-mobile-handle:active {
        transform: translateY(-50%);
    }
}
