/* Lazy Loading Styles for FuchsTravels */

/* Lazy loading placeholder */
.lazy-placeholder {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: lazy-shimmer 1.5s infinite;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Shimmer animation for loading state */
@keyframes lazy-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* 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: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    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: linear-gradient(45deg, #e2e8f0 25%, transparent 25%, transparent 75%, #e2e8f0 75%),
                linear-gradient(45deg, #e2e8f0 25%, transparent 25%, transparent 75%, #e2e8f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    min-height: 200px;
    animation: lazy-checkerboard 2s ease-in-out infinite alternate;
}

@keyframes lazy-checkerboard {
    0% { opacity: 0.3; }
    100% { opacity: 0.6; }
}

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

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

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

/* High DPI / Retina display optimizations */
@media (min-resolution: 2dppx) {
    .lazy-placeholder {
        background-size: 400% 100%;
    }
}

/* 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: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    }

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

    .card-lazy-placeholder {
        background: linear-gradient(45deg, #374151 25%, transparent 25%, transparent 75%, #374151 75%),
                    linear-gradient(45deg, #374151 25%, transparent 25%, transparent 75%, #374151 75%);
    }
}

/* Focus states for accessibility */
img[data-src]:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}
