/**
 * Estilos para Lazy Loading - UNAgency
 * Efectos de transición y placeholders
 */

/* Placeholder para imágenes en carga */
.lazy-placeholder {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

@keyframes loading-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Imágenes con lazy loading */
img.lazy {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    filter: blur(2px);
}

img.lazy.loaded {
    opacity: 1;
    filter: blur(0);
}

/* Efecto de fade in para imágenes cargadas */
img.lazy.loaded {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Placeholder con spinner */
.lazy-spinner {
    position: relative;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.lazy-spinner::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Contenedor de imagen con aspect ratio */
.lazy-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
    background: #f8f9fa;
}

.lazy-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.lazy-container:hover img {
    transform: scale(1.05);
}

/* Error state para imágenes que fallan */
img.lazy-error {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

/* Optimización para diferentes tamaños de pantalla */
@media (max-width: 768px) {
    .lazy-spinner {
        min-height: 150px;
    }
    
    .lazy-spinner::before {
        width: 30px;
        height: 30px;
        border-width: 3px;
    }
}

/* Efecto de skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-image {
    width: 100%;
    height: 200px;
    border-radius: 8px;
}

/* Progreso de carga */
.lazy-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: #007bff;
    width: 0%;
    transition: width 0.3s ease;
}

/* Optimización para imágenes de fondo */
.lazy-bg {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: opacity 0.3s ease;
}

.lazy-bg.loading {
    opacity: 0.3;
}

.lazy-bg.loaded {
    opacity: 1;
} 