/* 
 * Will-Change Memory Budget Optimization
 * Fixes: Użycie pamięci przez własność „will-change" jest zbyt wysokie
 * 
 * This file replaces problematic will-change properties with more efficient
 * GPU acceleration techniques that don't exceed browser memory budgets.
 */

/* Global will-change budget optimization */
* {
    /* Remove any global will-change declarations that might be causing issues */
}

/* Replace will-change with translateZ(0) for lightweight GPU acceleration */
.modal,
.dropdown-menu,
.tooltip,
.popover,
.navbar-collapse,
.carousel-item,
.fade,
.show {
    /* Use translateZ(0) instead of will-change for memory efficiency */
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Optimize commonly animated elements */
.btn:hover,
.card:hover,
.nav-link:hover {
    /* Lightweight hover optimization without will-change */
    transform: translateZ(0);
}

/* Animation performance optimization */
@keyframes optimizedFadeIn {
    from { 
        opacity: 0; 
        transform: translateZ(0) translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateZ(0) translateY(0); 
    }
}

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

/* Optimized transitions for better performance */
.optimized-transition {
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform: translateZ(0);
}

/* Specific fixes for agenda/calendar components */
.cd-schedule .event-modal {
    /* Fix applied - using translateZ(0) instead of will-change */
    transform: translateZ(0);
}

.cd-schedule .event-modal .header-bg,
.cd-schedule .event-modal .body-bg {
    /* Fix applied - removed will-change: transform */
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Performance optimization for frequently animated elements */
.agenda-item,
.timeline-item,
.speaker-card,
.partner-logo {
    /* Memory-efficient GPU acceleration */
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Scroll performance optimization */
.scroll-container {
    /* Optimize scrolling performance without excessive memory usage */
    -webkit-overflow-scrolling: touch;
    transform: translateZ(0);
}

/* Hover effects optimization */
.hover-effect:hover {
    /* Efficient hover animations */
    transform: translateZ(0) scale(1.02);
    transition: transform 0.2s ease;
}

/* Fix for Bootstrap modal animations */
.modal.fade {
    transform: translateZ(0) translateY(-50px);
}

.modal.fade.show {
    transform: translateZ(0) translateY(0);
}

/* Optimize carousel transitions */
.carousel-item {
    transform: translateZ(0);
    backface-visibility: hidden;
}

.carousel-item.active {
    transform: translateZ(0) translateX(0);
}

.carousel-item-next,
.carousel-item-prev {
    transform: translateZ(0);
}

/* Performance monitoring helper class */
.performance-optimized {
    /* Elements with this class use memory-efficient animations */
    transform: translateZ(0);
    backface-visibility: hidden;
    /* Remove any existing will-change properties */
    will-change: auto;
}

/* Media queries for responsive optimization */
@media (max-width: 768px) {
    /* Reduce GPU acceleration on mobile to save battery */
    .mobile-reduce-gpu * {
        transform: none !important;
        will-change: auto !important;
    }
}

/* Print optimization */
@media print {
    * {
        /* Remove all GPU acceleration for printing */
        transform: none !important;
        will-change: auto !important;
        backface-visibility: visible !important;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    /* Respect user's motion preferences */
    * {
        transform: none !important;
        will-change: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Debug helper - uncomment to identify problematic elements */
/*
[style*="will-change"] {
    outline: 2px solid red !important;
}
[style*="will-change"]::before {
    content: "WILL-CHANGE DETECTED" !important;
    background: red !important;
    color: white !important;
    font-size: 10px !important;
    padding: 2px !important;
    position: absolute !important;
    z-index: 9999 !important;
}
*/