/* =========================================
   SWIMRUN INFOS PRATIQUES - FRONT CSS
   ========================================= */

:root {
    --infos-yellow: #fedd02;
    --infos-black: #000000;
    --infos-white: #ffffff;
    --infos-gray: #666666;
    --infos-gray-light: #999999;
}

/* =========================================
   1. WRAPPER
   ========================================= */
.swimrun-infos-pratiques-wrapper {
    font-family: 'Roboto', sans-serif;
}

.swimrun-infos-pratiques-wrapper .no-data {
    text-align: center;
    padding: 40px;
    background: var(--infos-black);
    border-radius: 20px;
    color: var(--infos-gray-light);
}

/* =========================================
   2. CONTENT LAYOUT
   ========================================= */
.infos-pratiques-content {
    display: flex;
    gap: 25px;
    align-items: flex-start;
}

/* Mode sans légende */
.no-legend .infos-pratiques-map-container {
    flex: 1;
    width: 100%;
}

/* Mode auto : côte par défaut */
.legende-auto .infos-pratiques-content {
    flex-direction: row;
}

/* Mode forcé côté */
.legende-cote .infos-pratiques-content {
    flex-direction: row !important;
}

/* Mode forcé dessous */
.legende-dessous .infos-pratiques-content {
    flex-direction: column !important;
}

.legende-dessous .infos-pratiques-legende {
    width: 100% !important;
    max-width: none !important;
}

.legende-dessous .legende-list {
    flex-direction: row !important;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px 30px;
}

/* =========================================
   3. CARTE
   ========================================= */
.infos-pratiques-map-container {
    flex: 1;
    min-width: 0;
    position: relative;
    width: 100%;
}

.infos-pratiques-map {
    width: 100% !important;
    height: 500px !important;
    min-height: 500px !important;
    border-radius: 20px;
    overflow: hidden;
    border: 3px solid var(--infos-black);
    background: #e0e0e0;
    position: relative;
    z-index: 1;
}

/* Forcer Leaflet à prendre toute la place */
.infos-pratiques-map .leaflet-container {
    width: 100% !important;
    height: 100% !important;
}

/* Message Ctrl + scroll */
.map-scroll-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.map-scroll-message.visible {
    opacity: 1;
    visibility: visible;
}

/* Message tactile - 2 doigts */
.map-touch-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
    text-align: center;
    max-width: 80%;
}

.map-touch-message.visible {
    opacity: 1;
    visibility: visible;
}

/* Style Leaflet overrides */
.infos-pratiques-map .leaflet-popup-content-wrapper {
    background: var(--infos-black);
    color: var(--infos-white);
    border-radius: 10px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
}

.infos-pratiques-map .leaflet-popup-content {
    margin: 12px 15px;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
}

.infos-pratiques-map .leaflet-popup-content strong {
    color: var(--infos-yellow);
    font-family: 'Antonio', sans-serif;
    font-size: 16px;
    text-transform: uppercase;
}

.infos-pratiques-map .leaflet-popup-tip {
    background: var(--infos-black);
}

.infos-pratiques-map .leaflet-popup-close-button {
    color: var(--infos-white) !important;
}

.infos-pratiques-map .leaflet-popup-close-button:hover {
    color: var(--infos-yellow) !important;
}

/* =========================================
   4. LÉGENDE
   ========================================= */
.infos-pratiques-legende {
    flex: 0 0 auto;
    /* On augmente la largeur pour permettre 2 colonnes (ex: 400px) */
    width: 400px; 
    max-width: 400px;
    background: var(--infos-black);
    border-radius: 20px;
    padding: 25px;
}

.legende-title {
    font-family: 'Antonio', sans-serif;
    font-size: 20px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--infos-yellow);
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(254, 221, 2, 0.3);
}

.legende-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    /* On autorise le passage à la ligne et on met en ligne */
    flex-direction: row;
    flex-wrap: wrap; 
    gap: 15px 10px; /* Gap vertical et horizontal */
}

.legende-item {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 8px;
    transition: background 0.2s ease;
    /* On force chaque item à prendre un peu moins de 50% pour faire 2 colonnes */
    flex: 0 0 calc(50% - 10px); 
    box-sizing: border-box;
}

.legende-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.legende-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.legende-icon img {
    max-width: 28px;
    max-height: 28px;
    object-fit: contain;
}

.legende-icon-default .icon-dot {
    width: 16px;
    height: 16px;
    background: var(--infos-yellow);
    border: 2px solid var(--infos-white);
    border-radius: 50%;
}

.legende-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--infos-white);
}

/* =========================================
   5. MARQUEURS PERSONNALISÉS
   ========================================= */
.poi-marker-icon {
    background: none;
    border: none;
}

.poi-default-marker {
    background: none;
    border: none;
}

.poi-default-marker .marker-dot {
    width: 20px;
    height: 20px;
    background: var(--infos-yellow);
    border: 3px solid var(--infos-black);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* =========================================
   6. RESPONSIVE
   ========================================= */

/* Tablette et mobile : légende toujours en dessous */
@media (max-width: 900px) {
    .infos-pratiques-content {
        flex-direction: column !important;
    }
    
    /* IMPORTANT: La carte doit être en premier (avant la légende) */
    .infos-pratiques-map-container {
        order: 1;
        width: 100% !important;
        flex: none !important;
    }
    
    .infos-pratiques-legende {
        order: 2;
        width: 100% !important;
        max-width: none !important;
    }
    
    .legende-list {
        flex-direction: row !important;
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px 25px;
    }
    
    .legende-item {
        padding: 6px 8px;
    }
    
    /* Forcer la hauteur de la carte sur mobile */
    .infos-pratiques-map {
        height: 400px !important;
        min-height: 400px !important;
    }
}

@media (max-width: 600px) {
    .infos-pratiques-map {
        height: 350px !important;
        min-height: 350px !important;
        border-radius: 15px;
    }
    
    .infos-pratiques-legende {
        padding: 20px;
        border-radius: 15px;
    }
    
    .legende-title {
        font-size: 18px;
        text-align: center;
    }
    
    .legende-list {
        gap: 10px 20px;
    }
    
    .legende-icon {
        width: 28px;
        height: 28px;
    }
    
    .legende-icon img {
        max-width: 24px;
        max-height: 24px;
    }
    
    .legende-label {
        font-size: 13px;
    }
}

/* =========================================
   7. MODE AUTO - LÉGENDE QUI DÉPASSE
   ========================================= */
.swimrun-infos-pratiques-wrapper.legende-auto.legende-overflow .infos-pratiques-content {
    flex-direction: column;
}

.swimrun-infos-pratiques-wrapper.legende-auto.legende-overflow .infos-pratiques-legende {
    width: 100%;
    max-width: none;
}

.swimrun-infos-pratiques-wrapper.legende-auto.legende-overflow .legende-list {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px 30px;
}



//* =========================================
   8. CLUSTERING
   ========================================= */
.custom-cluster-icon {
    background: transparent;
    border: none;
}

.swimrun-cluster {
    width: 44px;
    height: 44px;
    background-color: var(--infos-yellow);
    border: 3px solid var(--infos-black);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    color: var(--infos-black);
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
    position: relative;
    font-size: 16px;
}


/* L'infobulle 0B0B0B au survol */
.cluster-hover-icons {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #0B0B0B;
    padding: 8px 12px;
    border-radius: 10px;
    display: flex;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    z-index: 1000;
}

.cluster-hover-icons img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* Flèche de l'infobulle */
.cluster-hover-icons::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border: 6px solid transparent;
    border-top-color: #0B0B0B;
}

/* Affichage au survol */
.swimrun-cluster:hover .cluster-hover-icons {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}