/* Lazy Loading Styles and Image Optimization Visual Feedback */

/* Lazy loading placeholder styles */
.lazy-image-placeholder {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 14px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.lazy-image-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Loading state */
.lazy-loading {
    opacity: 0.7;
    filter: blur(1px);
    transition: all 0.3s ease;
}

/* Loaded state */
.lazy-loaded {
    opacity: 1;
    filter: blur(0);
    animation: fadeInScale 0.5s ease-out;
}

@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Error state */
.lazy-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    text-align: center;
    padding: 20px;
}

.lazy-error::before {
    content: '⚠️';
    margin-right: 8px;
    font-size: 16px;
}

/* Progressive image loading */
.progressive-image {
    position: relative;
    overflow: hidden;
}

.progressive-image img {
    transition: opacity 0.3s ease;
}

.progressive-image img.low-quality {
    filter: blur(10px);
    transform: scale(1.1);
}

.progressive-image img.high-quality {
    filter: blur(0);
    transform: scale(1);
}

/* Responsive image container */
.responsive-image-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
}

.responsive-image-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Image optimization indicators */
.image-optimization-info {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.progressive-image:hover .image-optimization-info {
    opacity: 1;
}

/* Loading spinner for critical images */
.critical-image-loading {
    position: relative;
}

.critical-image-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* WebP support indicator */
.webp-supported .webp-image {
    display: block;
}

.webp-supported .fallback-image {
    display: none;
}

.webp-not-supported .webp-image {
    display: none;
}

.webp-not-supported .fallback-image {
    display: block;
}

/* Performance optimization classes */
.optimized-image {
    will-change: opacity, transform;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* Print styles */
@media print {
    .lazy-image-placeholder,
    .lazy-loading,
    .lazy-error {
        display: none !important;
    }
    
    img {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .lazy-image-placeholder {
        background: #000;
        color: #fff;
        border: 2px solid #fff;
    }
    
    .lazy-error {
        background: #000;
        border: 2px solid #ff0000;
        color: #ff0000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .lazy-loaded,
    .lazy-image-placeholder::before,
    .critical-image-loading::after {
        animation: none;
    }
    
    .lazy-loading,
    .lazy-loaded {
        transition: none;
    }
}
