/* nav.css - navigation specific rules (desktop & mobile) */

/* Navbars : desktop/tablette vs mobile */
/* Add horizontal padding so logo and content aren't flush to the viewport edge */
.nav-desktop {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 18px;
}

/* Make navbar items visually consistent: same height, centered, framed like dropdowns */
.nav-desktop ul li {
    display: flex;
    align-items: center;
    height: 48px;
}

.nav-desktop .navbtn {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    /* bordure visible par défaut */
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    height: 34px;
    box-sizing: border-box;
    transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.18s ease;
}

/* Ensure top-level nav anchors (Accueil, SVT, JV, Crédits) get the same visible frame */
.nav-desktop>ul>li>a.navbtn,
.nav-desktop>ul>li>.dropdown-header>.navbtn,
.nav-desktop>ul>li>.dropdown-header>.dropdown-toggle {
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    padding: 8px 12px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.18s ease;
}

.nav-desktop .navbtn:hover {
    border-color: rgba(255, 102, 0, 0.35);
    background: rgba(255, 102, 0, 0.06);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

/* Logo box: subtler, smoother transition */
.nav-desktop .logo {
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.03);
    background: rgba(255, 255, 255, 0.01);
    margin-left: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.18s ease;
}

.nav-desktop .logo:hover {
    background: rgba(255, 255, 255, 0.03);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.nav-desktop .logo img {
    display: block;
}

.nav-mobile {
    display: none;
}

/* Ensure dropdowns in desktop are positioned and visible cleanly avec animations */
.nav-desktop ul {
    display: flex;
    gap: 18px;
    margin: 0;
    padding: 0;
    list-style: none;
    align-items: center;
}

.nav-desktop .dropdown {
    position: relative;
}

.nav-desktop .dropdown .dropdown-content {
    position: absolute;
    /* center the dropdown under its parent item */
    left: 50%;
    top: 80%;
    z-index: 200;
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    /* translateX centers horizontally, translateY keeps the subtle offset for the closed state */
    transform: translateX(-50%) translateY(10px);
    transition: opacity 0.28s cubic-bezier(.2, .9, .2, 1), transform 0.28s cubic-bezier(.2, .9, .2, 1), visibility 0.28s;
    /* bordure visible par défaut, même apparence que les boutons */
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    padding: 8px;
    /* keep consistent spacing (overrides inline if needed) */
    background-clip: padding-box;
}

/* Dark theme: increase border contrast and tweak shadows for better visibility */
body.theme-dark .nav-desktop .navbtn,
body.theme-dark .nav-desktop>ul>li>a.navbtn,
body.theme-dark .nav-desktop .dropdown-header .navbtn,
body.theme-dark .nav-desktop .dropdown-header .dropdown-toggle {
    border-color: rgba(255, 255, 255, 0.18) !important;
    background: rgba(255, 255, 255, 0.02) !important;
    box-shadow: 0 6px 18px rgba(255, 255, 255, 0.03) !important;
}

body.theme-dark .nav-desktop .dropdown .dropdown-content {
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6) !important;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0.01));
}

body.theme-dark .nav-desktop .logo {
    border-color: rgba(255, 255, 255, 0.06) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
}

/* Open dropdown via .open class (used by click handlers) */
.nav-desktop .dropdown.open .dropdown-content {
    opacity: 1;
    visibility: visible;
    /* keep horizontal centering while removing the vertical offset */
    transform: translateX(-50%) translateY(0);
    top: 100%;
}

/* Animation de la flèche desktop */
.nav-desktop .dropdown .arrow {
    display: inline-block;
    transition: transform 0.3s ease;
}

.nav-desktop .dropdown.open .arrow {
    transform: rotate(180deg);
}

/* Keyboard focus styles for better accessibility */
.nav-desktop .dropdown-toggle:focus,
.nav-desktop a:focus {
    outline: 3px solid rgba(255, 102, 0, 0.25);
    outline-offset: 2px;
    border-radius: 6px;
}

/* Make the small arrow button clearly clickable */
.nav-desktop .dropdown-toggle {
    cursor: pointer;
    background: transparent;
    border: none;
}

/* Menu mobile avec animations */
#mobile-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
    background: rgba(0, 0, 0, 0.85);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out, padding 0.4s ease-in-out;
}

#mobile-menu.show {
    max-height: 500px;
    /* hauteur maximale estimée */
    padding: 10px;
}

/* Mobile nav should inherit theme/font from body so it matches desktop theme */
.nav-mobile {
    background: inherit;
    color: inherit;
    padding: 8px 12px;
    font-family: inherit;
}

.nav-mobile a {
    color: inherit;
    padding: 8px 6px;
    text-decoration: none;
    display: block;
}

/* Mobile submenu styles avec animations */
.mobile-submenu-toggle {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 10px 6px;
    font-size: 1em;
    color: inherit;
    cursor: pointer;
    font-family: inherit;
}

.mobile-submenu-toggle .arrow {
    display: inline-block;
    margin-left: 4px;
    transition: transform 0.3s ease;
}

.mobile-submenu-toggle[aria-expanded="true"] .arrow {
    transform: rotate(180deg);
}

.mobile-submenu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: inherit;
    max-height: 0;
    overflow: hidden;
    padding: 0;
    opacity: 0;
    transition: max-height 0.3s ease-in-out, opacity 0.2s ease-in-out, padding 0.3s ease-in-out;
}

.mobile-submenu:not([hidden]) {
    max-height: 200px;
    opacity: 1;
    padding: 6px 6px 10px 12px;
}

/* Responsive switches */
@media screen and (max-width: 768px) {
    .nav-desktop {
        display: none;
    }

    .nav-mobile {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 12px;
    }

    #mobile-menu {
        width: 100%;
    }
}

/* Style du logo inspiré de la page 503 (sans effet de couleur) */
.logo img {
    transition: transform 0.3s ease !important;
}

.logo img:hover {
    transform: scale(1.1) rotate(5deg) !important;
}