/* Lazy Loading Image Styles */

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

/* Loading state */
.lazy-image.lazy-loading {
    opacity: 1;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: lazy-shimmer 1.5s infinite;
}

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

/* Loaded state - fade in */
.lazy-image.lazy-loaded {
    opacity: 1;
    background: none;
    animation: none;
}

/* Error state */
.lazy-image.lazy-error {
    opacity: 1;
    background-color: #fee;
    border: 1px dashed #fcc;
}

/* Table images - smaller shimmer */
table .lazy-image.lazy-loading {
    min-width: 60px;
    min-height: 40px;
}

/* Channel/category images */
.ch-img.lazy-image,
.ch-img-preview.lazy-image {
    border-radius: 8px;
}

/* Preview images in forms */
#previewImg.lazy-image {
    max-width: 100%;
    border-radius: 8px;
}

/* Dashboard stats images */
.dashboard-stats .lazy-image {
    border-radius: 50%;
}

/* List group images */
.list-group-item .lazy-image {
    border-radius: 50%;
    object-fit: cover;
}

/* Prevent layout shift - maintain aspect ratio */
.lazy-image[data-width][data-height] {
    aspect-ratio: attr(data-width) / attr(data-height);
}

/* Blur effect while loading (optional) */
.lazy-image.blur-load {
    filter: blur(10px);
    transition: filter 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

.lazy-image.blur-load.lazy-loaded {
    filter: blur(0);
}

/* Placeholder for missing images */
.lazy-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    color: #999;
    font-size: 24px;
    min-height: 60px;
}

/* Card images */
.card .lazy-image {
    border-radius: 8px 8px 0 0;
}

/* Thumbnail grid images */
.thumbnail-grid .lazy-image {
    border-radius: 4px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .lazy-image.lazy-loading {
        animation-duration: 1s; /* Faster animation on mobile */
    }
}

/* Print styles - show all images */
@media print {
    .lazy-image {
        opacity: 1 !important;
        background: none !important;
        animation: none !important;
    }
}
