/**
 * Carlisi - Crelan Liège
 * Styles responsive - VERSION CORRIGÉE
 * @version 2.1
 * @date 2025-11-18
 * 
 * CORRECTIONS APPORTÉES :
 * - Menu hamburger mobile complètement fonctionnel
 * - Z-index corrigé pour la croix (X)
 * - Menu positionné plus bas pour éviter superposition
 * - Liens cliquables dans le mega-menu mobile
 */

/* ============================================================================
   TABLETTE (max-width: 1024px)
   ========================================================================= */
@media (max-width: 1024px) {

    /* Typographie */
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.375rem;
    }

    .section-title {
        font-size: 2rem;
    }

    /* Hero */
    .hero-content-wrapper {
        gap: 2rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.25rem;
    }

    /* Image bâtiment adaptée */
    .building-image {
        max-width: 90%;
    }

    /* Mega menu */
    .mega-menu {
        min-width: 500px;
    }

    .mega-menu-content {
        gap: 1.5rem;
    }

    /* Grilles */
    .advantages-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }

    /* Avis */
    .reviews-carousel {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Actualités - 3 colonnes sur tablette */
    .news-carousel {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================================================
   MOBILE (max-width: 768px)
   ========================================================================= */
@media (max-width: 768px) {

    /* Container */
    .container {
        padding: 0 15px;
    }

    /* Typographie */
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .section-title {
        font-size: 1.75rem;
    }

    .section-subtitle {
        font-size: 1rem;
    }

    /* Boutons */
    .btn-lg {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }

    /* Header */
    .header-content {
        justify-content: space-between;
        /* Pousse le logo Crelan à gauche et le reste à droite */
        width: 100%;
    }

    .header-right {
        gap: 1rem;
    }

    .logo-crelan img,
    .logo-carlisi img {
        height: 40px;
    }

    /* ============================================================================
       MOBILE MENU - CLEAN REFACTORED VERSION
       ========================================================================= */

    /* Menu burger button - MUST be above everything */
    .menu-toggle {
        display: flex;
        position: relative;
        z-index: 11001 !important;
        /* Above menu (11000) */
    }

    .menu-toggle.active {
        position: fixed;
        right: 15px;
        top: 15px;
        z-index: 11001;
        /* Above menu (11000) */
    }

    /* Mobile navigation panel - MUST be above overlay */
    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 400px;
        height: 100vh;
        background-color: var(--color-black);
        transition: right 0.3s ease;
        overflow-y: auto;
        z-index: 11000 !important;
        /* Above overlay (10999) */
        border-left: 3px solid var(--color-green-2);
        padding-top: 80px;
    }

    .main-nav.active {
        right: 0;
    }

    /* Overlay - MUST be below the menu AND not block clicks when inactive */
    .nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: transparent;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        z-index: 10999 !important;
        /* Just below the menu */
        pointer-events: none !important;
        /* CRITICAL: Don't block clicks when inactive */
    }

    .nav-overlay.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto !important;
        /* Allow clicks only when active to close menu */
    }

    /* Menu structure */
    .nav-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-menu {
        flex-direction: column;
    }

    .nav-item {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Menu links */
    .nav-link {
        justify-content: space-between;
        padding: 1rem;
        display: flex;
        width: 100%;
        color: white;
        text-decoration: none;
        pointer-events: auto;
        cursor: pointer;
    }

    /* Chevron rotation when accordion is open */
    .nav-link .fa-chevron-down {
        transition: transform 0.3s ease;
    }

    .nav-item.active>.nav-link .fa-chevron-down {
        transform: rotate(180deg);
    }

    /* ============================================================================
       SIMPLIFIED MOBILE MENU (Direct Links Only)
       ========================================================================= */

    /* Hide mega-menu completely on mobile */
    .mega-menu {
        display: none !important;
    }

    /* Style the links to look like main navigation items */
    .nav-item .nav-link {
        display: block;
        padding: 15px 0;
        font-size: 1.1rem;
        font-weight: 600;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        width: 100%;
        text-align: left;
    }

    .mega-menu-content {
        flex-direction: column;
        padding: 1rem;
        gap: 1.5rem;
        pointer-events: auto;
    }

    .mega-menu-column {
        pointer-events: auto;
    }

    .mega-menu-column>h3 {
        font-size: 1rem;
        color: var(--color-green-3);
        margin-bottom: 0.5rem;
        /* Reduced margin */
        padding: 0.5rem 0;
        /* Add touch target size */
        pointer-events: auto;
        /* Enable clicks */
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .mega-menu-column>h3::after {
        content: '\f078';
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        font-size: 0.8em;
        transition: transform 0.3s ease;
    }

    .mega-menu-column.active>h3::after {
        transform: rotate(180deg);
    }

    /* Hide sections by default on mobile */
    .mega-menu-column .menu-section {
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
        margin-bottom: 0;
    }

    /* Show sections when column is active */
    .mega-menu-column.active .menu-section {
        max-height: 500px;
        /* Enough for content */
        opacity: 1;
        margin-bottom: 1.5rem;
    }

    /* Menu sections */
    .menu-section {
        margin-bottom: 1.5rem;
        pointer-events: auto;
    }

    .menu-section h4 {
        color: rgba(255, 255, 255, 0.7);
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
        pointer-events: none;
    }

    .menu-section ul {
        display: block !important;
        opacity: 1 !important;
        pointer-events: auto;
    }

    .menu-section ul li {
        margin-bottom: 0;
    }

    /* Force white color on mobile menu links with higher specificity */
    .main-nav.active .menu-section ul li a {
        color: rgba(255, 255, 255, 0.9) !important;
        padding: 0.75rem 0.5rem;
        margin: 0.25rem 0;
        display: block;
        pointer-events: auto !important;
        cursor: pointer !important;
        -webkit-tap-highlight-color: rgba(132, 189, 0, 0.2);
        transition: background-color 0.2s ease, color 0.2s ease;
    }

    .main-nav.active .menu-section ul li a:hover,
    .main-nav.active .menu-section ul li a:active {
        background-color: rgba(130, 183, 1, 0.1);
        color: var(--color-green-3) !important;
        padding-left: 1rem;
    }


    /* Hero - IMAGE BÂTIMENT ADAPTÉE EN MOBILE */
    .hero-section {
        min-height: auto;
        padding: 3rem 0;
    }

    .hero-content-wrapper {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.125rem;
    }

    .hero-cta {
        justify-content: center;
    }

    .hero-text {
        order: 1;
        /* Texte en premier */
    }

    .hero-image {
        order: 2;
        /* Image après le texte */
    }

    /* CORRECTION IMAGE BÂTIMENT EN MOBILE - Taille réduite */
    .building-image {
        max-width: 70%;
        margin: 0 auto;
        height: auto;
    }

    /* Navigation volets */
    .navigation-volets {
        padding: 3rem 0;
    }

    .volets-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .volet-card {
        padding: 1.5rem;
    }

    .volet-icon {
        font-size: 2.5rem;
    }

    /* Actualités */
    .actualites-section {
        padding: 3rem 0;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 2rem;
    }

    .news-carousel {
        grid-template-columns: repeat(2, 1fr);
        /* 2 colonnes sur mobile */
        gap: 1.5rem;
    }

    /* Avis - Logo Google adapté */
    .reviews-section {
        padding: 3rem 0;
    }

    .reviews-section::before {
        top: 1rem;
        right: 1rem;
        width: 80px;
        height: 80px;
        background-size: 50px;
    }

    .reviews-carousel {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    /* Avantages */
    .advantages-section {
        padding: 3rem 0;
    }

    .advantages-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .advantage-card {
        padding: 1.5rem;
    }

    /* CTA Section */
    .cta-section {
        padding: 3rem 0;
    }

    .cta-content {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
    }

    .cta-text h2 {
        font-size: 1.75rem;
    }

    .cta-text p {
        font-size: 1rem;
    }

    .cta-buttons {
        justify-content: center;
        flex-direction: column;
        width: 100%;
    }

    .cta-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    /* Footer */
    .footer-logos {
        flex-direction: column;
        gap: 1.5rem;
        align-items: center;
    }

    .footer-logo-crelan img,
    .footer-logo-carlisi img {
        height: 50px;
    }

    .footer-main {
        padding: 3rem 0;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-column {
        text-align: center;
    }

    .footer-list li {
        justify-content: center;
    }

    .footer-socials {
        justify-content: center;
    }

    .footer-bottom-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    /* Scroll to top */
    .scroll-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
    }
}

/* ============================================================================
   PETIT MOBILE (max-width: 480px)
   ========================================================================= */
@media (max-width: 480px) {

    /* Typographie */
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.375rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    /* Hero */
    .hero-title {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-cta {
        flex-direction: column;
        width: 100%;
    }

    .hero-cta .btn {
        width: 100%;
        justify-content: center;
    }

    /* IMAGE BÂTIMENT ENCORE PLUS PETITE SUR TRÈS PETITS ÉCRANS */
    .building-image {
        max-width: 60%;
    }

    /* Menu mobile encore plus étroit si nécessaire */
    .main-nav {
        width: 90%;
    }

    /* Volets */
    .volet-card {
        padding: 1.25rem;
    }

    .volet-icon {
        font-size: 2rem;
    }

    /* News */
    .news-carousel {
        grid-template-columns: 1fr;
        /* 1 colonne sur très petits écrans */
    }

    .news-image {
        height: 180px;
    }

    .news-content {
        padding: 1.25rem;
    }

    /* Avis */
    .reviews-carousel {
        grid-template-columns: 1fr;
    }

    .review-card {
        padding: 1.5rem;
        min-height: 220px;
    }

    .reviews-section::before {
        width: 60px;
        height: 60px;
        background-size: 40px;
    }

    /* CTA */
    .cta-text h2 {
        font-size: 1.5rem;
    }
}

/* ============================================================================
   UTILITAIRES RESPONSIVE
   ========================================================================= */

/* Cacher sur mobile */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Afficher uniquement sur mobile */
.show-mobile {
    display: none !important;
}

@media (max-width: 768px) {
    .show-mobile {
        display: block !important;
    }
}

/* ============================================================================
   ANIMATIONS MOBILES
   ========================================================================= */
@media (max-width: 768px) {
    @keyframes fadeInLeft {
        from {
            opacity: 0;
            transform: translateY(20px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @keyframes fadeInRight {
        from {
            opacity: 0;
            transform: translateY(20px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* ============================================================================
   OPTIMISATIONS PERFORMANCES MOBILE
   ========================================================================= */
@media (max-width: 768px) {

    /* Réduire les ombres pour performances */
    .news-card,
    .advantage-card,
    .volet-card,
    .review-card {
        box-shadow: var(--shadow-sm);
    }

    /* Réduire les transitions */
    * {
        transition-duration: 0.2s !important;
    }

    /* Simplifier les gradients */
    .hero-overlay {
        background: rgba(0, 0, 0, 0.6);
    }

    .reviews-section {
        background: linear-gradient(135deg, var(--color-green-2) 0%, var(--color-green-1) 100%);
    }
}

/* ============================================================================
   ACCESSIBILITÉ MOBILE
   ========================================================================= */
@media (max-width: 768px) {

    /* Zone tactile minimum 44x44px */
    .btn,
    .nav-link,
    .social-link,
    .volet-toggle {
        min-height: 44px;
        min-width: 44px;
    }

    /* Texte lisible */
    body {
        font-size: 16px;
        /* Empêche le zoom automatique sur iOS */
    }

    input,
    textarea,
    select {
        font-size: 16px;
        /* Empêche le zoom automatique sur iOS */
    }
}

/* ============================================================================
   LANDSCAPE MOBILE (hauteur réduite)
   ========================================================================= */
@media (max-width: 768px) and (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding: 2rem 0;
    }

    .building-image {
        max-width: 40%;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    /* Menu encore plus compact en paysage */
    .main-nav {
        padding-top: 60px;
    }
}

/* ============================================================================
   CORRECTION SUPPLÉMENTAIRE : Assurer que tous les liens sont cliquables
   ========================================================================= */
@media (max-width: 768px) {

    /* Force tous les liens à être cliquables */
    .main-nav a,
    .mega-menu a,
    .menu-section a {
        pointer-events: auto !important;
        cursor: pointer !important;
        -webkit-tap-highlight-color: rgba(132, 189, 0, 0.2);
    }

    /* Zone tactile élargie pour meilleure UX mobile */
    .menu-section ul li a {
        padding: 0.75rem 0.5rem;
        margin: 0.25rem 0;
    }
}