/* CSS Mobile Fix pour SolairePro */
/* Corrige la destructuration sur mobile en forçant les styles responsive */

/* Reset de base pour éviter la destructuration */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
}

/* Force les containers à respecter la largeur */
.max-w-7xl,
.max-w-5xl,
.max-w-4xl,
.max-w-3xl,
.max-w-md {
    width: 100%;
    max-width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Mobile First - Force 1 colonne sur mobile */
@media (max-width: 639px) {
    /* Grid - Force 1 colonne */
    .grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
    }
    
    .grid-cols-1,
    .sm\:grid-cols-2,
    .md\:grid-cols-3,
    .lg\:grid-cols-4,
    .lg\:grid-cols-3 {
        grid-template-columns: 1fr !important;
    }
    
    /* Flex - Force colonne */
    .flex-row,
    .sm\:flex-row {
        flex-direction: column !important;
    }
    
    /* Padding mobile */
    .p-6,
    .sm\:p-6 {
        padding: 1rem !important;
    }
    
    .px-6,
    .sm\:px-6,
    .lg\:px-8 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .py-12,
    .sm\:py-12 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
    
    /* Margin mobile */
    .mb-6,
    .sm\:mb-6 {
        margin-bottom: 1rem !important;
    }
    
    .mt-8,
    .sm\:mt-8 {
        margin-top: 1rem !important;
    }
    
    /* Text sizes mobile */
    .text-2xl,
    .sm\:text-2xl {
        font-size: 1.5rem !important;
        line-height: 1.75rem !important;
    }
    
    .text-xl,
    .sm\:text-xl {
        font-size: 1.125rem !important;
        line-height: 1.5rem !important;
    }
    
    .text-lg,
    .sm\:text-lg {
        font-size: 1rem !important;
        line-height: 1.5rem !important;
    }
    
    /* Width mobile */
    .w-auto,
    .sm\:w-auto {
        width: 100% !important;
    }
    
    /* Table responsive */
    table {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
    }
    
    /* Masquer colonnes table sur mobile */
    .hidden.sm\:table-cell,
    .hidden.md\:table-cell,
    .hidden.lg\:table-cell,
    [class*="md:table-cell"],
    [class*="lg:table-cell"] {
        display: none !important;
    }
    
    /* Afficher éléments mobile */
    .sm\:hidden {
        display: none !important;
    }
    
    .sm\:block {
        display: block !important;
    }
    
    .sm\:flex {
        display: flex !important;
    }
    
    /* Navigation desktop - cachée sur mobile */
    nav .sm\:flex {
        display: none !important;
    }
    
    /* Menu hamburger - toujours visible sur mobile */
    nav .sm\:hidden {
        display: flex !important;
    }
    
    /* Menu hamburger bouton - toujours visible sur mobile */
    nav .sm\\:hidden {
        display: flex !important;
    }
    
    nav button[class*="inline-flex"] {
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Menu responsive - Alpine.js gère avec x-show */
    /* Menu CACHÉ par défaut - Alpine.js l'affichera quand open = true */
    nav div[x-show].sm\\:hidden {
        display: none !important;
    }
    
    /* Menu visible SEULEMENT quand Alpine.js l'affiche (style="display: block") */
    nav div[x-show].sm\\:hidden[style*="display: block"],
    nav div[x-show].sm\\:hidden[style*="display:block"] {
        display: block !important;
    }
    
    /* Liens visibles SEULEMENT quand le menu est ouvert */
    nav div[x-show][style*="display: block"] a,
    nav div[x-show][style*="display:block"] a,
    nav div[x-show][style*="display: block"] > div a,
    nav div[x-show][style*="display:block"] > div a {
        display: block !important;
        width: 100% !important;
        padding: 0.5rem 1rem !important;
        visibility: visible !important;
        opacity: 1 !important;
        color: inherit !important;
        text-decoration: none !important;
    }
    
    /* Cards - Force full width */
    .rounded-lg,
    .rounded-xl,
    .rounded-2xl {
        border-radius: 0.5rem !important;
    }
    
    /* Buttons - Force full width sur mobile */
    button,
    a[href*="login"],
    a.btn {
        width: 100% !important;
        display: block !important;
        text-align: center !important;
    }
    
    /* Gap mobile */
    .gap-6,
    .sm\:gap-6 {
        gap: 1rem !important;
    }
    
    .gap-8 {
        gap: 1.5rem !important;
    }
    
    /* Images responsive */
    img {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Header responsive */
    header {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Navigation logo */
    nav img {
        max-height: 2.5rem !important;
    }
}

/* Tablet (640px - 1023px) */
@media (min-width: 640px) and (max-width: 1023px) {
    .lg\:grid-cols-4,
    .lg\:grid-cols-3 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .lg\:table-cell {
        display: none !important;
    }
}

/* Desktop (1024px+) - Styles normaux */
@media (min-width: 1024px) {
    .max-w-7xl {
        max-width: 80rem;
        padding-left: 2rem;
        padding-right: 2rem;
    }
    
    .max-w-5xl {
        max-width: 64rem;
    }
    
    .max-w-4xl {
        max-width: 56rem;
    }
    
    .max-w-3xl {
        max-width: 48rem;
    }
}

/* Fix pour éviter le débordement horizontal */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

.container,
.max-w-7xl,
.max-w-5xl,
.max-w-4xl,
.max-w-3xl {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Force les éléments à rester dans leur container */
* {
    max-width: 100%;
}

/* Fix pour les tableaux */
.overflow-x-auto {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
}

/* Fix pour les gradients */
.bg-gradient-to-r,
.bg-gradient-to-br {
    background-size: 100% 100%;
}

/* Fix pour les boutons */
button[type="submit"],
a[href*="login"] {
    min-height: 44px; /* Taille tactile minimale */
    -webkit-tap-highlight-color: transparent;
}
/* Fix final menu mobile - Garantit la visibilité */
@media (max-width: 639px) {
    /* Bouton hamburger - FORCER visible */
    nav > div > div:last-child {
        display: flex !important;
    }
    
    nav > div > div:last-child > button {
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 50 !important;
    }
    
    /* Menu dropdown - CACHÉ par défaut */
    nav > div[x-show].sm\\:hidden {
        display: none !important;
    }
    
    /* Menu visible SEULEMENT quand Alpine.js l'affiche */
    nav > div[x-show].sm\\:hidden[style*="display: block"],
    nav > div[x-show].sm\\:hidden[style*="display:block"] {
        display: block !important;
        position: relative !important;
        z-index: 40 !important;
    }
    
    /* Liens du menu - visibles SEULEMENT quand le menu est ouvert */
    nav div[x-show][style*="display: block"] .space-y-1,
    nav div[x-show][style*="display:block"] .space-y-1,
    nav div[x-show][style*="display: block"] .space-y-1 > *,
    nav div[x-show][style*="display:block"] .space-y-1 > * {
        display: block !important;
    }
    
    nav div[x-show][style*="display: block"] a,
    nav div[x-show][style*="display:block"] a {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        padding: 0.75rem 1rem !important;
        width: 100% !important;
    }
}
/* Fix Alpine.js x-show - Menu doit être caché par défaut */
@media (max-width: 639px) {
    /* Menu caché par défaut - Alpine.js l'affichera */
    nav div[x-show].sm\\:hidden:not([style*="display: block"]):not([style*="display:block"]) {
        display: none !important;
    }
    
    /* Menu visible seulement quand Alpine.js l'affiche */
    nav div[x-show][style*="display: block"],
    nav div[x-show][style*="display:block"] {
        display: block !important;
    }
}
/* Menu mobile - Caché par défaut, visible avec Alpine.js */
@media (max-width: 639px) {
    /* Menu caché par défaut - mais respecter le style inline d'Alpine.js */
    nav div[x-show].sm\\:hidden:not([style*="display: block"]):not([style*="display:block"]) {
        display: none !important;
    }
    
    /* Menu visible quand Alpine.js l'affiche - style inline a priorité */
    nav div[x-show].sm\\:hidden[style*="display: block"],
    nav div[x-show].sm\\:hidden[style*="display:block"] {
        display: block !important;
    }
}
