/* Chart Component Styles */
.chart-wrapper {
    position: relative;
    width: 100%;
    padding: 16px;
    background: var(--card, #fff);
    border-radius: var(--radius, 12px);
    transition: all 0.3s ease;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.chart-legend {
    display: flex;
    gap: 12px;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--line, #e5e7eb);
    border-radius: 20px;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    color: var(--muted, #6b7280);
    transition: all 0.2s ease;
}

.chart-legend-item:hover {
    background: var(--soft, #f3f4f6);
}

.chart-legend-item.active {
    background: var(--soft2, #e5e7eb);
    color: var(--text, #111827);
    border-color: var(--soft2, #e5e7eb);
    font-weight: 500;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-dot.bar {
    background: linear-gradient(135deg, #9D65C9, #B892D9);
}

.legend-dot.line {
    background: linear-gradient(135deg, #9D65C9, #B892D9);
}

html[data-theme="dark"] .legend-dot.bar,
html[data-theme="dark"] .legend-dot.line {
    background: linear-gradient(135deg, #A78BFA, #C4B5FD);
}

.chart-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-update-time {
    font-size: 12px;
    color: var(--muted, #9ca3af);
}

.chart-refresh-btn {
    background: transparent;
    border: none;
    color: var(--muted, #9ca3af);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s;
}

.chart-refresh-btn:hover {
    color: var(--text, #111827);
}

.chart-body {
    position: relative;
    min-height: 300px;
}

.echarts-container {
    width: 100%;
    height: 300px;
}

/* Overlays */
.chart-loading-overlay,
.chart-error-overlay,
.chart-empty-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(2px);
    z-index: 10;
    border-radius: 8px;
}

html[data-theme="dark"] .chart-loading-overlay,
html[data-theme="dark"] .chart-error-overlay,
html[data-theme="dark"] .chart-empty-overlay {
    background: rgba(30, 30, 30, 0.8);
}

.chart-error-overlay p,
.chart-empty-overlay p {
    color: var(--muted, #6b7280);
    margin-bottom: 12px;
}

.chart-error-overlay button {
    padding: 6px 16px;
    background: var(--soft2, #e5e7eb);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text, #111827);
    font-size: 13px;
    transition: background 0.2s;
}

.chart-error-overlay button:hover {
    background: var(--line, #d1d5db);
}

/* Spinner */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--soft2, #e5e7eb);
    border-top-color: #9D65C9;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

html[data-theme="dark"] .spinner {
    border-top-color: #A78BFA;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .chart-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .echarts-container {
        height: 250px;
    }
}
