/**
 * Product Gallery Slider Styles
 * 产品图片滚动插件样式
 */

/* ==========================================================================
   产品图片容器
   ========================================================================== */
.pgs-product-images {
    position: relative;
    width: 100%;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background-color: #f5f5f5;
    border-radius: 8px;
}

.pgs-images-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.pgs-image-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pgs-image-item.active {
    opacity: 1;
    z-index: 1;
}

.pgs-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ==========================================================================
   导航按钮
   ========================================================================== */
.pgs-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.pgs-product-images:hover .pgs-nav {
    opacity: 1;
}

.pgs-nav:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.pgs-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.pgs-nav-prev {
    left: 10px;
}

.pgs-nav-next {
    right: 10px;
}

.pgs-nav span {
    font-size: 18px;
    font-weight: 700;
    color: #2d5016;
    line-height: 1;
}

/* ==========================================================================
   指示点
   ========================================================================== */
.pgs-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pgs-product-images:hover .pgs-dots {
    opacity: 1;
}

.pgs-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.pgs-dot:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.2);
}

.pgs-dot.active {
    background: #fff;
    width: 20px;
    border-radius: 4px;
}

/* ==========================================================================
   响应式设计
   ========================================================================== */

/* 平板设备 */
@media (max-width: 768px) {
    .pgs-nav {
        width: 32px;
        height: 32px;
        opacity: 0.7;
    }

    .pgs-nav span {
        font-size: 16px;
    }

    .pgs-dots {
        opacity: 0.7;
    }

    .pgs-dot {
        width: 7px;
        height: 7px;
    }

    .pgs-dot.active {
        width: 16px;
    }
}

/* 移动设备 */
@media (max-width: 480px) {
    .pgs-nav {
        width: 28px;
        height: 28px;
    }

    .pgs-nav span {
        font-size: 14px;
    }

    .pgs-nav-prev {
        left: 5px;
    }

    .pgs-nav-next {
        right: 5px;
    }

    .pgs-dots {
        bottom: 8px;
        gap: 4px;
    }

    .pgs-dot {
        width: 6px;
        height: 6px;
    }

    .pgs-dot.active {
        width: 14px;
    }
}

/* ==========================================================================
   与 Storefront 主题的兼容性
   ========================================================================== */

/* 确保产品列表项的图片区域正确显示 */
.woocommerce ul.products li.product .pgs-product-images,
.woocommerce-page ul.products li.product .pgs-product-images {
    margin-bottom: 1em;
}

/* 产品卡片悬停效果优化 */
.woocommerce ul.products li.product:hover .pgs-product-images,
.woocommerce-page ul.products li.product:hover .pgs-product-images {
    border-color: #7fb069;
}

/* 禁用默认的图片链接悬停效果 */
.woocommerce ul.products li.product a img,
.woocommerce-page ul.products li.product a img {
    transition: none;
}

/* ==========================================================================
   可访问性增强
   ========================================================================== */

/* 聚焦状态 */
.pgs-nav:focus,
.pgs-dot:focus {
    outline: 2px solid #4a7c2c;
    outline-offset: 2px;
}

/* 键盘导航提示 */
.pgs-nav:focus-visible {
    outline: 3px solid #4a7c2c;
    outline-offset: 3px;
}

/* 减少动画（用户偏好设置） */
@media (prefers-reduced-motion: reduce) {
    .pgs-image-item,
    .pgs-nav,
    .pgs-dots,
    .pgs-dot {
        transition: none;
    }
}
