/**
 * Lazy Loading Styles
 * Stili per immagini e contenuti lazy loaded
 */

/* Immagini lazy loading */
img[data-src] {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    background: #f0f0f0;
    min-height: 100px;
}

img.lazy-loading {
    opacity: 0.5;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

img.lazy-loaded {
    opacity: 1;
}

img.lazy-error {
    opacity: 0.3;
    background: #ffebee;
}

@keyframes loading-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Contenuti lazy loading */
[data-lazy-content] {
    min-height: 50px;
    position: relative;
}

[data-lazy-content].lazy-content-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

[data-lazy-content].lazy-content-loaded {
    animation: fadeIn 0.3s ease-in;
}

[data-lazy-content].lazy-content-error {
    color: #d32f2f;
    padding: 20px;
    text-align: center;
}

/* Sezioni lazy loading */
[data-lazy-section] {
    position: relative;
}

[data-lazy-section].lazy-section-loading::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;
}

[data-lazy-section].lazy-section-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 11;
}

[data-lazy-section].lazy-section-loaded {
    animation: fadeIn 0.3s ease-in;
}

[data-lazy-section].lazy-section-error {
    padding: 20px;
    background: #ffebee;
    color: #d32f2f;
    border-radius: 4px;
    margin: 10px 0;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Placeholder per immagini */
img[data-src]::before {
    content: '📷';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2em;
    opacity: 0.3;
}







