/* Chart Performance Optimizations */

/* Optimize canvas rendering */
canvas {
    /* Enable hardware acceleration */
    transform: translateZ(0);
    will-change: transform;
    
    /* Optimize rendering */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Optimize chart containers */
.chart-container {
    /* Prevent layout thrashing */
    contain: layout style paint;
    
    /* Optimize for animations */
    transform: translateZ(0);
    will-change: transform;
}

/* Optimize card animations */
.card {
    /* Smooth transitions */
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
    
    /* Optimize for hover effects */
    will-change: transform, box-shadow;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Optimize table rendering */
.table {
    /* Prevent layout thrashing */
    contain: layout style;
}

.table tbody tr {
    /* Smooth row transitions */
    transition: background-color 0.15s ease-out;
}

/* Optimize loading states */
.chart-loading {
    /* Prevent layout shifts */
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Optimize responsive behavior */
@media (max-width: 768px) {
    .chart-container {
        /* Reduce complexity on mobile */
        max-height: 250px;
    }
    
    canvas {
        /* Optimize for mobile rendering */
        max-width: 100%;
        height: auto;
    }
}

/* Optimize print styles */
@media print {
    .chart-container {
        /* Disable animations for printing */
        animation: none !important;
        transition: none !important;
    }
    
    canvas {
        /* Optimize for print */
        page-break-inside: avoid;
    }
}

/* Performance monitoring styles */
.performance-warning {
    position: fixed;
    top: 10px;
    right: 10px;
    background: #ff6b6b;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 9999;
    display: none;
}

.performance-warning.show {
    display: block;
} 