/**
 * 图片异步加载样式
 */

/* 图片容器样式 */
.image-container {
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
    border-radius: 8px;
}

/* 图片占位符样式 */
img[data-src],
img[data-srcset] {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

/* 图片加载完成样式 */
img.lazy-loaded,
img.image-loaded {
    opacity: 1;
    animation: none;
}

/* 图片加载错误样式 */
img.lazy-error,
img.image-error {
    opacity: 1;
    background: #ff4444;
    position: relative;
}

img.lazy-error::after,
img.image-error::after {
    content: '图片加载失败';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    white-space: nowrap;
}

/* 加载动画 */
@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 缩略图样式优化 */
.thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.thumb:hover {
    transform: scale(1.05);
}

/* 详情页封面图样式优化 */
.detail img {
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.detail img:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* 列表项图片样式优化 */
.items .item img {
    width: 120px;
    height: 160px;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.items .item:hover img {
    transform: scale(1.1);
}

/* 轮播图图片样式优化 */
.hot-swiper .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.hot-swiper .swiper-slide:hover img {
    transform: scale(1.05);
}

/* 响应式图片容器 */
@media (max-width: 768px) {
    .items .item img {
        width: 80px;
        height: 120px;
    }
    
    .detail img {
        max-width: 100%;
    }
}

/* 加载状态指示器 */
.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 图片懒加载基础样式 */
img[data-src] {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

img.lazy-loaded,
img.image-loaded {
    opacity: 1;
    animation: none;
}

img.lazy-error {
    opacity: 1;
    background: #ff4444;
    position: relative;
}

img.lazy-error::after {
    content: '图片加载失败';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    white-space: nowrap;
}

/* 网站logo样式 - 保持原有尺寸 */
.site-logo {
    max-height: 32px;
    width: auto;
    height: auto;
    transition: opacity 0.3s ease;
}

/* 详情页封面图样式 - 保持原有布局 */
.detail-cover {
    width: 240px;
    height: auto;
    max-width: 100%;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.detail-cover:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* 缩略图样式 - 保持原有尺寸 */
.thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.thumb:hover {
    transform: scale(1.05);
}

/* 加载动画 */
@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .detail-cover {
        max-width: 100%;
    }
    
    .thumb {
        width: 80px;
        height: 120px;
    }
}