/* ========================================
   HEADER CSS - Navigation et Header
   ======================================== */

header {
    background: var(--color-bg);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
    will-change: transform;
    height: auto;
    min-height: 80px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(var(--color-bg-rgb, 255, 255, 255), 0.95);
}

/* Animation de disparition/apparition du header */
header.header-hidden {
    transform: translateY(-100%);
}

header:not(.header-hidden) {
    transform: translateY(0);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* ========================================
   LOGO
   ======================================== */

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-shrink: 0;
    min-width: 200px;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.logo-link:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

.logo-img {
    width: 45px;
    height: 45px;
    border-radius: var(--border-radius);
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.logo-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.2;
    white-space: nowrap;
}

.logo-subtitle {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 300;
    line-height: 1.2;
    white-space: nowrap;
}

/* ========================================
   NAVIGATION PRINCIPALE
   ======================================== */

nav ul {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    align-items: center;
    margin: 0;
    padding: 0;
    flex: 1;
    justify-content: center;
}

nav ul li {
    position: relative;
    list-style: none;
}

nav ul li a {
    text-decoration: none;
    color: var(--color-primary);
    font-weight: 500;
    transition: var(--transition-normal);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    display: block;
    white-space: nowrap;
}

nav ul li a:hover {
    color: var(--color-primary);
    background: var(--color-bg-accent);
}

/* ========================================
   MENUS DÉROULANTS
   ======================================== */

.dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.dropdown-toggle::after {
    content: '▼';
    font-size: 0.7rem;
    transition: var(--transition-normal);
    color: var(--text-light);
    margin-left: 0.25rem;
}

.dropdown.active .dropdown-toggle::after {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--color-bg);
    box-shadow: var(--shadow-md);
    border-radius: var(--border-radius);
    min-width: 200px;
    max-width: 250px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition-normal);
    z-index: 1001;
    padding: 0.5rem 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border: 1px solid var(--color-bg-accent);
}

/* Positionnement pour éviter les débordements */
.dropdown:nth-last-child(-n+3) .dropdown-menu {
    right: 0;
    left: auto;
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--color-primary);
    text-decoration: none;
    transition: var(--transition-normal);
    border-radius: 0;
    width: 100%;
    box-sizing: border-box;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.dropdown-menu a:hover {
    background: var(--color-bg-accent);
    color: var(--color-primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--color-bg-accent-more);
    margin: 0.5rem 0;
    border: none;
    width: 100%;
}


/* ========================================
   CONTRÔLES DE NAVIGATION
   ======================================== */

.nav-controls {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-shrink: 0;
    min-width: 200px;
    justify-content: flex-end;
}

/* ========================================
   ICÔNES RÉSEAUX SOCIAUX
   ======================================== */

.social-icons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    color: var(--color-primary);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 1rem;
    border: 1px solid transparent;
}

.social-icon:hover {
    transform: translateY(-2px);
}


/* ========================================
   SÉLECTEUR DE LANGUE
   ======================================== */

.language-selector-custom {
    position: relative;
    flex-shrink: 0;
}

.language-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--color-bg);
    border: 1px solid var(--color-bg-accent);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition-normal);
    font-size: 0.9rem;
    white-space: nowrap;
}

.language-button:hover {
    border-color: var(--color-bg-accent);
}

.language-flag {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.language-flag svg {
    border-radius: 2px;
    overflow: hidden;
    display: block;
    flex-shrink: 0;
    max-width: 20px;
    max-height: 12px;
    width: 20px;
    height: 12px;
}

.language-code {
    font-weight: 500;
    white-space: nowrap;
}

.language-arrow {
    font-size: 0.7rem;
    transition: var(--transition-normal);
    flex-shrink: 0;
}

.language-selector-custom.active .language-arrow {
    transform: rotate(180deg);
}

.language-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--color-bg);
    border: 1px solid var(--color-bg-accent);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition-normal);
    z-index: 1003;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.language-selector-custom.active .language-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--color-text);
    transition: var(--transition-normal);
    width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
}

.language-option:hover {
    background: var(--color-bg-accent);
}

.language-option.active {
    background: var(--color-bg-accent);
}

/* ========================================
   BOUTON HAMBURGER MOBILE
   ======================================== */

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition-normal);
}

.mobile-menu-toggle:hover {
    background: var(--color-bg-accent);
}

.hamburger {
    width: 24px;
    height: 24px;
    position: relative;
    transform: rotate(0deg);
    transition: var(--transition-normal);
}

.hamburger span {
    display: block;
    position: absolute;
    height: 3px;
    width: 100%;
    background: var(--color-primary);
    border-radius: 3px;
    opacity: 1;
    left: 0;
    transform: rotate(0deg);
    transition: var(--transition-normal);
}

.hamburger span:nth-child(1) {
    top: 0px;
}

.hamburger span:nth-child(2),
.hamburger span:nth-child(3) {
    top: 8px;
}

.hamburger span:nth-child(4) {
    top: 16px;
}

.mobile-menu-toggle.active .hamburger span:nth-child(1) {
    top: 8px;
    width: 0%;
    left: 50%;
}

.mobile-menu-toggle.active .hamburger span:nth-child(2) {
    transform: rotate(45deg);
}

.mobile-menu-toggle.active .hamburger span:nth-child(3) {
    transform: rotate(-45deg);
}

.mobile-menu-toggle.active .hamburger span:nth-child(4) {
    top: 8px;
    width: 0%;
    left: 50%;
}

/* ========================================
   RESPONSIVE - MOBILE
   ======================================== */

@media (max-width: 768px) {
    header {
        width: 100%;
        box-sizing: border-box;
    }

    nav {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 1rem;
        position: relative;
        width: 100%;
        box-sizing: border-box;
        min-height: 70px;
    }
    
    /* Masquer nav-controls quand le menu est fermé sur mobile */
    .nav-controls-wrapper {
        display: none !important;
    }

    .logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        min-width: auto;
        flex-shrink: 0;
        z-index: 1;
        max-width: calc(100% - 120px);
    }

    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        order: 3;
        z-index: 1002;
    }

    .main-menu {
        /* Solution propre : complètement invisible quand fermé */
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        background: var(--color-bg);
        z-index: 1001;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        gap: 0;
        padding-top: 80px;
        padding-bottom: 0;
        overflow-x: hidden;
        overflow-y: auto;
        box-sizing: border-box;
        margin: 0;
        padding-left: 0;
        padding-right: 0;
    }
    
    /* Afficher nav-controls quand le menu mobile est ouvert */
    .main-menu .nav-controls-wrapper {
        display: block !important;
    }

    .main-menu.active {
        /* Solution propre : affichage simple */
        display: flex;
    }
    
    /* Blocage du scroll quand menu ouvert */
    .mobile-menu-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
    }

    nav ul {
        flex-direction: column;
        gap: 0;
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        flex: 1;
        overflow: visible;
        position: relative;
    }

    nav ul li {
        width: 100%;
        border-bottom: 1px solid var(--color-bg-accent);
        position: relative;
        display: block;
    }

    nav ul li:not(.dropdown):last-child {
        border-bottom: none;
    }

    nav ul li a {
        display: block;
        padding: 1.5rem 2rem;
        text-align: center;
        font-size: 1.1rem;
        border-radius: 0;
        width: 100%;
        box-sizing: border-box;
    }

    /* Bouton reservation centré sur mobile */
    nav ul li .generic-button {
        display: block;
        text-align: center;
        margin: 1rem 2rem;
        padding: 1.25rem;
        width: calc(100% - 4rem);
        box-sizing: border-box;
    }

    .generic-button {
        margin: 1rem 2rem;
        padding: 1rem 2rem;
        text-align: center;
        border-radius: var(--border-radius);
        background: var(--color-primary);
        color: white;
    }

    .dropdown {
        width: 100%;
        position: relative;
        display: block;
    }

    .dropdown-toggle {
        justify-content: center;
        width: 100%;
        padding: 1.5rem 2rem;
        border-bottom: 1px solid var(--color-bg-accent);
        margin: 0;
        position: relative;
        z-index: auto;
    }

    .dropdown-toggle::after {
        margin-left: 0.5rem;
    }

    .dropdown-toggle:hover {
        background: var(--color-bg-accent);
    }

    .dropdown-menu {
        display: none;
        position: static;
        width: 100vw;
        max-width: none;
        min-width: auto;
        margin-left: calc(-50vw + 50%);
        background: var(--color-bg-secondary);
        border-radius: 0;
        padding: 0;
        box-shadow: none;
        border: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        z-index: auto;
    }

    .dropdown.active .dropdown-menu {
        display: block;
        animation: slideDown 0.3s ease;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .dropdown-menu li {
        border-bottom: 1px solid var(--color-bg-accent);
        width: 100%;
        position: relative;
        display: block;
        margin: 0;
        padding: 0;
    }

    .dropdown-menu li:last-child {
        border-bottom: none;
    }

    .dropdown-menu a {
        padding: 1.25rem 2rem;
        text-align: center;
        font-size: 0.95rem;
        border-bottom: none;
        display: block;
        width: 100%;
        box-sizing: border-box;
        position: relative;
        z-index: auto;
        margin: 0;
    }

    .dropdown-menu a::before {
        content: '→ ';
        color: var(--color-primary);
        font-weight: bold;
        margin-right: 0.5rem;
    }

    .dropdown-menu a:hover {
        background: var(--color-bg-accent);
        color: var(--color-primary);
        transform: none;
    }

    .dropdown-menu a:hover::before {
        color: var(--color-primary-dark);
    }

    /* Dividers dans les menus */
    .dropdown-menu .dropdown-divider {
        height: 1px;
        background: var(--color-bg-accent);
        margin: 0;
        border: none;
    }

    .nav-controls-wrapper {
        width: 100%;
        order: 999;
        border-top: 1px solid var(--color-bg-accent);
        background: var(--color-bg-secondary);
        margin-top: auto;
        z-index: 1000;
        position: relative;
    }
    
    .main-menu .nav-controls {
        display: flex !important;
        flex-direction: column;
        gap: 1rem;
        width: 100%;
        padding: 2rem;
        align-items: center;
        z-index: 1001;
        position: relative;
        min-width: auto;
        justify-content: center;
    }

    /* Fix language selector on mobile */
    .nav-controls .language-selector-custom {
        position: relative;
        width: auto;
        display: flex;
        align-self: center;
        z-index: 1002;
    }

    .nav-controls .language-button {
        min-width: 80px;
        justify-content: center;
        z-index: 1002;
    }

    .nav-controls .language-dropdown {
        position: absolute;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
        top: auto;
        margin-bottom: 0.5rem;
        z-index: 1003;
    }

    .nav-controls .social-icons {
        gap: 1rem;
        justify-content: center;
        align-self: center;
        z-index: 1002;
    }
    
    .nav-controls .social-icon {
        z-index: 1002;
    }

    .logo-link {
        gap: 0.6rem;
    }

    .logo-img {
        width: 40px;
        height: 40px;
    }

    .logo-title {
        font-size: 1.2rem;
    }

    .logo-subtitle {
        font-size: 0.7rem;
    }

    /* Overlay pour fermer le menu en cliquant à l'extérieur */
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: var(--transition-normal);
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    .mobile-menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

@media (max-width: 480px) {
    nav {
        padding: 0.5rem 0.75rem;
        min-height: 65px;
    }

    .logo {
        max-width: calc(100% - 100px);
    }

    .language-button {
        font-size: 0.8rem;
        padding: 0.3rem 0.5rem;
    }

    .logo-title {
        font-size: 1.1rem;
    }

    .logo-subtitle {
        font-size: 0.65rem;
    }
}

/* Très petites résolutions (moins de 280px) */
@media (max-width: 280px) {
    nav {
        padding: 0.5rem;
        min-height: 60px;
    }

    .logo {
        max-width: calc(100% - 80px);
    }

    .logo-title {
        font-size: 1rem;
    }

    .logo-subtitle {
        font-size: 0.6rem;
    }

    .mobile-menu-toggle {
        padding: 0.25rem;
    }

    .hamburger {
        width: 20px;
        height: 20px;
    }

    .language-button {
        font-size: 0.7rem;
        padding: 0.25rem 0.4rem;
        min-width: 70px;
    }

    /* Force small flags on very small screens */
    .language-flag svg {
        width: 16px !important;
        height: 10px !important;
        max-width: 16px !important;
        max-height: 10px !important;
    }

    /* Ensure no overflow on very small screens */
    .language-flag {
        width: 16px;
        height: 10px;
        overflow: hidden;
        flex-shrink: 0;
    }

    .language-option .language-flag {
        width: 16px;
        height: 10px;
        overflow: hidden;
    }

    .main-menu {
        padding-top: 70px;
        padding-bottom: 0;
    }
}