/*
 * hub-navigation.css — la barre latérale du Hub (#hubNavigation), unique.
 *
 * Il y en avait deux dans les Réglages : celle du Hub (Dashboard, Clients, Collaborateurs…) et, juste
 * à côté, la colonne des onglets des réglages. Deux menus côte à côte, de la place perdue, et l'on ne
 * savait plus lequel pilotait quoi. Tout est ici, rangé en catégories (Espace, Gestion,
 * Configuration) ; « Réglages du Hub » se déplie sur ses rubriques. Le thème et la déconnexion, qui
 * la terminaient, vivent dans le menu du compte, en haut à droite (hub-menu-compte.js).
 *
 * REPLIABLE à partir de 768 px : un rail d'icônes, le logo seul en tête, une bulle au survol. Les
 * libellés restent lus par les lecteurs d'écran (masqués visuellement, jamais par display). Sous
 * 768 px, la barre est un tiroir (hub-vues.css) et le repli ne s'applique pas.
 *
 * Après l'esprit du menu d'administration de livres-en-ville, dans les couleurs du Hub. Fonds
 * OPAQUES partout où il y a du texte (SonarCloud juge un rgba() comme s'il était plein), et aucune
 * règle `display` sur ce que le script masque par la classe `hidden` : `:not(.hidden)` la porte.
 */

.hub-nav:not(.hidden) {
    display: flex;
}

.hub-nav {
    position: relative;
    z-index: 50;
    flex: none;
    flex-direction: column;
    width: 264px;
    height: 100%;
    border-right: 1px solid #e7e2ee;
    background-color: #ffffff;
    transition: width 0.3s cubic-bezier(.3, .8, .3, 1);
}

.dark .hub-nav {
    border-right-color: var(--fp-trait);
    background-color: var(--fp-creux);
}

/* --- La tête : le logo, et le bouton qui replie ------------------------------------------- */
.hub-nav__tete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 80px;
    padding: 14px 14px 14px 12px;
    border-bottom: 1px solid #e7e2ee;
}

.dark .hub-nav__tete {
    border-bottom-color: var(--fp-trait);
}

.hub-nav__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 6px 8px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
}

.hub-nav__logo:hover {
    background-color: #f4f1f8;
}

.hub-nav__logo-image {
    flex: none;
    width: 32px;
    height: 32px;
}

.hub-nav__marque {
    overflow: hidden;
    color: #1c1b1f;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.hub-nav__replier {
    display: grid;
    flex: none;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid #e7e2ee;
    border-radius: 10px;
    background-color: #ffffff;
    color: #5f5b66;
    cursor: pointer;
}

.hub-nav__replier:hover {
    border-color: #cfc7dc;
    color: #1c1b1f;
}

.hub-nav__replier svg {
    width: 17px;
    height: 17px;
}

.hub-nav__icone-deplier {
    display: none;
}

.dark .hub-nav__logo:hover {
    background-color: var(--fp-surface-haute);
}

.dark .hub-nav__marque {
    color: var(--fp-texte);
}

.dark .hub-nav__replier {
    border-color: var(--fp-trait);
    background-color: var(--fp-creux);
    color: var(--fp-doux);
}

.dark .hub-nav__replier:hover {
    border-color: var(--fp-trait-fort);
    color: #ffffff;
}

/* --- Le corps : catégories, entrées, rubriques -------------------------------------------- */
.hub-nav__corps {
    flex: 1;
    padding: 6px 12px 16px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
}

.hub-nav__section {
    margin: 18px 0 6px 12px;
    color: #6b6675;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.hub-nav__liste,
.hub-nav__sous-liste {
    display: grid;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hub-nav__lien {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #49454f;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.hub-nav__lien:hover {
    background-color: #f4f1f8;
    color: #1c1b1f;
}

.hub-nav__lien[aria-current="page"],
.hub-nav__lien[data-actif] {
    background-color: #f1ebfb;
    color: #4f378b;
    font-weight: 600;
}

/* Le trait de l'entrée ouverte, sur le bord gauche de la barre. */
.hub-nav__lien[aria-current="page"]::before,
.hub-nav__lien[data-actif]::before {
    content: "";
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: -12px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background-color: #6750a4;
}

.hub-nav__icone {
    flex: none;
    width: 20px;
    height: 20px;
}

.hub-nav__libelle {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* « Réglages du Hub » et le chevron qui déplie ses rubriques. */
.hub-nav__ligne {
    position: relative;
    display: flex;
    align-items: center;
}

.hub-nav__groupe .hub-nav__lien {
    padding-right: 42px;
}

.hub-nav__deplier {
    position: absolute;
    right: 6px;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #6b6675;
    cursor: pointer;
    transition: transform 0.3s ease, background-color 0.2s ease;
}

.hub-nav__deplier:hover {
    background-color: #ece6f4;
    color: #1c1b1f;
}

.hub-nav__deplier[aria-expanded="true"] {
    transform: rotate(180deg);
}

.hub-nav__deplier svg {
    width: 16px;
    height: 16px;
}

.hub-nav__sous {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.32s cubic-bezier(.3, .8, .3, 1);
}

.hub-nav__sous--ouvert {
    grid-template-rows: 1fr;
}

.hub-nav__sous > .hub-nav__sous-liste {
    margin-left: 22px;
    padding-left: 12px;
    overflow: hidden;
    border-left: 1px solid #e7e2ee;
}

.hub-nav__sous--ouvert > .hub-nav__sous-liste {
    padding-top: 4px;
    padding-bottom: 6px;
}

.hub-nav__sous-lien {
    position: relative;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 36px;
    padding: 7px 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #5f5b66;
    font-size: 13.5px;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.hub-nav__sous-lien:not(.hidden) {
    display: flex;
}

.hub-nav__sous-lien:hover {
    background-color: #f4f1f8;
    color: #1c1b1f;
}

.hub-nav__sous-lien[aria-current="page"] {
    color: #4f378b;
    font-weight: 600;
}

/* Le point de la rubrique affichée, posé sur le filet. */
.hub-nav__sous-lien[aria-current="page"]::before {
    content: "";
    position: absolute;
    top: 50%;
    left: -15px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: #6750a4;
    box-shadow: 0 0 0 3px #ffffff;
    transform: translateY(-50%);
}

.hub-nav__logo:focus-visible,
.hub-nav__replier:focus-visible,
.hub-nav__lien:focus-visible,
.hub-nav__deplier:focus-visible,
.hub-nav__sous-lien:focus-visible {
    outline: 2px solid #6750a4;
    outline-offset: 2px;
}

.dark .hub-nav__section {
    color: #a9a2b2;
}

.dark .hub-nav__lien,
.dark .hub-nav__sous-lien,
.dark .hub-nav__deplier {
    color: var(--fp-doux);
}

.dark .hub-nav__lien:hover,
.dark .hub-nav__sous-lien:hover,
.dark .hub-nav__deplier:hover {
    background-color: var(--fp-surface-haute);
    color: #ffffff;
}

.dark .hub-nav__lien[aria-current="page"],
.dark .hub-nav__lien[data-actif] {
    background-color: #2c2540;
    color: #eaddff;
}

.dark .hub-nav__lien[aria-current="page"]::before,
.dark .hub-nav__lien[data-actif]::before,
.dark .hub-nav__sous-lien[aria-current="page"]::before {
    background-color: #d0bcff;
}

.dark .hub-nav__sous-lien[aria-current="page"] {
    color: #eaddff;
}

.dark .hub-nav__sous-lien[aria-current="page"]::before {
    box-shadow: 0 0 0 3px var(--fp-creux);
}

.dark .hub-nav__sous > .hub-nav__sous-liste {
    border-left-color: var(--fp-trait);
}

.dark .hub-nav__logo:focus-visible,
.dark .hub-nav__replier:focus-visible,
.dark .hub-nav__lien:focus-visible,
.dark .hub-nav__deplier:focus-visible,
.dark .hub-nav__sous-lien:focus-visible {
    outline-color: #d0bcff;
}

/* --- Sur un téléphone, un tiroir : le repli ne s'applique pas ----------------------------- */
@media (max-width: 767px) {
    .hub-nav__replier {
        display: none;
    }
}

/* --- La barre repliée : un rail d'icônes -------------------------------------------------- */
@media (min-width: 768px) {
    .hub-menu-replie .hub-nav {
        width: 76px;
    }

    .hub-menu-replie .hub-nav__tete {
        flex-direction: column;
        justify-content: center;
        gap: 10px;
        padding: 14px 8px;
    }

    .hub-menu-replie .hub-nav__icone-replier {
        display: none;
    }

    .hub-menu-replie .hub-nav__icone-deplier {
        display: block;
    }

    /* Masqués à l'œil, lus par les lecteurs d'écran : chaque bouton garde son nom. */
    .hub-menu-replie .hub-nav__marque,
    .hub-menu-replie .hub-nav__libelle {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .hub-menu-replie .hub-nav__section {
        height: 0;
        margin: 10px 4px;
        overflow: hidden;
        border-top: 1px solid #e7e2ee;
    }

    .dark .hub-menu-replie .hub-nav__section {
        border-top-color: var(--fp-trait);
    }

    .hub-menu-replie .hub-nav__lien,
    .hub-menu-replie .hub-nav__groupe .hub-nav__lien {
        justify-content: center;
        padding-inline: 0;
    }

    .hub-menu-replie .hub-nav__deplier,
    .hub-menu-replie .hub-nav__sous {
        display: none;
    }

    /* La bulle du rail : le nom de l'entrée, à droite de la barre. */
    .hub-menu-replie .hub-nav__lien::after {
        content: attr(data-infobulle);
        position: fixed;
        left: 84px;
        z-index: 80;
        padding: 6px 10px;
        border-radius: 10px;
        background-color: #1c1b1f;
        color: #ffffff;
        font-size: 13px;
        font-weight: 500;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        box-shadow: 0 8px 20px rgb(0 0 0 / 0.2);
        transform: translateX(-4px);
        transition: opacity 0.15s ease, transform 0.15s ease;
    }

    .hub-menu-replie .hub-nav__lien:hover::after,
    .hub-menu-replie .hub-nav__lien:focus-visible::after {
        opacity: 1;
        transform: none;
    }

    .dark .hub-menu-replie .hub-nav__lien::after {
        background-color: var(--fp-texte);
        color: var(--fp-creux);
    }
}

[data-mouvement="non"] .hub-nav,
[data-mouvement="non"] .hub-nav__sous,
[data-mouvement="non"] .hub-nav__deplier {
    transition: none;
}

@media (prefers-reduced-motion: reduce) {
    .hub-nav,
    .hub-nav__sous,
    .hub-nav__deplier,
    .hub-nav__lien,
    .hub-nav__sous-lien,
    .hub-nav__lien::after {
        transition: none;
    }
}
