/**
 * Lazy Loading Styles - Meta Dados
 * Estilos para lazy loading de imagens e elementos
 */

/* ===== PLACEHOLDER PARA IMAGENS LAZY ===== */
.lazy-image {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
    border-radius: 8px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.lazy-image::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: loading-shine 2s infinite;
}

/* Animação de shimmer */
@keyframes loading-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Animação de brilho */
@keyframes loading-shine {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* ===== ESTADOS DAS IMAGENS ===== */
.lazy-image {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.lazy-loaded {
    opacity: 1 !important;
    background: none !important;
    animation: none !important;
}

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

.lazy-error {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.lazy-error::after {
    content: '⚠️ Erro ao carregar imagem';
    text-align: center;
}

/* ===== TRANSIÇÕES SUAVES ===== */
img {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

img[data-src] {
    opacity: 0;
    transform: scale(0.95);
}

img:not([data-src]) {
    opacity: 1;
    transform: scale(1);
}

/* ===== SEÇÕES LAZY ===== */
section[data-lazy] {
    position: relative;
}

section[data-lazy].loading {
    opacity: 0.6;
}

section[data-lazy].loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0069ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

section[data-lazy].loaded {
    opacity: 1;
}

section[data-lazy].loaded::after {
    display: none;
}

/* ===== VÍDEOS LAZY ===== */
video[data-src] {
    background: #000;
    position: relative;
}

video[data-src]::before {
    content: '▶️';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: white;
    z-index: 1;
}

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

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 768px) {
    .lazy-image {
        min-height: 80px;
    }
    
    .lazy-image::before {
        animation-duration: 1.5s;
    }
}

@media (max-width: 576px) {
    .lazy-image {
        min-height: 60px;
        border-radius: 4px;
    }
}

/* ===== MELHORIAS DE PERFORMANCE ===== */
.lazy-image,
.lazy-loaded,
.lazy-error {
    /* will-change removido para compatibilidade */
}

/* ===== ESTADOS DE CARREGAMENTO ===== */
.loading-overlay {
    position: relative;
}

.loading-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading-overlay.loaded::after {
    display: none;
}

/* ===== INDICADORES DE PROGRESSO ===== */
.lazy-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #0069ff, #00d7d2);
    transition: width 0.3s ease;
    z-index: 2;
}

/* ===== ESTILOS PARA AVATARES ===== */
.lazy-image.avatar {
    border-radius: 50%;
    background: linear-gradient(135deg, #0069ff, #00d7d2);
}

.lazy-image.avatar::before {
    content: '👤';
    font-size: 1.5rem;
    color: white;
    z-index: 1;
}

/* ===== ESTILOS PARA LOGOS ===== */
.lazy-image.logo {
    background: white;
    border: 1px solid #e0e0e0;
}

.lazy-image.logo::before {
    content: '🏢';
    font-size: 1.2rem;
    color: #666;
}

/* ===== ESTILOS PARA ÍCONES ===== */
.lazy-image.icon {
    background: #f8f9fa;
    border-radius: 8px;
}

.lazy-image.icon::before {
    content: '⚡';
    font-size: 1rem;
    color: #0069ff;
}

/* ===== PREVENÇÃO DE LAYOUT SHIFT ===== */
.lazy-image {
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.lazy-image.avatar {
    aspect-ratio: 1 / 1;
}

.lazy-image.logo {
    aspect-ratio: 16 / 9;
}

.lazy-image.icon {
    aspect-ratio: 1 / 1;
}

/* ===== ESTADOS DE FOCO E HOVER ===== */
.lazy-image:focus {
    outline: 2px solid #0069ff;
    outline-offset: 2px;
}

.lazy-loaded:hover {
    transform: scale(1.02);
}

/* ===== ANIMAÇÕES DE ENTRADA ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lazy-loaded {
    animation: fadeInUp 0.6s ease-out;
}

/* ===== OTIMIZAÇÕES PARA PERFORMANCE ===== */
.lazy-image,
.lazy-loaded,
.lazy-error {
    /* Otimizações de performance removidas para compatibilidade */
}

/* ===== ESTILOS PARA DARK MODE ===== */
@media (prefers-color-scheme: dark) {
    .lazy-image {
        background: linear-gradient(90deg, #2d3748 25%, #4a5568 50%, #2d3748 75%);
    }
    
    .lazy-error {
        background: #2d3748;
        border-color: #4a5568;
        color: #a0aec0;
    }
    
    .loading-overlay::after {
        background: rgba(45, 55, 72, 0.8);
    }
}
