/* =============================================================
   CARTE PAYS/VILLE — Hôtels & Restaurants
   Chemin conseillé : /assets/css/components/country-map.css
   ============================================================= */

:root {
    /* Échelle hôtels — par niveau de prix ($ → $$$$), ton bleu */
    --cm-hotel-1: #a9c9e8;
    --cm-hotel-2: #6b9bd1;
    --cm-hotel-3: #3d6ea5;
    --cm-hotel-4: #1c3f66;

    /* Échelle restaurants — par note (0 → 5) */
    --cm-resto-1: #d9534f;
    --cm-resto-2: #e0873c;
    --cm-resto-3: #dcc23c;
    --cm-resto-4: #8bc34a;
    --cm-resto-5: #3f9142;
}

/* ─────────────────────────────────────────
   CONTENEUR
───────────────────────────────────────── */
.cm-map-wrap {
    position: relative;
    width: 100%;
    margin: 0;
}

.cm-map {
    width: 100%;
    height: 460px;
    border: 0.5px solid var(--background-nav-stronger);
    border-radius: 4px;
    overflow: hidden;
}

@media (max-width: 768px) {
    .cm-map {
        height: 340px;
    }
}

/* ─────────────────────────────────────────
   LÉGENDE
───────────────────────────────────────── */
.cm-legend {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 10px;
    background: var(--background-nav-color);
    backdrop-filter: blur(6px);
    border: 0.5px solid var(--background-nav-stronger);
    border-radius: 4px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    font-size: 12px;
    color: var(--text-color);
}

.cm-legend__group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cm-legend__title {
    font-weight: 600;
    min-width: 62px;
}

.cm-legend__scale {
    display: flex;
    gap: 3px;
}

.cm-legend__range {
    color: var(--text-color-attenuate);
    font-size: 11px;
    white-space: nowrap;
}

.cm-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 0.5px solid var(--background-nav-stronger);
}

.cm-swatch--hotel-1 { background: var(--cm-hotel-1); }
.cm-swatch--hotel-2 { background: var(--cm-hotel-2); }
.cm-swatch--hotel-3 { background: var(--cm-hotel-3); }
.cm-swatch--hotel-4 { background: var(--cm-hotel-4); }

.cm-swatch--resto-1 { background: var(--cm-resto-1); }
.cm-swatch--resto-2 { background: var(--cm-resto-2); }
.cm-swatch--resto-3 { background: var(--cm-resto-3); }
.cm-swatch--resto-4 { background: var(--cm-resto-4); }
.cm-swatch--resto-5 { background: var(--cm-resto-5); }

@media (max-width: 768px) {
    .cm-legend {
        top: 8px;
        right: 8px;
        font-size: 11px;
        padding: 6px 8px;
    }

    .cm-legend__title {
        min-width: 50px;
    }
}

/* ─────────────────────────────────────────
   PINS (divIcon Leaflet)
───────────────────────────────────────── */

.leaflet-div-icon.cm-pin {
    background: transparent;
    border: none;
}
 
.cm-pin svg {
    display: block;
    width: 100%;
    height: 100%;
}

.cm-pin {
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
    transition: transform 0.15s ease;
}

.cm-pin:hover {
    transform: scale(1.1);
    z-index: 1000 !important;
}

/* ─────────────────────────────────────────
   POPUP
───────────────────────────────────────── */
.leaflet-popup-content-wrapper {
    background: var(--background-nav-color);
    color: var(--text-color);
    border-radius: 4px;
    padding: 0;
    overflow: hidden;
}

.leaflet-popup-tip {
    background: var(--background-nav-color);
}

.leaflet-popup-content {
    margin: 0;
    width: 220px !important;
}

.cm-popup {
    display: flex;
    flex-direction: column;
}

.cm-popup__img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.cm-popup__body {
    padding: 10px 12px;
}

.cm-popup__title {
    font-weight: 600;
    font-size: 13px;
    line-height: 1.3;
    color: var(--text-color);
    margin-bottom: 4px;
}

.cm-popup__meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.cm-popup__badge {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 7px;
    border: 0.5px solid var(--background-nav-stronger);
    border-radius: 4px;
    color: var(--text-color);
}

.cm-popup__link {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-color);
    text-decoration: none;
    border: 0.5px solid var(--background-nav-stronger);
    border-radius: 4px;
    padding: 5px 10px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

/* Inversion texte/fond au survol : fonctionne nativement en dark comme en
   light mode puisqu'on ne fait qu'échanger --text-color et --background-color,
   sans valeur codée en dur. */
.cm-popup__link:hover {
    background: var(--text-color);
    color: var(--background-color);
    border-color: var(--text-color);
}