/**
 * 懒加载样式
 * 提供图片加载过程中的过渡效果和视觉反馈
 */

/* 基础懒加载样式 */
.lazy {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

/* 加载中状态 */
.lazy-loading {
    position: relative;
    background-color: #f5f5f5;
    background-image: linear-gradient(45deg, #eeeeee 25%, transparent 25%, transparent 75%, #eeeeee 75%, #eeeeee),
                      linear-gradient(45deg, #eeeeee 25%, transparent 25%, transparent 75%, #eeeeee 75%, #eeeeee);
    background-size: 60px 60px;
    background-position: 0 0, 30px 30px;
    animation: lazyLoading 1s linear infinite;
}

/* 加载完成状态 */
.lazy-loaded {
    opacity: 1;
    background: none;
}

/* 加载错误状态 */
.lazy-error {
    opacity: 1;
    background-color: #fee;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
}

.lazy-error::after {
    content: "图片加载失败";
    color: #c33;
    font-size: 14px;
}

/* 图片特定的懒加载样式 */
img.lazy {
    object-fit: cover;
}

/* 背景图片懒加载占位 */
.bg-lazy {
    min-height: 200px;
}

/* 骨架屏效果 */
.lazy-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

/* 加载动画 */
@keyframes lazyLoading {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 120px 0;
    }
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .lazy-loading {
        background-size: 40px 40px;
    }
    
    .bg-lazy {
        min-height: 150px;
    }
}

/* 针对不同元素的调整 */
.lazy-image-container {
    position: relative;
    overflow: hidden;
}

.lazy-image-container img.lazy {
    width: 100%;
    height: auto;
}

/* 性能优化：减少重绘 */
.lazy-loading, .lazy-loaded {
    will-change: opacity;
}

/* 可访问性增强 */
.lazy-loading[aria-busy="true"] {
    aria-busy: true;
}