/**
 * Lazy Loading Styles for Fair E Web Host
 * 
 * This file provides styling for lazy-loaded images, including
 * placeholders and fade-in animations.
 */

/* Base styles for lazy-loaded images */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    background-color: #f8f9fa;
    position: relative;
}

/* Placeholder styling */
.lazy-image::before {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f8f9fa;
    z-index: 1;
}

/* Loading animation */
.lazy-image::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    border: 2px solid #e9ecef;
    border-top-color: var(--primary-color, #0d6efd);
    border-radius: 50%;
    z-index: 2;
    animation: lazy-spinner 0.8s linear infinite;
    transform: translate(-50%, -50%);
}

/* Animation for the spinner */
@keyframes lazy-spinner {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Fade in the image once loaded */
.lazy-loaded {
    opacity: 1;
}

/* Remove placeholder and spinner once loaded */
.lazy-loaded::before,
.lazy-loaded::after {
    display: none;
}

/* Maintain aspect ratio for responsive images */
.lazy-image-container {
    position: relative;
    overflow: hidden;
    height: 0;
    padding-bottom: 56.25%; /* Default 16:9 aspect ratio */
}

.lazy-image-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Custom aspect ratios */
.lazy-image-container.ratio-1x1 {
    padding-bottom: 100%; /* 1:1 aspect ratio */
}

.lazy-image-container.ratio-4x3 {
    padding-bottom: 75%; /* 4:3 aspect ratio */
}

.lazy-image-container.ratio-21x9 {
    padding-bottom: 42.86%; /* 21:9 aspect ratio */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .lazy-image::after {
        width: 20px;
        height: 20px;
    }
}