/* products.css - 商品展示页面样式 */

/* 分类筛选栏 */
.product-categories{
    display:flex;
    flex-wrap:wrap;
    gap:10px;
    justify-content:center;
    margin-bottom:50px;
}
.product-cat-btn{
    padding:8px 24px;
    border-radius:20px;
    background:var(--bg-gray);
    color:var(--text2);
    font-size:14px;
    text-decoration:none;
    transition:all .3s ease;
    border:1px solid var(--border);
}
.product-cat-btn:hover{
    color:var(--text);
    border-color:#07c160;
}
.product-cat-btn.active{
    background:#07c160;
    color:#fff;
    border-color:#07c160;
}

/* 商品网格 */
.product-grid{
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(280px,1fr));
    gap:30px;
    margin-bottom:60px;
}

/* 商品卡片 */
.product-card{
    display:block;
    text-decoration:none;
    color:inherit;
    background:var(--card);
    border:1px solid var(--card-border);
    border-radius:16px;
    overflow:hidden;
    transition:all .3s ease;
}
.product-card:hover{
    transform:translateY(-4px);
    box-shadow:0 12px 40px rgba(0,0,0,0.12);
    border-color:#07c160;
}

/* 商品图片区 */
.product-card-img{
    position:relative;
    width:100%;
    height:280px;
    overflow:hidden;
    background:var(--bg-gray);
}
/* 免费下载水印：价格=0 时显示在封面图右上角 */
.product-free-badge{
    position:absolute;
    top:10px;
    right:10px;
    z-index:5;
    padding:4px 10px;
    background:rgba(255,69,0,0.92);
    color:#fff;
    font-size:12px;
    font-weight:bold;
    border-radius:4px;
    box-shadow:0 2px 6px rgba(0,0,0,0.25);
    pointer-events:none;
    letter-spacing:1px;
}
.product-card-img img{
    width:100%;
    height:100%;
    object-fit:cover;
    transition:transform .3s ease;
}
.product-card:hover .product-card-img img{
    transform:scale(1.05);
}

/* 多图轮播容器 */
.product-img-swiper{
    position:relative;
    width:100%;
    height:100%;
}
.product-img-slide{
    position:absolute;
    top:0;
    left:0;
    width:100%;
    height:100%;
    object-fit:cover;
    opacity:0;
    transition:opacity .4s ease !important;
    z-index:1;
}
.product-img-slide:first-child{
    opacity:1;
    z-index:2;
}

/* 指示点 */
.product-img-dots{
    position:absolute;
    bottom:10px;
    left:50%;
    transform:translateX(-50%);
    display:flex;
    gap:5px;
    z-index:2;
}
.product-img-dot{
    width:6px;
    height:6px;
    border-radius:50%;
    background:rgba(255,255,255,0.5);
    transition:all .3s ease;
}
.product-img-dot.active{
    background:#fff;
    width:18px;
    border-radius:3px;
}

/* 图片占位 */
.product-img-placeholder{
    width:100%;
    height:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    background:var(--bg-gray);
    color:var(--text2);
    font-size:14px;
}

/* 商品卡片信息区 */
.product-card-body{
    padding:18px;
}
.product-card-title{
    font-size:16px;
    font-weight:600;
    color:var(--text);
    margin-bottom:8px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.product-card-category{
    font-size:12px;
    color:var(--text2);
    margin-bottom:10px;
}
.product-card-price{
    font-size:20px;
    font-weight:700;
    color:#ff5722;
    margin-bottom:12px;
}
.product-card-btn{
    text-align:center;
    padding:8px 0;
    border-radius:8px;
    background:var(--bg-gray);
    color:var(--text2);
    font-size:14px;
    transition:all .3s ease;
}
.product-card:hover .product-card-btn{
    background:#07c160;
    color:#fff;
}

/* ========== 详情页样式 ========== */

/* 面包屑 */
.product-breadcrumb{
    display:flex;
    align-items:center;
    gap:8px;
    margin-bottom:30px;
    font-size:14px;
    color:var(--text2);
}
.product-breadcrumb a{
    color:var(--text2);
    text-decoration:none;
    transition:color .3s ease;
}
.product-breadcrumb a:hover{
    color:#07c160;
}

/* 详情页主体 */
.product-detail-wrap{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:50px;
    margin-bottom:60px;
}

/* 详情页左侧图片区 */
.product-detail-left{
    position:sticky;
    top:100px;
    align-self:start;
}
.product-detail-main-img{
    width:100%;
    height:700px;
    border-radius:16px;
    overflow:hidden;
    border:1px solid var(--card-border);
    margin-bottom:15px;
    background:#000;
}
.product-detail-main-img img{
    width:100%;
    height:100%;
    object-fit:contain;
    display:block;
}
.product-detail-thumb-list{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
}
.product-detail-thumb{
    width:70px;
    height:70px;
    border-radius:8px;
    overflow:hidden;
    cursor:pointer;
    border:2px solid transparent;
    transition:all .3s ease;
}
.product-detail-thumb img{
    width:100%;
    height:100%;
    object-fit:cover;
}
.product-detail-thumb.active{
    border-color:#07c160;
}
.product-detail-thumb:hover{
    opacity:.85;
}

/* 详情页右侧信息区 */
.product-detail-right{
    padding-top:20px;
}
.product-detail-title{
    font-size:28px;
    font-weight:700;
    color:var(--text);
    margin-bottom:15px;
    line-height:1.4;
}
.product-detail-meta{
    margin-bottom:20px;
}
.product-detail-category{
    display:inline-block;
    padding:4px 14px;
    background:var(--bg-gray);
    color:var(--text2);
    font-size:13px;
    border-radius:12px;
}

/* 价格区 */
.product-detail-price{
    background:linear-gradient(135deg,#fff5f0,var(--bg-gray));
    padding:20px;
    border-radius:12px;
    margin-bottom:30px;
}
[data-theme="dark"] .product-detail-price{
    background:linear-gradient(135deg,#2a1f1f,var(--bg-gray));
}
.product-detail-price-label{
    font-size:14px;
    color:var(--text2);
    display:block;
    margin-bottom:5px;
}
.product-detail-price-value{
    font-size:36px;
    font-weight:700;
    color:#ff5722;
}

/* 购买按钮 */
.product-detail-buy{
    margin-bottom:30px;
}
.product-detail-buy-btn{
    display:inline-block;
    padding:14px 50px;
    background:#07c160;
    color:#fff;
    font-size:18px;
    font-weight:600;
    border-radius:30px;
    text-decoration:none;
    border:none;
    cursor:pointer;
    transition:all .3s ease;
    text-align:center;
}
.product-detail-buy-btn:hover{
    background:#06ad56;
    transform:translateY(-2px);
    box-shadow:0 6px 20px rgba(7,193,96,0.35);
}
.product-detail-buy-disabled{
    background:var(--bg-gray);
    color:var(--text2);
    cursor:not-allowed;
}
.product-detail-buy-disabled:hover{
    background:var(--bg-gray);
    transform:none;
    box-shadow:none;
}

/* 描述区 */
.product-detail-desc-section{
    margin-bottom:60px;
}
.product-detail-desc-title{
    font-size:24px;
    font-weight:700;
    color:var(--text);
    margin-bottom:25px;
    padding-bottom:12px;
    border-bottom:1px solid var(--border);
}
.product-detail-desc-content{
    font-size:15px;
    line-height:1.8;
    color:var(--text);
}
.product-detail-desc-content p{
    margin-bottom:12px;
}
.product-detail-desc-content img{
    max-width:100%;
    border-radius:10px;
    margin:10px 0;
}

/* 相关商品 */
.product-related-section{
    margin-bottom:60px;
}

/* 站长微信二维码气泡（点击购买按钮后在下方弹出） */
.wechat-qr-trigger{
    position:relative;
    display:inline-block;
}
/* 全屏遮罩，点遮罩关闭气泡 */
.wechat-qr-mask{
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    background:rgba(0,0,0,0.4);
    z-index:99;
    display:none;
}
.wechat-qr-mask.show{
    display:block;
}
.wechat-qr-popover{
    position:absolute;
    top:100%;
    left:50%;
    transform:translateX(-50%);
    margin-top:14px;
    background:#fff;
    border:1px solid #eee;
    border-radius:12px;
    box-shadow:0 6px 24px rgba(0,0,0,0.12);
    padding:15px;
    width:220px;
    text-align:center;
    z-index:100;
    display:none;
}
.wechat-qr-popover.show{
    display:block;
}
/* 向上指的三角箭头，提示用户这是从按钮弹出的 */
.wechat-qr-popover-arrow{
    position:absolute;
    top:-11px;
    left:50%;
    transform:translateX(-50%);
    width:0;
    height:0;
    border-left:11px solid transparent;
    border-right:11px solid transparent;
    border-bottom:11px solid #fff;
    filter:drop-shadow(0 -1px 1px rgba(0,0,0,0.06));
}
.wechat-qr-popover-arrow::before{
    content:'';
    position:absolute;
    top:1px;
    left:-11px;
    width:0;
    height:0;
    border-left:11px solid transparent;
    border-right:11px solid transparent;
    border-bottom:11px solid #eee;
    z-index:-1;
}
.wechat-qr-popover-img{
    width:100%;
    height:auto;
    border-radius:6px;
    display:block;
}
.wechat-qr-popover-text{
    margin:10px 0 0;
    font-size:13px;
    color:#666;
}

/* 描述图片查看器：点击放大、缩放、上下页、拖拽平移 */
.desc-img-viewer{
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    z-index:9999;
    display:none;
}
.desc-img-viewer.show{
    display:block;
}
.desc-img-viewer-mask{
    position:absolute;
    inset:0;
    background:rgba(0,0,0,0.92);
}
.desc-img-viewer-inner{
    position:absolute;
    inset:0;
    overflow:hidden;
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:grab;
    user-select:none;
}
.desc-img-viewer-inner.grabbing{
    cursor:grabbing;
}
.desc-img-viewer-img{
    max-width:90vw;
    max-height:80vh;
    transition:transform 0.2s ease;
    transform-origin:center center;
    user-select:none;
    -webkit-user-drag:none;
    pointer-events:none;
}
.desc-img-viewer-toolbar{
    position:absolute;
    bottom:30px;
    left:50%;
    transform:translateX(-50%);
    display:flex;
    align-items:center;
    gap:8px;
    padding:10px 16px;
    background:rgba(0,0,0,0.6);
    border-radius:30px;
    backdrop-filter:blur(8px);
    z-index:2;
}
.desc-img-viewer-btn{
    width:40px;
    height:40px;
    border-radius:50%;
    border:none;
    background:rgba(255,255,255,0.1);
    color:#fff;
    font-size:22px;
    cursor:pointer;
    display:flex;
    align-items:center;
    justify-content:center;
    transition:background 0.2s;
    line-height:1;
}
.desc-img-viewer-btn:hover{
    background:rgba(255,255,255,0.25);
}
.desc-img-viewer-btn:disabled{
    opacity:0.3;
    cursor:not-allowed;
}
.desc-img-viewer-close{
    background:rgba(255,69,0,0.7);
    margin-left:8px;
}
.desc-img-viewer-close:hover{
    background:rgba(255,69,0,0.9);
}
.desc-img-viewer-scale{
    color:#fff;
    font-size:13px;
    min-width:50px;
    text-align:center;
}
.desc-img-viewer-counter{
    color:#fff;
    font-size:13px;
    margin-left:8px;
    opacity:0.7;
}

/* 描述里的图片：鼠标变 zoom-in 提示可点 */
.product-detail-desc-content img{
    cursor:zoom-in;
    transition:opacity 0.2s;
}
.product-detail-desc-content img:hover{
    opacity:0.85;
}

/* 描述中的标题样式（H1 最大 → H5 最小） */
.product-detail-desc-content h1{
    font-size:26px;
    font-weight:bold;
    margin:28px 0 14px;
    color:var(--text);
    scroll-margin-top:100px;
    padding-bottom:6px;
    border-bottom:2px solid #eee;
}
.product-detail-desc-content h2{
    font-size:22px;
    font-weight:bold;
    margin:24px 0 12px;
    color:var(--text);
    scroll-margin-top:100px;
    padding-bottom:6px;
    border-bottom:1px solid #eee;
}
.product-detail-desc-content h3{
    font-size:18px;
    font-weight:bold;
    margin:18px 0 8px;
    color:var(--text);
    scroll-margin-top:100px;
}
.product-detail-desc-content h4{
    font-size:16px;
    font-weight:bold;
    margin:14px 0 6px;
    color:var(--text);
    scroll-margin-top:100px;
}
.product-detail-desc-content h5{
    font-size:14px;
    font-weight:bold;
    margin:12px 0 4px;
    color:var(--text2, #666);
    scroll-margin-top:100px;
}

/* 右侧自动目录（仅大屏显示） */
.desc-toc{
    position:fixed;
    top:130px;
    right:30px;
    width:240px;
    max-height:700px;
    overflow-y:auto;
    padding:15px 20px;
    background:#fff;
    border-left:3px solid var(--primary, #07c160);
    border-radius:4px;
    box-shadow:0 2px 12px rgba(0,0,0,0.06);
    z-index:50;
    font-size:13px;
}
.desc-toc::-webkit-scrollbar{
    width:6px;
}
.desc-toc::-webkit-scrollbar-thumb{
    background:#d9d9d9;
    border-radius:3px;
}
.desc-toc::-webkit-scrollbar-thumb:hover{
    background:#bfbfbf;
}
.desc-toc-title{
    font-size:14px;
    font-weight:bold;
    margin-bottom:10px;
    color:var(--text, #333);
    padding-bottom:8px;
    border-bottom:1px solid #f0f0f0;
}
.desc-toc-list{
    list-style:none;
    padding:0;
    margin:0;
}
.desc-toc-list li{
    margin-bottom:6px;
    line-height:1.5;
}
.desc-toc-list li a{
    color:var(--text2, #666);
    text-decoration:none;
    transition:color 0.2s;
    display:block;
    word-break:break-all;
}
/* 有子项的 li：不用 flex，让图标作为 <a> 内部文字流的一部分，自然跟在最后一行文字之后 */
.desc-toc-list li.has-children > a{
    color:var(--text, #333);
    font-weight:500;
    display:block;
    word-break:break-word;
    overflow-wrap:anywhere;
    line-height:1.6;
}
/* 折叠/展开按钮：放在 <a> 内部，inline 跟随文字流，自然换行到最后一行末尾 */
.desc-toc-toggle{
    display:inline !important;
    margin-left:6px;                 /* 离文字末尾 10px */
    font-size:12px !important;
    color:#bfbfbf;
    cursor:pointer;
    user-select:none;
    transition:color 0.2s;
    line-height:inherit !important;   /* 跟随行高，与文字对齐 */
    vertical-align:baseline;
    width:auto !important;
}
.desc-toc-toggle:hover{
    color:var(--primary, #07c160);
}
/* 子项折叠：属于该 H2 但被隐藏 */
.desc-toc-list li.toc-hidden{
    display:none !important;
}
.desc-toc-list li.desc-toc-l2{
    margin-left:14px;
    font-size:12px;
}
.desc-toc-list li.desc-toc-l3{
    margin-left:28px;
    font-size:12px;
}
.desc-toc-list li.desc-toc-l4{
    margin-left:42px;
    font-size:11px;
}
.desc-toc-list li.desc-toc-l5{
    margin-left:56px;
    font-size:11px;
    color:var(--text2, #999);
}
.desc-toc-list li a:hover{
    color:var(--primary, #07c160);
}
.desc-toc-list li.active > a{
    color:var(--primary, #07c160);
    font-weight:bold;
}

/* 默认隐藏目录，只在大屏（≥1280px）显示 */
.desc-toc{
    display:none;
}
@media (min-width:1280px){
    .desc-toc{
        display:block;
    }
}

/* ========== 响应式 ========== */
@media (max-width:768px){
    .product-detail-wrap{
        grid-template-columns:1fr;
        gap:30px;
    }
    .product-detail-left{
        position:static;
    }
    .product-grid{
        grid-template-columns:repeat(auto-fill,minmax(160px,1fr));
        gap:15px;
    }
    .product-card-img{
        height:200px;
    }
    .product-card-title{
        font-size:14px;
    }
    .product-card-price{
        font-size:17px;
    }
    .product-detail-title{
        font-size:22px;
    }
    .product-detail-price-value{
        font-size:28px;
    }
    .product-detail-buy-btn{
        padding:12px 36px;
        font-size:16px;
        width:100%;
    }
    .product-detail-thumb{
        width:55px;
        height:55px;
    }
    .product-detail-main-img{
        height:360px;
    }
    .product-categories{
        gap:8px;
    }
    .product-cat-btn{
        padding:6px 16px;
        font-size:13px;
    }
}
