/* 图片懒加载样式 */

/* 加载中的图片 */
img.loading {
    opacity: 0;
    transition: opacity 0.3s ease-in;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* 已加载的图片 */
img.loaded {
    opacity: 1;
    transition: opacity 0.5s ease-in;
}

/* 加载失败的图片 */
img.error {
    opacity: 0.5;
    background: #f0f0f0;
}

/* 骨架屏动画 */
@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 占位背景 */
img[data-src]:not([src]) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100px;
    min-width: 100%;
}

/* 项目卡片图片容器优化 */
.card-im {
    opacity: 0;
    transition: opacity 0.5s ease-in;
}

.card-im.loaded {
    opacity: 1;
}

/* 项目详情弹框图片 */
.project-image-section img {
    opacity: 0;
    transition: opacity 0.5s ease-in;
    object-fit: contain !important;
    width: 100% !important;
    height: 100% !important;
}

.project-image-section img.loaded {
    opacity: 1;
}

.project-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.project-image:hover {
    transform: scale(1.05);
}

/* 图片预览样式 */
.image-preview {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    cursor: zoom-out;
}

.image-preview img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    transform: scale(1);
    transition: transform 0.3s ease;
    cursor: move;
}

.preview-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 30px;
    cursor: pointer;
    z-index: 100001;
    line-height: 1;
}

.preview-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.preview-zoom-in,
.preview-zoom-out,
.preview-reset {
    position: absolute;
    bottom: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 100001;
    line-height: 1;
}

.preview-zoom-in {
    right: 80px;
}

.preview-zoom-out {
    right: 140px;
}

.preview-reset {
    right: 200px;
    font-size: 12px;
}

.preview-zoom-in:hover,
.preview-zoom-out:hover,
.preview-reset:hover {
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
    .preview-zoom-in,
    .preview-zoom-out,
    .preview-reset {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .preview-zoom-in {
        right: 60px;
    }

    .preview-zoom-out {
        right: 110px;
    }

    .preview-reset {
        right: 160px;
        font-size: 10px;
    }
}