/* 图片优化样式 */

/* 4:3 宽高比容器 */
.aspect-4-3 {
    aspect-ratio: 4/3;
    position: relative;
    overflow: hidden;
}

/* 图片加载状态 */
.image-container {
    position: relative;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

.image-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23ccc"><path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.3;
}

/* 图片加载完成后隐藏占位符 */
.image-container img.loaded {
    opacity: 1;
}

.image-container img {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* 加载动画 */
@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 图片错误状态 */
.image-error {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    color: #999;
    font-size: 14px;
}

.image-error::before {
    content: '🖼️';
    font-size: 24px;
    margin-right: 8px;
}

/* 响应式图片优化 */
@media (max-width: 640px) {
    .aspect-4-3 {
        aspect-ratio: 16/9; /* 移动端使用16:9比例 */
    }
}

/* WebP支持检测 */
.webp .image-webp {
    display: block;
}

.webp .image-fallback {
    display: none;
}

.no-webp .image-webp {
    display: none;
}

.no-webp .image-fallback {
    display: block;
}

/* 图片悬停效果优化 */
.image-hover-effect {
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.image-hover-effect:hover {
    transform: scale(1.05);
}

/* 图片质量优化提示 */
.image-quality-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-container:hover .image-quality-badge {
    opacity: 1;
}