.chart-component {
    max-width: 100%;
    margin: 0 auto;
}

.scenarios-section {
    margin-bottom: 2rem;
}

.scenario-card {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border: 2px solid #e5e7eb;
}

.scenario-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    border-color: #93c5fd;
}

.scenario-card.active {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.05);
}

.scenario-card.active::before {
    content: '✓';
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 24px;
    height: 24px;
    background: #3b82f6;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

.card-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    font-size: 2rem;
    color: #3b82f6;
    border-radius: inherit;
}

.chart-filters {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.filters-row {
    display: flex;
    gap: 1.5rem;
    align-items: end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: #374151;
}

.filter-select {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: white;
    min-width: 200px;
}

.btn-regions, .btn-reset {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-regions {
    background: #3b82f6;
    color: white;
    border: none;
}

.btn-regions:hover {
    background: #2563eb;
}

.btn-reset {
    background: transparent;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.btn-reset:hover {
    background: #f3f4f6;
}

.chart-container {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: var(--border-radius-s);
}

.chart-internal-filters {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f3f4f6;
}

.filters-left {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
}

.filter-select-sm {
    padding: 0.375rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0;
    background: white;
    font-size: 0.875rem;
    min-width: 120px;
    height: 34px;
}

.btn-regions-sm, .btn-reset-sm {
    padding: 0.375rem 0.75rem;
    border-radius: 0;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-regions-sm {
    background: var(--primary-600, #3b82f6);
    color: white;
    border: 1px solid var(--primary-600, #3b82f6);
}

.btn-regions-sm:hover {
    background: var(--primary-700, #2563eb);
    border: 1px solid var(--primary-700, #2563eb);
}

.btn-reset-sm {
    background: transparent;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.btn-reset-sm:hover {
    background: #f3f4f6;
}

.filter-count {
    background: #ef4444;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.7rem;
    margin-left: 4px;
}

.chart-canvas {
    width: 100%;
    height: 500px;
    position: relative;
}

.chart-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.chart-loading p {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0;
}

.chart-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    z-index: 999;
    pointer-events: all;
}

.regions-dropdown {
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 100%;
    background: white;
    border-left: 1px solid #d1d5db;
    border-radius: 0;
    z-index: 1002;
    overflow: hidden;
}

.regions-dropdown-content {
    padding: 1rem;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.regions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f3f4f6;
}

.regions-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}

.btn-close-compact {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #9ca3af;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
}

.btn-close-compact:hover {
    background: #f3f4f6;
    color: #6b7280;
}

.btn-all-chile-compact {
    width: 100%;
    padding: 0.5rem;
    background: var(--primary-600, #3b82f6);
    color: white;
    border: 1px solid var(--primary-600, #3b82f6);
    border-radius: 0;
    margin-bottom: 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
}

.btn-all-chile-compact:hover {
    background: var(--primary-700, #2563eb);
    border-color: var(--primary-700, #2563eb);
}

.regions-list-compact {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    overflow-y: auto;
}

.region-item-compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    cursor: pointer;
    border-radius: 0;
    font-size: 0.875rem;
    color: #374151;
}

.region-item-compact:hover {
    background: #f9fafb;
}

.region-item-compact input[type="checkbox"] {
    margin: 0;
    width: 14px;
    height: 14px;
}

@media (max-width: 768px) {
    .filters-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-select {
        min-width: auto;
    }
    
    .chart-internal-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filters-left {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .regions-dropdown {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 100%;
        border-left: none;
        border-top: 1px solid #d1d5db;
    }
}