/* ========== ESTILOS PARA LEYENDA DE MAPAS ========== */
.legend {
    background: white !important;
    padding: 16px !important;
    border-radius: 10px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 4px 20px rgba(0, 0, 0, 0.1) !important;
    font-family: "Archia", sans-serif !important;
    font-size: 12px !important;
    line-height: 1.5;
    max-width: 290px;
    z-index: 1000;
}

.legend div:first-child {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 12px;
    /* padding-bottom: 8px; */
    /* border-bottom: 2px solid #ecf0f1; */
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend i {
    color: #e74c3c;
    font-size: 14px;
}

.legend .color-box {
    width: 35px;
    height: 28px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.legend .color-box:hover {
    transform: scale(1.08);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
}

.legend .legend-item {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 10px;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
}

.legend .legend-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.legend .legend-label {
    color: #34495e;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
}

.legend .legend-label span {
    display: block;
    font-size: 10px;
    color: #999;
    font-weight: normal;
    margin-top: 2px;
}

.legend .legend-footer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid #ecf0f1;
    font-size: 10px;
    color: #7f8c8d;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend .legend-footer i {
    color: #3498db;
    font-size: 12px;
    flex-shrink: 0;
}

/* Animación suave para aparición de leyenda */
.legend {
    animation: fadeInLegend 0.3s ease-in-out;
}

@keyframes fadeInLegend {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsiva: Leyenda más compacta en móviles */

.legend.collapsed .legend-body,
.legend.collapsed .legend-extra {
    display: none !important;
}

@media (max-width: 768px) {
    .legend {
        padding: 12px !important;
        font-size: 11px !important;
        max-width: 260px;
    }

    .legend div:first-child {
        font-size: 11px;
    }

    .legend .legend-item {
        grid-template-columns: 32px 1fr;
        gap: 8px;
        padding: 5px 0;
    }

    .legend .color-box {
        width: 32px;
        height: 24px;
    }

    .legend .legend-label {
        font-size: 10px;
    }

    .legend .legend-label span {
        font-size: 9px;
    }

    .legend .legend-footer {
        font-size: 9px;
    }
}

/* Muy móvil (<480px) */
@media (max-width: 480px) {
    .legend {
        padding: 10px !important;
        font-size: 10px !important;
        max-width: 240px;
    }

    .legend div:first-child {
        font-size: 10px;
        gap: 4px;
    }

    .legend .legend-item {
        grid-template-columns: 28px 1fr;
        gap: 6px;
        padding: 4px 0;
    }

    .legend .color-box {
        width: 28px;
        height: 22px;
    }

    .legend .legend-label {
        font-size: 9px;
    }

    .legend .legend-footer {
        font-size: 8px;
        gap: 4px;
    }
}

/* Efecto hover general para legibilidad */
.legend:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 6px 24px rgba(0, 0, 0, 0.12) !important;
}
