/* ========================================
   NAVIGATION RESPONSIVE AMÃ‰LIORÃ‰E
   OPC Wallonie - Version 2.3
   Support iOS Safe Areas + Footer fix
   ======================================== */

/* === Variables CSS pour cohÃ©rence === */
:root {
    --nav-primary: #2E2F73;
    --nav-secondary: #CAC8D8;
    --nav-hover: #1a1b45;
    --nav-text: #333;
    --nav-text-light: #fff;
    --nav-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --touch-min-size: 44px; /* Taille minimale recommandÃ©e pour zones tactiles */
    --transition-speed: 0.3s;
    --header-height: 70px;
    --footer-height: 70px; /* Augmenté pour plus de marge */
}

/* === GESTION DES SAFE AREAS iOS === */
/* Padding du body pour header et footer fixes + safe areas iOS */
body {
    padding-top: calc(var(--header-height) + 25px) !important;
    padding-bottom: calc(var(--footer-height) + 40px) !important;
}

/* Support iOS Safe Areas (encoche, barre home, etc.) */
@supports (padding: env(safe-area-inset-top)) {
    body {
        padding-top: calc(var(--header-height) + 25px + env(safe-area-inset-top)) !important;
        padding-bottom: calc(var(--footer-height) + 40px + env(safe-area-inset-bottom)) !important;
    }
}

/* === HEADER PRINCIPAL === */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #fff;
    box-shadow: var(--nav-shadow);
    z-index: 1010; /* Au-dessus du menu mobile pour que le X reste cliquable */
}

/* Support iOS safe area pour le header */
@supports (padding: env(safe-area-inset-top)) {
    .site-header {
        padding-top: env(safe-area-inset-top);
    }
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
}

/* Logo dans le header - CLIQUABLE pour retour accueil */
.header-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    cursor: pointer;
    transition: opacity var(--transition-speed);
}

.header-logo:hover {
    opacity: 0.8;
}

.header-logo img {
    height: 50px;
    width: auto;
}

.header-logo-text {
    font-size: 1.1em;
    font-weight: bold;
    color: var(--nav-primary);
    margin-left: 10px;
}

/* === NAVIGATION PRINCIPALE (Desktop) === */
.main-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 5px;
}

.nav-links li {
    margin: 0;
}

.nav-links a {
    display: block;
    padding: 12px 18px;
    color: var(--nav-text);
    text-decoration: none;
    font-size: 1.05em;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 6px;
    transition: all var(--transition-speed);
}

.nav-links a:hover {
    background-color: var(--nav-secondary);
    color: var(--nav-primary);
}

/* === BOUTONS CTA (Call to Action) === */
.nav-cta {
    display: flex;
    gap: 10px;
}

.btn-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    min-height: var(--touch-min-size);
    font-size: 0.95em;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: all var(--transition-speed);
    white-space: nowrap;
    /* Style par dÃ©faut : contour sans fond */
    background-color: transparent;
    color: var(--nav-primary);
    border: 2px solid var(--nav-primary);
}

.btn-cta:hover {
    background-color: var(--nav-primary);
    color: var(--nav-text-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 47, 115, 0.3);
}

/* CompatibilitÃ© avec les anciennes classes */
.btn-cta-primary,
.btn-cta-secondary {
    background-color: transparent;
    color: var(--nav-primary);
    border: 2px solid var(--nav-primary);
}

.btn-cta-primary:hover,
.btn-cta-secondary:hover {
    background-color: var(--nav-primary);
    color: var(--nav-text-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 47, 115, 0.3);
}

/* IcÃ´nes dans les boutons */
.btn-icon {
    font-size: 1.2em;
}

/* === MENU HAMBURGER (Mobile) === */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: var(--touch-min-size);
    height: var(--touch-min-size);
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1012; /* Au-dessus de tout */
}

.hamburger-line {
    width: 28px;
    height: 3px;
    background-color: var(--nav-primary);
    margin: 3px 0;
    border-radius: 2px;
    transition: all var(--transition-speed);
}

/* Animation hamburger -> X */
.hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* === MENU MOBILE (Overlay) === */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height pour iOS */
    background-color: rgba(255, 255, 255, 0.98);
    z-index: 1001;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed), visibility var(--transition-speed);
}

/* Padding top pour le menu mobile avec safe area */
.mobile-menu {
    padding-top: calc(var(--header-height) + 20px);
}

@supports (padding: env(safe-area-inset-top)) {
    .mobile-menu {
        padding-top: calc(var(--header-height) + 20px + env(safe-area-inset-top));
        padding-bottom: env(safe-area-inset-bottom);
    }
}

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

.mobile-menu-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    gap: 15px;
}

/* Boutons CTA en mobile - GRAND et facilement touchable */
.mobile-cta-section {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px 15px;
    border-bottom: 1px solid #eee;
    box-sizing: border-box;
}

/* Boutons CTA mobile - Style uniforme (contour) */
.mobile-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: calc(100% - 10px); /* Légèrement plus petit pour éviter débordement */
    max-width: 100%;
    min-height: 56px; /* Plus grand que le minimum pour meilleur confort */
    padding: 16px 15px;
    font-size: 1.05em;
    font-weight: 600;
    text-decoration: none;
    border-radius: 12px;
    transition: all var(--transition-speed);
    box-sizing: border-box;
    margin: 0 auto; /* Centrage */
    /* Style uniforme : contour sans fond */
    background-color: transparent;
    color: var(--nav-primary);
    border: 2px solid var(--nav-primary);
}

.mobile-cta-btn:hover,
.mobile-cta-btn:active {
    background-color: var(--nav-primary);
    color: var(--nav-text-light);
    transform: scale(1.02);
}

/* Liens de navigation mobile */
.mobile-nav-links {
    list-style: none;
    margin: 0;
    padding: 20px 0;
    width: 100%;
    max-width: 400px;
}

.mobile-nav-links li {
    margin: 0;
}

.mobile-nav-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: var(--touch-min-size);
    padding: 15px 20px;
    color: var(--nav-text);
    text-decoration: none;
    font-size: 1.1em;
    font-weight: 500;
    border-radius: 8px;
    transition: background-color var(--transition-speed);
}

.mobile-nav-links a:hover,
.mobile-nav-links a:active {
    background-color: var(--nav-secondary);
}

/* Informations de contact en mobile */
.mobile-contact-info {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 0.9em;
    border-top: 1px solid #eee;
    width: 100%;
    max-width: 400px;
}

.mobile-contact-info a {
    color: var(--nav-primary);
    text-decoration: none;
    font-weight: 500;
}

/* === FOOTER FIX POUR iOS === */
footer {
    padding-top: 12px !important;
    padding-bottom: 20px !important;
}

/* Assurer que le footer ne chevauche pas le contenu */
.footer-content {
    padding-bottom: 8px;
}

@supports (padding: env(safe-area-inset-bottom)) {
    footer {
        padding-bottom: calc(20px + env(safe-area-inset-bottom)) !important;
    }
}

/* === RESPONSIVE === */

/* Tablettes (768px - 992px) : Hamburger + boutons CTA complets */
@media (max-width: 992px) {
    /* Masquer les liens texte de navigation */
    .nav-links {
        display: none;
    }
    
    /* Afficher le hamburger sur tablette */
    .hamburger-btn {
        display: flex;
    }
    
    /* Afficher le menu mobile sur tablette aussi */
    .mobile-menu {
        display: block;
    }
    
    /* Garder les boutons CTA visibles avec texte complet */
    .nav-cta {
        display: flex;
        gap: 8px;
        margin-right: 10px; /* Espace avant le hamburger */
    }
    
    .btn-cta {
        padding: 10px 14px;
        font-size: 0.85em;
    }
    
    /* Le texte reste visible sur tablette ! */
    .btn-cta .btn-text {
        display: inline;
    }
    
    .btn-cta .btn-icon {
        font-size: 1.1em;
    }
}

/* Mobile (< 768px) : Hamburger seul, CTA dans le menu */
@media (max-width: 768px) {
    :root {
        --header-height: 60px;
        --footer-height: 75px;
    }
    
    /* IMPORTANT: Forcer des paddings plus grands sur mobile */
    body {
        padding-top: calc(var(--header-height) + 30px) !important;
        padding-bottom: calc(var(--footer-height) + 50px) !important;
    }
    
    @supports (padding: env(safe-area-inset-top)) {
        body {
            padding-top: calc(var(--header-height) + 30px + env(safe-area-inset-top)) !important;
            padding-bottom: calc(var(--footer-height) + 50px + env(safe-area-inset-bottom)) !important;
        }
    }
    
    /* Cacher les CTA du header en mobile - ils sont dans le menu */
    .nav-cta {
        display: none;
    }
    
    .header-logo img {
        height: 40px;
    }
    
    .header-logo-text {
        font-size: 0.95em;
    }
}

/* Petits mobiles (< 480px) */
@media (max-width: 480px) {
    body {
        padding-top: calc(var(--header-height) + 35px) !important;
        padding-bottom: calc(var(--footer-height) + 55px) !important;
    }
    
    @supports (padding: env(safe-area-inset-bottom)) {
        body {
            padding-bottom: calc(var(--footer-height) + 55px + env(safe-area-inset-bottom)) !important;
        }
    }
    
    .header-container {
        padding: 8px 15px;
    }
    
    .header-logo-text {
        display: none;
    }
    
    .mobile-cta-btn {
        font-size: 1em;
        padding: 14px 16px;
    }
}

/* TrÃ¨s petits Ã©crans (< 360px) */
@media (max-width: 360px) {
    body {
        padding-bottom: calc(var(--footer-height) + 60px) !important;
    }
    
    .mobile-cta-btn {
        font-size: 0.95em;
        padding: 12px 14px;
    }
}

/* === Ã‰TATS FOCUS POUR ACCESSIBILITÃ‰ === */
.btn-cta:focus,
.nav-links a:focus,
.mobile-nav-links a:focus,
.mobile-cta-btn:focus,
.hamburger-btn:focus,
.header-logo:focus {
    outline: 3px solid var(--nav-secondary);
    outline-offset: 2px;
}

/* === ANIMATION D'ENTRÃ‰E MENU MOBILE === */
@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-menu.active .mobile-menu-content > * {
    animation: slideInFromTop 0.3s ease forwards;
}

.mobile-menu.active .mobile-menu-content > *:nth-child(1) { animation-delay: 0.05s; }
.mobile-menu.active .mobile-menu-content > *:nth-child(2) { animation-delay: 0.1s; }
.mobile-menu.active .mobile-menu-content > *:nth-child(3) { animation-delay: 0.15s; }

/* === SUPPRESSION DE L'ANCIEN BANDEAU === */
/* Si tu gardes la classe .top-banner dans le HTML mais veux la cacher */
.top-banner {
    display: none !important;
}
