/* =====================================================================
   Menu moderne APC Pédagogie (03/12/2026)
   - n'ajoute ni ne retire aucun lien : seulement l'apparence et le comportement
   - pour revenir à l'ancien menu :
     bash /www/wwwroot/sauvegardes/menu_ancien_20261203/restaurer_ancien_menu.sh
   ===================================================================== */

/* ---------- Barre ---------- */
html body .apc-navbar {
    background: linear-gradient(180deg, rgba(6, 18, 37, .97) 0%, rgba(9, 27, 51, .96) 100%) !important;
    -webkit-backdrop-filter: saturate(160%) blur(10px);
    backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 0 !important;
    box-shadow: 0 8px 28px rgba(3, 10, 22, .35);
}
html body .apc-navbar::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #00d8ff 22%, #4fe3ff 50%, #ffb606 78%, transparent 100%);
    pointer-events: none;
}

/* ---------- Liens principaux ---------- */
html body .apc-navbar .navbar-nav > .nav-item > .nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: .5rem;
    color: rgba(255, 255, 255, .9);
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .07em;
    padding: .62rem 1rem !important;
    border-radius: 999px;
    transition: background-color .2s ease, color .2s ease;
}
html body .apc-navbar .apc-mi {
    font-size: 1.05rem;
    color: #00d8ff;
    line-height: 1;
    transition: transform .25s ease;
}
html body .apc-navbar .nav-link.dropdown-toggle::after {
    border: 0;
    content: "\F282";                 /* chevron-down */
    font-family: "bootstrap-icons";
    font-size: .7rem;
    margin-left: .1rem;
    vertical-align: 0;
    opacity: .75;
    transition: transform .25s ease;
}
html body .apc-navbar .navbar-nav > .nav-item > .nav-link:hover,
html body .apc-navbar .navbar-nav > .nav-item > .nav-link:focus-visible,
html body .apc-navbar .navbar-nav > .nav-item > .nav-link.show {
    color: #fff;
    background-color: rgba(0, 216, 255, .12);
}
html body .apc-navbar .navbar-nav > .nav-item > .nav-link:hover .apc-mi,
html body .apc-navbar .navbar-nav > .nav-item > .nav-link.show .apc-mi { transform: scale(1.15); }
html body .apc-navbar .nav-link.dropdown-toggle.show::after { transform: rotate(180deg); }

/* ---------- Bouton de recherche ---------- */
html body .apc-nav-actions .nav-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px; height: 42px;
    border-radius: 50%;
    font-size: 1.05rem;
    color: #fff;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(0, 216, 255, .35);
    transition: background-color .2s ease, transform .2s ease;
}
html body .apc-nav-actions .nav-icon-link:hover {
    background: #00d8ff;
    color: #062035;
    transform: scale(1.06);
}

/* ---------- Sous-menus : commun ---------- */
html body .apc-navbar .dropdown-item.apc-voir-tout { color: #00a8c8; font-weight: 700; }

/* =====================================================================
   ORDINATEUR (>= 992 px)
   ===================================================================== */
@media (min-width: 992px) {
    html body .apc-navbar .navbar-nav > .nav-item.dropdown::after {
        /* pont invisible : la souris passe du titre au menu sans le fermer */
        content: "";
        position: absolute;
        left: 0; right: 0; top: 100%;
        height: 14px;
    }
    html body .apc-navbar .navbar-nav > .nav-item > .nav-link:hover .apc-mi { transform: scale(1.15); }
    html body .apc-navbar .navbar-nav > .nav-item.dropdown:hover > .nav-link {
        color: #fff;
        background-color: rgba(0, 216, 255, .12);
    }
    html body .apc-navbar .navbar-nav > .nav-item.dropdown:hover > .nav-link::after { transform: rotate(180deg); }

    /* Menus déroulants : apparition douce, fermeture retardée (le menu ne disparaît pas trop vite) */
    html body .apc-navbar .navbar-nav > .nav-item > .dropdown-menu {
        display: block !important;
        visibility: hidden;
        opacity: 0;
        transform: translateY(8px);
        pointer-events: none;
        animation: none;
        margin-top: 10px !important;
        min-width: 17.5rem;
        padding: .6rem;
        border-radius: 16px;
        background: #fff;
        border: 1px solid rgba(0, 216, 255, .22) !important;
        box-shadow: inset 0 3px 0 #00d8ff, 0 22px 50px rgba(9, 27, 51, .28), 0 2px 8px rgba(9, 27, 51, .08) !important;
        transition: opacity .2s ease, transform .2s ease, visibility 0s linear .45s;   /* reste 450 ms */
    }
    html body .apc-navbar .navbar-nav > .nav-item:hover > .dropdown-menu,
    html body .apc-navbar .navbar-nav > .nav-item:focus-within > .dropdown-menu,
    html body .apc-navbar .navbar-nav > .nav-item > .dropdown-menu.show {
        visibility: visible;
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
        transition: opacity .2s ease .08s, transform .2s ease .08s, visibility 0s linear .08s;
    }

    html body .apc-navbar .dropdown-item {
        position: relative;
        color: #1d3557;
        font-size: .9rem;
        font-weight: 500;
        padding: .6rem .85rem;
        border-radius: 10px;
        transition: background-color .18s ease, color .18s ease, padding-left .18s ease;
    }
    html body .apc-navbar .dropdown-item::before {
        content: "";
        position: absolute;
        left: 0; top: 22%; bottom: 22%;
        width: 3px;
        border-radius: 3px;
        background: #00d8ff;
        opacity: 0;
        transition: opacity .18s ease;
    }
    html body .apc-navbar .dropdown-item:hover,
    html body .apc-navbar .dropdown-item:focus,
    html body .apc-navbar .dropdown-submenu:hover > .dropdown-item {
        background: #e8f9fd;
        color: #0b5c75;
        padding-left: 1.1rem;
    }
    html body .apc-navbar .dropdown-item:hover::before,
    html body .apc-navbar .dropdown-submenu:hover > .dropdown-item::before { opacity: 1; }

    /* 2e niveau */
    html body .apc-navbar .dropdown-submenu > .dropdown-menu {
        border-radius: 14px;
        padding: .5rem;
        border: 1px solid rgba(0, 216, 255, .22) !important;
        box-shadow: 0 18px 44px rgba(9, 27, 51, .25) !important;
    }
}

/* =====================================================================
   SMARTPHONE ET TABLETTE (< 992 px)
   ===================================================================== */
@media (max-width: 991.98px) {
    html body .apc-navbar .navbar-toggler {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 48px; height: 48px;
        border-radius: 14px !important;
        background: rgba(0, 216, 255, .12) !important;
        border: 1px solid rgba(0, 216, 255, .45) !important;
    }
    html body .apc-navbar .navbar-toggler i { font-size: 1.6rem !important; line-height: 1; }

    /* Panneau du menu : carte qui défile seule (le menu reste à l'écran) */
    html body .apc-navbar .navbar-collapse.show,
    html body .apc-navbar .navbar-collapse.collapsing {
        margin-top: .8rem;
        padding: .45rem;
        border-radius: 18px;
        background: linear-gradient(180deg, #0f2a4c 0%, #091b33 100%);
        border: 1px solid rgba(0, 216, 255, .22);
        box-shadow: 0 24px 48px rgba(0, 0, 0, .45);
    }
    html body .apc-navbar .navbar-collapse.show {
        max-height: calc(100vh - 100px);
        max-height: calc(100dvh - 100px);
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    html body .apc-navbar .navbar-nav { margin: 0 !important; width: 100%; }
    html body .apc-navbar .navbar-nav > .nav-item + .nav-item { border-top: 1px solid rgba(255, 255, 255, .07); }

    html body .apc-navbar .navbar-nav > .nav-item > .nav-link {
        font-size: .92rem;
        padding: .95rem .9rem !important;
        border-radius: 12px;
        min-height: 52px;
    }
    html body .apc-navbar .nav-link.dropdown-toggle::after { margin-left: auto; font-size: .85rem; }

    html body .apc-navbar .navbar-nav > .nav-item > .dropdown-menu {
        margin: 0 .25rem .6rem !important;
        padding: .35rem !important;
        border-radius: 12px !important;
        background: rgba(255, 255, 255, .05) !important;
        border-left: 2px solid #00d8ff !important;
    }
    html body .apc-navbar .dropdown-item {
        color: rgba(255, 255, 255, .9);
        font-size: .93rem;
        padding: .72rem .8rem;
        min-height: 46px;
        border-radius: 10px;
        white-space: normal;
    }
    html body .apc-navbar .dropdown-item:active,
    html body .apc-navbar .dropdown-item:hover,
    html body .apc-navbar .dropdown-item:focus {
        background: rgba(0, 216, 255, .14);
        color: #fff;
    }
    html body .apc-navbar .dropdown-item.apc-voir-tout { color: #4fe3ff; }
    html body .apc-navbar .dropdown-submenu > .dropdown-menu {
        border-left: 2px solid rgba(255, 182, 6, .7) !important;
        background: rgba(255, 255, 255, .03) !important;
        border-radius: 10px !important;
        margin: .2rem 0 .4rem .4rem !important;
    }
    html body .apc-navbar .apc-nav-actions { padding: .6rem .5rem .4rem; }
}

@media (prefers-reduced-motion: reduce) {
    html body .apc-navbar *,
    html body .apc-navbar *::after { transition: none !important; }
}

/* ---------- Flèche des sous-menus (remplace l'ancien triangle) ---------- */
html body .apc-navbar .dropdown-submenu > a::after,
html body .apc-navbar .dropdown-submenu > .dropdown-item::after {
    border: 0 !important;
    float: none !important;
    margin: 0 0 0 auto !important;
    content: "\F285" !important;          /* chevron-right */
    font-family: "bootstrap-icons" !important;
    font-size: .72rem !important;
    color: #00a8c8 !important;
    opacity: .9;
}

/* ---------- Ordinateur : menu aligné à droite, loin du logo ---------- */
@media (min-width: 992px) {
    html body .apc-navbar .navbar-nav {
        margin-left: auto !important;
        margin-right: .75rem !important;
        gap: .15rem;
    }
    html body .apc-navbar .navbar-nav > .nav-item > .nav-link { padding: .6rem .85rem !important; letter-spacing: .05em; }
    /* le dernier menu s'ouvre vers la gauche pour ne pas sortir de l'écran */
    html body .apc-navbar .navbar-nav > .nav-item:last-child > .dropdown-menu { right: 0; left: auto; }
}
@media (min-width: 992px) and (max-width: 1199.98px) {
    html body .apc-navbar .apc-mi { display: none; }
    html body .apc-navbar .navbar-nav > .nav-item > .nav-link { font-size: .76rem; padding: .55rem .6rem !important; }
}

/* ---------- Smartphone : flèche vers le bas, tournée quand le sous-menu est ouvert ---------- */
@media (max-width: 991.98px) {
    html body .apc-navbar .dropdown-submenu > a::after,
    html body .apc-navbar .dropdown-submenu > .dropdown-item::after {
        content: "\F282" !important;      /* chevron-down */
        color: #4fe3ff !important;
        transition: transform .25s ease;
    }
    html body .apc-navbar .dropdown-submenu > .dropdown-item { display: flex; align-items: center; gap: .5rem; }
    html body .apc-navbar .dropdown-submenu:has(> .dropdown-menu.show) > .dropdown-item::after { transform: rotate(180deg); }
}

/* ---------- Ordinateur : espace libre garanti à droite du logo ---------- */
@media (min-width: 992px) {
    html body .apc-navbar .navbar-nav { gap: 0; }
    html body .apc-navbar .navbar-nav > .nav-item > .nav-link { letter-spacing: .03em; padding: .6rem .72rem !important; gap: .4rem; }
    html body .apc-navbar .navbar-collapse { padding-left: 150px; }
}
@media (min-width: 992px) and (max-width: 1199.98px) {
    html body .apc-navbar .navbar-collapse { padding-left: 120px; }
}

/* ---------- Logo un peu plus petit (03/12/2026) ---------- */
@media (min-width: 992px) {
    html body .apc-logo { width: 92px; }
    html body .apc-logo-img { height: 88px !important; top: -8px; }
    html body .apc-navbar .navbar-collapse { padding-left: 120px; }
}
@media (max-width: 991.98px) {
    html body .apc-logo-img,
    html body img.apc-logo-img[src*="logo.png"] { height: 42px !important; max-height: 42px !important; }
}
@media (max-width: 400px) {
    html body .apc-logo-img,
    html body img.apc-logo-img[src*="logo.png"] { height: 38px !important; max-height: 38px !important; }
}
