/* ZZX Product Pricing Block v0.5
 *
 * 布局：左右两列 grid
 *   左：Quantity Pricing 阶梯价表 + Availability
 *   右：数量输入框 + Add to Cart + View Cart
 *
 * 右栏宽度固定 220px，和左侧表格自动分隔；
 * 小屏下变成上下堆叠，操作栏移到下方。
 */

.zzx-pp-layout {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 28px;
    align-items: start;
}

.zzx-pp-col-table {
    min-width: 0; /* 防止 grid 子项撑开父容器 */
}

.zzx-pp-col-action {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    background: rgba(0,0,0,0.025);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 10px;
}

.zzx-pp-subheading {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 10px;
    color: rgba(0,0,0,0.75);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* ================= 阶梯价表 ================= */
.zzx-pp-tier-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin: 0;
    background: transparent;
    table-layout: auto;
}

.zzx-pp-tier-table thead th {
    background: rgba(0,0,0,0.03);
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(0,0,0,0.6);
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.zzx-pp-tier-table tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    font-variant-numeric: tabular-nums;
}

.zzx-pp-tier-table tbody tr:last-child td {
    border-bottom: none;
}

.zzx-pp-tier-row {
    cursor: pointer;
    transition: background-color 0.12s ease;
}

.zzx-pp-tier-row:hover {
    background: rgba(24, 95, 165, 0.04);
}

.zzx-pp-tier-row.is-active {
    background: rgba(24, 95, 165, 0.08);
}

.zzx-pp-tier-row.is-active td:first-child {
    font-weight: 600;
}

.zzx-pp-note {
    margin: 10px 0 0;
    font-size: 12px;
    color: rgba(0,0,0,0.55);
}

/* ================= 库存行 ================= */
.zzx-pp-stock-line {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed rgba(0,0,0,0.1);
    font-size: 14px;
}

.zzx-pp-stock-label {
    color: rgba(0,0,0,0.6);
    margin-right: 6px;
}

.zzx-pp-stock-value {
    font-weight: 600;
}

.zzx-pp-stock-value.is-in-stock {
    color: #1a7f37;
}

.zzx-pp-stock-value.is-out-of-stock {
    color: #b42318;
}

/* ================= 右栏操作区 ================= */
.zzx-pp-qty-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(0,0,0,0.6);
    margin: 0;
    display: block;
}

.zzx-pp-qty-input {
    width: 100%;
    padding: 0 12px;
    height: 42px;
    border: 1px solid rgba(0,0,0,0.2);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    background: #fff;
    color: inherit;
    box-sizing: border-box;
    -moz-appearance: textfield;
}

.zzx-pp-qty-input::-webkit-outer-spin-button,
.zzx-pp-qty-input::-webkit-inner-spin-button {
    /* 保留默认的上下按钮；要隐藏改成 appearance:none */
}

.zzx-pp-qty-input:focus {
    outline: none;
    border-color: #185fa5;
    box-shadow: 0 0 0 3px rgba(24, 95, 165, 0.18);
}

.zzx-pp-cart-btn,
.zzx-pp-viewcart-btn {
    width: 100%;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    padding: 0 16px;
    box-sizing: border-box;
}

.zzx-pp-cart-btn {
    /* 复用主题 .zzx-pn-btn--primary */
}

.zzx-pp-viewcart-btn {
    /* 复用主题 .zzx-pn-btn--secondary */
    font-weight: 500;
}

.zzx-pp-cart-btn.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.zzx-pp-cart-btn.loading::after {
    content: "";
    display: inline-block;
    margin-left: 8px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.45);
    border-top-color: #fff;
    animation: zzxPpSpin 0.7s linear infinite;
}

.zzx-pp-cart-btn.added {
    background: #1a7f37 !important;
    border-color: #1a7f37 !important;
    color: #fff !important;
}

@keyframes zzxPpSpin {
    to { transform: rotate(360deg); }
}

.zzx-pp-feedback {
    margin-top: 4px;
    min-height: 18px;
    font-size: 12px;
    color: #1a7f37;
    text-align: center;
    line-height: 1.4;
}

.zzx-pp-feedback a {
    color: inherit;
    text-decoration: underline;
    margin-left: 4px;
}

.zzx-pp-out-msg {
    padding: 12px;
    background: #fff7ed;
    border: 1px solid #fcd9b6;
    border-radius: 8px;
    color: #9a3412;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}

/* ================= 免责声明 ================= */
.zzx-pp-disclaimer {
    margin: 20px 0 0;
    padding: 10px 14px;
    background: rgba(24, 95, 165, 0.06);
    border-left: 3px solid rgba(24, 95, 165, 0.5);
    border-radius: 0 4px 4px 0;
    font-size: 12px;
    color: rgba(0,0,0,0.65);
    line-height: 1.5;
}

/* ================= 响应式 ================= */
@media (max-width: 768px) {
    .zzx-pp-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .zzx-pp-col-action {
        /* 小屏：操作栏从右侧窄列变成下方通栏；改横向布局更顺手 */
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding: 14px;
    }
    .zzx-pp-qty-label {
        flex-basis: 100%;
    }
    .zzx-pp-qty-input {
        width: 110px;
        flex: 0 0 auto;
    }
    .zzx-pp-cart-btn {
        flex: 1 1 auto;
        min-width: 140px;
        width: auto;
    }
    .zzx-pp-viewcart-btn {
        flex: 0 0 auto;
        width: auto;
        padding: 0 18px;
    }
    .zzx-pp-feedback {
        flex-basis: 100%;
    }
}

@media (max-width: 480px) {
    .zzx-pp-col-action {
        flex-direction: column;
    }
    .zzx-pp-qty-input,
    .zzx-pp-cart-btn,
    .zzx-pp-viewcart-btn {
        width: 100%;
    }
    .zzx-pp-tier-table {
        font-size: 13px;
    }
    .zzx-pp-tier-table thead th,
    .zzx-pp-tier-table tbody td {
        padding: 9px 10px;
    }
}
