.sectioned-products-page {
    width: 100%;
    max-width: 1200px;
    margin: 24px auto 60px;
    padding: 0 16px;
    box-sizing: border-box;
}

.sectioned-products-page .sectioned-products-tabs {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
    gap: 12px !important;
    margin-bottom: 18px !important;
}

.sectioned-products-page .section-tab {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 18px 20px;
    min-height: 72px;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    color: #111827;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sectioned-products-page .section-tab.is-active {
    border-color: #2563eb;
    background: #2563eb;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.18);
    color: #ffffff;
}

.sectioned-products-page .sectioned-products-content {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px;
    background: #fafafa;
}

.sectioned-products-page .sectioned-products-layout {
    position: relative;
    padding-right: 360px; /* 给右侧固定购物车预留空间 */
}

.sectioned-products-page .sectioned-products-main {
    width: 100%;
}

.sectioned-products-page .section-panel {
    display: none;
}

.sectioned-products-page .section-panel.is-active {
    display: block;
}

.sectioned-products-page .product-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(240px, 240px)) !important;
    justify-content: flex-start !important;
    gap: 16px !important;
    /* 行高自适应，避免内容被裁剪 */
}

.sectioned-products-page .product-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    position: relative;
    min-height: 380px;
    height: auto;
    width: 240px !important;
    box-sizing: border-box;
}

.sectioned-products-page .product-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.sectioned-products-page .product-card.is-sold-out {
    filter: grayscale(1);
    opacity: 0.75;
}

.sectioned-products-page .card-image {
    position: relative;
    width: 100%;
    padding: 12px;
    box-sizing: border-box;
}

.sectioned-products-page .card-image img {
    width: 100%;
    height: 200px !important;
    object-fit: cover !important;
    border-radius: 10px;
    display: block;
}

.sectioned-products-page .sold-out-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
}

.sectioned-products-page .card-body {
    padding: 0 16px 8px;
    flex: 1 1 auto !important;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    overflow: visible; /* 避免价格区撑开后遮挡底部按钮 */
}

.sectioned-products-page .card-title {
    font-size: 16px;
    margin: 0 0 8px;
    line-height: 1.4;
    min-height: 44px;
    max-height: 44px;
    overflow: hidden;
}

.sectioned-products-page .card-title a {
    color: #111827;
    text-decoration: none;
}

.sectioned-products-page .card-title a:hover {
    color: #2563eb;
}

.sectioned-products-page .price-row {
    margin: 4px 0;
    display: flex;
    align-items: baseline;
    gap: 6px;
    color: #374151;
}

.sectioned-products-page .price-row .label {
    color: #6b7280;
    font-size: 13px;
    min-width: 48px;
}

.sectioned-products-page .price-block {
    margin: 6px 0 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sectioned-products-page .price-block .price-primary {
    font-size: 17px;
    font-weight: 700;
    color: #e11d48;
    line-height: 1.4;
    display: block;
}

.sectioned-products-page .price-block .price-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    line-height: 1.4;
    color: #111827;
    font-weight: 700;
}

.sectioned-products-page .price-block .price-secondary .price-separator {
    color: #6b7280;
}

.sectioned-products-page .card-footer {
    padding: 12px 14px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.sectioned-products-page .btn-buy-now,
.sectioned-products-page .btn-add-cart {
    flex: 1 1 0;
    border: none;
    color: #fff;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.sectioned-products-page .btn-buy-now {
    background: #e11d48;
}

.sectioned-products-page .btn-buy-now:hover:not([disabled]) {
    background: #be123c;
}

.sectioned-products-page .btn-add-cart {
    background: #2563eb;
}

.sectioned-products-page .btn-add-cart:hover:not([disabled]) {
    background: #1d4ed8;
}

.sectioned-products-page .btn-buy-now[disabled],
.sectioned-products-page .btn-add-cart[disabled] {
    cursor: not-allowed;
    background: #9ca3af;
}

.sectioned-products-page .no-products {
    padding: 24px;
    color: #6b7280;
}

/* 页面级容器去边距：不改 container.css，只在本模板页覆盖 */
.page-template-sectioned-products-template .content-area,
.page-template-sectioned-products-template .entry-content-wrap {
    padding: 0 !important;
}
.page-template-sectioned-products-template .content-area {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}
.sectioned-products-page .stock-row {
    margin: 4px 0 6px;
    font-size: 13px;
    color: #065f46;
    font-weight: 600;
}

.sectioned-products-page .stock-row.is-zero {
    color: #b91c1c;
}

/* Mini cart sidebar */
.sectioned-mini-cart {
    position: fixed;
    top: 96px;
    right: 24px;
    width: 320px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    padding: 14px;
    min-height: 320px;
    z-index: 50;
}

.mini-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.mini-cart-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}

.mini-cart-count {
    background: #2563eb;
    color: #fff;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
}

.mini-cart-body {
    max-height: 420px;
    overflow-y: auto;
}

.mini-cart-empty {
    margin: 12px 0;
    color: #6b7280;
    font-size: 14px;
}

.mini-cart-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mini-cart-item {
    display: grid;
    grid-template-columns: 64px 1fr 48px;
    gap: 10px;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    align-items: center;
}

.mini-cart-item img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
}

.mini-cart-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mini-cart-title {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    margin: 0;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.mini-cart-price {
    font-size: 13px;
    color: #e11d48;
    font-weight: 700;
}

.mini-cart-qty {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mini-cart-qty button {
    width: 26px;
    height: 26px;
    border: 1px solid #d1d5db;
    background: #f3f4f6;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 800;
    color: #111827;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.mini-cart-qty input {
    width: 52px;
    text-align: center;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 4px;
}

.mini-cart-remove {
    border: none;
    background: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 14px;
}

.mini-cart-footer {
    margin-top: 12px;
    border-top: 1px solid #e5e7eb;
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mini-cart-total {
    display: flex;
    justify-content: space-between;
    color: #111827;
    font-weight: 600;
}

.mini-cart-total-amount {
    color: #e11d48;
}

.mini-cart-total-foreign {
    display: flex;
    gap: 6px;
    color: #111827;
    font-size: 13px;
    font-weight: 600;
}

.btn-mini-checkout {
    width: 100%;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-mini-checkout:hover:not([disabled]) {
    background: #1d4ed8;
}

.btn-mini-checkout[disabled] {
    background: #9ca3af;
    cursor: not-allowed;
}

.btn-mini-cart {
    width: 100%;
    background: #fbbf24;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-mini-cart:hover:not([disabled]) {
    background: #f59e0b;
}

/* SKU mini selector */
.sku-mini-selector {
    margin: 8px 0 10px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.sku-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sku-label {
    font-size: 12px;
    color: #6b7280;
    min-width: 48px;
}

.sku-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sku-option {
    border: 1px solid #d1d5db;
    background: #cbd5e1; /* 未选：中灰蓝，对比更明显 */
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    color: #0f172a;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sku-option.selected {
    border-color: #2563eb;
    color: #ffffff;
    background: #2563eb; /* 选中：蓝底白字 */
    font-weight: 700;
}

@media (max-width: 640px) {
    .sectioned-products-page {
        padding: 0 12px;
    }
    .sectioned-products-page .card-image img {
        height: 200px !important;
    }
    .sectioned-products-page .sectioned-products-layout {
        padding-right: 0;
    }
    .sectioned-mini-cart {
        position: relative;
        right: auto;
        top: auto;
        width: 100%;
        margin-top: 12px;
    }
}
