/* === 产品页面布局修复 === */
/* 使用浮动布局确保图库和摘要并排 */
.single-product div.product {
    overflow: hidden; /* 清除浮动 */
    width: 100% !important;
    max-width: 100% !important;
    min-width: 1408px; /* 减小最小宽度：785px + 543px + 80px间隙 */
}

.woocommerce-product-gallery {
    float: left !important;
    width: 46.25dvw !important;
    margin-right: 5.2dvw !important;
    margin-bottom: 0px !important;
}

/* === 自定义图库样式 === */
.custom-product-gallery-wrapper {
    width: 46.25dvw !important;
    max-width: 46.25dvw !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 主图 Swiper 样式 */
.main-product-gallery {
    width: 46.25dvw !important;
    height: 530px !important;
    background: #f8f8f8;
    position: relative;
    overflow: hidden;
}

.main-product-gallery .swiper-wrapper {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important; /* 添加 flex 布局 */
}

.main-product-gallery .swiper-slide {
    position: relative !important; /* 移除 absolute */
    top: auto !important;
    left: auto !important;
    width: 100% !important; /* 改为100%而不是46.25dvw */
    flex-shrink: 0; /* 防止slide被压缩 */
    height: 530px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f8f8;
    opacity: 0; /* 默认隐藏所有 */
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.main-product-gallery .swiper-slide-active {
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 10;
}

.main-product-gallery .swiper-slide-zoomed {
    z-index: 20;
}

.main-product-gallery .swiper-slide img {
    width: 100% !important;
    height: 100% !important;
    object-fit: fill !important;
    object-position: center;
    display: block;
}

/* === 缩略图外层容器 === */
.thumbnail-gallery-outer {
    position: relative;
    width: 46.25dvw !important;
    margin: 20px auto 50px !important;
    padding: 0 50px !important; /* 为外部箭头预留空间 */
    box-sizing: border-box;
}

/* 缩略图 Swiper 容器 */
.thumbnail-product-gallery {
    width: 100% !important; /* 改为100%填充外层容器 */
    height: 100px !important;
    margin: 0 !important; /* 移除原来的margin */
    padding: 0 !important; /* 移除原来的padding */
    display: flex !important;
    align-items: center !important;
    position: relative;
}

/* 确保滑动容器正确设置 */
.thumbnail-product-gallery .swiper-container {
    width: 100% !important;
    overflow: hidden !important;
}

/* 滑动包装器 */
.thumbnail-product-gallery .swiper-wrapper {
    width: auto !important;
    display: flex !important;
    justify-content: flex-start !important;
    transition-timing-function: ease-out;
}

/* 缩略图slide */
.thumbnail-product-gallery .swiper-slide {
    /* width: calc((100% - 40px) / 3) !important;  总宽度减去3个间距，除以4 */
     width: calc((100% - (20px * (var(--thumb-count, 4) - 1))) / var(--thumb-count, 4)) !important;
    /* width: calc((100% - (20px * (var(--thumb-count, 4) - 1))) / var(--thumb-count, 4)) !important; */
    height: 100px !important;
    border: none !important;
    box-sizing: border-box;
    opacity: 0.6 !important;
    transition: opacity 0.3s ease;
    cursor: pointer !important;
    flex-shrink: 0 !important;
}

.thumbnail-product-gallery .swiper-slide-thumb-active {
    opacity: 1 !important;
    border: 1px solid #B8860B !important;
    box-sizing: border-box !important;
}

.thumbnail-product-gallery .swiper-slide img {
    width: 100% !important;
    height: 100% !important;
    object-fit: fill !important;
    object-position: center;
    display: block;
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* === 外部箭头样式 === */
.thumbnail-gallery-outer .swiper-button-next,
.thumbnail-gallery-outer .swiper-button-prev {
    width: 32px !important;
    height: 32px !important;
    /* background: rgba(255, 255, 255, 0.95) !important; */
    /* border: 1px solid #ddd !important; */
    /* border-radius: 4px !important; */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    color: #333 !important;
    top: 50% !important;
    margin-top: 0 !important;
    position: absolute !important;
    transform: translateY(-50%) !important;
    z-index: 40 !important; /* 提高z-index确保在最上层 */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
}

.thumbnail-gallery-outer .swiper-button-next:after,
.thumbnail-gallery-outer .swiper-button-prev:after {
    font-size: 14px;
    font-weight: bold;
}

/* 左箭头定位到外层容器左侧 */
.thumbnail-gallery-outer .swiper-button-prev {
    left: 0 !important; /* 定位到外层容器的左侧边缘 */
    right: auto !important;
}

/* 右箭头定位到外层容器右侧 */
.thumbnail-gallery-outer .swiper-button-next {
    right: 0 !important; /* 定位到外层容器的右侧边缘 */
    left: auto !important;
}

/* 禁用状态样式 */
.thumbnail-gallery-outer .swiper-button-disabled {
    opacity: 0.2 !important;
    cursor: auto !important;
    pointer-events: none !important;
}

/* 确保最后一个slide没有额外右边距 */
.thumbnail-product-gallery .swiper-slide:last-child {
    margin-right: 0 !important;
}

/* 分页器和导航按钮 */
.main-product-gallery .swiper-pagination {
    bottom: 15px;
    right: 15px;
    left: auto;
    width: auto;
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.main-product-gallery .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.8);
    opacity: 1;
}

.main-product-gallery .swiper-pagination-bullet-active {
    background: #0073aa;
}

.main-product-gallery .swiper-button-next,
.main-product-gallery .swiper-button-prev {
    width: 40px;
    height: 40px;
    background: none;          /* 去掉白色底色 */
    border-radius: 0;          /* 去掉圆角 */
    box-shadow: none;          /* 去掉投影 */
    color: #000;               /* 箭头纯黑 */
    transition: all 0.3s ease;
}

.main-product-gallery .swiper-button-next:after,
.main-product-gallery .swiper-button-prev:after {
    font-size: 18px;
    font-weight: bold;
}

/* Zoom 提示 */
.zoom-hint {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.main-product-gallery:hover .zoom-hint {
    opacity: 1;
}

/* === 修复其他布局元素 === */
/* 确保其他内容在下方正常显示 */
.woocommerce-tabs,
.related.products{
    clear: both !important;
    width: 100% !important;
    margin-top: 40px !important;
}

.upsells.products {
    clear: both !important;
    width: 100% !important;
    margin-top: 70px !important;
}

/* 修复双滚动条问题 */
.woocommerce-Tabs-panel,
.entry-content {
    overflow-y: visible !important;
    min-height: auto !important;
    padding-bottom: 0 !important;
}

/* 隐藏 WooCommerce 默认图库元素 */
.woocommerce-product-gallery .flex-viewport,
.woocommerce-product-gallery .woocommerce-product-gallery__trigger {
    display: none !important;
}

/* ===== tab块样式 ===== */
/* 标签容器样式 */
.woocommerce-tabs.wc-tabs-wrapper {
    background: transparent;
}

/* 标签列表样式 */
.woocommerce-tabs .wc-tabs {
    background: transparent !important;
    border: none !important;
    margin-bottom: 10px !important;
}

/* 覆盖 WooCommerce 主题的左侧内边距 */
.woocommerce div.product .woocommerce-tabs ul.tabs {
    padding-left: 0 !important;
}

/* 单个标签项样式 */
.woocommerce-tabs .wc-tabs li {
    background: transparent !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    margin: 0 40px 0 0 !important; /* 希望和padding20加起来看起来是60px */
}

/* 标签链接基础样式 */
.woocommerce-tabs .wc-tabs li a {
    background: transparent !important;
    color: #333 !important; /* 文字颜色，可根据需要调整 */
    border: none !important;
    padding: 12px 20px 12px 0 !important; /* 右侧保持20px，左侧设为0 */
    text-decoration: none !important;
    position: relative;
    transition: all 0.3s ease;
    text-transform: uppercase !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.5 !important;
    letter-spacing: 2px !important;
    font-family: "trajan-pro-3", serif; /* 继承原主题字体 */
}

/* 非激活标签状态 */
.woocommerce-tabs .wc-tabs li:not(.active) a {
    opacity: 0.7;
}

/* 激活标签的下划线效果 */
.woocommerce-tabs .wc-tabs li.active a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0px;  /*左侧贴边*/
    right: 20px;
    height: 2px;
    background-color: #333; /* 下划线颜色，可根据需要调整 */
    transition: all 0.3s ease;
}

/* 鼠标悬停效果 */
.woocommerce-tabs .wc-tabs li a:hover {
    opacity: 1;
    background: transparent !important;
}

.woocommerce-tabs .wc-tabs li a:hover::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0px;  /*左侧贴边*/
    right: 20px;
    height: 1px;
    background-color: #333;
}

/* 标签内容面板样式 */
.woocommerce-tabs .woocommerce-Tabs-panel {
    background: transparent;
    border: none !important;
    /* padding: 0px 0 !important; */
    margin-top: 0;
}

/* 移除可能存在的默认边框 */
.woocommerce-tabs .wc-tabs::before,
.woocommerce-tabs .wc-tabs::after {
    display: none !important;
}

/* 确保标签项之间没有分隔线 */
.woocommerce-tabs .wc-tabs li + li {
    border-left: none !important;
}


/* ===== 单产品页移动端完整修复（覆盖所有 <=1200px 设备）===== */
@media (max-width: 1200px) {

    /* 1. 解除父容器最小宽度限制 —— 这是页面被撑爆的根源 */
    .single-product div.product {
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    /* 2. 图库与摘要彻底垂直排列，移除所有浮动 */
    .woocommerce-product-gallery,
    .summary.entry-summary {
        float: none !important;
        clear: both !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* 3. 图库下边距，与摘要分开 
    .woocommerce-product-gallery {
        margin-bottom: 30px !important;
    }*/

    /* 4. 摘要容器重置 —— 这就是您漏掉的关键！ */
    .summary.entry-summary {
        padding: 0 15px !important;
        box-sizing: border-box !important;
        /* 强制覆盖任何遗留的浮动/宽度 */
        position: static !important;
        left: auto !important;
        right: auto !important;
    }

    /* 5. 自定义图库宽度自适应 */
    .custom-product-gallery-wrapper,
    .main-product-gallery,
    .thumbnail-gallery-outer {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* 6. 主幻灯片：用 aspect-ratio 替换固定高度，彻底解决窄高 */
    .main-product-gallery,
    .product-gallery-slider {
        height: auto !important;
        aspect-ratio: 4 / 3 !important;  /* 4:3 经典比例 */
        max-height: none !important;
        min-height: 0 !important;
    }
    .main-product-gallery .swiper,
    .product-gallery-slider .swiper {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
    }
    .main-product-gallery .swiper-slide,
    .product-gallery-slider .swiper-slide {
        height: 100% !important;
    }
    .main-product-gallery .swiper-slide img,
    .product-gallery-slider .swiper-slide img {
        object-fit: cover !important;
        width: 100% !important;
        height: 100% !important;
    }

    /* 7. 隐藏主图箭头（移动端用点状指示器更友好） */
    .main-product-gallery .swiper-button-next,
    .main-product-gallery .swiper-button-prev,
    .product-gallery-slider .swiper-button-next,
    .product-gallery-slider .swiper-button-prev {
        display: none !important;
    }

    /* 8. 缩略图区域：自动宽度，高度固定，图片 contain */
    .thumbnail-product-gallery .swiper-slide {
        width: auto !important;
        height: 80px !important;
        opacity: 0.7 !important;
    }
    .thumbnail-product-gallery .swiper-slide img {
        width: auto !important;
        height: 100% !important;
        object-fit: contain !important;
    }
    .thumbnail-product-gallery .swiper-slide-thumb-active {
        opacity: 1 !important;
        border: 2px solid #B8860B !important;
    }
    .thumbnail-gallery-outer {
        padding: 0 45px !important;
        margin: 15px auto 0px !important;
    }

    /* 9. 颜色选项网格 横向滚动 */
    .color-images {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        gap: 15px !important;
        padding-bottom: 10px; /* 为滚动条留空间 */
        scrollbar-width: thin;
    }
    .color-option {
        flex: 0 0 auto;
        width: 70px; /* 固定宽度，可按需调整 */
        text-align: center;
    }
    .color-option img {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1 !important;
        object-fit: cover !important;
    }

    /* 10. Tab 标签改为垂直排列 */
    .woocommerce-tabs .wc-tabs {
        display: block !important;          /* 块级排列 */
        overflow-x: visible !important;
        padding-bottom: 0 !important;
        margin-bottom: 20px !important;
        border-bottom: 1px solid #ddd;      /* 可选：添加分隔线 */
    }

    .woocommerce-tabs .wc-tabs li {
        display: block !important;
        margin: 0 0 10px 0 !important;      /* 纵向间距 */
        flex: none !important;
        border-bottom: 1px solid #eee;       /* 可选：项分隔线 */
        padding: 8px 0 !important;
    }

    .woocommerce-tabs .wc-tabs li:last-child {
        border-bottom: none;
    }

    .woocommerce-tabs .wc-tabs li a {
        padding: 0 !important;
        font-size: 14px !important;          /* 保持字号，可微调 */
        white-space: normal !important;       /* 允许文字换行 */
    }

    /* 下划线效果改为背景色或其他方式 */
    .woocommerce-tabs .wc-tabs li.active a::after {
        display: none;                        /* 移除下划线，改用其他标识 */
    }
    .woocommerce-tabs .wc-tabs li.active a {
        font-weight: bold !important;
        color: #000 !important;
    }

    /* 1. 强制覆盖标签内容面板高度，并增加底部间距 */
    .woocommerce-Tabs-panel.panel.entry-content.wc-tab {
        height: 450px !important;                /* 固定高度，可根据需要微调（400~500px） */
        max-height: none !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 40px !important;          /* 与下方模块拉开距离 */
        /* 保留原有 padding 或根据需要调整 */
        padding: 15px !important;
        /* 移除可能影响高度的 border 设置（可选） */
        border: 1px solid #e0e0e0 !important;    /* 保持原样，但确保不干扰高度 */
        border-top: none !important;
        box-sizing: border-box !important;
    }

    /* 2. 确保 .woocommerce-tabs 容器本身不限制高度 */
    .woocommerce-tabs {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        margin-bottom: 25px !important;              /* 重置可能的下边距 */
    }

    /* 3. 给下方的自定义界面添加上边距，确保与标签内容区彻底分开 */
    .custom-variable-interface {
        margin-top: 40px !important;
    }

    /* 11. 超小屏进一步优化 */
    @media (max-width: 480px) {
        .thumbnail-product-gallery .swiper-slide {
            height: 60px !important;
        }
        .color-images {
            grid-template-columns: 1fr !important;
        }
        .woocommerce-tabs .wc-tabs li {
            margin-right: 18px !important;
        }
        .woocommerce-tabs .wc-tabs li a {
            font-size: 12px !important;
        }
    }
}