/* ============================================================
   maps.css – Nature's Green  |  Premium redesign
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600&family=Inter:wght@300;400;500&display=swap');

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: transparent;
}

/* ── Wrapper principal ── */
.mapa-wrapper {
    display: flex;
    width: 100%;
    height: 500px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
}

/* ══════════════════════════════════════
   PANEL LATERAL
══════════════════════════════════════ */
.mapa-lista {
    width: 270px;
    min-width: 240px;
    flex-shrink: 0;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #ececec;
}

/* Cabecera del panel */
.lista-header {
    padding: 20px 18px 16px;
    background: #1b4332;
    flex-shrink: 0;
}

.lista-header-titulo {
    font-family: 'Playfair Display', serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lista-header-titulo i {
    font-size: 0.85rem;
    opacity: 0.8;
}

.lista-header-sub {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.55);
    margin-top: 3px;
    font-weight: 300;
    letter-spacing: 0.03em;
}

/* Scroll de items */
.lista-items {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.lista-items::-webkit-scrollbar {
    width: 3px;
}

.lista-items::-webkit-scrollbar-thumb {
    background: #d4e8dc;
    border-radius: 3px;
}

/* Estados */
.lista-cargando,
.lista-vacia,
.lista-error {
    padding: 20px 18px;
    font-size: 0.8rem;
    color: #aaa;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lista-error {
    color: #c0392b;
}

/* ── Cada sucursal ── */
.sucursal-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.18s ease, border-color 0.18s ease;
    position: relative;
}

.sucursal-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 1px;
    background: #f3f3f3;
}

.sucursal-item:last-child::after {
    display: none;
}

.sucursal-item:hover {
    background: #f4faf7;
    border-left-color: #52b788;
}

.sucursal-item.activo {
    background: #eaf5ef;
    border-left-color: #1b4332;
}

/* Contenedor del logo sin el círculo restrictivo */
.sucursal-icono {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: transparent;
}

.sucursal-icono img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
    transition: transform 0.3s ease;
}

.sucursal-item:hover .sucursal-icono img {
    transform: scale(1.08);
}

/* Texto */
.sucursal-info {
    flex: 1;
    min-width: 0;
}

.sucursal-info h3 {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    color: #1b4332;
    margin-bottom: 4px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sucursal-info p {
    font-size: 0.7rem;
    color: #999;
    margin-bottom: 2px;
    line-height: 1.4;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.sucursal-info p i {
    color: #52b788;
    font-size: 0.62rem;
    width: 10px;
    flex-shrink: 0;
}

/* Flecha indicadora al hacer hover */
.sucursal-arrow {
    flex-shrink: 0;
    color: #c8e6d4;
    font-size: 0.65rem;
    transition: color 0.18s, transform 0.18s;
}

.sucursal-item:hover .sucursal-arrow,
.sucursal-item.activo .sucursal-arrow {
    color: #52b788;
    transform: translateX(2px);
}

/* ══════════════════════════════════════
   MAPA
══════════════════════════════════════ */
#mapa {
    flex: 1;
    height: 100%;
    z-index: 1;
}

/* Zoom control personalizado */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15) !important;
    border-radius: 8px !important;
    overflow: hidden;
}

.leaflet-control-zoom a {
    width: 32px !important;
    height: 32px !important;
    line-height: 32px !important;
    font-size: 1rem !important;
    color: #1b4332 !important;
    background: #fff !important;
    border: none !important;
}

.leaflet-control-zoom a:hover {
    background: #f0faf5 !important;
}

/* ── Marcador ── */
.marco-marker {
    background: #ffffff;
    border: 2px solid #52b788;
    padding: 3px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    border-radius: 14px;
}

.marker-fallback {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #2d6a4f, #1b4332);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

.marker-fallback i {
    color: #fff;
    font-size: 0.9rem;
    transform: rotate(45deg);
}

/* ── Popup ── */
.leaflet-popup-content-wrapper {
    border-radius: 12px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15) !important;
    border: none !important;
    padding: 0 !important;
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0 !important;
    width: auto !important;
}

.leaflet-popup-tip {
    box-shadow: none !important;
}

.popup-marco {
    padding: 16px 18px;
    min-width: 200px;
}

.popup-marco h4 {
    font-family: 'Playfair Display', serif;
    font-size: 0.95rem;
    color: #1b4332;
    margin-bottom: 8px;
    font-weight: 600;
    line-height: 1.3;
}

.popup-marco p {
    font-size: 0.74rem;
    color: #777;
    margin-bottom: 4px;
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.popup-marco p i {
    color: #52b788;
    font-size: 0.68rem;
    width: 10px;
}

.popup-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 7px 16px;
    background: linear-gradient(135deg, #2d6a4f, #1b4332);
    color: #fff !important;
    border-radius: 20px;
    text-decoration: none !important;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: opacity 0.2s, transform 0.2s;
}

.popup-link:hover {
    opacity: 0.88;
    transform: translateY(-1px);
    color: #fff !important;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .mapa-wrapper {
        flex-direction: column;
        height: auto;
        border-radius: 12px;
    }

    .mapa-lista {
        width: 100%;
        max-height: 190px;
        border-right: none;
        border-bottom: 1px solid #ececec;
    }

    #mapa {
        flex: none;
        height: 380px;
        min-height: 380px;
        width: 100%;
    }
}