/* ================================================
   PERFORMANCE OPTIMIZATIONS FOR ALL CALCULATORS
   ================================================ */

/* CRITICAL: Mobile Performance Fixes */
@media (max-width: 768px) {
    /* Disable all expensive backdrop filters on mobile */
    *,
    *::before,
    *::after {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    
    /* Disable all background animations on mobile */
    body::before,
    body::after,
    .calculator-card::before,
    .tdee-result::before,
    .feature-block::before {
        animation: none !important;
    }
    
    /* Force hardware acceleration for critical elements */
    .calculator-card,
    .results-section,
    .hero-content,
    .metrics-display,
    .metric-item {
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        will-change: auto !important;
    }
    
    /* Simplify shadows on mobile */
    .calculator-card,
    .tdee-result,
    .breakdown-card,
    .goal-card {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    }
    
    /* Disable hover effects on mobile */
    .card:hover,
    .activity-card:hover,
    .goal-card:hover,
    .breakdown-card:hover,
    .metric-item:hover {
        transform: none !important;
        box-shadow: none !important;
    }
    
    /* Remove expensive gradients on mobile */
    .tdee-number,
    .breakdown-value,
    .goal-value {
        background: none !important;
        -webkit-background-clip: unset !important;
        background-clip: unset !important;
        -webkit-text-fill-color: var(--fire-primary) !important;
        color: var(--fire-primary) !important;
    }
    
    /* Simplify borders */
    .calculator-card::before,
    .breakdown-card::before,
    .goal-card::before {
        display: none !important;
    }
    
    /* Reduce animation complexity */
    * {
        transition-duration: 0.2s !important;
    }
}

/* Desktop optimizations */
@media (min-width: 769px) {
    /* Use GPU acceleration for smooth animations */
    .calculator-card,
    .hero-content,
    .results-section {
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
    
    /* Limit will-change to only animating elements */
    .calculate-btn,
    .recalculate-btn,
    .activity-card,
    .goal-card {
        will-change: transform;
    }
    
    /* Remove will-change after animation */
    .calculate-btn:not(:hover):not(:active),
    .recalculate-btn:not(:hover):not(:active),
    .activity-card:not(:hover):not(:active),
    .goal-card:not(:hover):not(:active) {
        will-change: auto;
    }
}

/* Universal optimizations */
/* Reduce particle opacity for better performance */
.particle {
    opacity: 0.3 !important;
    will-change: transform, opacity;
}

/* Optimize rotating gradients */
@keyframes rotate {
    0% { transform: rotate(0deg) translateZ(0); }
    100% { transform: rotate(360deg) translateZ(0); }
}

/* Optimize glow animations */
@keyframes fireGlow {
    0%, 100% { 
        box-shadow: 0 0 15px rgba(255, 107, 0, 0.3);
        transform: scale(1) translateZ(0);
    }
    50% { 
        box-shadow: 0 0 20px rgba(255, 107, 0, 0.4);
        transform: scale(1.03) translateZ(0);
    }
}

@keyframes muscleGlow {
    0%, 100% { 
        box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
        transform: translateZ(0);
    }
    50% { 
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
        transform: translateZ(0);
    }
}

/* Contain layout shifts */
.calculator-container,
.results-section {
    contain: layout style paint;
}

/* Optimize font rendering */
body {
    text-rendering: optimizeSpeed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Reduce paint on scroll */
.navbar {
    contain: layout style;
}
