/* ======================================== */
/* LEGEND */
/* ======================================== */
.legend-section {
    background: linear-gradient(135deg, var(--color-bg) 0%, white 100%);
    padding: var(--space-lg);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.legend-section:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.legend-section h3 {
    margin-bottom: var(--space-md) !important;
    color: var(--color-primary) !important;
    font-size: var(--font-size-lg) !important;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.legend-scale {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    animation: fadeIn 0.6s var(--ease-standard);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: var(--font-size-sm);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    animation: slideInLeft 0.4s var(--ease-standard);
    animation-fill-mode: both;
}

.legend-item:nth-child(1) { animation-delay: 0.1s; }
.legend-item:nth-child(2) { animation-delay: 0.15s; }
.legend-item:nth-child(3) { animation-delay: 0.2s; }
.legend-item:nth-child(4) { animation-delay: 0.25s; }
.legend-item:nth-child(5) { animation-delay: 0.3s; }

.legend-item:hover {
    background: white;
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.legend-color {
    width: 48px;
    height: 28px;
    border-radius: var(--border-radius-sm);
    border: 2px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.legend-color::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    transition: left 0.5s;
}

.legend-item:hover .legend-color {
    transform: scale(1.1);
    box-shadow: var(--shadow);
}

.legend-item:hover .legend-color::before {
    left: 100%;
}

.legend-item span:not(.legend-color) {
    font-weight: 500;
    color: var(--color-text);
    letter-spacing: 0.01em;
}

.legend-range {
    margin-top: var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border);
    text-align: center;
    font-weight: 500;
    animation: fadeIn 0.8s var(--ease-standard);
}

.legend-range::before {
    content: '📊';
    margin-right: var(--space-xs);
}

/* ======================================== */
/* LEGEND GRADIENT VARIANT (Alternative) */
/* ======================================== */
.legend-gradient {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin: var(--space-md) 0;
    padding: var(--space-md);
    background: white;
    border-radius: var(--border-radius);
}

.legend-gradient-bar {
    flex: 1;
    height: 32px;
    border-radius: var(--border-radius-sm);
    background: linear-gradient(to right, 
        #C0152F 0%, 
        #E66761 25%, 
        #E6A77F 50%, 
        #7DAFA3 75%, 
        #21808D 100%
    );
    box-shadow: var(--shadow-inner);
    position: relative;
    overflow: hidden;
}

.legend-gradient-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.3) 0%, transparent 100%);
}

.legend-gradient-labels {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-xs);
    font-size: var(--font-size-xs);
    color: var(--color-text-light);
    font-weight: 500;
}

/* ======================================== */
/* RESPONSIVE - LEGEND */
/* ======================================== */
@media (max-width: 768px) {
    .legend-section {
        padding: var(--space-md);
    }
    
    .legend-section h3 {
        font-size: var(--font-size-base) !important;
    }
    
    .legend-item {
        gap: var(--space-sm);
        font-size: var(--font-size-xs);
    }
    
    .legend-color {
        width: 40px;
        height: 24px;
    }
    
    .legend-range {
        font-size: var(--font-size-xs);
    }
}

@media (max-width: 480px) {
    .legend-section {
        padding: var(--space-sm);
    }
    
    .legend-item {
        padding: var(--space-xs);
    }
    
    .legend-color {
        width: 36px;
        height: 20px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .legend-section,
    .legend-item,
    .legend-color {
        transition: none !important;
        animation: none !important;
    }
    
    .legend-color::before {
        display: none;
    }
}
