/* WD Frontpage Promo Price v2.3.0 - guest member teaser + multi voucher + cart/checkout */
body.home ul.products li.product .onsale,
body.home .products .product .onsale,
body.home ul.products li.product .wc-block-grid__product-onsale,
body.home ul.products li.product .sale-badge,
body.home ul.products li.product .sale_badge,
body.home ul.products li.product .sale-percent,
body.home ul.products li.product .sale-percentage,
body.home ul.products li.product .discount-badge,
body.home ul.products li.product .discount-percent,
body.home ul.products li.product .product-sale,
body.home ul.products li.product .product-sale-badge,
body.home ul.products li.product .sale-flash,
body.home ul.products li.product .product-label.sale,
body.home ul.products li.product .product-label--sale,
body.home ul.products li.product .product-badge.sale,
body.home ul.products li.product .product-badge--sale,
body.home .wd-fpp-legacy-prehide{display:none!important;visibility:hidden!important;opacity:0!important;pointer-events:none!important;}


/* Produk yang dimuat via "Tampilkan Lebih Banyak" dibuatkan blok WD lewat JS. */
body.home .wd-fppromo.wd-fpp-dynamic-pending .wd-fpp-member-teaser,
body.home .wd-fppromo.wd-fpp-dynamic-pending .wd-fpp-save,
body.home .wd-fppromo.wd-fpp-dynamic-pending .wd-fpp-stats,
body.home .wd-fppromo.wd-fpp-dynamic-pending .wd-fpp-points{
    display:none !important;
}

/* Safety net: bila theme tidak memberi product ID atau endpoint gagal, harga native
 * ditampilkan lagi supaya kartu produk tidak pernah kosong total. */
body.home ul.products li.product.wd-fpp-fallback-show .price,
body.home .products .product.wd-fpp-fallback-show .price{
    display:block !important;
    visibility:visible !important;
    opacity:1 !important;
}

/* WD Frontpage Promo Price v1.6 */
body.home .products .product .price,
body.home ul.products li.product .price,
body.home .products .product .star-rating,
body.home ul.products li.product .star-rating{
    display:none !important;
}

body.home .wd-fppromo{
    display:block !important;
    visibility:visible !important;
    opacity:1 !important;
    margin:8px 0 3px;
    line-height:1.25;
    width:100%;
    text-align:center;
}
body.home .wd-fppromo .wd-fpp-price-badge{
    display:inline-flex !important;
    visibility:visible !important;
    opacity:1 !important;
    align-items:center;
    justify-content:center;
    gap:6px;
    max-width:100%;
    padding:5px 9px;
    border:1.5px solid #ff6b84;
    border-radius:9px;
    color:#ff4f70;
    background:#fff;
    font-size:16px;
    font-weight:800;
    line-height:1.15;
    box-sizing:border-box;
    white-space:nowrap;
}
body.home .wd-fppromo .wd-fpp-ticket{
    width:19px;
    height:19px;
    flex:0 0 19px;
    display:block !important;
}
body.home .wd-fppromo .wd-fpp-price-value,
body.home .wd-fppromo .wd-fpp-price-value .woocommerce-Price-amount,
body.home .wd-fppromo .wd-fpp-price-value .woocommerce-Price-currencySymbol,
body.home .wd-fppromo .wd-fpp-price-value bdi{
    display:inline !important;
    visibility:visible !important;
    opacity:1 !important;
    color:inherit !important;
    font:inherit !important;
    line-height:inherit !important;
    text-decoration:none !important;
}


/* Guest teaser: harga tetap terlihat seperti promo, tetapi statusnya jelas sebagai harga member. */
body.home .wd-fppromo[data-guest-teaser="1"] .wd-fpp-price-badge{
    border-color:#ff5574;
    background:#fff7f9;
}
body.home .wd-fppromo .wd-fpp-member-teaser{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:6px;
    margin-top:6px;
    flex-wrap:wrap;
    line-height:1.15;
}
body.home .wd-fppromo .wd-fpp-member-pill{
    display:inline-flex;
    align-items:center;
    min-height:20px;
    padding:2px 7px;
    border-radius:999px;
    background:#ffedf1;
    color:#ef4565;
    font-size:10.5px;
    font-weight:800;
    letter-spacing:.01em;
    white-space:nowrap;
}
body.home .wd-fppromo .wd-fpp-member-copy{
    color:#6b7280;
    font-size:10.5px;
    font-weight:600;
}

/* Seluruh teks Hemat adalah satu elemen supaya angka % tidak kena hide script lama. */
body.home .wd-fppromo .wd-fpp-save{
    display:block;
    visibility:visible !important;
    opacity:1 !important;
    margin-top:6px;
    color:#ff6900;
    font-size:13px;
    font-weight:700;
    line-height:1.25;
}

/* Rating ringkas ala marketplace: ★ 4.8 • 20 terjual */
body.home .wd-fppromo .wd-fpp-stats{
    display:flex !important;
    visibility:visible !important;
    opacity:1 !important;
    align-items:center;
    justify-content:center;
    gap:5px;
    margin-top:6px;
    color:#6b7280;
    font-size:13px;
    font-weight:400;
    line-height:1.2;
    white-space:nowrap;
}
body.home .wd-fppromo .wd-fpp-rating-group{
    display:inline-flex;
    align-items:center;
    gap:4px;
}
body.home .wd-fppromo .wd-fpp-star{
    color:#ffb400;
    font-size:15px;
    line-height:1;
}
body.home .wd-fppromo .wd-fpp-rating{
    color:#6b7280;
}
body.home .wd-fppromo .wd-fpp-sep{
    color:#b0b4bb;
    margin-left:1px;
}
body.home .wd-fppromo .wd-fpp-sold{
    color:#6b7280;
}
body.home .wd-fppromo .wd-fpp-zero-badge{
    color:#f4512b;
    font-weight:600;
}

body.home .wd-fppromo .wd-fpp-points{
    display:block !important;
    visibility:visible !important;
    opacity:1 !important;
    margin-top:6px;
    padding:0;
    border:0;
    border-radius:0;
    color:#f4512b;
    background:transparent;
    font-size:13px;
    font-weight:400;
    line-height:1.2;
}
body.home .wd-fppromo .wd-fpp-point-value{
    display:inline !important;
    visibility:visible !important;
    opacity:1 !important;
}

@media (max-width:767px){
    body.home .wd-fppromo{margin-top:7px}
    body.home .wd-fppromo .wd-fpp-price-badge{
        gap:5px;
        padding:5px 7px;
        font-size:14px;
        border-radius:8px;
    }
    body.home .wd-fppromo .wd-fpp-ticket{
        width:17px;
        height:17px;
        flex-basis:17px;
    }
    body.home .wd-fppromo .wd-fpp-save,
    body.home .wd-fppromo .wd-fpp-stats,
    body.home .wd-fppromo .wd-fpp-points{
        margin-top:5px;
        font-size:11.5px;
    }
    body.home .wd-fppromo .wd-fpp-member-teaser{gap:4px;margin-top:5px}
    body.home .wd-fppromo .wd-fpp-member-pill{font-size:9px;min-height:18px;padding:2px 6px}
    body.home .wd-fppromo .wd-fpp-member-copy{font-size:9.5px}
    body.home .wd-fppromo .wd-fpp-star{
        font-size:13px;
    }
}

/* =========================================================
 * Single Product - Voucher tepat di bawah QTY
 * ========================================================= */
body.single-product #wd-spv-root{
    display:block;
    width:100%;
    clear:both;
    margin:12px 0 14px;
    transition:opacity .18s ease;
}
body.single-product #wd-spv-root.is-loading{
    opacity:.55;
    pointer-events:none;
}
body.single-product .wd-spv-box{
    width:100%;
    box-sizing:border-box;
    border:1px solid #eceff3;
    border-radius:12px;
    background:#fff;
    padding:12px;
}
body.single-product .wd-spv-head{
    display:flex;
    align-items:center;
    gap:7px;
    margin-bottom:9px;
    color:#222;
    font-size:14px;
    line-height:1.25;
}
body.single-product .wd-spv-head-icon{
    font-size:16px;
    line-height:1;
}
body.single-product .wd-spv-list{
    display:flex;
    flex-direction:column;
    gap:8px;
}
body.single-product .wd-spv-item{
    display:grid;
    grid-template-columns:34px minmax(0,1fr) auto;
    align-items:center;
    gap:9px;
    min-width:0;
    padding:9px 10px;
    border:1px solid #f0f1f4;
    border-radius:10px;
    background:#fff;
}
body.single-product .wd-spv-item.is-best{
    border-color:#ff9aac;
    background:#fffafb;
}
body.single-product .wd-spv-ticket{
    display:flex;
    width:30px;
    height:30px;
    align-items:center;
    justify-content:center;
    border-radius:8px;
    background:#ff5574;
    color:#fff;
    font-size:16px;
    font-weight:800;
    line-height:1;
}
body.single-product .wd-spv-copy{
    min-width:0;
}
body.single-product .wd-spv-value{
    color:#ef4565;
    font-size:14px;
    font-weight:800;
    line-height:1.2;
}
body.single-product .wd-spv-meta{
    margin-top:3px;
    color:#7a7f87;
    font-size:11.5px;
    font-weight:400;
    line-height:1.25;
}
body.single-product .wd-spv-meta .woocommerce-Price-amount,
body.single-product .wd-spv-meta .woocommerce-Price-currencySymbol,
body.single-product .wd-spv-meta bdi{
    color:inherit !important;
    font:inherit !important;
}
body.single-product .wd-spv-status{
    flex:0 0 auto;
    border-radius:999px;
    padding:5px 8px;
    background:#fff0f3;
    color:#ee4968;
    font-size:10.5px;
    font-weight:700;
    line-height:1.1;
    white-space:nowrap;
}
body.single-product .wd-spv-item:not(.is-best) .wd-spv-status{
    background:#f5f6f7;
    color:#777d86;
}
body.single-product .wd-spv-note{
    margin-top:8px;
    color:#8a8f96;
    font-size:10.5px;
    line-height:1.35;
}

@media (max-width:767px){
    body.single-product #wd-spv-root{
        margin:10px 0 12px;
    }
    body.single-product .wd-spv-box{
        padding:10px;
        border-radius:10px;
    }
    body.single-product .wd-spv-item{
        grid-template-columns:30px minmax(0,1fr) auto;
        gap:7px;
        padding:8px;
    }
    body.single-product .wd-spv-ticket{
        width:27px;
        height:27px;
        border-radius:7px;
        font-size:14px;
    }
    body.single-product .wd-spv-value{
        font-size:12.5px;
    }
    body.single-product .wd-spv-meta{
        font-size:10px;
    }
    body.single-product .wd-spv-status{
        padding:4px 6px;
        font-size:9px;
    }
    body.single-product .wd-spv-note{
        font-size:9.5px;
    }
}

/* =========================================================
 * v1.9 - Voucher bisa dipakai / dilepas + harga live
 * ========================================================= */
body.single-product .wd-spv-head{
    justify-content:space-between;
}
body.single-product .wd-spv-head-title{
    display:flex;
    align-items:center;
    gap:7px;
    min-width:0;
}
body.single-product .wd-spv-switch{
    appearance:none;
    -webkit-appearance:none;
    border:0;
    background:transparent;
    padding:0;
    margin:0;
    display:inline-flex;
    align-items:center;
    gap:7px;
    cursor:pointer;
    color:#6f7580;
    font-size:10.5px;
    font-weight:700;
    line-height:1;
    flex:0 0 auto;
}
body.single-product .wd-spv-switch-track{
    position:relative;
    display:inline-block;
    width:34px;
    height:20px;
    border-radius:999px;
    background:#d8dce2;
    transition:background .18s ease;
}
body.single-product .wd-spv-switch-knob{
    position:absolute;
    left:3px;
    top:3px;
    width:14px;
    height:14px;
    border-radius:50%;
    background:#fff;
    box-shadow:0 1px 3px rgba(0,0,0,.18);
    transition:transform .18s ease;
}
body.single-product .wd-spv-switch.is-on{
    color:#ef4565;
}
body.single-product .wd-spv-switch.is-on .wd-spv-switch-track{
    background:#ff5574;
}
body.single-product .wd-spv-switch.is-on .wd-spv-switch-knob{
    transform:translateX(14px);
}
body.single-product .wd-spv-live-price{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    margin:0 0 9px;
    padding:8px 10px;
    border-radius:9px;
    background:#fff6f8;
}
body.single-product .wd-spv-live-label{
    color:#6d727a;
    font-size:11.5px;
    font-weight:600;
    line-height:1.2;
}
body.single-product .wd-spv-live-value,
body.single-product .wd-spv-live-value .woocommerce-Price-amount,
body.single-product .wd-spv-live-value .woocommerce-Price-currencySymbol,
body.single-product .wd-spv-live-value bdi{
    color:#ef4565 !important;
    font-size:15px !important;
    font-weight:800 !important;
    line-height:1.1 !important;
    white-space:nowrap;
}
body.single-product .wd-spv-box.is-disabled .wd-spv-live-price{
    background:#f6f7f8;
}
body.single-product .wd-spv-box.is-disabled .wd-spv-live-value,
body.single-product .wd-spv-box.is-disabled .wd-spv-live-value .woocommerce-Price-amount,
body.single-product .wd-spv-box.is-disabled .wd-spv-live-value .woocommerce-Price-currencySymbol,
body.single-product .wd-spv-box.is-disabled .wd-spv-live-value bdi{
    color:#4f5660 !important;
}
body.single-product .wd-spv-box.is-disabled .wd-spv-item.is-best{
    border-color:#e4e6ea;
    background:#fafafa;
    opacity:.72;
}
body.single-product .wd-spv-box.is-disabled .wd-spv-item.is-best .wd-spv-status{
    background:#f0f1f3;
    color:#757b84;
}
body.single-product .wd-spv-price-is-voucher{
    color:#ef4565 !important;
}

@media (max-width:767px){
    body.single-product .wd-spv-switch{
        gap:5px;
        font-size:9.5px;
    }
    body.single-product .wd-spv-switch-track{
        width:31px;
        height:18px;
    }
    body.single-product .wd-spv-switch-knob{
        width:12px;
        height:12px;
    }
    body.single-product .wd-spv-switch.is-on .wd-spv-switch-knob{
        transform:translateX(13px);
    }
    body.single-product .wd-spv-live-price{
        padding:7px 8px;
    }
    body.single-product .wd-spv-live-label{
        font-size:10px;
    }
    body.single-product .wd-spv-live-value,
    body.single-product .wd-spv-live-value .woocommerce-Price-amount,
    body.single-product .wd-spv-live-value .woocommerce-Price-currencySymbol,
    body.single-product .wd-spv-live-value bdi{
        font-size:13px !important;
    }
}

/* v1.9.1 - harga utama produk ikut status voucher */
body.single-product .summary .wd-spv-price-is-voucher,
body.single-product .entry-summary .wd-spv-price-is-voucher,
body.single-product .product-summary .wd-spv-price-is-voucher{
    color:inherit !important;
    font:inherit !important;
}


/* =========================================================
 * v2.0 - Multi voucher selectable + akumulasi
 * ========================================================= */
body.single-product .wd-spv-item[data-voucher-code]{
    cursor:pointer;
    user-select:none;
    -webkit-user-select:none;
    transition:border-color .16s ease, background .16s ease, opacity .16s ease, transform .08s ease;
}
body.single-product .wd-spv-item[data-voucher-code]:active{
    transform:scale(.995);
}
body.single-product .wd-spv-item.is-selected{
    border-color:#ff9aac;
    background:#fffafb;
}
body.single-product .wd-spv-item.is-selected .wd-spv-status,
body.single-product .wd-spv-item:not(.is-best).is-selected .wd-spv-status{
    background:#fff0f3;
    color:#ee4968;
}
body.single-product .wd-spv-item:not(.is-selected){
    border-color:#f0f1f4;
    background:#fff;
}
body.single-product .wd-spv-item:not(.is-selected) .wd-spv-status{
    background:#f5f6f7;
    color:#777d86;
}
body.single-product .wd-spv-box.is-disabled .wd-spv-item.is-selected{
    border-color:#e4e6ea;
    background:#fafafa;
    opacity:.72;
}
body.single-product .wd-spv-box.is-disabled .wd-spv-item.is-selected .wd-spv-status{
    background:#f0f1f3;
    color:#757b84;
}

/* =========================================================
 * v2.3 - Guest Member Teaser di halaman produk
 * ========================================================= */
body.single-product .wd-spv-box.wd-spv-guest{
    border-color:#ffd9e1;
    background:#fff;
}
body.single-product .wd-spv-guest .wd-spv-head{
    justify-content:space-between;
}
body.single-product .wd-spv-guest-badge{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:22px;
    padding:2px 8px;
    border-radius:999px;
    background:#ffedf1;
    color:#ef4565;
    font-size:10px;
    font-weight:800;
    letter-spacing:.04em;
}
body.single-product .wd-spv-guest-copy{
    margin:2px 0 10px;
    color:#68707a;
    font-size:11.5px;
    line-height:1.45;
}
body.single-product .wd-spv-guest-cta{
    display:flex;
    align-items:center;
    justify-content:center;
    width:100%;
    min-height:38px;
    box-sizing:border-box;
    border:1px solid #ff6d88;
    border-radius:9px;
    background:#fff7f9;
    color:#ef4565 !important;
    font-size:12px;
    font-weight:800;
    text-decoration:none !important;
}
body.single-product .wd-spv-guest-cta:hover{
    background:#ffedf1;
}
@media (max-width:767px){
    body.single-product .wd-spv-guest-copy{font-size:10.5px}
    body.single-product .wd-spv-guest-cta{min-height:36px;font-size:11px}
}

/* =========================================================
 * v2.1 - Cart / Mini Cart / Checkout setelah Voucher
 * ========================================================= */
.wd-fpp-cart-net-price,
.wd-fpp-cart-net-subtotal,
.wd-fpp-mini-net-subtotal{
    color:inherit !important;
    font:inherit !important;
    text-decoration:none !important;
    white-space:nowrap;
}

/* Harga line item yang sudah benar-benar dipotong voucher WooCommerce. */
.widget_shopping_cart .wd-fpp-cart-net-price,
.woocommerce-mini-cart .wd-fpp-cart-net-price,
.woocommerce-cart-form .wd-fpp-cart-net-price,
.woocommerce-checkout-review-order .wd-fpp-cart-net-price,
.woocommerce-checkout-review-order .wd-fpp-cart-net-subtotal{
    font-weight:600 !important;
}

/* Baris voucher di Cart / Checkout dibuat compact dan tidak seperti box voucher besar. */
.woocommerce-cart-form + .cart-collaterals tr.cart-discount th,
.woocommerce-cart-form + .cart-collaterals tr.cart-discount td,
.woocommerce-checkout-review-order-table tr.cart-discount th,
.woocommerce-checkout-review-order-table tr.cart-discount td,
.woocommerce-checkout tr.cart-discount th,
.woocommerce-checkout tr.cart-discount td{
    background:#fff8fa;
    border-top:1px solid #f4dce2;
    border-bottom:1px solid #f4dce2;
    padding-top:10px !important;
    padding-bottom:10px !important;
    vertical-align:middle !important;
}

.woocommerce-cart-form + .cart-collaterals tr.cart-discount th,
.woocommerce-checkout-review-order-table tr.cart-discount th,
.woocommerce-checkout tr.cart-discount th{
    border-left:1px solid #f4dce2;
}
.woocommerce-cart-form + .cart-collaterals tr.cart-discount td,
.woocommerce-checkout-review-order-table tr.cart-discount td,
.woocommerce-checkout tr.cart-discount td{
    border-right:1px solid #f4dce2;
}

.wd-fpp-voucher-row-label{
    display:inline-flex;
    align-items:center;
    flex-wrap:wrap;
    gap:6px;
    min-width:0;
    color:#222;
    font-weight:700;
}
.wd-fpp-voucher-word{
    white-space:nowrap;
}
.wd-fpp-voucher-code-wrap{
    display:inline-flex;
    align-items:center;
    gap:5px;
    min-width:0;
}
.wd-fpp-voucher-mini-icon{
    display:inline-flex;
    width:17px;
    height:17px;
    align-items:center;
    justify-content:center;
    flex:0 0 17px;
    border-radius:5px;
    background:#ff5574;
    color:#fff;
    font-size:10px;
    font-weight:800;
    line-height:1;
}
.wd-fpp-voucher-code-wrap code{
    padding:0 !important;
    margin:0 !important;
    background:transparent !important;
    border:0 !important;
    color:#3f434a !important;
    font-family:inherit !important;
    font-size:12px !important;
    font-weight:700 !important;
    line-height:1.2 !important;
    overflow-wrap:anywhere;
}
.wd-fpp-voucher-row-value{
    display:inline-flex;
    align-items:center;
    justify-content:flex-end;
    flex-wrap:wrap;
    gap:7px;
    color:#ef4565;
    font-weight:700;
}
.wd-fpp-voucher-row-value .woocommerce-Price-amount,
.wd-fpp-voucher-row-value .woocommerce-Price-currencySymbol,
.wd-fpp-voucher-row-value bdi{
    color:inherit !important;
    font:inherit !important;
}
.wd-fpp-voucher-row-value .woocommerce-remove-coupon{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:4px 8px;
    border-radius:999px;
    background:#fff;
    border:1px solid #ffd0d9;
    color:#ef4565 !important;
    font-size:10.5px;
    font-weight:700;
    line-height:1.1;
    text-decoration:none !important;
    white-space:nowrap;
}

/* Box Voucher Saya lama (foto #3) tidak dipakai lagi di checkout. */
body.woocommerce-checkout #wd-checkout-vouchers-root,
body.woocommerce-checkout .wd-checkout-vouchers,
body.woocommerce-checkout .wd-checkout-voucher-list{
    display:none !important;
}

@media (max-width:767px){
    .wd-fpp-voucher-row-label{gap:5px;font-size:12px;}
    .wd-fpp-voucher-mini-icon{width:15px;height:15px;flex-basis:15px;font-size:9px;border-radius:4px;}
    .wd-fpp-voucher-code-wrap code{font-size:10.5px !important;}
    .wd-fpp-voucher-row-value{gap:5px;font-size:12px;}
    .wd-fpp-voucher-row-value .woocommerce-remove-coupon{padding:3px 6px;font-size:9.5px;}
}


/* =========================================================
 * v2.2.3 - CART VOUCHER LABEL ESCAPE FIX
 * Theme tertentu meng-escape woocommerce_cart_totals_coupon_label,
 * jadi label sekarang plain text dan ikon dibuat murni via CSS.
 * ========================================================= */
.woocommerce tr.cart-discount th,
.woocommerce-page tr.cart-discount th,
.woocommerce-cart tr.cart-discount th,
.woocommerce-checkout tr.cart-discount th{
    overflow-wrap:anywhere;
    word-break:break-word;
}
.woocommerce tr.cart-discount th::before,
.woocommerce-page tr.cart-discount th::before,
.woocommerce-cart tr.cart-discount th::before,
.woocommerce-checkout tr.cart-discount th::before{
    content:"%";
    display:inline-flex;
    width:17px;
    height:17px;
    align-items:center;
    justify-content:center;
    vertical-align:middle;
    margin:0 6px 2px 0;
    border-radius:5px;
    background:#ff5574;
    color:#fff;
    font-size:10px;
    font-weight:800;
    line-height:1;
    box-sizing:border-box;
}
@media (max-width:767px){
    .woocommerce tr.cart-discount th::before,
    .woocommerce-page tr.cart-discount th::before,
    .woocommerce-cart tr.cart-discount th::before,
    .woocommerce-checkout tr.cart-discount th::before{
        width:15px;
        height:15px;
        margin-right:5px;
        border-radius:4px;
        font-size:9px;
    }
}
