/**
 * 产品图片展示组件样式
 * 配合 product-gallery.js 和 Swiper 使用
 */

/* ========================================
   产品图片展示容器
   ======================================== */
.product-gallery {
    max-width: 360px;
    margin: 0;
    position: relative;
}

/* ========================================
   主图区域
   ======================================== */
.product-gallery__main {
    position: relative;
    margin-bottom: 10px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: visible;
}

.product-gallery__main .swiper-slide {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    position: relative;
    overflow: hidden;
}

.product-gallery__main .swiper-slide img {
    width: 100%;
    height: auto;
    max-height: 360px;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease;
}

/* 主图导航箭头 - 隐藏 */
.product-gallery__nav-prev,
.product-gallery__nav-next {
    display: none;
}

/* ========================================
   缩略图区域
   ======================================== */

.product-gallery__thumbs .swiper-slide {
    cursor: pointer;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s ease;
    opacity: 0.7;
    background: #fff;
}

.product-gallery__thumbs .swiper-slide:hover {
    opacity: 0.9;
    border-color: #999;
}

.product-gallery__thumbs .swiper-slide-thumb-active {
    opacity: 1;
    border-color: #00984f;
    box-shadow: 0 0 0 2px rgba(0, 152, 79, 0.2);
}

.product-gallery__thumbs .swiper-slide img {
    width: 100%;
    height: 75px;
    object-fit: cover;
    display: block;
}

/* 缩略图导航箭头 - 优化样式 */
.product-gallery__thumbs {
    position: relative;
    padding: 0 50px;
    margin-top: 10px;
}

.product-gallery__thumbs .swiper-button-prev,
.product-gallery__thumbs .swiper-button-next {
    position: absolute;
    width: 45px;
    height: 75px;
    background: #f8f8f8;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s ease;
    top: 0;
    margin-top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-gallery__thumbs .swiper-button-prev {
    left: 0;
}

.product-gallery__thumbs .swiper-button-next {
    right: 0;
}

.product-gallery__thumbs .swiper-button-prev::after,
.product-gallery__thumbs .swiper-button-next::after {
    font-size: 20px;
    font-weight: bold;
    color: #666;
}

.product-gallery__thumbs .swiper-button-prev:hover,
.product-gallery__thumbs .swiper-button-next:hover {
    background: #00984f;
    border-color: #00984f;
    transform: translateY(-50%) scale(1.05);
}

.product-gallery__thumbs .swiper-button-prev:hover::after,
.product-gallery__thumbs .swiper-button-next:hover::after {
    color: #fff;
}

.product-gallery__thumbs .swiper-button-disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.product-gallery__thumbs .swiper-button-disabled:hover {
    background: #f5f5f5;
    border-color: #ddd;
    transform: translateY(-50%);
}

.product-gallery__thumbs .swiper-button-disabled:hover::after {
    color: #666;
}

/* ========================================
   图片放大预览（悬停效果）
   ======================================== */
.zoom-lens {
    position: absolute;
    width: 100px;
    height: 100px;
    border: 2px solid #00984f;
    background: rgba(0, 152, 79, 0.1);
    pointer-events: none;
    z-index: 5;
    border-radius: 0;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.3);
}

.zoom-preview {
    position: absolute;
    left: 370px;
    top: 0;
    width: 400px;
    height: 400px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.zoom-preview__image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    transform-origin: 0 0;
}

/* ========================================
   灯箱查看大图
   ======================================== */
.product-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-lightbox.show {
    opacity: 1;
}

.product-lightbox.closing {
    opacity: 0;
}

.product-lightbox__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    cursor: zoom-out;
}

.product-lightbox__content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px 20px 20px;
}

.product-lightbox__image {
    max-width: 90%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.product-lightbox__caption {
    color: #fff;
    margin-top: 20px;
    font-size: 16px;
    text-align: center;
}

.product-lightbox__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1;
}

.product-lightbox__close:hover {
    background: #fff;
    transform: rotate(90deg);
}

.product-lightbox__close svg {
    width: 24px;
    height: 24px;
    color: #333;
}

/* ========================================
   分页器样式 - 已移除
   ======================================== */
.swiper-pagination {
    display: none;
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 768px) {
    .product-gallery {
        max-width: 100%;
    }

    .product-gallery__main {
        border-radius: 0;
    }

    .product-gallery__main .swiper-slide img {
        max-height: 300px;
    }

    .product-gallery__thumbs .swiper-slide img {
        height: 60px;
    }

    .zoom-preview {
        display: none !important;
    }

    .product-gallery__nav-prev,
    .product-gallery__nav-next {
        width: 35px;
        height: 35px;
    }

    .product-gallery__nav-prev {
        left: 10px;
    }

    .product-gallery__nav-next {
        right: 10px;
    }

    .product-lightbox__image {
        max-width: 95%;
        max-height: 70vh;
    }
}

@media (max-width: 480px) {
    .product-gallery__thumbs {
        padding: 0 30px;
    }

    .product-gallery__thumbs .swiper-slide img {
        height: 50px;
    }

    .product-lightbox__content {
        padding: 50px 10px 10px;
    }
}

/* ========================================
   加载动画
   ======================================== */
.product-gallery__loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #00984f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}
