/* ===== CHART CONTAINER ===== */

.cyber-chart-container {
	position: relative;
	background: rgba(12, 17, 43, 0.75);
	border: var(--cyber-border);
	border-radius: var(--cyber-radius-md);
	padding: 1.5rem;
	margin-bottom: 1.5rem;
	overflow: hidden;
}

.cyber-chart-container::after {
	content: '';
	position: absolute;
	inset: 0;
	background: radial-gradient(circle at top right, rgba(102, 126, 234, 0.12), transparent 60%);
	pointer-events: none;
	z-index: 0;
}

/* ===== CHART HEADER ===== */

.cyber-chart-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1.25rem;
	position: relative;
	z-index: 1;
	gap: 1rem;
}

.cyber-chart-title {
	font-size: 1.15rem;
	font-weight: 600;
	color: var(--cyber-text-primary);
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.cyber-chart-title::before {
	content: '📊';
	font-size: 1.25rem;
}

.cyber-chart-subtitle {
	font-size: 0.85rem;
	color: var(--cyber-text-muted);
	margin-top: 0.25rem;
}

.cyber-chart-controls {
	display: flex;
	gap: 0.5rem;
	align-items: center;
}

.cyber-chart-period-selector {
	padding: 0.4rem 0.75rem;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: var(--cyber-radius-xs);
	color: var(--cyber-text-secondary);
	font-size: 0.8rem;
	cursor: pointer;
	transition: all var(--cyber-transition);
}

.cyber-chart-period-selector:hover {
	background: rgba(6, 182, 212, 0.12);
	border-color: var(--cyber-accent-secondary);
	color: var(--cyber-accent-secondary);
}

.cyber-chart-period-selector.active {
	background: var(--cyber-gradient-primary);
	border-color: transparent;
	color: var(--cyber-text-inverse);
}

/* ===== CHART CANVAS ===== */

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

.cyber-chart-canvas canvas {
	max-width: 100%;
	max-height: 100%;
}

/* ===== CHART SIZES ===== */

.cyber-chart-container--sm .cyber-chart-canvas {
	height: 200px;
}

.cyber-chart-container--md .cyber-chart-canvas {
	height: 300px;
}

.cyber-chart-container--lg .cyber-chart-canvas {
	height: 400px;
}

.cyber-chart-container--xl .cyber-chart-canvas {
	height: 500px;
}

/* ===== SPARKLINE (Inline Mini Charts) ===== */

.cyber-sparkline {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	vertical-align: middle;
}

.cyber-sparkline-canvas {
	width: 80px;
	height: 30px;
	display: inline-block;
}

.cyber-sparkline-value {
	font-weight: 600;
	color: var(--cyber-text-primary);
}

.cyber-sparkline-trend {
	font-size: 0.75rem;
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
}

.cyber-sparkline-trend--up {
	color: var(--cyber-success);
}

.cyber-sparkline-trend--down {
	color: var(--cyber-danger);
}

/* ===== CHART LEGEND (Custom) ===== */

.cyber-chart-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	margin-top: 1rem;
	padding-top: 1rem;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	position: relative;
	z-index: 1;
}

.cyber-chart-legend-item {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.85rem;
	color: var(--cyber-text-secondary);
}

.cyber-chart-legend-color {
	width: 12px;
	height: 12px;
	border-radius: 2px;
	flex-shrink: 0;
}

.cyber-chart-legend-label {
	white-space: nowrap;
}

/* ===== CHART LOADING STATE ===== */

.cyber-chart-loading {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(12, 17, 43, 0.95);
	z-index: 10;
	border-radius: var(--cyber-radius-md);
}

.cyber-chart-loading-spinner {
	width: 40px;
	height: 40px;
	border: 3px solid rgba(255, 255, 255, 0.1);
	border-top-color: var(--cyber-accent-secondary);
	border-radius: 50%;
	animation: cyber-spin 0.8s linear infinite;
}

/* ===== CHART EMPTY STATE ===== */

.cyber-chart-empty {
	text-align: center;
	padding: 3rem 1rem;
	color: var(--cyber-text-muted);
}

.cyber-chart-empty-icon {
	font-size: 3rem;
	margin-bottom: 1rem;
	opacity: 0.5;
}

.cyber-chart-empty-text {
	font-size: 0.9rem;
}

/* ===== CHART VARIANTS ===== */

.cyber-chart-container--gradient {
	background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.05));
	border-color: rgba(102, 126, 234, 0.2);
}

.cyber-chart-container--flat {
	background: rgba(12, 17, 43, 0.5);
	box-shadow: none;
}

.cyber-chart-container--bordered {
	border: 2px solid var(--cyber-accent-primary);
}

/* ===== CHART METRICS (Stats alongside chart) ===== */

.cyber-chart-metrics {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	gap: 1rem;
	margin-bottom: 1.25rem;
	position: relative;
	z-index: 1;
}

.cyber-chart-metric {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.cyber-chart-metric-label {
	font-size: 0.75rem;
	color: var(--cyber-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.cyber-chart-metric-value {
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--cyber-text-primary);
	line-height: 1;
}

.cyber-chart-metric-change {
	font-size: 0.75rem;
	display: flex;
	align-items: center;
	gap: 0.25rem;
}

.cyber-chart-metric-change--up {
	color: var(--cyber-success);
}

.cyber-chart-metric-change--down {
	color: var(--cyber-danger);
}

/* ===== RESPONSIVE - TABLET ===== */

@media (max-width: 768px) {
	.cyber-chart-container {
		padding: 1.25rem;
		margin-bottom: 1.25rem;
	}

	.cyber-chart-header {
		flex-direction: column;
		align-items: flex-start;
		margin-bottom: 1rem;
	}

	.cyber-chart-title {
		font-size: 1.05rem;
	}

	.cyber-chart-controls {
		width: 100%;
		justify-content: flex-start;
		overflow-x: auto;
		scrollbar-width: thin;
	}

	.cyber-chart-canvas {
		height: 250px;
	}

	.cyber-chart-container--lg .cyber-chart-canvas,
	.cyber-chart-container--xl .cyber-chart-canvas {
		height: 300px;
	}

	.cyber-chart-metrics {
		grid-template-columns: repeat(2, 1fr);
		gap: 0.85rem;
	}

	.cyber-chart-legend {
		gap: 0.75rem;
	}
}

/* ===== RESPONSIVE - MOBILE ===== */

@media (max-width: 480px) {
	.cyber-chart-container {
		padding: 1rem;
		margin-bottom: 1rem;
		border-radius: var(--cyber-radius-sm);
	}

	.cyber-chart-header {
		margin-bottom: 0.85rem;
	}

	.cyber-chart-title {
		font-size: 1rem;
	}

	.cyber-chart-title::before {
		font-size: 1.15rem;
	}

	.cyber-chart-subtitle {
		font-size: 0.8rem;
	}

	.cyber-chart-controls {
		gap: 0.35rem;
	}

	.cyber-chart-period-selector {
		padding: 0.35rem 0.6rem;
		font-size: 0.75rem;
	}

	.cyber-chart-canvas {
		height: 200px;
	}

	.cyber-chart-container--sm .cyber-chart-canvas {
		height: 150px;
	}

	.cyber-chart-container--md .cyber-chart-canvas,
	.cyber-chart-container--lg .cyber-chart-canvas,
	.cyber-chart-container--xl .cyber-chart-canvas {
		height: 220px;
	}

	.cyber-chart-metrics {
		grid-template-columns: 1fr;
		gap: 0.75rem;
	}

	.cyber-chart-metric-value {
		font-size: 1.35rem;
	}

	.cyber-chart-legend {
		flex-direction: column;
		gap: 0.5rem;
		margin-top: 0.85rem;
		padding-top: 0.85rem;
	}

	.cyber-sparkline-canvas {
		width: 60px;
		height: 24px;
	}
}
