/* =============================================================
   BN MAP WIDGET - map-points.css
   Mapa Interactivo Premium - Tema Bajo Nalón

   Sin :root local: consume tokens.css y --e-global-* del Kit.
   Sólo se conserva --bn-sidebar-w como token DE COMPONENTE
   (controla el ancho del sidebar del mapa, no es marca).
   ============================================================= */

.bn-map-wrapper {
    --bn-sidebar-w: 360px;
}

/* =========================================================
   WRAPPER PRINCIPAL
   ========================================================= */
.bn-map-wrapper {
    display: flex;
    width: 100%;
    height: 600px;
    background: var(--bn-color-bg-soft);
    border-radius: 24px; /* específico del componente, no en escala */
    overflow: hidden;
    box-shadow: var(--bn-shadow-lg);
    border: 1px solid var(--bn-color-border);
    position: relative;
    font-family: var(--e-global-typography-text-font-family);
}

/* =========================================================
   SIDEBAR
   ========================================================= */
.bn-map-sidebar {
    width: var(--bn-sidebar-w);
    min-width: var(--bn-sidebar-w);
    height: 100%;
    background: var(--bn-color-white);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--bn-color-border);
    overflow: hidden;
    z-index: 10;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Header del Sidebar === */
.bn-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 0 24px;
    flex-shrink: 0;
}

.bn-sidebar-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--e-global-color-text);
    margin: 0;
    letter-spacing: -0.3px;
    font-family: var(--e-global-typography-text-font-family);
}

.bn-sidebar-count {
    background: var(--e-global-color-primary);
    color: var(--bn-color-white);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 50px;
    white-space: nowrap;
    font-family: var(--e-global-typography-text-font-family);
}

/* === Buscador === */
.bn-map-search {
    padding: 16px 20px;
    flex-shrink: 0;
    position: relative;
}

.bn-map-search i {
    position: absolute;
    left: 36px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--bn-color-text-muted);
    font-size: 14px;
    pointer-events: none;
}

.bn-map-search-input {
    width: 100%;
    padding: 11px 16px 11px 42px;
    background: var(--bn-color-bg-soft);
    border: 1.5px solid var(--bn-color-border-soft);
    border-radius: 14px;
    font-family: var(--e-global-typography-text-font-family);
    font-size: 14px;
    color: var(--e-global-color-text);
    outline: none;
    transition: all var(--bn-dur-base) ease;
    box-sizing: border-box;
}

.bn-map-search-input::placeholder {
    color: var(--bn-color-text-soft);
}

.bn-map-search-input:focus {
    border-color: var(--e-global-color-primary);
    background: var(--bn-color-white);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--e-global-color-primary) 8%, transparent);
}

/* === Filtros de categoría === */
.bn-map-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 20px 14px 20px;
    flex-shrink: 0;
    /* Máx 2 filas, con scroll si hay más */
    max-height: 76px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--bn-color-border-soft) transparent;
}

.bn-map-filters::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.bn-map-filters::-webkit-scrollbar-track {
    background: transparent;
}

.bn-map-filters::-webkit-scrollbar-thumb {
    background: var(--bn-color-border-soft);
    border-radius: 4px;
}

.bn-cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--bn-color-bg-soft);
    border: 1.5px solid var(--bn-color-border-soft);
    border-radius: 50px;
    font-family: var(--e-global-typography-text-font-family);
    font-size: 12px;
    font-weight: 700;
    color: var(--bn-color-text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--bn-dur-base) cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    letter-spacing: 0.2px;
}

.bn-cat-chip i {
    font-size: 11px;
}

.bn-cat-chip:hover {
    border-color: var(--cat-color, var(--e-global-color-primary));
    color: var(--cat-color, var(--e-global-color-primary));
    background: color-mix(in srgb, var(--cat-color, var(--e-global-color-primary)) 8%, white);
    transform: translateY(-1px);
    box-shadow: var(--bn-shadow-sm);
}

.bn-cat-chip:focus-visible {
    outline: 2px solid var(--cat-color, var(--e-global-color-primary));
    outline-offset: 2px;
}

.bn-cat-chip.active {
    background: var(--cat-color, var(--e-global-color-primary));
    color: var(--bn-color-white);
    border-color: var(--cat-color, var(--e-global-color-primary));
    box-shadow: 0 4px 15px color-mix(in srgb, var(--cat-color, var(--e-global-color-primary)) 40%, transparent);
}

/* Chip "Todos" (sin variable de color) */
.bn-cat-chip[data-cat="all"]:hover {
    border-color: var(--e-global-color-text);
    color: var(--e-global-color-text);
    background: rgba(0, 0, 0, 0.05);
}

.bn-cat-chip[data-cat="all"].active {
    background: var(--e-global-color-text);
    color: var(--bn-color-white);
    border-color: var(--e-global-color-text);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* === Lista de puntos === */
.bn-map-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 12px 12px 12px;
    list-style: none;
    margin: 0;
    /* Fade visual en el borde inferior para indicar scroll */
    mask-image: linear-gradient(to bottom, black calc(100% - 28px), transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 28px), transparent 100%);
}

/* Scrollbar personalizada */
.bn-map-list::-webkit-scrollbar {
    width: 5px;
}

.bn-map-list::-webkit-scrollbar-track {
    background: transparent;
}

.bn-map-list::-webkit-scrollbar-thumb {
    background: var(--bn-color-border-soft);
    border-radius: 10px;
}

.bn-map-list::-webkit-scrollbar-thumb:hover {
    background: var(--bn-color-text-soft);
}

/* === Item de la lista === */
.bn-map-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 14px;
    border-radius: 16px;
    cursor: pointer;
    transition: all var(--bn-dur-base) ease;
    border: 1.5px solid transparent;
    margin-bottom: 6px;
    background: transparent;
    position: relative;
}

.bn-map-item:hover {
    background: var(--bn-color-bg-soft);
    border-color: var(--bn-color-border-soft);
    transform: translateX(3px);
}

.bn-map-item:focus-visible {
    outline: 2px solid var(--e-global-color-primary);
    outline-offset: 1px;
}

.bn-map-item.active {
    background: var(--bn-color-white);
    border-color: color-mix(in srgb, var(--e-global-color-primary) 20%, transparent);
    box-shadow: var(--bn-shadow-sm);
}

.bn-map-item.hidden {
    display: none;
}

.bn-map-item-icon {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bn-color-white);
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bn-map-item-info {
    flex: 1;
    min-width: 0;
}

.bn-map-item-info h4 {
    margin: 0 0 3px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--e-global-color-text);
    font-family: var(--e-global-typography-text-font-family);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.item-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.item-cat {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: var(--e-global-typography-text-font-family);
}

.item-address {
    font-size: 12px;
    color: var(--bn-color-text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: var(--e-global-typography-text-font-family);
}

.item-address i {
    font-size: 10px;
    flex-shrink: 0;
}

.bn-item-arrow {
    font-size: 11px;
    color: var(--bn-color-border-soft);
    transition: all var(--bn-dur-base) ease;
    flex-shrink: 0;
}

.bn-map-item:hover .bn-item-arrow,
.bn-map-item.active .bn-item-arrow {
    color: var(--e-global-color-primary);
    transform: translateX(3px);
}

/* Sin resultados */
.bn-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--bn-color-text-muted);
    gap: 12px;
    font-family: var(--e-global-typography-text-font-family);
}

.bn-no-results i {
    font-size: 32px;
    opacity: 0.3;
}

.bn-no-results p {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    opacity: 0.6;
}

[hidden] {
    display: none;
}

/* =========================================================
   ÁREA DEL MAPA
   ========================================================= */
.bn-map-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.bn-map-container {
    width: 100%;
    height: 100%;
    z-index: 1;
    font-family: var(--e-global-typography-text-font-family) !important;
}

/* Leaflet override básico */
.leaflet-container {
    font-family: var(--e-global-typography-text-font-family) !important;
    background: #c9d9e8 !important; /* azul claro de fondo del mapa, único */
}

/* =========================================================
   MARCADORES DEL MAPA
   ========================================================= */
.bn-custom-marker {
    background: transparent !important;
    border: none !important;
}

.marker-dot {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bn-color-white);
    font-size: 14px;
    position: relative;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.15);
}

.marker-dot:hover {
    transform: scale(1.2) translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.marker-dot.is-active {
    transform: scale(1.25) translateY(-5px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35);
}

/* Pulso animado */
.marker-dot::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: inherit;
    opacity: 0.4;
    animation: marker-pulse 2.5s ease-out infinite;
    z-index: -1;
    top: 0;
    left: 0;
}

@keyframes marker-pulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    70% {
        transform: scale(2.2);
        opacity: 0;
    }

    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* =========================================================
   CONTROLES DE ZOOM (Leaflet)
   ========================================================= */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: var(--bn-shadow-md) !important;
    border-radius: 16px !important;
    overflow: hidden;
}

.leaflet-control-zoom a {
    background: var(--bn-color-white) !important;
    color: var(--bn-color-surface-dark) !important;
    border: none !important;
    width: 40px !important;
    height: 40px !important;
    line-height: 40px !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    transition: all 0.2s ease !important;
}

.leaflet-control-zoom a:hover {
    background: var(--bn-color-bg-soft) !important;
    color: var(--e-global-color-primary) !important;
}

.leaflet-control-zoom-in {
    border-bottom: 1px solid var(--bn-color-border-soft) !important;
}

/* =========================================================
   OVERLAY DE SCROLL ZOOM (Ctrl+Scroll / Click para activar)
   ========================================================= */
.bn-scroll-overlay {
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--bn-color-surface-dark) 55%, transparent);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    border-radius: inherit;
}

.bn-scroll-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.bn-scroll-overlay-msg {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--bn-color-white);
    text-align: center;
    padding: 28px 36px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--bn-radius-lg);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    max-width: 240px;
    animation: zoomMsgIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes zoomMsgIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.bn-scroll-overlay-msg i {
    font-size: 28px;
    color: rgba(255, 255, 255, 0.9);
}

.bn-scroll-overlay-msg p {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    font-family: var(--e-global-typography-text-font-family);
    color: rgba(255, 255, 255, 0.95);
}

.bn-scroll-overlay-msg small {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.65);
    font-weight: 400;
}

/* Indicador de teclado Ctrl */
.bn-key-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
}

.bn-key-badge kbd {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 12px;
    font-family: var(--e-global-typography-text-font-family);
    color: var(--bn-color-white);
    font-weight: 700;
}

/* =========================================================
   POPUP DE LEAFLET - DISEÑO PREMIUM
   ========================================================= */
.bn-leaflet-popup .leaflet-popup-content-wrapper {
    padding: 0 !important;
    overflow: hidden;
    border-radius: 18px !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.06) !important;
    border: 1px solid var(--bn-color-border) !important;
    background: var(--bn-color-white) !important;
}

.bn-leaflet-popup .leaflet-popup-content {
    margin: 0 !important;
    width: auto !important;
    max-width: 320px;
    min-width: 260px;
    padding: 0 !important;
}

.bn-leaflet-popup .leaflet-popup-tip-container {
    width: 24px;
    height: 12px;
    margin: 0 auto;
}

.bn-leaflet-popup .leaflet-popup-tip {
    background: var(--bn-color-white) !important;
    box-shadow: none !important;
    width: 12px;
    height: 12px;
}

/* =========================================================
   Compact popup layout + accesibilidad
   ========================================================= */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* =========================================================
   CONTENIDO DEL POPUP
   ========================================================= */
.bn-map-popup {
    display: flex;
    flex-direction: column;
    font-family: var(--e-global-typography-text-font-family);
    animation: bn-popup-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes bn-popup-in {
    from { opacity: 0; transform: translateY(6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)  scale(1);    }
}

/* ---- Cabecera de color del popup ---- */
.bn-popup-header {
    height: 6px;
    background: var(--e-global-color-primary);
    flex-shrink: 0;
    border-radius: 18px 18px 0 0;
}

/* ---- Cuerpo del popup ---- */
.bn-popup-body {
    padding: 20px 20px 18px;
}

.bn-popup-body.bn-popup-compact {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 20px 20px 18px;
    min-width: 0;
}

/* Imagen en versión compacta */
.bn-popup-body.bn-popup-compact .bn-popup-image-wrap {
    width: 100%;
    height: 130px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 14px;
    flex-shrink: 0;
}

.bn-popup-body.bn-popup-compact .bn-popup-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bn-popup-body.bn-popup-compact .bn-popup-info {
    min-width: 0;
}

/* ---- Título ---- */
.bn-popup-title {
    margin: 0 0 6px 0;
    font-size: 16px;
    font-weight: 800;
    color: var(--e-global-color-text);
    line-height: 1.25;
    letter-spacing: -0.2px;
    font-family: var(--e-global-typography-text-font-family);
}

.bn-popup-title:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--e-global-color-primary) 20%, transparent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---- Dirección ---- */
.bn-popup-address {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--bn-color-text-muted);
    margin: 0 0 8px 0;
    font-family: var(--e-global-typography-text-font-family);
}

.bn-popup-address i {
    color: var(--e-global-color-primary);
    font-size: 11px;
    flex-shrink: 0;
}

/* ---- Descripción ---- */
.bn-popup-desc {
    font-size: 13px;
    color: var(--bn-color-text-strong);
    line-height: 1.6;
    margin: 0 0 14px 0;
    font-family: var(--e-global-typography-text-font-family);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- Separador ---- */
.bn-popup-divider {
    height: 1px;
    background: var(--bn-color-border-soft);
    margin: 0 0 14px 0;
}

/* ---- Acciones ---- */
.bn-popup-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* Botón enlace principal */
.bn-popup-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: 50px;
    color: var(--bn-color-white);
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
    font-family: var(--e-global-typography-text-font-family);
    background: var(--btn-color, var(--e-global-color-primary));
    border: none;
    transition: filter 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--e-global-color-primary) 25%, transparent);
    white-space: nowrap;
}

.bn-popup-btn i {
    font-size: 11px;
}

.bn-popup-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--e-global-color-primary) 32%, transparent);
    color: var(--bn-color-white);
    text-decoration: none;
}

.bn-popup-btn:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--e-global-color-primary) 30%, transparent);
    outline-offset: 3px;
}

.bn-popup-btn[hidden] {
    display: none;
}

/* Botón secundario "Ver detalle" */
.bn-popup-open-detail {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    border-radius: 50px;
    border: 1.5px solid var(--bn-color-border-soft);
    background: var(--bn-color-bg-soft);
    font-weight: 700;
    font-size: 13px;
    font-family: var(--e-global-typography-text-font-family);
    color: var(--e-global-color-text);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
}

.bn-popup-open-detail:hover {
    border-color: var(--e-global-color-primary);
    background: color-mix(in srgb, var(--e-global-color-primary) 5%, transparent);
    color: var(--e-global-color-primary);
}

.bn-popup-open-detail:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--e-global-color-primary) 20%, transparent);
    outline-offset: 2px;
}

/* Imagen del popup (versión completa, no compacta) */
.bn-popup-image-wrap {
    width: 100%;
    height: 160px;
    overflow: hidden;
    position: relative;
    background: var(--bn-color-border-soft);
    flex-shrink: 0;
}

.bn-popup-image-wrap::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 45%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.45), transparent);
    pointer-events: none;
}

.bn-popup-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    display: block;
}

.bn-leaflet-popup:hover .bn-popup-image-wrap img {
    transform: scale(1.05);
}

/* Placeholder sin imagen */
.bn-popup-image-placeholder {
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bn-color-bg-soft), var(--bn-color-border-soft));
    color: var(--bn-color-text-soft);
    font-size: 24px;
    flex-shrink: 0;
}

/* Tag de categoría */
.bn-popup-cat-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--bn-color-white);
    font-family: var(--e-global-typography-text-font-family);
    margin-bottom: 6px;
}

/* Detail popup text (sin clamp) */
.bn-map-popup-detail .bn-popup-desc {
    -webkit-line-clamp: unset;
    display: block;
}

/* ---- Botón de cierre ---- */
.bn-leaflet-popup .leaflet-popup-close-button {
    top: 10px !important;
    right: 10px !important;
    width: 26px !important;
    height: 26px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.9) !important;
    color: var(--bn-color-text-strong) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12) !important;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease !important;
    font-size: 18px !important;
    line-height: 1 !important;
    padding: 0 !important;
    text-decoration: none !important;
    z-index: 100;
}

.bn-leaflet-popup .leaflet-popup-close-button:hover {
    background: var(--e-global-color-primary) !important;
    color: var(--bn-color-white) !important;
    transform: rotate(90deg) !important;
}

@media (max-width: 480px) {
    .bn-leaflet-popup .leaflet-popup-content {
        min-width: 0 !important;
        max-width: 88vw !important;
    }
    .bn-popup-body.bn-popup-compact {
        padding: 16px;
    }
}

/* =========================================================
   PANEL DETALLE (Móvil overlay)
   ========================================================= */

.bn-detail-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bn-color-white);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 80%;
    overflow-y: auto;
    font-family: var(--e-global-typography-text-font-family);
}

.bn-detail-panel.is-open {
    transform: translateY(0);
}

.bn-panel-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    background: var(--bn-color-bg-soft);
    border: none;
    border-radius: 50%;
    color: var(--e-global-color-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.25s ease;
    z-index: 10;
}

.bn-panel-close:hover {
    background: var(--e-global-color-primary);
    color: var(--bn-color-white);
    transform: rotate(90deg);
}

.bn-panel-content {
    padding: 20px;
}

/* Handle visual para el panel móvil */
.bn-detail-panel::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: var(--bn-color-border-soft);
    border-radius: 2px;
    margin: 12px auto 4px;
}

@media (max-width: 767px) {

    /* =========================================================
   BOTÓN MÓVIL: TOGGLE SIDEBAR
   ========================================================= */
    .bn-sidebar-toggle-btn {
        position: sticky;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 500;
        align-items: center;
        gap: 8px;
        padding: 12px 22px;
        background: color-mix(in srgb, var(--bn-color-surface-dark) 88%, transparent);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        color: var(--bn-color-white);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 50px;
        font-family: var(--e-global-typography-text-font-family);
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
        transition: all 0.25s ease;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
        white-space: nowrap;
    }

    .bn-sidebar-toggle-btn:hover {
        background: var(--e-global-color-primary);
        transform: translateX(-50%) translateY(-2px);
    }
}

/* =========================================================
   OVERLAY MÓVIL DEL SIDEBAR
   ========================================================= */
.bn-map-sidebar-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 150;
    cursor: pointer;
    transition: opacity 0.4s ease;
    opacity: 0;
}

/* =========================================================
   ANIMACIONES GLOBALES
   ========================================================= */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* =========================================================
   RESPONSIVE - TABLET (max 1024px)
   ========================================================= */
@media (max-width: 1024px) {
    .bn-map-wrapper.has-sidebar {
        flex-direction: column;
        height: auto !important;
        min-height: 500px;
    }

    .bn-map-area.has-sidebar {
        height: 400px;
        order: 1;
        flex: none;
    }

    .bn-map-wrapper {
        height: 400px !important;
    }

    .bn-map-sidebar {
        width: 100% !important;
        min-width: 100% !important;
        height: 300px;
        border-right: none;
        border-bottom: 1px solid var(--bn-color-border);
        order: 2;
    }

    .bn-map-area {
        height: 400px;
        order: 1;
    }

    .bn-map-sidebar-overlay {
        display: none;
    }

    .bn-sidebar-toggle-btn {
        display: none ;
    }
}

/* =========================================================
   RESPONSIVE - MÓVIL (max 767px)
   ========================================================= */
@media (max-width: 767px) {
    .bn-map-wrapper.has-sidebar {
        flex-direction: column;
        height: 380px !important;
        min-height: 400px;
    }

    .bn-map-wrapper {
        border-radius: 16px;
        height: 380px !important;
    }

    .bn-map-area {
        height: 380px;
        width: 100%;
        order: 1;
        flex: 1;
    }

    /* En móvil el sidebar se convierte en overlay deslizante desde abajo */
    .bn-map-sidebar {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100% !important;
        min-width: 100% !important;
        height: 70% !important;
        border: none;
        border-radius: 24px 24px 0 0;
        order: 2;
        transform: translateY(100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 200;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
    }

    /* Handle del sidebar móvil */
    .bn-map-sidebar::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: var(--bn-color-border-soft);
        border-radius: 2px;
        margin: 14px auto 6px;
        flex-shrink: 0;
    }

    .bn-map-sidebar.is-open {
        transform: translateY(0);
    }

    .bn-sidebar-toggle-btn {
        display: flex;
    }

    .bn-map-sidebar.is-open~.bn-map-sidebar-overlay {
        opacity: 1;
    }

    /* Overlay oscuro al abrir sidebar: vive dentro del bn-map-wrapper */
    .bn-map-wrapper .bn-map-sidebar-overlay {
        display: block;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.4s ease;
        /* Cubre todo el wrapper */
        position: absolute;
        inset: 0;
        z-index: 150;
    }

    .bn-map-wrapper .bn-map-sidebar-overlay.is-visible {
        opacity: 1;
        pointer-events: auto;
    }

    /* Filtros en móvil: más compactos */
    .bn-map-filters {
        padding: 0 16px 12px;
        gap: 6px;
    }

    .bn-cat-chip {
        padding: 6px 12px;
        font-size: 11px;
    }

    .bn-sidebar-header {
        padding: 8px 20px 0;
    }

    /* Popup en móvil: más estrecho */
    .bn-leaflet-popup .leaflet-popup-content {
        width: 260px !important;
    }

    .bn-popup-image-wrap {
        height: 140px;
    }
}

@media (max-width: 480px) {
    .bn-map-area {
        height: 340px;
    }

    .bn-map-wrapper {
        border-radius: 16px;
        height: 340px !important;
    }

    .bn-map-sidebar {
        height: 75% !important;
    }
}

/* =========================================================
   POPUP FINAL OVERRIDE
   ========================================================= */
.bn-leaflet-popup {
    --bn-popup-surface: var(--bn-color-white);
    --bn-popup-border:  color-mix(in srgb, var(--bn-color-surface-dark) 10%, transparent);
    --bn-popup-shadow:  0 16px 48px color-mix(in srgb, var(--bn-color-surface-dark) 16%, transparent),
                        0 4px 12px  color-mix(in srgb, var(--bn-color-surface-dark) 8%, transparent);
}

.bn-leaflet-popup .leaflet-popup-content-wrapper {
    padding: 0 !important;
    overflow: hidden;
    border-radius: var(--bn-radius-lg) !important;
    border: 1px solid var(--bn-popup-border) !important;
    background: var(--bn-popup-surface) !important;
    box-shadow: var(--bn-popup-shadow) !important;
}

.bn-leaflet-popup .leaflet-popup-content {
    margin: 0 !important;
    width: 310px !important;
    max-width: calc(100vw - 28px);
    padding: 0 !important;
}

.bn-leaflet-popup .leaflet-popup-tip-container {
    width: 28px;
    height: 14px;
    margin: 0 auto;
    overflow: visible;
}

.bn-leaflet-popup .leaflet-popup-tip {
    width: 14px;
    height: 14px;
    margin: -7px auto 0;
    background: var(--bn-popup-surface) !important;
    border-right: 1px solid var(--bn-popup-border);
    border-bottom: 1px solid var(--bn-popup-border);
    box-shadow: none !important;
}

/* ---- Botón cierre ---- */
.bn-leaflet-popup .leaflet-popup-close-button {
    top: 12px !important;
    right: 12px !important;
    width: 30px !important;
    height: 30px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    border: 1.5px solid color-mix(in srgb, var(--bn-color-surface-dark) 10%, transparent) !important;
    background: rgba(255, 255, 255, 0.95) !important;
    color: var(--bn-color-text-strong) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    text-decoration: none !important;
    font-size: 18px !important;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--bn-color-surface-dark) 12%, transparent) !important;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease !important;
    z-index: 100;
}

.bn-leaflet-popup .leaflet-popup-close-button:hover,
.bn-leaflet-popup .leaflet-popup-close-button:focus-visible {
    background: var(--e-global-color-primary) !important;
    color: var(--bn-color-white) !important;
    transform: rotate(90deg) !important;
    border-color: var(--e-global-color-primary) !important;
    outline: none;
}

/* ---- Estructura del popup ---- */
.bn-map-popup {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    color: var(--e-global-color-text);
    font-family: var(--e-global-typography-text-font-family);
    animation: bn-popup-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.bn-map-popup::before {
    content: '';
    display: block;
    height: 5px;
    background: linear-gradient(90deg, var(--e-global-color-primary) 0%, var(--e-global-color-secondary) 100%);
    border-radius: 20px 20px 0 0;
    flex-shrink: 0;
}

/* ---- Cuerpo compacto ---- */
.bn-popup-body.bn-popup-compact {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 18px 18px;
}

.bn-popup-body.bn-popup-compact .bn-popup-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

/* ---- Título ---- */
.bn-popup-title,
.bn-popup-body.bn-popup-compact .bn-popup-title {
    margin: 0;
    padding-right: 38px; /* espacio para botón cierre */
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: var(--e-global-color-text);
    font-family: var(--e-global-typography-text-font-family);
}

.bn-popup-title:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--e-global-color-primary) 20%, transparent);
    outline-offset: 3px;
    border-radius: 6px;
}

/* ---- Dirección ---- */
.bn-popup-address {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--bn-color-text-muted);
    font-family: var(--e-global-typography-text-font-family);
}

.bn-popup-address i {
    color: var(--e-global-color-primary);
    margin-top: 0.1rem;
    flex-shrink: 0;
    font-size: 0.78rem;
}

/* ---- Descripción ---- */
.bn-popup-desc,
.bn-popup-body.bn-popup-compact .bn-popup-desc {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--bn-color-text-strong);
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-family: var(--e-global-typography-text-font-family);
}

.bn-map-popup-detail .bn-popup-desc,
.bn-map-popup-detail .bn-popup-body.bn-popup-compact .bn-popup-desc {
    -webkit-line-clamp: unset;
    display: block;
    max-height: 7em;
    overflow-y: auto;
}

.bn-map-popup-detail .bn-popup-desc::-webkit-scrollbar {
    width: 4px;
}

.bn-map-popup-detail .bn-popup-desc::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--bn-color-surface-dark) 15%, transparent);
    border-radius: 999px;
}

/* ---- Acciones ---- */
.bn-popup-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid color-mix(in srgb, var(--bn-color-surface-dark) 7%, transparent);
    align-items: stretch;
}

.bn-popup-actions:empty {
    display: none;
    padding-top: 0;
    border-top: none;
}

/* ---- Botón principal ---- */
.bn-popup-btn {
    display: inline-flex;
    flex: 1;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid transparent;
    color: var(--bn-color-white);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 700;
    font-family: var(--e-global-typography-text-font-family);
    line-height: 1.2;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--e-global-color-primary) 22%, transparent);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.bn-popup-btn i {
    font-size: 0.78rem;
    flex-shrink: 0;
}

.bn-popup-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 8px 20px color-mix(in srgb, var(--e-global-color-primary) 30%, transparent);
    color: var(--bn-color-white);
    text-decoration: none;
}

.bn-popup-btn:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--e-global-color-primary) 25%, transparent);
    outline-offset: 3px;
}

.bn-popup-btn[hidden] {
    display: none;
}

@media (max-width: 767px) {
    .bn-leaflet-popup .leaflet-popup-content {
        width: min(290px, calc(100vw - 20px)) !important;
    }

    .bn-popup-body.bn-popup-compact {
        padding: 16px 16px 16px;
    }

    .bn-popup-title,
    .bn-popup-body.bn-popup-compact .bn-popup-title {
        padding-right: 34px;
        font-size: 0.95rem;
    }
}
