/* Chart.js Customizations */
.chart-container canvas {
    border-radius: 8px;
}

/* ApexCharts Customizations */
.apexcharts-tooltip {
    background: white !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.apexcharts-tooltip-title {
    background: var(--primary-color) !important;
    color: white !important;
    border-bottom: none !important;
    font-weight: 600 !important;
}

.apexcharts-xaxistooltip, 
.apexcharts-yaxistooltip {
    background: white !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 6px !important;
    color: var(--dark-color) !important;
}

.apexcharts-legend-text {
    color: var(--dark-color) !important;
    font-weight: 500 !important;
}

.apexcharts-gridline {
    stroke: #f0f0f0 !important;
}

/* Custom Chart Styles */
.chart-widget {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
}

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

.chart-widget-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
}

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

.chart-action-btn {
    background: none;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-muted);
    transition: var(--transition);
}

.chart-action-btn:hover {
    background: #f8f9fa;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Sparkline Charts */
.sparkline-container {
    display: inline-block;
    position: relative;
}

.sparkline-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 1000;
}

.sparkline-container:hover .sparkline-tooltip {
    opacity: 1;
}

/* Progress Charts */
.progress-chart {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin: 10px 0;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--dark-color);
}

.progress-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
}

.progress-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #2980b9);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Gauge Charts */
.gauge-container {
    text-align: center;
    padding: 20px;
}

.gauge-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--dark-color);
    margin-bottom: 5px;
}

.gauge-label {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Donut Charts */
.donut-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* Animation Classes */
.chart-fade-in {
    animation: chartFadeIn 0.5s ease-in-out;
}

@keyframes chartFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chart-slide-in {
    animation: chartSlideIn 0.4s ease-out;
}

@keyframes chartSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Print Styles */
@media print {
    .chart-container {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .kpi-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .no-print {
        display: none !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .chart-container {
        border: 2px solid var(--dark-color);
    }
    
    .kpi-card {
        border: 2px solid var(--dark-color);
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .chart-fade-in,
    .chart-slide-in {
        animation: none;
    }
    
    .progress-fill {
        transition: none;
    }
}

/* Adicione ao charts.css */
.chart-container {
    width: 100%;
    height: 300px;
    position: relative;
}

.chart-card.full-width .chart-container {
    height: 400px;
}

/* Garantir que os canvases sejam visíveis */
canvas {
    display: block;
    max-width: 100%;
}