/* Video Loading Optimizations */
.video-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    color: white;
    font-family: Arial, sans-serif;
}

.video-loading-spinner .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.video-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 15;
    transition: all 0.3s ease;
}

.video-play-button:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

/* Hero video specific optimizations */
.video-hero {
    position: relative;
}

.hero-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Lazy loading placeholders */
img.lazy {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img.lazy.loaded {
    opacity: 1;
}

img.lazy.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

/* Background images with lazy loading */
.lazy-bg {
    background-color: #f0f0f0;
    position: relative;
}

.lazy-bg.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

.lazy-bg.loaded::before {
    display: none;
}

/* Shimmer animation for loading states */
@keyframes loading-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Responsive image optimizations */
.responsive-image {
    width: 100%;
    height: auto;
    display: block;
}

/* Video optimization styles */
.hero-video.loading {
    opacity: 0;
}

.hero-video.loaded {
    opacity: 1;
    transition: opacity 0.5s ease;
}

/* Performance indicators */
.performance-indicator {
    position: fixed;
    bottom: 100px;
    left: 20px;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    z-index: 999999;
    transition: all 0.3s ease;
}

.performance-indicator.good {
    background: rgba(76, 175, 80, 0.9);
}

.performance-indicator.average {
    background: rgba(255, 152, 0, 0.9);
}

.performance-indicator.poor {
    background: rgba(244, 67, 54, 0.9);
}

/* Critical resource loading indicators */
.resource-loading {
    position: relative;
}

.resource-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #667eea, transparent);
    animation: loading-bar 2s infinite;
}

@keyframes loading-bar {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Image error states */
img.error {
    background: #f5f5f5;
    border: 1px dashed #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #999;
    min-height: 100px;
}

img.error::after {
    content: 'Image failed to load';
}

/* Preload hints for critical images */
.critical-image {
    display: block;
    font-weight: normal;
}

/* Mobile optimizations for images */
@media (max-width: 768px) {
    img.lazy {
        max-width: 100%;
        height: auto;
    }
    
    .hero-loading {
        min-height: 60vh;
    }
}

/* Print optimizations */
@media print {
    .lazy-bg.loading::before,
    .hero-loading,
    .performance-indicator,
    .resource-loading::after {
        display: none !important;
    }
    
    img.lazy {
        opacity: 1 !important;
    }
}