/* Styles pour le logo */
nav .logo {
    z-index: 9999;
    display: flex;
    align-items: center;
    position: relative;
}

nav .logo-img {
    height: 60px;
    width: auto;
    margin-right: 1rem;
}

/* Styles de base pour la navigation mobile */
.main-nav {
    z-index: 9999;
    font-family: 'Arial', sans-serif;
    letter-spacing: 1px;
    color: var(--color-secondary);
    background: var(--color-accent);
    padding: 1rem;
    position: fixed;
    top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
    transition: transform 0.3s ease-in-out;
}

.main-nav.hidden {
  transform: translateY(-100%);
}

.main-nav > * {
    position: relative;
}

.main-nav.sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

body.nav-active {
}

.nav-bar {
    z-index: 9999;
}

/* Bouton burger visible par défaut en mobile */
.burger-btn {
    display: block;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1000;
    margin-left: auto;
    position: relative;
}

/* Styles des lignes du bouton burger */
.burger-line {
    display: block;
    width: 25px;
    height: 3px;
    background: white;
    margin: 5px 0;
    transition: transform 0.3s, opacity 0.3s;
}

/* Menu principal caché par défaut en mobile */
.nav-list {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100vh;
    background: var(--color-accent);
    list-style: none;
    padding: 6rem 0 0;
    margin: 0;
    flex-direction: column;
    order: 3;
    transition: right 0.3s ease-in-out;
    z-index: 990;
    overflow-y: auto;
}

/* Menu visible lorsqu'activé */
.nav-list.active {
    right: 0;
    display: flex;
}

/* Styles des liens de navigation */
.nav-link, .submenu-link {
    display: block;
    padding: 0.8rem 1rem;
    color: white;
    text-decoration: none;
    transition: background 0.3s ease-in-out, color 0.3s ease-in-out;
}

/* Sous-sous menus invisibles en mobile */
.subsubmenu-link {
    display : none;
}

/* Icônes pour les menus déroulants */
.dropdown-icon {
    display: none;
    margin-left: 0.5rem;
    font-size: 0.7em;
}

/* Sous-menus en mobile */
.submenu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 53%;
    height: 100vh;
    background: var(--color-primary);
    list-style: none;
    padding: 6rem 0 0 0.5rem;
    transition: right 0.3s ease-in-out;
    z-index: 995;
    overflow-y: auto;
    box-sizing: border-box;
}

.nav-list > li:nth-of-type(2) > .submenu > li:nth-of-type(1) {
    padding: 2.9em 0 0;
}

.nav-list > li:nth-of-type(3) > .submenu > li:nth-of-type(1) {
    padding: 5.6em 0 0;
}

.nav-list > li:nth-of-type(4) > .submenu > li:nth-of-type(1) {
    padding: 8.4em 0 0;
}

.nav-list > li:nth-of-type(5) > .submenu > li:nth-of-type(1) {
    padding: 11.2em 0 0;
}

.nav-list > li:nth-of-type(6) > .submenu > li:nth-of-type(1) {
    padding: 13.8em 0 0;
}

.nav-list > li:nth-of-type(7) > .submenu > li:nth-of-type(1) {
    padding: 16.5em 0 0;
}

/* Sous-menus visibles lorsqu'activés en mobile */
.submenu.active {
    right: 0;
    display: block;
}

/* Style pour les éléments nav-item non actifs quand un sous-menu est actif */
.nav-list:has(.submenu.active) .nav-item:not(:has(.submenu.active)) {
  opacity: 0.6;
  transition: opacity 0.3s ease-in-out;
}

/* Sous-sous menus invisibles en mobile */
.subsubmenu, .subsubmenu.active {
    display: none;
}


/* Bouton de retour pour les subsubmenu */
.back-button {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    background: none;
    border: none;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0.5rem;
}

.back-button:before {
    content: '←';
    margin-right: 0.5rem;
    font-size: 1.2rem;
}

/* Animation du bouton burger lorsqu'ouvert */
.burger-btn.open .burger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.burger-btn.open .burger-line:nth-child(2) {
    opacity: 0;
}

.burger-btn.open .burger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Animation du bouton burger en mode retour */
.burger-btn.back .burger-line:nth-child(1) {
    transform: translateY(0) rotate(-45deg);
    width: 100%;
    margin-left: auto;
}

.burger-btn.back .burger-line:nth-child(2) {
    opacity: 0;
}

.burger-btn.back .burger-line:nth-child(3) {
    transform: translateY(0) rotate(45deg);
    width: 100%;
    margin-left: auto;
}

/* Styles pour le bouton téléphone */
.phone-btn {
    z-index: 9999;
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--color-accent);
    color: white;
    text-decoration: none;
    border: 2px solid white;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.phone-btn:hover {
    background: var(--color-secondary);
    color: var(--color-accent) !important;
}

.phone-icon {
    margin-right: 0.5rem;
}

/* Affichage mobile */
.mobile-phone {
    display: flex;
    margin-right: auto;
}

.desktop-phone {
    display: none;
}

/* Styles pour les éléments actifs en mobile */
.nav-item.active > .nav-link,
.submenu-item.active > .submenu-link {
    color: var(--color-secondary);
}

/* Style pour les liens parents */
.parent-link {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Styles pour la version desktop */
@media (min-width: 768px) {
    .main-nav {
        display: flex;
        justify-content: flex-start;
        align-items: center;
    }

    .burger-btn {
        display: none;
    }

    .nav-list {
        position: static;
        display: flex;
        flex-direction: row;
        width: auto;
        height: auto;
        background: transparent;
        padding: 0;
        margin-right: auto;
        order: 1;
        transition: none;
        overflow: visible;
    }

    .nav-item {
        position: relative;
    }

    /* Effet hover sur les liens */
    .nav-link:hover, .submenu-link:hover, .subsubmenu-link:hover {
        border-radius: 4px;
        background: var(--color-secondary);
        color: var(--color-accent) !important;
    }

    .submenu-item {
        position: relative;
    }

    .submenu, .subsubmenu {
        position: absolute;
        min-width: 200px;
        height: auto;
        padding: 0;
        z-index: 5000;
        background: var(--color-accent);
        list-style: none;
        display: block;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
        right: auto;
        overflow: visible;
    }

    .submenu {
        top: 100%;
        left: 0;
    }

    .subsubmenu {
        top: 0;
        left: 100%;
        width: auto;
    }

    .nav-item:hover > .submenu {
        opacity: 1;
        visibility: visible;
    }

    .submenu-item:hover > .subsubmenu {
        opacity: 1;
        visibility: visible;
    }
    
    .dropdown-icon {
        margin-left: 0.5rem;
        font-size: 0.7em;
    }

    .nav-list > li:nth-of-type(2) > .submenu > li:nth-of-type(1) {
        padding: 0 0;
    }
    
    .nav-list > li:nth-of-type(3) > .submenu > li:nth-of-type(1) {
        padding: 0 0;
    }
    
    .nav-list > li:nth-of-type(4) > .submenu > li:nth-of-type(1) {
        padding: 0 0;
    }
    
    .nav-list > li:nth-of-type(5) > .submenu > li:nth-of-type(1) {
        padding: 0 0;
    }
    
    .nav-list > li:nth-of-type(6) > .submenu > li:nth-of-type(1) {
        padding: 0 0;
    }

    .nav-list > li:nth-of-type(7) > .submenu > li:nth-of-type(1) {
        padding: 0 0;
    }
    
    .mobile-phone {
        display: none;
    }

    .desktop-phone {
        display: flex;
        order: 2;
    }

    .back-button {
        display: none;
    }
    
    .parent-link {
        /* display: none; */
    }
    .submenu-item.parent-link {
        display: block;
    }
    .submenu-link.parent-link {
        display: block;
        padding: 0.8rem 1rem;
        color: white;
        text-decoration: none;
        transition: background 0.3s ease-in-out, color 0.3s ease-in-out;
    }
}