/* 1. Configuración base */
body {
    margin: 0;
    padding: 0;
}

html,
body,
#map {
    height: 100%;
    width: 100%;
    font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;
}

/* 2. Popup */
.maplibregl-popup-content {
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: none;
    width: 300px;
}

.maplibregl-popup-close-button {
    color: #999;
    font-size: 18px;
    padding: 5px 10px;
}

.maplibregl-popup-close-button:hover {
    color: #333;
    background: none;
}

/* Contenido Interno Popup */
.popup-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.popup-tag {
    align-self: flex-start;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.popup-title {
    margin: 5px 0 0 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}

.popup-description {
    margin: 5px 0;
    line-height: 1.4;
    color: #555;
    font-size: 13px;
}

.popup-link {
    display: inline-block;
    margin-top: 5px;
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
    font-size: 12px;
}

.popup-link:hover {
    text-decoration: underline;
}

.popup-footer {
    border-top: 1px solid #eee;
    margin-top: 8px;
    padding-top: 8px;
    font-size: 11px;
    color: #95a5a6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 3. Leyenda */
.map-legend {
    position: absolute;
    bottom: 30px;
    left: 20px;
    background: rgba(255, 255, 255, 0.98);
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    width: 300px;
    overflow: hidden;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.legend-header {
    background-color: #f8f9fa;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.legend-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.legend-header h4 {
    margin: 0;
    font-size: 13px;
    color: #2c3e50;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend-help {
    border: 1px solid #f8d7da;
    background-color: #f8d7da;
    border-radius: 12px;
    padding: 12px 12px 12px 24px;
    font-size: 12px;
    margin-bottom: 0;
    line-height: 1.35;
    color: #5f6b76;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.total-badge {
    background-color: #e03a3c;
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 10px;
}

.legend-body {
    padding: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    margin-bottom: 2px;
    font-size: 12px;
    color: #555;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

/* Efecto al pasar el mouse por encima (Hover) */
.legend-item:hover {
    background-color: #f0f2f5;
    color: #333;
}

/* ESTADO: NO SELECCIONADO (Dimmed) */
/* Se aplica a los que NO son el filtro actual */
.legend-item.dimmed {
    color: #878f97
}

.legend-item.dimmed:hover {
    background-color: #f0f2f5;
}

/* ESTADO: SELECCIONADO (Active) */
/* Se aplica al filtro actual para resaltarlo */
.legend-item.selected {
    background-color: rgba(44, 62, 80, 0.08);
    font-weight: 700;
    color: #000;
    /* box-shadow: inset 3px 0 0 #2c3e50; */
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
}


/* Loader */
.map-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 1);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
    border-radius: 12px;
}

/* Texto del loader */
.map-loader p {
    margin-top: 15px;
    color: #2c3e50;
    font-weight: 600;
    font-size: 14px;
    font-family: sans-serif;
    letter-spacing: 0.5px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #e74c3c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}