/* ── Conteneur principal ────────────────────────────────────────────────── */
.map-osm-container {
    width         : 100%;
    /* Hauteur fluide : 60% de la largeur écran, entre 300px et 600px */
    height        : clamp(300px, 60vw, 600px);
    border-radius : 6px;
    overflow      : hidden;
    position      : relative;
    box-sizing    : border-box;
    display       : block;
}

/* ── Tablette (≤ 900px) ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .map-osm-container {
        height        : clamp(320px, 70vw, 500px);
        border-radius : 4px;
    }
}

/* ── Mobile (≤ 600px) ───────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .map-osm-container {
        /* Prend toute la hauteur visible moins la navigation */
        height        : calc(100svh - 160px);
        min-height    : 300px;
        border-radius : 0;    /* plein bord sur mobile */
        /* Permet d'occuper toute la largeur même avec marges du thème */
        margin-left   : calc(-1 * var(--wp--style--root--padding-left, 0px));
        margin-right  : calc(-1 * var(--wp--style--root--padding-right, 0px));
    }
}

/* ── Contrôles Leaflet plus grands sur touch ────────────────────────────── */
@media (max-width: 768px) {
    .map-osm-container .leaflet-control-zoom a {
        width       : 36px;
        height      : 36px;
        line-height : 36px;
        font-size   : 18px;
    }
    .map-osm-container .leaflet-touch .leaflet-control-zoom a {
        width       : 40px;
        height      : 40px;
        line-height : 40px;
    }
}

/* ── Popups ─────────────────────────────────────────────────────────────── */
.mom-popup {
    font-size   : 13px;
    line-height : 1.5;
    max-width   : 240px;
}
.mom-popup strong    { display: block; font-size: 14px; margin-bottom: 4px; }
.mom-popup-addr,
.mom-popup-tel       { color: #555; font-size: 12px; }
.mom-popup-tarif     { font-weight: 600; color: #1a5a9c; margin: 3px 0; }
.mom-popup-link      { margin-top: 6px; }
.mom-popup-link a    { color: #0066cc; font-weight: 600; }

@media (max-width: 600px) {
    .mom-popup        { font-size: 14px; max-width: 200px; }
    .mom-popup strong { font-size: 15px; }
}

/* ── Infobulles des tracés et marqueurs ─────────────────────────────────────
   Le thème du site remet à zéro les marges du contenu et place la croix à
   cheval sur le bord (elle recouvrait le texte). Sélecteurs par identifiant
   + !important : priorité sur le thème quel que soit l'ordre de chargement. */
#map-osm-frontend .mom-leaflet-popup {
    margin-bottom : 14px;
}
#map-osm-frontend .mom-leaflet-popup .leaflet-popup-content-wrapper {
    padding       : 0 !important;
    border        : 1px solid rgba(17, 24, 39, .08) !important;
    border-radius : 14px !important;
    overflow      : visible !important;
    background    : #fff !important;
    color         : #111827;
    box-shadow    : 0 12px 32px rgba(17, 24, 39, .22), 0 2px 6px rgba(17, 24, 39, .08) !important;
}
#map-osm-frontend .mom-leaflet-popup .leaflet-popup-content {
    margin      : 12px 46px 12px 12px !important;
    padding     : 0 !important;
    font-family : inherit;
    font-size   : 14px;
    line-height : 1.35;
}
#map-osm-frontend .mom-leaflet-popup .leaflet-popup-tip {
    background : #fff !important;
    box-shadow : 0 6px 14px rgba(17, 24, 39, .16) !important;
}
#map-osm-frontend .mom-leaflet-popup .leaflet-popup-close-button {
    position        : absolute !important;
    top             : 50% !important;
    right           : 10px !important;
    width           : 28px !important;
    height          : 28px !important;
    margin-top      : -14px !important;
    padding         : 0 !important;
    display         : flex !important;
    align-items     : center;
    justify-content : center;
    border-radius   : 50% !important;
    background      : #eef0f3 !important;
    color           : #374151 !important;
    font            : 400 20px/1 Arial, Helvetica, sans-serif !important;
    text-decoration : none !important;
    box-shadow      : none !important;
    transition      : background .15s, color .15s;
}
#map-osm-frontend .mom-leaflet-popup .leaflet-popup-close-button span {
    display    : block;
    margin-top : -2px;
}
#map-osm-frontend .mom-leaflet-popup .leaflet-popup-close-button:hover,
#map-osm-frontend .mom-leaflet-popup .leaflet-popup-close-button:focus-visible {
    background : #111827 !important;
    color      : #fff !important;
}

/* Contenu : repère visuel + libellé + nom */
.mom-pop {
    display     : flex;
    align-items : center;
    gap         : 12px;
}
.mom-pop-visual {
    flex            : 0 0 40px;
    width           : 40px;
    height          : 40px;
    border-radius   : 10px;
    background      : #f3f4f6;
    display         : flex;
    align-items     : center;
    justify-content : center;
}
.mom-pop-visual img {
    width      : 26px !important;
    height     : 26px !important;
    max-width  : none !important;
    margin     : 0 !important;
    box-shadow : none !important;
}
.mom-pop-swatch {
    position      : relative;
    width         : 20px;
    height        : 20px;
    border        : 3px solid var(--mom-c);
    border-radius : 5px;
    box-sizing    : border-box;
    overflow      : hidden;
}
.mom-pop-swatch::after {
    content    : "";
    position   : absolute;
    inset      : 0;
    background : var(--mom-c);
    opacity    : .28;
}
.mom-pop-swatch--line {
    width         : 24px;
    height        : 5px;
    border        : 0;
    border-radius : 3px;
    background    : var(--mom-c);
}
.mom-pop-swatch--line::after { display: none; }
.mom-pop-body { min-width: 0; }
.mom-pop-type {
    display        : block;
    margin-bottom  : 2px;
    font-size      : 11px;
    font-weight    : 600;
    letter-spacing : .08em;
    text-transform : uppercase;
    color          : #6b7280;
}
.mom-pop-title {
    display     : block;
    font-size   : 15px;
    font-weight : 700;
    color       : #111827;
    word-wrap   : break-word;
}
.mom-pop-extra {
    margin-top : 4px;
    font-size  : 13px;
    color      : #4b5563;
}

@media (max-width: 600px) {
    .mom-pop-title { font-size: 16px; }
}

/* ── Hérités de l'ancienne carte (pointsv2) ─────────────────────────────── */
.cont_map  { margin-bottom: 4px; font-size: 12px; }
.titre_map { font-weight: 600; }

/* ── État de chargement / erreur ────────────────────────────────────────── */
.mom-map-overlay {
    position   : absolute;
    inset      : 0;
    z-index    : 500;
    display    : flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap        : 12px;
    background : rgba(255,255,255,.82);
    color      : #444;
    font-size  : 14px;
    text-align : center;
    padding    : 20px;
}
.mom-map-spinner {
    width        : 34px;
    height       : 34px;
    border       : 3px solid #d6e2ef;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation    : mom-spin .8s linear infinite;
}
@keyframes mom-spin { to { transform: rotate(360deg); } }
.mom-map-overlay--error { color: #a33; }
.mom-map-retry {
    background : #2271b1;
    color      : #fff;
    border     : none;
    border-radius: 5px;
    padding    : 7px 16px;
    font-size  : 13px;
    cursor     : pointer;
}
.mom-map-retry:hover { background: #135e96; }
@media (prefers-reduced-motion: reduce) {
    .mom-map-spinner { animation: none; }
}

/* ── Marqueurs logo (carrés à fond plein) ───────────────────────────────── */
.map-osm-container .mom-pin--accueil,
.map-osm-container .mom-pin--pmr {
    border-radius : 4px;
    box-shadow    : 0 1px 4px rgba(0, 0, 0, .35);
}
.mom-pop-visual img[src*="pin-accueil"],
.mom-pop-visual img[src*="pin-pmr"] {
    border-radius : 4px;
}
