/* Background Video CSS - Instant Visibility Management */

/* Initial state: hide video containers, show image containers */
.hidden-on-load {
    display: none !important;
    animation: none !important;
    transition: none !important;
}

.shown-on-load {
    display: block !important;
    animation: none !important;
    transition: none !important;
}

/* Video ready state: show video containers, hide image containers - INSTANT */
.video-ready .hidden-on-load {
    display: block !important;
    animation: none !important;
    transition: none !important;
}

.video-ready .shown-on-load {
    display: none !important;
    animation: none !important;
    transition: none !important;
}

/* Responsive visibility classes for GTM */
@media (max-width: 767px) {
    .gtm-hide-phone {
        display: none !important;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .gtm-hide-tablet {
        display: none !important;
    }
}

@media (min-width: 1024px) {
    .gtm-hide-desktop {
        display: none !important;
    }
}

/* Ensure video elements are properly sized and optimized */
.hidden-on-load video,
.shown-on-load video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* GPU acceleration for video rendering */
    transform: translateZ(0);
    will-change: transform;
    /* Optimize video performance */
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Video loading optimization */
video {
    /* Performance optimizations */
    pointer-events: none;
    user-select: none;
    /* GPU acceleration */
    transform: translateZ(0);
    will-change: transform;
}

/* Video loading progress bar */
#video-progress-track {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

#video-loading-progress {
    opacity: 0;
    transition: width 0.3s ease-out, opacity 0.3s ease-in-out;
}

#video-progress-track.visible,
#video-loading-progress.visible {
    opacity: 1;
}

/* Enhanced video ready state transitions */
@keyframes fadeInVideo {
    from {
        opacity: 0;
        transform: translateZ(0) scale(1.02);
    }
    to {
        opacity: 1;
        transform: translateZ(0) scale(1);
    }
}

@keyframes fadeOutImage {
    from {
        opacity: 1;
        transform: translateZ(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateZ(0) scale(0.98);
    }
}

/* Enhanced video loading state indicators */
.video-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #4CAF50;
    border-radius: 50%;
    animation: videoLoadingSpin 1s linear infinite;
    z-index: 10;
}

@keyframes videoLoadingSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
