/* =====================================================================
   Mapa interactivo — Conocé Baradero
   Componente compartido por la página de inicio y /mapa.html
   ===================================================================== */
.cb-mapa {
    --cbm-purple: #72637D;
    --cbm-purple-dark: #5b4f64;
    --cbm-bg: #F9F7F5;
    --cbm-text: #2D2530;
    --cbm-muted: #6b6370;
    --cbm-border: #e7e2ea;
    --cbm-radius: 1.5rem;
    color: var(--cbm-text);
}
.cb-mapa[hidden] { display: none; }

.cbm-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    grid-template-areas: "filters filters" "list map";
    /* La franja de filtros va arriba; lista y mapa comparten la altura configurada */
    grid-template-rows: auto var(--cbm-height, 560px);
    gap: 1rem 1.25rem;
}

.cbm-panel {
    background: #fff;
    border: 1px solid var(--cbm-border);
    border-radius: var(--cbm-radius);
    box-shadow: 0 10px 30px -12px rgba(114, 99, 125, .25);
}
.cbm-title { margin: 0 0 .6rem; font-size: .7rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: var(--cbm-purple); }

/* Filtros: menús + subcategorías */
.cbm-filters { grid-area: filters; padding: 1rem; min-width: 0; }
.cbm-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; list-style: none; }
.cbm-subs { margin-top: .8rem; padding-top: .75rem; border-top: 1px dashed var(--cbm-border); }
.cbm-subs .cbm-chips { max-height: 6.2rem; overflow-y: auto; overscroll-behavior: contain; padding: 2px; }
.cbm-chip {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .7rem .3rem .35rem;
    border: 1px solid var(--cbm-border);
    border-radius: 999px;
    background: #fff;
    color: var(--cbm-text);
    font: inherit;
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .2s, background .2s, color .2s;
}
.cbm-chip:hover { border-color: var(--cbm-cat, var(--cbm-purple)); color: var(--cbm-cat, var(--cbm-purple)); }
.cbm-chip .dot {
    flex: none;
    width: 1.6rem;
    height: 1.6rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: .8rem;
    background: var(--cbm-cat, var(--cbm-purple));
}
.cbm-chip .count { font-size: .68rem; font-weight: 800; color: var(--cbm-muted); }
.cbm-chip[aria-pressed="true"] { background: var(--cbm-cat, var(--cbm-purple)); border-color: var(--cbm-cat, var(--cbm-purple)); color: #fff; }
.cbm-chip[aria-pressed="true"] .count { color: rgba(255, 255, 255, .85); }
.cbm-chip[aria-pressed="true"] .dot { background: rgba(255, 255, 255, .22); }
.cbm-subs .cbm-chip { padding-left: .6rem; min-height: 32px; font-weight: 600; }

/* Lista de lugares */
.cbm-places { grid-area: list; display: flex; flex-direction: column; min-height: 0; padding: 1rem 0 .5rem; }
.cbm-places .cbm-title, .cbm-search { margin-left: 1rem; margin-right: 1rem; }
.cbm-search {
    min-height: 40px;
    margin-bottom: .5rem;
    padding: .45rem .8rem;
    border: 2px solid var(--cbm-border);
    border-radius: .9rem;
    font: inherit;
    font-size: .82rem;
}
.cbm-search:focus { outline: none; border-color: var(--cbm-purple); }
.cbm-list { flex: 1; min-height: 0; margin: 0; padding: 0 .5rem; list-style: none; overflow-y: auto; overscroll-behavior: contain; }
.cbm-place {
    width: 100%;
    display: flex;
    gap: .6rem;
    align-items: flex-start;
    padding: .55rem .5rem;
    border: 0;
    border-radius: .8rem;
    background: transparent;
    font: inherit;
    text-align: left;
    color: var(--cbm-text);
    cursor: pointer;
}
.cbm-place:hover, .cbm-place.is-active { background: #f6f3f8; }
.cbm-place .ico { flex: none; width: 1.7rem; height: 1.7rem; display: grid; place-items: center; border-radius: 50%; font-size: .8rem; background: var(--cbm-cat); }
.cbm-place strong { display: block; font-size: .84rem; line-height: 1.25; }
.cbm-place small { display: block; margin-top: .1rem; font-size: .72rem; color: var(--cbm-muted); }
.cbm-empty { padding: .5rem 1rem; font-size: .84rem; color: var(--cbm-muted); }

/* Mapa */
.cbm-map-wrap { grid-area: map; position: relative; min-height: 0; overflow: hidden; }
.cbm-map { width: 100%; height: 100%; border-radius: var(--cbm-radius); background: #eef0ee; z-index: 0; }
.cbm-map .leaflet-tile-pane { filter: saturate(.75) contrast(.97); }
.cbm-reset {
    position: absolute;
    right: 12px;
    bottom: 28px;
    z-index: 500;
    min-height: 40px;
    padding: .5rem .9rem;
    border: 1px solid var(--cbm-border);
    border-radius: 999px;
    background: #fff;
    color: var(--cbm-purple);
    font: inherit;
    font-size: .78rem;
    font-weight: 800;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
    cursor: pointer;
}
.cbm-reset:hover { background: var(--cbm-bg); }

/* Pins con el ícono de la subcategoría */
.cbm-marker { background: none; border: 0; }
.cbm-pin {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 3px solid #fff;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    background: var(--cbm-cat, #72637D);
    box-shadow: 0 6px 14px rgba(0, 0, 0, .25);
    transition: transform .15s;
}
.cbm-pin span { transform: rotate(45deg); font-size: .95rem; line-height: 1; }
@media (hover: hover) { .cbm-marker:hover .cbm-pin { transform: rotate(-45deg) scale(1.12); } }
.cbm-marker:focus-visible .cbm-pin { transform: rotate(-45deg) scale(1.12); }

/* Grupos de pins cercanos */
.cbm-cluster { background: none; border: 0; }
.cbm-cluster div {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #72637D;
    color: #fff;
    font-size: .85rem;
    font-weight: 900;
    border: 3px solid #fff;
    box-shadow: 0 0 0 5px rgba(114, 99, 125, .28), 0 6px 14px rgba(0, 0, 0, .2);
}

/* Popup */
.cb-mapa .leaflet-popup-content-wrapper, .cbm-popup-host .leaflet-popup-content-wrapper { border-radius: 1.1rem; padding: 0; overflow: hidden; box-shadow: 0 14px 34px -10px rgba(45, 37, 48, .35); }
.cb-mapa .leaflet-popup-content { margin: 0; width: 260px !important; font-family: inherit; }
.cb-mapa .leaflet-container a.leaflet-popup-close-button { top: 6px; right: 6px; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.cbm-popup-img { display: block; width: 100%; aspect-ratio: 2 / 1; object-fit: cover; }
.cbm-popup-head { padding: .8rem 2.2rem .7rem 1rem; background: var(--cbm-cat, #72637D); color: #fff; }
.cbm-popup-head span { display: block; font-size: .62rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; opacity: .9; }
.cbm-popup-head h3 { margin: .2rem 0 0; font-size: 1rem; font-weight: 900; line-height: 1.25; }
.cbm-popup-body { padding: .75rem 1rem 1rem; font-size: .82rem; color: var(--cbm-text); }
.cbm-popup-body p { margin: 0 0 .4rem; }
.cb-mapa .leaflet-container .cbm-popup-body a.tel { color: #72637D; font-weight: 700; text-decoration: none; }
.cbm-actions { display: grid; gap: .4rem; margin-top: .7rem; }
.cb-mapa .leaflet-container a.cbm-btn, .cbm-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 38px;
    border: 0;
    border-radius: .8rem;
    font: inherit;
    font-size: .8rem;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}
.cb-mapa .leaflet-container a.cbm-btn-primary { background: #72637D; color: #fff; }
.cb-mapa .leaflet-container a.cbm-btn-primary:hover { background: #5b4f64; }
.cb-mapa .leaflet-container a.cbm-btn-wa { background: #ecfdf5; color: #047857; }
.cbm-btn-ghost { background: #f3f1f4; color: #72637D; }
.cbm-btn-ghost:hover { background: #e9e4ee; }

@media (max-width: 860px) {
    .cbm-layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "filters" "map" "list";
        grid-template-rows: auto auto auto;
        height: auto;
    }
    .cbm-filters { padding: .85rem; }
    .cbm-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: none; }
    .cbm-chips::-webkit-scrollbar { display: none; }
    .cbm-chip { flex: none; }
    .cbm-subs .cbm-chips { max-height: none; overflow-y: visible; }
    .cbm-map-wrap { height: 60vh; min-height: 360px; }
    .cbm-list { max-height: 320px; }
    /* Popup más compacto para que entre en el mapa junto con el pin */
    .cb-mapa .leaflet-popup-content { width: 240px !important; }
    .cbm-popup-img { aspect-ratio: 3 / 1; }
    .cbm-popup-head { padding: .6rem 2.2rem .55rem .9rem; }
    .cbm-popup-body { padding: .6rem .9rem .8rem; }
    .cbm-actions { margin-top: .5rem; gap: .35rem; }
}
@media (prefers-reduced-motion: reduce) {
    .cbm-chip, .cbm-pin { transition: none; }
}
