/* tailwind css v4.x */
@import "tailwindcss";
@import "tailwindcss-animated";

*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Quicksand', sans-serif;
    background-color: #ecf1f3 ;
}


/* Animation improvement */
.animate-slide-in-left,
.animate-slide-in-right,
.animate-fade-in-up {
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.weather-card-bg {
    background: linear-gradient(135deg, #4a90e2 0%, #50e3c2 100%);
}

/* Weather-Map */
/* Amélioration des Popups Leaflet */
.leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 1rem;
    /* Rounded-2xl equivalent */
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0;
    width: auto !important;
}

.leaflet-container a.leaflet-popup-close-button {
    color: #999;
    top: 5px;
    right: 5px;
}

/* Gestion du Z-Index pour que le marqueur survolé passe TOUJOURS devant les autres */
.leaflet-marker-icon:hover {
    z-index: 9999 !important;
}

/* Ajustement pour mobile : s'assurer que les popups sont bien au-dessus */
.leaflet-popup {
    z-index: 10000 !important;
}

/* Classe magique ajoutée par JS quand le zoom est faible (vue pays entier).
   On réduit drastiquement les icônes pour éviter le chevauchement.
*/
.map-zoomed-out .custom-weather-icon {
    transform: scale(0.6) !important;
    /* 60% de la taille originale */
    opacity: 0.9;
    /* Légère transparence pour alléger */
}

/* Sur mobile, si on est dézoomé, on réduit encore plus */
@media (max-width: 768px) {
    .map-zoomed-out .custom-weather-icon {
        transform: scale(0.5) !important;
        /* 50% de la taille */
    }

    /* Optionnel : cacher le nom de la ville en vue très large sur mobile pour alléger */
    .map-zoomed-out .custom-weather-icon .group div:last-child {
        display: none;
    }
}


/* Alert Card Styles */
.alert-card {
    background-color: #fffbe6;
    /* Light yellow for alerts */
    border-left: 4px solid #f59e0b;
    /* Amber border */
}

.forecast-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    background-color:#ecf1f3 !important;
}

.forecast-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Mobile menu specific styles */
#mobile-menu {
    transition: transform 0.3s ease-in-out;
    transform: translateX(100%);
}

#mobile-menu.active {
    transform: translateX(0);
}

#mobile-menu-overlay {
    background-color: rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease-in-out;
}

/* --- Mobile Dropdown Enhancements --- */
.mobile-dropdown-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-in-out;
}

.mobile-dropdown-menu.open {
  max-height: 500px; /* plenty for full dropdowns */
}

.mobile-dropdown-toggle .arrow {
  transition: transform 0.3s ease;
}

.mobile-dropdown-toggle.open .arrow {
  transform: rotate(180deg);
}


/* Gradient text style for the logo */
.text-gradient {
    background-image: linear-gradient(to right, #2563eb, #22c55e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

/* Partners Slider  */
    /* Custom scroll-snap for smooth, page-like scrolling */
    #slider-content {
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch; /* iOS smooth scrolling */
        scrollbar-width: none; /* Hide scrollbar for Firefox */
    }
    /* Hide scrollbar for Webkit browsers (Chrome, Safari, Edge) */
    #slider-content::-webkit-scrollbar {
        display: none;
    }
    .slider-slide {
        scroll-snap-align: start;
        /* Control slide width for responsiveness */
        flex: 0 0 100%; /* Mobile: 1 item per view */
    }
    /* Tablet view: 2 items per view (with spacing accounted for) */
    @media (min-width: 768px) {
        .slider-slide {
            flex: 0 0 calc(50% - 0.75rem); /* 50% width minus half the space-x-6 gap (1.5rem / 2 = 0.75rem) */
        }
    }
    /* Desktop view: 4 items per view (with spacing accounted for) */
    @media (min-width: 1024px) {
        /* 25% width minus 3/4 of the space-x-6 gap (1.5rem * 3/4 = 1.125rem) */
        .slider-slide {
            flex: 0 0 calc(25% - 1.125rem); 
        }
    }
    /* Styles pour l'optimisation des transitions (Anti-saccades) */
    .timeline-item-content {
        will-change: transform, opacity;
        transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Smooth transition */
        transform: translateZ(0); /* Force GPU layer */
    }
        
/* Styles pour la ligne centrale de la timeline */
        .timeline-container {
             background-color: transparent;
        }

        /* Mobile Menu */
        .mobile-menu {
            transition: max-height 0.3s ease-out;
            max-height: 0;
            overflow: hidden;
        }
        .mobile-menu.active {
            max-height: 500px; 
        }
        
        /* À ajouter dans styles.css ou <style> */
        .hide-scrollbar::-webkit-scrollbar {
            display: none;
        }
        
        .hide-scrollbar {
            -ms-overflow-style: none;
            /* IE and Edge */
            scrollbar-width: none;
            /* Firefox */
        }

/* Vision et Stratégie */
/* small custom to make hero wave svg blend */
    .hero-bg {
      background: linear-gradient(180deg, rgba(11,37,64,1) 0%, rgba(15,90,146,0.85) 60%), url(''); /* put an image url() if you want */
      background-size: cover;
      background-position: center;
    }

/* Page-Organisation */
/* Basic transition for x-show */
        [x-cloak] {
            display: none !important;
        }


/* Swiper Prestations */
.swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: bold;
    color: #fff;
}



/* --- Styles pour la section Actualités (Swiper Custom) --- */
.swiper-button-prev:after,
.swiper-rtl .swiper-button-next:after,
.swiper-button-next:after,
.swiper-rtl .swiper-button-prev:after {
    content: '' !important;
}

.swiper-button-next svg,
.swiper-button-prev svg {
    width: 24px !important;
    height: 24px !important;
}

.swiper-button-next,
.swiper-button-prev {
    position: relative !important;
    margin-top: 0 !important;
    /* Reset margin */
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
}


/* --- GESTION DU ZOOM ET DU MOBILE --- */

/* Comportement de base de l'icône */
.custom-weather-icon {
    transition: all 0.3s ease;
    transform-origin: center center;
}

/* MODE "DÉZOOMÉ" (Vue globale du pays) 
   C'est ici qu'on résout le problème de la capture d'écran 
*/
.map-zoomed-out .custom-weather-icon {
    /* On annule les transformations conflictuelles */
    transform: none !important;
}

/* Quand on est dézoomé : On cache la bulle de température ET la bulle de vent */
.map-zoomed-out .temp-badge,
.map-zoomed-out .wind-badge {
    display: none !important;
}

/* Quand on est dézoomé : On réduit la taille de l'emoji météo */
.map-zoomed-out .weather-emoji {
    font-size: 1.5rem !important;
    /* Taille réduite (environ 24px) */
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    /* Ombre pour lisibilité */
}


/* --- GESTION DE L'AFFICHAGE DU VENT --- */

/* 1. Par défaut, on CACHE la bulle de vent */
/* AJOUTEZ !important ICI pour surcharger la classe 'flex' de Tailwind */
.wind-badge {
    display: none !important;
}

/* 2. Si la carte (le conteneur parent) a la classe 'wind-enabled', on AFFICHE la bulle */
/* On garde !important ici aussi pour rétablir l'affichage */
.wind-enabled .wind-badge {
    display: flex !important;
}

/* 3. On garde la règle pour cacher en mode dézoomé (priorité absolue) */
.map-zoomed-out .wind-badge {
    display: none !important;
}


/* SPÉCIFIQUE MOBILE (Écrans < 768px) */
@media (max-width: 768px) {

    /* Ajustement fin pour mobile */
    .map-zoomed-out .weather-emoji {
        font-size: 1.2rem !important;
        /* Encore plus petit sur mobile (env 20px) */
    }
}

/* Modal carte mobile - plein écran */
#map-modal {
    -webkit-overflow-scrolling: touch;
}

/* S'assurer que la carte mobile prend bien tout l'espace */
#weather-map-mobile {
    touch-action: pan-x pan-y;
}

/* Amélioration du bouton d'ouverture */
#open-map-modal-btn {
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
}

#open-map-modal-btn:active {
    transform: scale(0.98);
}


/* ========================================
   CORRECTIONS CARTE MOBILE
   ======================================== */

/* 1. Bouton de fermeture plus visible */
#close-map-modal-btn {
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
}

#close-map-modal-btn:hover {
    background-color: rgba(255, 255, 255, 0.4) !important;
    transform: scale(1.1);
}

#close-map-modal-btn:active {
    transform: scale(0.95);
}

/* 2. Header modale toujours visible */
#map-modal .absolute.top-0 {
    backdrop-filter: blur(10px);
    background: linear-gradient(to bottom, rgba(17, 24, 39, 0.95), rgba(17, 24, 39, 0.7));
}

/* 3. Popups Leaflet adaptés mobile */
@media (max-width: 768px) {
    .leaflet-popup-content-wrapper {
        max-width: 280px !important;
        padding: 8px;
    }

    .leaflet-popup-content {
        font-size: 13px;
        line-height: 1.3;
    }

/* Boutons dans popups plus accessibles */
    .leaflet-popup button {
        font-size: 12px !important;
        padding: 8px 12px !important;
        white-space: normal !important;
        line-height: 1.2 !important;
    }

    /* Titres de ville plus petits */
    .leaflet-popup h3 {
        font-size: 16px !important;
    }

    /* Espacement réduit */
    .leaflet-popup .flex.justify-around {
        gap: 8px;
    }
}

/* 4. Zone cliquable des marqueurs agrandie sur mobile */
@media (max-width: 768px) {
    .custom-weather-icon {
        cursor: pointer;
        padding: 8px;
    }

    /* Faciliter le clic sur les icônes */
    .leaflet-marker-icon {
        cursor: pointer !important;
    }
}


/* Animation rapide pour le point d'alerte */
@keyframes ping-fast {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    70%,
    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

.animate-ping-fast {
    animation: ping-fast 0.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}


/* Barre de défilement personnalisée pour la playlist vidéo */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}


/* --- Styles Carousel Focus (Grande Section) --- */

/* Pagination (petits points en bas) */
.swiper-pagination-focus {
    position: relative;
    margin-top: 10px;
}

.swiper-pagination-focus .swiper-pagination-bullet {
    width: 12px;
    height: 12px;
    background-color: #cbd5e1;
    /* Gris clair */
    opacity: 1;
    transition: all 0.3s ease;
    margin: 0 6px !important;
}

.swiper-pagination-focus .swiper-pagination-bullet-active {
    background-color: #2563eb;
    /* Bleu */
    width: 30px;
    /* Le point actif devient une ligne */
    border-radius: 6px;
}

/* Ajustement boutons navigation sur mobile */
@media (max-width: 768px) {

    .swiper-button-next-focus,
    .swiper-button-prev-focus {
        display: none !important;
        /* On cache les flèches sur mobile, on garde le swipe */
    }
}



/* ========================================
   THEME SOMBRE CARTE (OVERLAY)
   ======================================== */

/* On cible spécifiquement '.leaflet-tile-pane' (les images de fond).
   Cela permet d'appliquer l'effet sombre SANS toucher aux marqueurs ou aux popups
   qui se trouvent sur des couches supérieures (marker-pane, popup-pane).
*/
#weather-map-desktop .leaflet-tile-pane, 
#weather-map-mobile .leaflet-tile-pane {
    /* brightness(0.7) : Simule un overlay noir à 30% (70% de luminosité restante)
       contrast(1.1)   : Augmente légèrement le contraste pour garder les routes/frontières visibles
       grayscale(0.2)  : Légère désaturation pour un rendu plus moderne et moins "flashy"
    */
    filter: brightness(0.4) contrast(1.5) grayscale(0.2) !important;
    
    /* Transition douce si jamais on change de fond */
    transition: filter 0.5s ease;
}

/* OPTIONNEL : Effet interactif
   Quand l'utilisateur passe la souris sur la carte (desktop), 
   on éclaire très légèrement le fond pour améliorer la lisibilité lors de la navigation.
*/
#weather-map-desktop:hover .leaflet-tile-pane {
    filter: brightness(0.85) contrast(1.05) grayscale(0.1) !important;
}


/* ========================================
   FIX CONFLIT TAILWIND / LEAFLET
   ======================================== */

/* Restaure l'apparence des boutons radio et checkboxes dans le menu Leaflet */
.leaflet-control-layers-selector {
    appearance: auto !important;
    -webkit-appearance: auto !important;
    -moz-appearance: auto !important;

    /* S'assurer qu'ils ont une taille visible */
    width: auto !important;
    height: auto !important;

    /* Un peu d'espacement avec le texte */
    margin-right: 8px !important;

    /* Curseur main pour l'ergonomie */
    cursor: pointer;
}

/* Alignement correct du texte et de la case */
.leaflet-control-layers label {
    display: flex !important;
    align-items: center;
    margin-bottom: 2px;
}


/* --- Style pour le Popup Régional --- */
.region-popup-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 13px;
}

.region-popup-table th {
    text-align: left;
    color: #64748b;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.region-popup-table td {
    padding: 8px 4px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.region-popup-table tr:last-child td {
    border-bottom: none;
}

.region-popup-btn {
    background-color: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.region-popup-btn:hover {
    background-color: #2563eb;
    color: white;
    border-color: #2563eb;
}

/* Style pour l'icône de région sur la carte */
.region-marker-icon {
    background: white;
    border: 2px solid #2563eb;
    border-radius: 50%;
    color: #2563eb;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    font-size: 14px;
}

/* Optimisation du tableau pour mobile */
@media (max-width: 768px) {

    .region-popup-table th,
    .region-popup-table td {
        padding: 6px 2px;
        /* Réduction du padding horizontal */
        font-size: 11px;
        /* Texte légèrement plus petit */
    }

    .region-popup-btn {
        padding: 4px 6px;
        /* Bouton plus compact */
        font-size: 10px;
    }

    /* Conteneur avec défilement horizontal de sécurité */
    .popup-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }
}


/* Cache la scrollbar tout en gardant le défilement */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Force l'alignement des images dans le carrousel */
.carousel-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.carousel-item {
    flex: 0 0 100%;
    scroll-snap-align: start;
}

/* Cache la scrollbar tout en gardant le défilement */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Force l'alignement des images dans le carrousel */
.carousel-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.carousel-item {
    flex: 0 0 100%;
    scroll-snap-align: start;
}