/* ========================================
   Products Page — Full Redesign
   Match reference screenshot 1:1
   ======================================== */

/* ---- Page-level overrides ---- */
.products-page {
    background: #f5f7fa;
}

.products-page body::before,
body.products-page::before,
.products-page .cube-stage {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ==================== HERO ==================== */
.pd-hero {
    padding: 100px 0 50px;
    background: #fff;
    overflow-x: clip;
}

.pd-hero-inner {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 48px;
    align-items: center;
}

/* 左侧文案 */
.pd-hero-copy {
    padding-right: 20px;
}

.pd-hero-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 52px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.12;
    margin-bottom: 14px;
}

.pd-hero-sub {
    font-size: 17px;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 32px;
}

.pd-hero-sub strong {
    color: #e84954;
    font-weight: 700;
}

/* 特色标签行 */
.pd-hero-features {
    display: flex;
    flex-wrap: wrap;
    gap: 18px 24px;
    align-items: flex-start;
}

.pd-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fafbfc;
    border: 1px solid #eef2f6;
    border-radius: 10px;
    padding: 10px 14px;
    min-width: 150px;
}

.pf-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pf-icon svg {
    width: 20px;
    height: 20px;
}

.pf-icon-factory {
    background: #fef2f2;
}

.pf-icon-moq {
    background: #ecfdf5;
}

.pf-icon-ship {
    background: #eff6ff;
}

.pf-icon-quality {
    background: #fffbeb;
}

.pf-icon-box {
    background: #ecfdf5;
}

.pf-text {
    display: flex;
    flex-direction: column;
}

.pf-label {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    line-height: 1.3;
}

.pf-desc {
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.3;
}

/* 右侧配图 */
.pd-hero-img {
    position: relative;
}

.pd-hero-img img {
    width: 100%;
    max-width: 520px;
    border-radius: 16px;
    object-fit: contain;
    display: block;
}


/* ==================== 主内容区 ==================== */
.pd-main {
    padding: 40px 0 70px;
    overflow-x: clip;
    background: #ffffff !important;
}

.pd-main-inner {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 32px;
    align-items: start;
}


/* ==================== 筛选侧栏 ==================== */
.pd-sidebar {
    background: #fff;
    border-radius: 14px;
    padding: 24px 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 88px;
}

.pd-filter-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.pd-filter-title {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
}

.pd-clear-all {
    font-size: 13px;
    color: #94a3b8;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.pd-clear-all:hover {
    color: #e84954;
}

.pd-filter-group {
    margin-bottom: 24px;
    padding-bottom: 22px;
    border-bottom: 1px solid #f1f5f9;
}

.pd-filter-group:last-of-type {
    border-bottom: none;
    margin-bottom: 20px;
}

.pd-group-label {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 14px;
}

/* 筛选项 */
.pd-options {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.pd-options-sm {
    gap: 7px;
}

.pd-opt {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    font-size: 13.5px;
    color: #475569;
    padding: 4px 2px;
    border-radius: 6px;
    transition: background 0.2s;
}

.pd-opt:hover {
    background: #f8fafc;
}

.pd-check {
    width: 17px;
    height: 17px;
    border: 2px solid #cbd5e1;
    border-radius: 5px;
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s;
}

.pd-check.square {
    border-radius: 3px;
}

.pd-opt.active .pd-check {
    background: #e84954;
    border-color: #e84954;
}

.pd-opt.active .pd-check::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.pd-cat-icon {
    font-size: 15px;
    line-height: 1;
}

.pd-count {
    margin-left: auto;
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
}

.pd-count.red {
    color: #e84954;
    font-weight: 600;
}

/* 价格滑块（双 range 叠加，可拖拽实时筛选） */
.pd-range-wrap {
    padding: 4px 0;
}

.pd-range-values {
    display: flex;
    justify-content: space-between;
    font-size: 12.5px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.pd-range-track {
    position: relative;
    height: 16px;
    display: flex;
    align-items: center;
}

.pd-range-track::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
}

.pd-range-fill {
    position: absolute;
    height: 4px;
    background: #e84954;
    border-radius: 2px;
    left: 0;
    right: 0;
}

.pd-range-input {
    position: absolute;
    width: 100%;
    left: 0;
    margin: 0;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: transparent;
    z-index: 2;
}

.pd-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #e84954;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 1px 4px rgba(232, 73, 84, 0.3);
}

.pd-range-input::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #e84954;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 1px 4px rgba(232, 73, 84, 0.3);
}

/* Apply 按钮 */
.pd-apply-btn {
    width: 100%;
    padding: 11px;
    background: transparent;
    color: #e84954;
    border: 1.5px solid #e84954;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
}

.pd-apply-btn:hover {
    background: #e84954;
    color: #fff;
}


/* ==================== 产品内容区 ==================== */
.pd-content {
    min-width: 0;
}


/* 工具栏 */
.pd-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 22px;
}

.pd-results {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

.pd-toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pd-sort select {
    padding: 8px 32px 8px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13.5px;
    color: #334155;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394a3b8' fill='none' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    min-width: 150px;
}

.pd-view-toggle {
    display: flex;
    gap: 3px;
}

.pd-vbtn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    color: #94a3b8;
    transition: all 0.2s;
}

.pd-vbtn:hover {
    border-color: #e84954;
    color: #e84954;
}

.pd-vbtn.active {
    background: #e84954;
    border-color: #e84954;
    color: #fff;
}


/* ==================== 产品网格 ==================== */
.pd-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

/* 无真实产品时的空态提示（#productsGrid 由 js/products-list.js 渲染真实数据，此处仅兜底） */
.pd-grid-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 64px 20px;
    color: #94a3b8;
    font-size: 15px;
    line-height: 1.6;
}


/* 单个卡片 */
.pd-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #f1f5f9;
    transition: all 0.35s ease;
    position: relative;
    /* staggered entrance (re-plays on each re-render, e.g. filter/search) */
    animation: pdCardIn .45s var(--ease-out-quart) backwards;
    animation-delay: calc(var(--i, 0) * 45ms);
}

@keyframes pdCardIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pd-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.09);
    border-color: #fecdd3;
}

.pd-card-top {
    position: relative;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 16px 16px 0;
}

/* 徽章 */
.pd-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.3px;
}

.pd-badge-hot {
    background: #e84954;
}

/* Bestseller — red */
.pd-badge-new {
    background: #10b981;
}

/* New — green */
.pd-badge-sale {
    background: #f97316;
}

/* 卡片图片 */
.pd-img {
    height: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px 10px 0 0;
    overflow: hidden;
}

.pd-img img {
    max-width: 85%;
    max-height: 85%;
    object-fit: contain;
    transition: transform 0.4s ease;
}

.pd-card:hover .pd-img img {
    transform: scale(1.08) rotate(-2deg);
}

/* 卡片信息区 */
.pd-info {
    padding: 14px 16px 18px;
}

.pd-name {
    font-size: 14.5px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 3px;
    line-height: 1.35;
    /* 真实 WC 商品名可能很长：最多 2 行，超出显示 … */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pd-sku {
    font-size: 12px;
    color: #94a3b8;
    display: block;
    margin-bottom: 8px;
}

.pd-price {
    font-size: 15px;
    font-weight: 700;
    color: #e84954;
    margin-bottom: 12px;
}

.pd-btn-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.pd-detail-btn {
    flex: 1;
    padding: 9px;
    background: #fff;
    color: #334155;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
}

.pd-detail-btn:hover {
    background: #0f172a;
    color: #fff;
    border-color: #0f172a;
}

.pd-quick-add {
    flex-shrink: 0;
    width: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e84954;
    color: #fff;
    border: 1.5px solid #e84954;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s;
}

.pd-quick-add svg {
    width: 18px;
    height: 18px;
}

.pd-quick-add:hover {
    background: #dc2626;
    border-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(232, 73, 84, .32);
}

/* success state after adding to cart */
.pd-quick-add.is-added {
    background: #22c55e !important;
    border-color: #22c55e !important;
    animation: addPop .42s var(--ease-out-quart);
}
@keyframes addPop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* pager press feedback */
.pd-page:active:not(:disabled) {
    transform: scale(0.92);
}


/* ==================== 分页 ==================== */
.pd-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
}

.pd-page {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}

.pd-page:hover:not(.active):not(:disabled) {
    border-color: #e84954;
    color: #e84954;
}

.pd-page.active {
    background: #e84954;
    border-color: #e84954;
    color: #fff;
}

.pd-page:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.pd-dots {
    color: #94a3b8;
    padding: 0 4px;
    font-size: 14px;
}


/* ==================== 底部 CTA 条 (截图2) ==================== */
.pd-cta-bar {
    background: linear-gradient(135deg, #fef2f2 0%, #fff1f2 100%);
    border-top: 1px solid #fecdd3;
    padding: 28px 0;
}

.pd-cta-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

.pd-cta-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pd-cta-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    background: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(232, 73, 84, 0.1);
}

.pd-cta-icon svg {
    width: 21px;
    height: 21px;
}

.pd-cta-text {
    display: flex;
    flex-direction: column;
}

.pd-cta-text strong {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
}

.pd-cta-text span {
    font-size: 12.5px;
    color: #64748b;
}

.pd-cta-btn {
    display: inline-flex;
    align-items: center;
    padding: 14px 28px;
    background: #e84954;
    color: #fff;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.25s;
    box-shadow: 0 4px 14px rgba(232, 73, 84, 0.3);
}

.pd-cta-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(232, 73, 84, 0.4);
}


/* ==================== 移动端筛选抽屉控件（桌面隐藏） ==================== */
.pd-filter-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    background: #e84954;
    color: #fff;
    border: none;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .2s;
}

.pd-filter-toggle:hover { background: #dc2626; }

.pd-filter-toggle svg { width: 16px; height: 16px; }

.pd-filter-close {
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-left: auto;
    border: none;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 22px;
    line-height: 1;
    color: #475569;
    cursor: pointer;
    flex-shrink: 0;
}

.pd-filter-close:hover { background: #e2e8f0; }

.pd-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease;
}

.pd-no-scroll { overflow: hidden; }

/* ==================== 响应式 ==================== */

/* 平板 */
@media (max-width: 1080px) {
    .pd-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }

    .pd-hero-title {
        font-size: 42px;
    }

    .pd-cta-inner {
        flex-wrap: wrap;
        gap: 18px;
    }

    .pd-cta-bar {
        padding: 22px 0;
    }
}

@media (max-width: 900px) {
    .pd-hero-inner {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .pd-hero-copy {
        padding-right: 0;
    }

    .pd-hero-img img {
        max-width: 420px;
        margin: 0 auto;
    }

    .pd-main-inner {
        grid-template-columns: 1fr;
    }

    /* 平板竖屏：侧栏变 2 列更协调（侧栏已改为抽屉） */
    .pd-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    /* 工具栏：筛选按钮 + 结果数一行，搜索整行，排序/视图整行 */
    .pd-toolbar {
        flex-wrap: wrap;
        row-gap: 12px;
    }

    .pd-filter-toggle {
        display: inline-flex;
        order: 0;
    }

    .pd-results {
        order: 1;
        margin-left: auto;
    }

    .pd-search {
        order: 2;
        flex-basis: 100%;
        max-width: none;
    }

    .pd-toolbar-right {
        order: 3;
        flex-basis: 100%;
        justify-content: space-between;
    }

    /* 筛选器 → 左侧滑出抽屉（带遮罩） */
    .pd-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: 300px;
        max-width: 86vw;
        background: #fff;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform .3s ease;
        overflow-y: auto;
        box-shadow: 4px 0 24px rgba(0, 0, 0, .18);
        border-radius: 0;
        padding: 20px 18px;
    }

    .pd-sidebar.mobile-open {
        transform: translateX(0);
    }

    .pd-sidebar-overlay {
        display: block;
    }

    .pd-sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    .pd-filter-close {
        display: flex;
    }

    /* CTA 条：平板/手机改 2×2 紧凑卡片网格，按钮占整行居中 */
    .pd-cta-inner {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
        align-items: stretch;
    }
    .pd-cta-item {
        flex: none;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 16px 14px;
        background: #fff;
        border: 1px solid #fecdd3;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(232, 73, 84, 0.06);
    }
    .pd-cta-icon {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }
    .pd-cta-icon svg {
        width: 19px;
        height: 19px;
    }
    .pd-cta-text strong {
        font-size: 13px;
    }
    .pd-cta-text span {
        font-size: 12px;
    }
    .pd-cta-btn {
        grid-column: 1 / -1;
        justify-self: center;
        margin-top: 4px;
    }
}

/* 手机竖屏 */
@media (max-width: 640px) {
    .pd-hero {
        padding: 80px 0 36px;
    }

    .pd-hero-title {
        font-size: 34px;
    }

    .pd-hero-features {
        gap: 12px;
    }

    .pd-feature {
        min-width: auto;
        padding: 8px 10px;
    }

    .pf-icon {
        width: 30px;
        height: 30px;
    }

    .pf-icon svg {
        width: 16px;
        height: 16px;
    }

    .pf-label {
        font-size: 11px;
    }

    .pf-desc {
        font-size: 10px;
    }

    .pd-main {
        padding: 24px 0 50px;
    }

    .pd-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* 隐藏 Hero 第 5 个无文字的孤图标（移动端避免难看的空药丸） */
    .pd-hero-features .pd-feature:last-child {
        display: none;
    }

    .pd-name {
        font-size: 13px;
    }

    .pd-price {
        font-size: 14px;
    }

    .pd-img {
        height: 140px;
    }

    .pd-cta-inner {
        gap: 10px;
    }
    .pd-cta-item {
        padding: 12px 10px;
        border-radius: 10px;
        gap: 8px;
    }
    .pd-cta-icon {
        width: 34px;
        height: 34px;
        min-width: 34px;
        border-radius: 8px;
    }
    .pd-cta-icon svg {
        width: 17px;
        height: 17px;
    }
    .pd-cta-text strong {
        font-size: 12.5px;
    }
    .pd-cta-text span {
        font-size: 11px;
    }
    .pd-cta-btn {
        padding: 12px 20px;
        font-size: 14px;
        margin-top: 2px;
    }
}

/* 超小屏 */
@media (max-width: 380px) {
    .pd-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== 搜索框 ==================== */
.pd-card {
    cursor: pointer;
}

.pd-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 260px;
    max-width: 380px;
}

.pd-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #94a3b8;
    pointer-events: none;
}

.pd-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 38px 10px 40px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    color: #334155;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}

.pd-search-input::placeholder {
    color: #94a3b8;
}

.pd-search-input:focus {
    outline: none;
    border-color: #e84954;
    box-shadow: 0 0 0 3px rgba(232, 73, 84, .12);
}

.pd-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pd-search-clear:hover {
    color: #e84954;
    background: #fef2f2;
}

/* 空状态 */
.pd-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 64px 20px;
    color: #64748b;
}

.pd-empty h3 {
    color: #1e293b;
    font-size: 18px;
    margin-bottom: 8px;
}

.pd-empty p {
    font-size: 14px;
    margin: 0;
}

/* 列表视图 */
.pd-grid.is-list {
    grid-template-columns: 1fr;
}
