/**
 * GON Map - Styles personnalisés
 */

.gon-map-wrapper {
    position: relative;
    width: 100vw;
    height: 100vh;
}

.gon-map-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
}

/* S'assurer que la carte MapLibre prend toute la place */
.gon-map-container .maplibregl-map {
    width: 100%;
    height: 100%;
}

/* Style pour les contrôles de la carte */
.gon-map-container .maplibregl-ctrl-bottom-left,
.gon-map-container .maplibregl-ctrl-bottom-right {
    margin-bottom: 10px;
}

.gon-map-container .maplibregl-ctrl-top-left,
.gon-map-container .maplibregl-ctrl-top-right {
    margin-top: 10px;
}

/* Responsive pour mobile */
@media (max-width: 768px) {
    .gon-map-container {
        height: 100vh;
    }
}

/* ========================================
   Styles des marqueurs MapLibre personnalisés
   ======================================== */

/* Personnaliser les marqueurs MapLibre en rouge */
.maplibregl-marker svg {
    fill: #ef4444 !important;
}

.maplibregl-marker {
    cursor: pointer;
}

/* Badge de compteur pour les marqueurs multiples */
.gon-marker-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    /* La couleur de fond est définie dynamiquement via JavaScript */
    color: white;
    font-size: 11px;
    font-weight: bold;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    z-index: 1;
    pointer-events: none;
    border: 2px solid white;
}

/* ========================================
   Légende de la carte - Glassmorphism
   ======================================== */

.gon-map-legend {
    position: absolute;
    bottom: 60px;
    right: 20px;
    /* Glassmorphism effect */
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    z-index: 10;
    min-width: 220px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.gon-legend-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 12px;
    color: #1f2937;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.gon-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    user-select: none;
}

.gon-legend-item:last-child {
    margin-bottom: 0;
}

.gon-legend-checkbox {
    cursor: pointer;
    width: 16px;
    height: 16px;
    appearance: none;
    -webkit-appearance: none;
    border: 2px solid rgba(137, 162, 140, 0.6);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    position: relative;
    transition: all 0.2s ease;
}

.gon-legend-checkbox:hover {
    border-color: #89A28C;
    background: rgba(137, 162, 140, 0.1);
}

.gon-legend-checkbox:checked {
    background: rgba(137, 162, 140, 0.2);
    border-color: #89A28C;
}

.gon-legend-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #89A28C;
    font-size: 12px;
    font-weight: bold;
}

.gon-legend-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.gon-legend-label {
    font-size: 13px;
    color: #1f2937;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.gon-marker-count {
    position: absolute;
    top: 0;
    right: 0;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    z-index: 10;
    pointer-events: none;
    transform: translate(25%, -25%);
}

/* ========================================
   Styles des popups modernes
   ======================================== */

/* Override du style par défaut de MapLibre */
.maplibregl-popup-content {
    padding: 0 !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
    overflow: hidden;
}

/* Cacher complètement le pointeur de la popup */
.maplibregl-popup-tip {
    display: none !important;
}

/* Conteneur principal de la popup */
.gon-popup {
    position: relative;
    min-width: 280px;
    max-width: 320px;
    background: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Bandeau "Sur inscription" */
.gon-popup-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Image de l'événement */
.gon-popup-image {
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
}

.gon-popup-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gon-popup:hover .gon-popup-image img {
    transform: scale(1.05);
}

/* Contenu de la popup */
.gon-popup-content {
    padding: 16px;
}

/* Titre de l'événement */
.gon-popup-title {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 700;
    color: #1a202c;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Champs d'information */
.gon-popup-field {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.gon-popup-field:last-child {
    border-bottom: none;
}

.gon-popup-field:hover {
    background-color: #f9fafb;
    border-radius: 6px;
    padding-left: 6px;
    padding-right: 6px;
}

/* Icônes des champs */
.gon-popup-icon {
    line-height: 1;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Icônes SVG spécifiques */
.gon-popup-icon-target {
    background-image: url('../assets/svg/target.svg');
    /* Filtre CSS pour obtenir la couleur #89A28C */
    filter: brightness(0) saturate(100%) invert(62%) sepia(8%) saturate(828%) hue-rotate(83deg) brightness(93%) contrast(85%);
}

.gon-popup-icon-calendar {
    background-image: url('../assets/svg/calendar-days.svg');
    /* Filtre CSS pour obtenir la couleur #89A28C */
    filter: brightness(0) saturate(100%) invert(62%) sepia(8%) saturate(828%) hue-rotate(83deg) brightness(93%) contrast(85%);
}

.gon-popup-icon-clock {
    background-image: url('../assets/svg/clock.svg');
    /* Filtre CSS pour obtenir la couleur #89A28C */
    filter: brightness(0) saturate(100%) invert(62%) sepia(8%) saturate(828%) hue-rotate(83deg) brightness(93%) contrast(85%);
}

.gon-popup-icon-map {
    background-image: url('../assets/svg/map-pin.svg');
    /* Filtre CSS pour obtenir la couleur #89A28C */
    filter: brightness(0) saturate(100%) invert(62%) sepia(8%) saturate(828%) hue-rotate(83deg) brightness(93%) contrast(85%);
}

/* Labels des champs */
.gon-popup-label {
    font-size: 14px;
    color: #4a5568;
    font-weight: 500;
    line-height: 1.4;
}

/* Lien Google Maps */
.gon-popup-maps {
    border-top: 2px solid #e2e8f0;
    margin-top: 8px;
    padding-top: 12px !important;
}

.gon-popup-maps-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    width: 100%;
}

.gon-popup-maps-link:focus {
    outline: none;
}

/* Compteur d'événements multiples */
.gon-popup-counter {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    z-index: 15;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Boutons de navigation entre événements */
.gon-popup-nav {
    display: flex;
    gap: 6px;
    padding: 6px 12px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.gon-popup-nav-btn {
    flex: 1;
    padding: 5px;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    min-height: 32px;
}

.gon-popup-nav-btn:hover {
    background: #89A28C;
    border-color: #89A28C;
    color: white;
    transform: scale(1.05);
}

.gon-popup-nav-btn:active {
    transform: scale(0.95);
}

/* Désactiver l'animation pour éviter le flash de positionnement */
.maplibregl-popup {
    /* Pas d'animation - la popup apparaît directement à sa position */
}

/* Cacher la popup pendant qu'elle se positionne */
.maplibregl-popup.maplibregl-popup-anchor-top,
.maplibregl-popup.maplibregl-popup-anchor-bottom,
.maplibregl-popup.maplibregl-popup-anchor-left,
.maplibregl-popup.maplibregl-popup-anchor-right {
    opacity: 1;
}

/* Bouton de fermeture personnalisé - positionné en haut à droite */
.maplibregl-popup-close-button {
    width: 32px !important;
    height: 32px !important;
    font-size: 0 !important;
    background-color: rgba(255, 255, 255, 0.9) !important;
    border-radius: 6px !important;
    padding: 0 !important;
    transition: all 0.2s ease !important;
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 20 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

/* Créer une vraie croix avec pseudo-éléments */
.maplibregl-popup-close-button::before,
.maplibregl-popup-close-button::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 2px;
    background-color: #2d3748;
    border-radius: 1px;
    transition: background-color 0.2s ease;
}

.maplibregl-popup-close-button::before {
    transform: rotate(45deg);
}

.maplibregl-popup-close-button::after {
    transform: rotate(-45deg);
}

.maplibregl-popup-close-button:hover {
    background-color: rgba(255, 255, 255, 1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

.maplibregl-popup-close-button:hover::before,
.maplibregl-popup-close-button:hover::after {
    background-color: #1a202c;
}

/* Responsive pour les popups */
@media (max-width: 768px) {
    .gon-popup {
        min-width: 260px;
        max-width: 280px;
    }

    .gon-popup-image {
        height: 140px;
    }

    .gon-popup-title {
        font-size: 16px;
    }

    .gon-popup-field {
        padding: 6px 0;
    }

    .gon-popup-label {
        font-size: 13px;
    }

    .gon-popup-badge {
        font-size: 11px;
        padding: 5px 10px;
    }
}
