/* =================================================================
   carte_zones_leaflet.css
   CSS externalisé pour [carte_interactive] — Carte Leaflet par zones
   Fusionne : styles du composant + styles des popups de régions
   ================================================================= */


/* ============================================
   1. COMPOSANT CARTE — Structure & layout
   ============================================ */

/* Conteneur principal — max-width et height sont en inline (varient par instance) */
[id^="hrm-"] .hrm-map-box {
    background: #f5f3ef;
    border-radius: 12px;
    padding: 0.6rem;
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    overflow: hidden;
}

[id^="hrm-"] .hrm-map {
    border-radius: 8px;
    z-index: 1;
}


/* ============================================
   2. POPUP LEAFLET — Override natif
   ============================================ */

[id^="hrm-"] .leaflet-popup-content-wrapper {
    border-radius: 8px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12) !important;
    border: 1px solid #05668d;
    padding: 0 !important;
}

[id^="hrm-"] .leaflet-popup-content {
    margin: 0 !important;
    min-width: 160px;
    padding: 0 !important;
}

[id^="hrm-"] .leaflet-popup-tip {
    border-top-color: #05668d !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1) !important;
}


/* ============================================
   3. LABEL RÉGION — Tooltip permanent Leaflet
   ============================================ */

[id^="hrm-"] .hrm-region-label {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    font-weight: 700;
    font-size: 12px;
    color: #071f1a;
    text-shadow:
        -1px -1px 0 #f5f3ef,
         1px -1px 0 #f5f3ef,
        -1px  1px 0 #f5f3ef,
         1px  1px 0 #f5f3ef;
    pointer-events: none;
}

[id^="hrm-"] .hrm-region-label::before {
    display: none !important;
}


/* ============================================
   4. BOUTONS — Fermer popup, Zoom, Home
   ============================================ */

[id^="hrm-"] .leaflet-popup-close-button,
[id^="hrm-"] .leaflet-popup-close-button:hover,
[id^="hrm-"] .leaflet-popup-close-button:focus,
[id^="hrm-"] .leaflet-popup-close-button:active {
    text-decoration: none !important;
}

[id^="hrm-"] .leaflet-control-zoom a,
[id^="hrm-"] .leaflet-control-zoom a:hover,
[id^="hrm-"] .leaflet-control-zoom a:focus,
[id^="hrm-"] .leaflet-control-zoom a:active {
    text-decoration: none !important;
}

[id^="hrm-"] .hrm-region-poly {
    cursor: pointer;
}

[id^="hrm-"] .leaflet-control-home {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.2);
    color: #333;
    cursor: pointer;
    text-decoration: none;
}

[id^="hrm-"] .leaflet-control-home:hover {
    background: #f4f4f4;
    color: #05668d;
}


/* ============================================
   5. LÉGENDE
   ============================================ */

[id^="hrm-"] .hrm-legend {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

[id^="hrm-"] .hrm-legend a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.8rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #333;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

[id^="hrm-"] .hrm-legend a:hover {
    border-color: #05668d;
    color: #071f1a;
    background: rgba(5, 102, 141, 0.06);
}

[id^="hrm-"] .hrm-legend-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #05668d;
    flex-shrink: 0;
}

[id^="hrm-"] .hrm-legend-count {
    color: #999;
    font-size: 0.75rem;
}


/* ============================================
   6. POPUPS DE RÉGIONS — Contenu
   ============================================ */

.region-popup {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.4;
    max-width: 280px;
    padding: 8px 8px 10px 12px;
}

.region-popup-title {
    margin-bottom: -10px;
    padding: 0;
    color: #05668d;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.region-popup-text {
    margin-bottom: -2px !important;
    padding: 0;
    color: #333;
    font-size: 13px;
    line-height: 1.6;
}

.region-popup-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #00a896 !important;
    font-size: 14px;
    font-weight: 600 !important;
    transition: all 0.2s ease;
    padding: 2px 0;
}

.region-popup-link:hover {
    color: #1d5341;
    gap: 6px;
}

.region-popup-link:active {
    transform: translateY(1px);
}

.region-popup-arrow {
    display: inline-block;
    transition: transform 0.2s ease;
    font-weight: 600;
    text-decoration: none !important;
}

.region-popup-link:hover .region-popup-arrow {
    transform: translateX(2px);
}


/* ============================================
   7. RESPONSIVE
   ============================================ */

@media (max-width: 600px) {
    [id^="hrm-"] .hrm-map {
        height: 360px;
        max-height: 70vh;
    }
}

@media (max-width: 480px) {
    .region-popup {
        max-width: 240px;
        padding: 10px;
    }

    .region-popup-title {
        font-size: 16px;
    }

    .region-popup-text {
        font-size: 12px;
    }

    .region-popup-link {
        font-size: 12px;
    }
}