/* ===== LAZY LOADING CSS - FABENE MASSAS ===== */

/* Estilos para imagens com lazy loading */
.lazy {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
    background-size: 200% 200%;
    animation: shimmer 1.5s infinite;
    position: relative;
    overflow: hidden;
}

.lazy::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-sweep 2s infinite;
}

.lazy.loaded {
    opacity: 1;
    background: none;
    animation: none;
}

.lazy.loaded::before {
    display: none;
}

/* Animação de shimmer para placeholder */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes shimmer-sweep {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Placeholder específico para produtos */
.lazy.product-image {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 50%, #f8f9fa 100%);
    border-radius: 15px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 0.9rem;
    text-align: center;
}

.lazy.product-image::after {
    content: '🖼️ Carregando...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

/* Placeholder para banners */
.lazy.banner-image {
    background: linear-gradient(135deg, #741818 0%, #8b1a1a 50%, #741818 100%);
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    text-align: center;
}

.lazy.banner-image::after {
    content: '🎨 Carregando banner...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

/* Placeholder para imagens pequenas */
.lazy.small-image {
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
    min-height: 100px;
    border-radius: 8px;
}

.lazy.small-image::after {
    content: '📷';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    opacity: 0.5;
}

/* Estados de erro */
.lazy.error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 50%, #f8d7da 100%);
    border: 2px dashed #dc3545;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #721c24;
    font-size: 0.9rem;
    text-align: center;
}

.lazy.error::after {
    content: '❌ Erro ao carregar';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

/* Otimizações para diferentes tamanhos de tela */
@media (max-width: 768px) {
    .lazy.product-image {
        min-height: 150px;
    }
    
    .lazy.banner-image {
        min-height: 200px;
    }
    
    .lazy.small-image {
        min-height: 80px;
    }
}

@media (max-width: 480px) {
    .lazy.product-image {
        min-height: 120px;
    }
    
    .lazy.banner-image {
        min-height: 150px;
    }
    
    .lazy.small-image {
        min-height: 60px;
    }
}

/* Classes utilitárias para lazy loading */
.lazy-container {
    position: relative;
    overflow: hidden;
}

.lazy-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy:hover .lazy-overlay {
    opacity: 1;
}

/* Indicador de progresso */
.lazy-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: #741818;
    width: 0%;
    transition: width 0.3s ease;
}

.lazy.loading .lazy-progress {
    animation: progress-loading 2s ease-in-out infinite;
}

@keyframes progress-loading {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Otimizações para impressão */
@media print {
    .lazy {
        opacity: 1 !important;
        background: none !important;
        animation: none !important;
    }
    
    .lazy::before,
    .lazy::after {
        display: none !important;
    }
}
