/**
 * Hamburger Menu Responsive Styles
 * Styles pour le menu mobile sur les petits écrans
 */

/* Structure de la navigation */
.nav-logo-section {
    flex: 0 0 auto;
    width: auto;
    display: flex;
    justify-content: flex-start;
    position: relative;
    z-index: 10;
    min-height: 0;
    margin-right: auto;
}

.nav-logo-section img {
    display: block;
    position: relative;
    z-index: 11;
    flex-shrink: 0;
    width: auto;
    height: 280px;
    margin: 0 0 -100px 0;
}

.hamburger-menu {
    display: none !important;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    position: relative;
    z-index: 20;
    flex-shrink: 0;
}

.hamburger-menu:hover {
    opacity: 0.8;
}

.nav-links {
    flex: 0 1 auto;
    order: 3;
    width: 100%;
}

/* Desktop navigation - show links normally */
@media (min-width: 769px) {
    .nav-container {
        flex-wrap: nowrap;
        align-items: center;
        gap: 1rem;
    }
    
    .nav-logo-section {
        flex: 0 0 auto;
        margin-right: 0;
    }
    
    .nav-links {
        display: flex !important;
        order: 2;
        width: auto;
        flex: 1 0 auto;
        margin: 0;
        padding: 0;
        position: static;
        background: transparent;
        gap: 2rem;
        min-width: auto;
        overflow: visible;
    }
    
    .nav-controls {
        order: 3;
        margin-left: auto;
        flex-shrink: 0;
    }
}

.nav-links.mobile-open {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    background: #ffffff;
    gap: 0;
    padding: 6rem 2rem 2rem; /* Space for the X button */
    z-index: 2000; /* High z-index to cover everything */
    width: 100vw;
    margin: 0;
    box-shadow: none;
    overflow-y: auto;
    
    /* Animation */
    animation: menuOpen 0.4s ease-out forwards;
    transform-origin: top right;
}

@keyframes menuOpen {
    0% {
        opacity: 0;
        transform: scale(0.8) translate(20%, -20%);
        border-bottom-left-radius: 50%;
    }
    100% {
        opacity: 1;
        transform: scale(1) translate(0, 0);
        border-bottom-left-radius: 0;
    }
}

/* Ensure the hamburger/close button is above the menu */
.hamburger-menu {
    z-index: 2001; /* Higher than the menu */
    transition: transform 0.3s ease;
}

.hamburger-menu.active {
    /* Removed fixed positioning to keep it in flow with other controls */
    color: #333 !important; /* Dark color for X to be visible on white menu */
    transform: rotate(90deg);
    display: block !important; /* Force display */
    opacity: 1 !important; /* Force opacity */
    visibility: visible !important; /* Force visibility */
}

.nav-links.mobile-open a {
    padding: 1rem 0;
    display: block;
    width: 100%;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    text-align: left; /* Reverted to left alignment */
}

.nav-links.mobile-open a:hover {
    background: #f8f9fa;
    color: #667eea;
}

.nav-links.mobile-open .nav-item {
    width: 100%;
}

.nav-links.mobile-open .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    background: #f8f9fa;
    min-width: 100%;
    max-width: 100%;
    border-radius: 0;
    box-shadow: none;
    grid-template-columns: 1fr;
    margin-top: 0;
}

.nav-links.mobile-open .dropdown-menu a {
    padding: 0.6rem 2rem 0.6rem 4rem;
    border-left: none;
    color: #555;
    border-bottom: 1px solid #eee;
}

.nav-links.mobile-open .dropdown-menu a:hover {
    background: #eef2f7;
    border-left: none;
    padding-left: 4rem;
    color: #667eea;
}

/* Mobile responsive - show hamburger at 768px */
@media (max-width: 768px) {
    .hamburger-menu {
        display: block !important;
    }
    
    .nav-links {
        display: none !important;
    }
    
    .nav-links.mobile-open {
        display: flex !important;
    }
    
    .nav-container {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 0.5rem;
        position: relative;
        overflow: visible;
        min-height: 280px;
    }
    
    .nav-logo-section {
        width: 100%;
        margin-bottom: 0;
        margin-right: 0;
        pointer-events: auto;
        min-height: auto;
        order: 1;
        z-index: 10; /* Keep logo below menu */
    }
    
    .nav-controls {
        position: absolute;
        top: 1rem;
        right: 1rem;
        order: 2;
        width: auto;
        justify-content: flex-end;
        padding-right: 0;
        z-index: 2001; /* Ensure controls are above menu */
        min-height: 2rem;
        align-items: center;
        flex-shrink: 0;
        display: flex;
        gap: 1rem;
    }
    
    .nav-links.mobile-open {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        height: 100vh;
        background: #ffffff;
        gap: 0;
        padding: 6rem 2rem 2rem; /* Space for the X button */
        z-index: 2000; /* High z-index to cover everything */
        width: 100vw;
        margin: 0;
        box-shadow: none;
        overflow-y: auto;
        order: unset;
        border-top: none;
    }

    .nav-links.mobile-open a {
        color: #333;
        border-bottom: 1px solid #f5f5f5;
    }

    .nav-links.mobile-open a:hover {
        background: #f9f9f9;
        color: #0066cc;
    }

    .nav-links.mobile-open .dropdown-menu {
        background: #f8f9fa;
    }

    .nav-links.mobile-open .dropdown-menu a {
        color: #555;
        border-bottom: 1px solid #eee;
    }

    .nav-links.mobile-open .dropdown-menu a:hover {
        background: #eee;
        color: #0066cc;
    }
    
    /* Ensure logo doesn't block navigation */
    .nav-logo-section img {
        pointer-events: auto;
        max-width: 100%;
    }
    
    /* Add padding to body to account for logo overflow on very small screens */
    @media (max-width: 450px) {
        body {
            padding-top: 0;
        }
        
        nav {
            padding: 0.5rem 0;
            overflow: visible;
        }
        
        .nav-container {
            min-height: 180px;
        }
        
        .nav-logo-section img {
            height: 150px !important;
            margin: 0 0 -50px 0 !important;
        }
        
        .nav-controls {
            top: 0.5rem;
            right: 0.5rem;
        }
    }
}

/* Language Selector Styles when Mobile Menu is Open */
body.mobile-menu-open .language-btn {
    color: #333;
    border: 1px solid #ccc;
    background: transparent;
}

body.mobile-menu-open .language-btn.active {
    background: white;
    color: #0066cc;
    border: 1px solid #0066cc;
}

