/* ===== CHART STYLES ===== */

.chart-container {
    position: relative;
    width: 100%;
    padding: 16px;
}

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

/* SVG Chart Styles */
.chart-svg {
    width: 100%;
    height: 100%;
}

.chart-line {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-line.primary { stroke: var(--primary-light); }
.chart-line.success { stroke: var(--success); }
.chart-line.warning { stroke: var(--accent); }
.chart-line.danger { stroke: var(--danger); }

.chart-area {
    opacity: 0.1;
}

.chart-area.primary { fill: var(--primary-light); }
.chart-area.success { fill: var(--success); }

.chart-dot {
    r: 4;
    fill: white;
    stroke-width: 2;
}

.chart-dot.primary { stroke: var(--primary-light); }
.chart-dot.success { stroke: var(--success); }
.chart-dot.warning { stroke: var(--accent); }
.chart-dot.danger { stroke: var(--danger); }

.chart-limit-line {
    stroke-dasharray: 6 4;
    stroke-width: 1.5;
    fill: none;
}

.chart-limit-line.alert { stroke: var(--accent); }
.chart-limit-line.action { stroke: var(--danger); }
.chart-limit-line.mean { stroke: var(--info); stroke-dasharray: 4 2; }
.chart-limit-line.ucl { stroke: var(--danger); }
.chart-limit-line.lcl { stroke: var(--success); }

.chart-grid-line {
    stroke: var(--border);
    stroke-width: 0.5;
}

.chart-axis-label {
    font-size: 10px;
    fill: var(--text-secondary);
    font-family: 'Segoe UI', sans-serif;
}

.chart-title-text {
    font-size: 12px;
    fill: var(--text-primary);
    font-weight: 600;
    font-family: 'Segoe UI', sans-serif;
}

/* Chart Legend */
.chart-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
}

.legend-line {
    width: 20px;
    height: 2px;
    border-radius: 1px;
}

.legend-line.solid { border-top: 2px solid; }
.legend-line.dashed { border-top: 2px dashed; }
.legend-line.primary { border-color: var(--primary-light); }
.legend-line.success { border-color: var(--success); }
.legend-line.warning { border-color: var(--accent); }
.legend-line.danger { border-color: var(--danger); }
.legend-line.info { border-color: var(--info); }

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

/* Control Chart Specific */
.control-chart-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    padding: 20px;
    margin-bottom: 20px;
}

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

.control-chart-info {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.chart-info-item {
    text-align: center;
}

.chart-info-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.chart-info-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Tooltip */
.chart-tooltip {
    position: absolute;
    background: var(--bg-sidebar);
    color: var(--text-white);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 100;
    white-space: nowrap;
}

.chart-tooltip.visible {
    opacity: 1;
}

/* Mini Chart (Sparkline) */
.sparkline {
    width: 80px;
    height: 24px;
}

.sparkline-path {
    fill: none;
    stroke: var(--primary-light);
    stroke-width: 1.5;
}

/* Bar Chart */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 60px;
}

.bar {
    flex: 1;
    border-radius: 2px 2px 0 0;
    min-width: 6px;
    transition: height 0.3s;
}

.bar.primary { background: var(--primary-light); }
.bar.success { background: var(--success); }
.bar.warning { background: var(--accent); }
.bar.danger { background: var(--danger); }

/* Trending chart controls */
.chart-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-period-btn {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.chart-period-btn.active {
    background: var(--primary-light);
    color: white;
    border-color: var(--primary-light);
}

.chart-period-btn:hover:not(.active) {
    background: var(--bg-body);
}
