/* === Card container === */

.custom-woo-price {
    border: 1px solid #e5e7eb;       /* light border */
    position: relative;
    border-radius: .6rem;
    overflow: hidden;
    padding: .6rem 1.0rem;
    background: #fff;
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    grid-template-areas:
        "mrp   mrp   .   save"
        "excl  excl  excl excl"
        "final final final final";
    row-gap: .45rem;
    column-gap: .6rem;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum","lnum";
    width: 100%;                     /* align full with tiles */
    box-sizing: border-box;
    margin-bottom: 20px;
}

/* Assign grid areas */
.custom-woo-price .cwp-mrp { grid-area: mrp; align-self: center; margin: 0; }
.custom-woo-price .cwp-price { 
    grid-area: excl; 
    margin: 0;
    font-size: .9rem;
    color: #6b7280;
}
.custom-woo-price .cwp-price-inc { grid-area: final; margin: 0; }
.custom-woo-price .cwp-save { grid-area: save; align-self: center; margin: 0; white-space: nowrap; }
.custom-woo-price .cwp-note { display: none; } /* hide “Inclusive of all taxes” */

/* --- MRP --- */
.custom-woo-price .cwp-mrp {
    display: flex;
    align-items: baseline;  /* keeps currency + numbers aligned nicely */
    gap: .35rem;            /* spacing between label and amount */
    margin: 0;
}

.custom-woo-price .cwp-mrp .cwp-label {
    font-size: .55rem;   /* smaller label */
    font-weight: 600;
    color: #6b7280;      /* lighter gray */
}

.custom-woo-price .cwp-mrp del {
    opacity: .6;
    text-decoration-thickness: 1.5px;
}

/* --- Excl. GST line --- */
.custom-woo-price .cwp-price .cwp-label {
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: .58rem;
    font-weight: 600;
}
.custom-woo-price .cwp-price .cwp-val {
    font-weight: 600;
    color: #1f2937;
}
.custom-woo-price .cwp-price .cwp-extra {
    color: #6b7280;
    font-weight: 600;
    margin-left: .35rem;
}

/* --- Final price incl. GST (hero row) --- */
.custom-woo-price .cwp-price-inc .cwp-extra {
    font-weight: 700;
    margin-left: .35rem;
    color: #374151;
}

/* --- Save badge --- */
.custom-woo-price .cwp-save {
    background: #111;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    padding: .2rem .35rem;
    border-radius: .25rem;
    white-space: nowrap;
}

/* --- Mobile fallback --- */
@media (max-width: 540px) {
    .custom-woo-price {
        grid-template-columns: auto 1fr auto;
        grid-template-areas:
            "mrp   . save"
            "excl  excl excl"
            "final final final";
    }
    .custom-woo-price .cwp-price-inc {
        border-radius: .4rem; /* simplify for small screens */
    }
}

/* Tiles: show their original small price; if a custom block leaks in, collapse it to one line */
.amazon-tiles .tile-price .custom-woo-price {
    display: block; margin: 0; line-height: 1.15; font-weight: 700;
    grid-template-columns: none; column-gap: 0; row-gap: 0;
}
.amazon-tiles .custom-woo-price .cwp-mrp,
.amazon-tiles .custom-woo-price .cwp-price,
.amazon-tiles .custom-woo-price .cwp-save,
.amazon-tiles .custom-woo-price .cwp-note,
.amazon-tiles .custom-woo-price .cwp-label,
.amazon-tiles .custom-woo-price .cwp-extra { display: none !important; }
.amazon-tiles .custom-woo-price .cwp-price-inc { display: block !important; margin: 0; }

/* ====================================================================
   TIERED BUNDLE UI CSS (v3 - Scoped to avoid Teleporter conflicts)
   ==================================================================== */

/* 1. Container Setup */
/* .enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .wcpa_group_field {
    display: flex !important;
    flex-direction: column !important;
    gap: 28px !important; 
    width: 100% !important;
}*/

/* Stack Tiered Cards vertically, but IGNORE any Acowebs grid layout (2, 3, 4, etc.) */
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .wcpa_group_field:not([class*="wcpa_fl_col-"]) {
    display: flex !important;
    flex-direction: column !important;
    gap: 28px !important;
    width: 100% !important;
}


.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .wcpa_radio {
    position: relative !important;
    margin: 0 !important;
    width: 100% !important; 
    display: block !important;
}

/* 2. Hide Native Radio Button */
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .wcpa_radio input[type="radio"] {
    display: none !important; 
}

/* 3. The Main Card Layout (The Label) */
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .wcpa_radio label {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 16px 20px !important;
    border: 2px solid #27ae60 !important; 
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.2s ease-in-out !important;
    background: #ffffff !important;
    margin: 0 !important; 
    min-height: 85px !important; 
    height: 85px !important; 
}

/* 4. Active/Selected State */
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .wcpa_radio.wcpa_selected label {
    background-color: #ccebd6 !important; 
    border-color: #27ae60 !important; 
}

/* 5. Custom Radio Circle */
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .wcpa_check,
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .wcpa_radio_custom {
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    min-height: 22px !important;
    border: 2px solid #27ae60 !important; 
    border-radius: 50% !important; 
    margin-right: 15px !important;
    position: relative !important;
    flex-shrink: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .wcpa_check::before,
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .wcpa_radio_custom::before {
    display: none !important;
}

.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .wcpa_radio.wcpa_selected .wcpa_check::after,
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .wcpa_radio.wcpa_selected .wcpa_radio_custom::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 12px !important;
    height: 12px !important;
    background-color: #27ae60 !important; 
    border-radius: 50% !important;
}

/* 6. Typography & Layout */
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .wcpa_radio span.card-title {
    font-weight: 700 !important;
    font-size: 16px !important;
    color: #000000 !important;
    flex: none !important; 
    margin-right: 12px !important; 
    text-transform: uppercase !important;
}

.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .per-unit-text {
    font-weight: 600 !important;
    font-size: 14px !important;
    color: #27ae60 !important;
    margin-right: auto !important; 
}

/* 7. Price Block */
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .price-block {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    line-height: 1.2 !important;
    flex-shrink: 0 !important;
    margin-top: 6px !important; 
}

.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .price-block .final-price {
    font-weight: 700 !important;
    font-size: 18px !important;
    color: #000000 !important;
}

.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .price-block .strike-price {
    font-size: 14px !important;
    color: #777777 !important; 
    text-decoration: line-through !important;
    margin-top: 2px !important;
}

/* 8. The Badges */
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .tier-badge {
    position: absolute !important;
    top: -22px !important; 
    right: 20px !important;
    padding: 4px 10px !important;
    border-radius: 4px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    z-index: 10 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important; 
}

.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .tier-badge.badge-pop {
    background-color: #FF5B4A !important; 
}

.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .tier-badge.badge-val {
    background-color: #27ae60 !important; 
}

/* ====================================================================
   NEW V39 ADDITIONS: PROMO ENGINE & DYNAMIC SHIPPING
   ==================================================================== */

/* Top-Left Premium Promo Badge */
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .promo-badge {
    position: absolute !important;
    top: -22px !important;
    left: 20px !important;
    padding: 4px 10px !important;
    border-radius: 4px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    background-color: #8e44ad !important; /* Premium Purple */
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    z-index: 10 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

/* Shipping Fee Display */
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .price-block .shipping-fee {
    font-size: 14px !important;
    font-weight: 700 !important;
    display: block !important;
    margin-top: 4px !important;
    text-align: right !important;
    letter-spacing: 0.3px !important;
}

.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .price-block .shipping-fee.free {
    color: #27ae60 !important; /* Success Green */
}

.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .price-block .shipping-fee.paid {
    color: #e67e22 !important; /* Warning Orange */
}

/* Hide the Acowebs Silent Promo product entirely */
.hide-me {
    display: none !important;
}

/* ====================================================================
   PREMIUM PROMO GIFT CARD & VIDEO ENGINE (MASTER CSS)
   ==================================================================== */

/* Reveal the promo with a smooth fade in */
.hide-me.promo-unlocked {
    display: block !important;
    animation: promoCardFadeIn 0.5s ease-in-out forwards;
    margin-top: 20px !important;
}

@keyframes promoCardFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hide the standard Acowebs title for this specific block */
.promo-unlocked .wcpa_field_label {
    display: none !important;
}

/* Restyle the main Acowebs wrapper into a premium gift box */
.promo-unlocked .wcpa_group_field {
    background: linear-gradient(145deg, #fdfbfe, #ffffff) !important;
    border: 2px dashed #27ae60 !important;
    border-radius: 12px !important;
    padding: 20px 16px !important;
    box-shadow: 0 8px 20px rgba(142, 68, 173, 0.12) !important;
    position: relative;
}

/* Inject a "Special Offer Unlocked" Header via CSS */
.promo-unlocked .wcpa_group_field::before {
    content: '✨ SPECIAL OFFER UNLOCKED!';
    display: block !important;
    font-weight: 800 !important;
    color: #27ae60 !important;
    margin-bottom: 20px !important;
    font-size: 15px !important;
    letter-spacing: 0.5px !important;
    text-align: center !important;
}

/* Flex layout for the outer radio container */
.promo-unlocked .wcpa_image label {
    display: flex !important;
    align-items: flex-start !important;
    gap: 16px !important;
    border: 1px solid #eaeaea !important;
    border-radius: 10px !important;
    padding: 12px !important;
    background: #fff !important;
    min-height: auto !important;
    height: auto !important;
    margin-bottom: 12px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.promo-unlocked .wcpa_image label:hover {
    border-color: #8e44ad !important;
    box-shadow: 0 4px 12px rgba(142, 68, 173, 0.08) !important;
}

/* Removes bottom margin from the very last option */
.promo-unlocked .wcpa_image:last-child label {
    margin-bottom: 0 !important;
}

/* Style the product thumbnail */
.promo-unlocked .wcpa_img_wrap {
    border-radius: 6px !important;
    overflow: hidden !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06) !important;
    border: 1px solid #eee !important;
    flex-shrink: 0 !important;
    width: 100px !important;
    height: 100px !important;
    min-width: 100px !important;
}

/* -----------------------------------------------------
   THE TEXT & PRICE LAYOUT (STRICT CSS GRID)
   ----------------------------------------------------- */
.promo-unlocked .wcpa_image_label {
    margin: 0 !important;
    display: grid !important;
    grid-template-columns: auto auto auto 1fr !important;
    align-items: center !important;
    row-gap: 8px !important;
    column-gap: 6px !important; 
    width: 100% !important;
    min-width: 0 !important; /* CRITICAL FIX: Stops flex child bleeding */
}

/* 1. The Title (Clips to 2 lines to save space on mobile) */
.promo-unlocked .wcpa_image_label > span:first-child {
    grid-column: 1 / -1 !important;
    font-weight: 700 !important;
    font-size: 14px !important; 
    color: #111 !important;
    line-height: 1.3 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important; 
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* 2. Original MRP Strikethrough */
.promo-unlocked .promo-mrp-strike {
    font-size: 12px !important;
    color: #9ca3af !important;
    text-decoration-thickness: 1px !important;
    margin: 0 !important;
}

/* 3. The Final Discounted Price */
.promo-unlocked .wcpa_option_price {
    font-weight: 800 !important;
    font-size: 15px !important;
    color: #27ae60 !important;
    margin: 0 !important;
}

/* ====================================================================
   PROMO DISCOUNT BADGE
   ==================================================================== */
.promo-discount-badge {
    background: #fff1f0 !important; 
    color: #ef4444 !important; 
    border: 1px solid #fecaca !important; 
    font-size: 10px !important;
    font-weight: 800 !important;
    padding: 3px 6px !important;
    border-radius: 6px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    margin: 0 !important;
    box-shadow: 0 1px 2px rgba(239, 68, 68, 0.05) !important;
    white-space: nowrap !important;
}

/* ====================================================================
   VIDEO PREVIEW BUTTON (Solid Premium Black)
   ==================================================================== */
.video-preview-btn {
    grid-column: 1 / -1 !important; 
    justify-self: stretch !important; 
    width: 100% !important;
    display: flex !important; 
    align-items: center !important;
    justify-content: center !important; 
    gap: 8px !important;
    
    /* Clean, Flat Black Aesthetic */
    background: #1a1a1a !important; 
    border: 1px solid #000000 !important; 
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1) !important; /* Soft, natural drop shadow */
    
    color: #ffffff !important; 
    font-size: 11px !important;
    font-weight: 800 !important;
    padding: 8px 12px !important;
    border-radius: 8px !important;
    margin-top: 8px !important;
    cursor: pointer !important;
    transition: all 0.2s ease-in-out !important;
    text-transform: uppercase !important;
    letter-spacing: 0.8px !important;
}

.video-preview-btn:hover {
    background: #000000 !important; /* Pitch black on hover */
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2) !important;
}

/* ====================================================================
   MOBILE RESPONSIVE SQUISH (Max 480px)
   ==================================================================== */
@media (max-width: 480px) {
    .promo-unlocked .wcpa_image label {
        gap: 10px !important; 
        padding: 10px !important; 
    }
    
    .promo-unlocked .wcpa_img_wrap {
        width: 75px !important; 
        height: 75px !important;
        min-width: 75px !important;
    }

    .promo-unlocked .wcpa_image_label {
        row-gap: 6px !important;
        column-gap: 4px !important;
    }

    .promo-unlocked .wcpa_image_label > span:first-child {
        font-size: 13px !important; 
    }

    .promo-unlocked .wcpa_option_price {
        font-size: 14px !important;
    }

    .promo-discount-badge {
        font-size: 9px !important;
        padding: 2px 5px !important;
    }
    
    .video-preview-btn {
        padding: 5px 10px !important;
        font-size: 10px !important;
    }
}

/* ====================================================================
   ANTI-BLEED FIXES FOR SECTION BODY CONTENT
   ==================================================================== */

/* 1. Prevent the overall section body from ever breaking viewport bounds */
.wcpa_section_body {
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important; /* Emergency clip for rogue elements */
}

/* 2. Fix the Tiered Bundle Cards bleeding on small screens */
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .wcpa_radio label {
    height: auto !important; /* Remove the strict 85px height so text can wrap */
    min-height: 85px !important;
    flex-wrap: wrap !important; /* Allow elements to drop to the next line if cramped */
    row-gap: 6px !important; /* Space between wrapped elements */
}

/* Force long titles and unit text to wrap instead of pushing out horizontally */
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .wcpa_radio span.card-title,
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .per-unit-text {
    white-space: normal !important;
    word-break: break-word !important;
}

/* Adjust per-unit text alignment when it gets squeezed on mobile */
@media (max-width: 480px) {
    .enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .per-unit-text {
        margin-right: 0 !important;
    }
}

/* 3. Fix the Image Group Labels bleeding (Overriding Acowebs nowrap default) */
.wcpa_type_image-group .wcpa_image_label,
.wcpa_type_image-group .wcpa_image_label span {
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.2 !important;
    display: inline-block !important; /* Allows it to respect the parent width */
    max-width: 100px !important; /* Matches your image width to keep it tidy */
}


/* ====================================================================
   TIERED CARDS: CSS GRID LAYOUT (Fixes messy wrapping on mobile)
   ==================================================================== */
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .wcpa_radio label {
    display: grid !important;
    /* Creates 3 columns: [Auto for Radio] [Flexible middle for Text] [Auto for Price] */
    grid-template-columns: auto 1fr auto !important;
    grid-template-areas:
        "radio title price"
        "radio unit  price" !important;
    align-items: center !important;
    column-gap: 12px !important;
    row-gap: 2px !important;
    padding: 16px 14px !important; /* Slightly optimized side padding for small screens */
    height: auto !important;
    min-height: 85px !important;
}

/* 1. Map Radio Circle to the Left Column */
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .wcpa_check,
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .wcpa_radio_custom {
    grid-area: radio !important;
    margin-right: 0 !important; /* Strips old flex margin */
}

/* 2. Map Title to Top-Middle */
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .wcpa_radio span.card-title {
    grid-area: title !important;
    margin-right: 0 !important;
    align-self: end !important; /* Pushes text down to hug the per-unit text */
    font-size: 15px !important; /* Marginally smaller for better mobile fit */
    line-height: 1.2 !important;
}

/* 3. Map Per-Unit Text to Bottom-Middle */
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .per-unit-text {
    grid-area: unit !important;
    margin-right: 0 !important;
    align-self: start !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
}

/* 4. Map Price Block to Right Column (spans both rows) */
.enable-tiered-bundles .wcpa_field_wrap:not(.teleport-upsell):not(.teleport-bag) .price-block {
    grid-area: price !important;
    margin-top: 0 !important; /* Strips old flex margin */
    text-align: right !important;
}

/* ====================================================================
   PROMO DISCOUNT BADGE
   ==================================================================== */
.promo-discount-badge {
    display: inline-block !important;
    background: #FF5B4A !important; /* Bold red/orange for urgency */
    color: #ffffff !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    margin-left: 8px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    vertical-align: middle !important;
    box-shadow: 0 2px 4px rgba(255, 91, 74, 0.3) !important;
}
