/* Lazy Loading Styles for FuchsTravels */

/* Global fade-in for lazy images */
img[loading="lazy"] {
    opacity: 1;
    transition: opacity 400ms ease;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Respect reduced motion preference for lazy images */
@media (prefers-reduced-motion: reduce) {
    img[loading="lazy"] {
        opacity: 1;
        transition: none;
    }
}

/* Lazy loading placeholder */
.lazy-placeholder {
    background: #E5E7EB;
    animation: lazy-pulse 2s ease-in-out infinite;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Pulse animation for loading state */
@keyframes lazy-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Loading state */
.lazy-loading {
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

/* Loaded state */
.lazy-loaded {
    opacity: 1;
    transition: opacity 0.5s ease;
}

/* Error state */
.lazy-error {
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: #64748b;
    font-size: 14px;
}

.lazy-error::after {
    content: "Image unavailable";
    display: block;
    text-align: center;
}

/* Fade-in animation for loaded images */
.lazy-loaded {
    animation: lazy-fade-in 0.5s ease-out;
}

@keyframes lazy-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hero images specific styles */
.hero-lazy-placeholder {
    background: #1E293B;
    min-height: 400px;
    position: relative;
}

.hero-lazy-placeholder::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Card images specific styles */
.card-lazy-placeholder {
    background: #E5E7EB;
    min-height: 200px;
    animation: lazy-pulse 2s ease-in-out infinite;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .lazy-placeholder {
        min-height: 150px;
    }

    .hero-lazy-placeholder {
        min-height: 250px;
    }

    .card-lazy-placeholder {
        min-height: 150px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .lazy-placeholder,
    .hero-lazy-placeholder::before,
    .card-lazy-placeholder {
        animation: none;
    }

    .lazy-loaded {
        animation: none;
        transition: opacity 0.2s ease;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .lazy-placeholder {
        background: #374151;
    }

    .lazy-error {
        background: #374151;
        color: #9ca3af;
    }

    .card-lazy-placeholder {
        background: #374151;
    }
}

/* Focus states for accessibility */
img[data-src]:focus {
    outline: 2px solid var(--color-primary, #D4922A);
    outline-offset: 2px;
}
