/* app/static/app/css/components/charts.css */
/* Professional Chart Styling - Chart.js Integration */

/* Chart Container Base Styling */
.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
    padding: 20px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.3s ease;
}

.chart-container:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

/* Chart Container Variants */
.chart-container-sm {
    height: 200px;
    padding: 15px;
}

.chart-container-md {
    height: 300px;
    padding: 20px;
}

.chart-container-lg {
    height: 400px;
    padding: 25px;
}

.chart-container-xl {
    height: 500px;
    padding: 30px;
}

/* Dashboard Chart Containers */
.dashboard-chart {
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    min-height: 300px;
}

.dashboard-chart canvas {
    max-height: 280px;
}

/* Chart Header (Title + Actions) */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

.chart-title {
    font-size: 1.1em;
    font-weight: 500;
    color: #313b77;
    margin: 0;
}

.chart-subtitle {
    font-size: 0.85em;
    color: #6c757d;
    margin-top: 4px;
}

.chart-actions {
    display: flex;
    gap: 8px;
}

.chart-action-btn {
    padding: 4px 8px;
    font-size: 0.85em;
    color: #6c757d;
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.chart-action-btn:hover {
    color: #313b77;
    border-color: #313b77;
    background: #f8f9fa;
}

/* Chart Loading State */
.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: #6c757d;
    font-size: 0.95em;
}

.chart-loading i {
    margin-right: 8px;
    animation: spin 1s linear infinite;
}

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

/* Chart Empty State */
.chart-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    text-align: center;
    padding: 40px 20px;
}

.chart-empty-state-icon {
    font-size: 3em;
    color: #dee2e6;
    margin-bottom: 15px;
}

.chart-empty-state h4 {
    font-size: 1.1em;
    color: #6c757d;
    margin-bottom: 8px;
}

.chart-empty-state p {
    font-size: 0.9em;
    color: #adb5bd;
    max-width: 400px;
}

/* Chart Legend Enhancements */
.chart-legend-custom {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
    color: #495057;
}

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

/* Chart Tooltip Enhancements (applied via JS) */
/* Tooltips are styled in chart_config.js for consistency */

/* Responsive Design */
@media (max-width: 768px) {
    .chart-container {
        height: 250px;
        padding: 15px;
    }

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

    .dashboard-chart {
        padding: 15px;
        min-height: 250px;
    }

    .dashboard-chart canvas {
        max-height: 220px;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .chart-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .chart-container,
    .dashboard-chart {
        background: #1a1d21;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }

    .chart-container:hover,
    .dashboard-chart:hover {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    }

    .chart-header {
        border-bottom-color: #343a40;
    }

    .chart-title {
        color: #e9ecef;
    }

    .chart-subtitle {
        color: #adb5bd;
    }

    .chart-action-btn {
        color: #adb5bd;
        border-color: #495057;
    }

    .chart-action-btn:hover {
        color: #e9ecef;
        border-color: #6c757d;
        background: #212529;
    }

    .chart-legend-custom {
        border-top-color: #343a40;
    }

    .chart-legend-item {
        color: #adb5bd;
    }
}

/* Print Styles */
@media print {
    .chart-container,
    .dashboard-chart {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #dee2e6;
    }

    .chart-actions {
        display: none;
    }
}
