/*
 * SkyRoute Chart Styles
 * Chart containers and styling
 */

/* ============================================
   CHART CONTAINERS
   ============================================ */
.chart-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

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

.chart-title i {
    color: var(--accent-primary);
}

.chart-actions {
    display: flex;
    gap: var(--space-2);
}

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

.chart-body canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ============================================
   CHART GRID
   ============================================ */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
}

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-full-width {
    grid-column: span 2;
}

@media (max-width: 1024px) {
    .chart-full-width {
        grid-column: span 1;
    }
}

/* ============================================
   CHART LEGENDS
   ============================================ */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-color);
}

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

.chart-legend-color {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-sm);
}

/* ============================================
   MINI CHARTS / SPARKLINES
   ============================================ */
.sparkline-container {
    width: 100%;
    height: 40px;
}

/* ============================================
   STAT CARDS WITH MINI CHARTS
   ============================================ */
.stat-card-chart {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.stat-card-info {
    flex: 1;
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.stat-card-label {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    margin-top: var(--space-1);
}

.stat-card-change {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.75rem;
    margin-top: var(--space-2);
}

.stat-card-change.positive {
    color: var(--success);
}

.stat-card-change.negative {
    color: var(--danger);
}

.stat-card-spark {
    width: 80px;
    height: 40px;
}

/* ============================================
   DONUT / PIE CHART SPECIFIC
   ============================================ */
.donut-chart-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.donut-center-text {
    position: absolute;
    text-align: center;
}

.donut-center-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.donut-center-label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   BAR CHART SPECIFIC
   ============================================ */
.horizontal-bar-chart {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.bar-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.bar-label {
    width: 100px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.bar-track {
    flex: 1;
    height: 24px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: var(--radius-sm);
    transition: width var(--transition-slow);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: var(--space-2);
}

.bar-value {
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    font-family: var(--font-mono);
}

/* ============================================
   GAUGE CHART
   ============================================ */
.gauge-container {
    position: relative;
    width: 150px;
    height: 75px;
    margin: 0 auto;
}

.gauge-meter {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: conic-gradient(
        var(--accent-primary) 0deg,
        var(--accent-primary) var(--gauge-value, 0deg),
        var(--bg-tertiary) var(--gauge-value, 0deg)
    );
    clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%);
    position: relative;
}

.gauge-meter::after {
    content: '';
    position: absolute;
    top: 20%;
    left: 20%;
    width: 60%;
    height: 60%;
    background: var(--bg-secondary);
    border-radius: 50%;
}

.gauge-value {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

/* ============================================
   CHART TOOLTIP (Custom)
   ============================================ */
.chart-tooltip {
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
    padding: var(--space-3) !important;
}

.chart-tooltip-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.chart-tooltip-body {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ============================================
   EMPTY CHART STATE
   ============================================ */
.chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
}

.chart-empty-icon {
    font-size: 2rem;
    margin-bottom: var(--space-2);
}

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

/* ============================================
   LOADING STATE
   ============================================ */
.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.chart-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
