/**
 * WooCommerce Product Bundles — UX Enhancement Styles
 * Stock status visibility, modal popup, add-to-cart feedback
 * ============================================================
 * Drop into: Appearance > Customize > Additional CSS
 * OR enqueue via functions.php
 */

/* ============================================================
   1. STOCK STATUS BADGES
   ============================================================ */

/* Reset / base for all variation availability containers */
.bundle_item .woocommerce-variation-availability,
.bundled_item_cart_content .woocommerce-variation-availability {
    margin: 8px 0 4px;
}

/* --- IN STOCK --- */
.stock.in-stock,
p.stock.in-stock,
.bundled_product .stock.in-stock,
.bundled_product p.stock.in-stock,
.bundle_item .woocommerce-variation-availability .stock.in-stock,
.bundled_item_cart_content .stock.in-stock,
.woocommerce-variation-availability .stock.in-stock {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    color: #28a745 !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
    padding: 6px 12px 6px 8px !important;
    background: rgba(40, 167, 69, 0.08) !important;
    border: 1px solid rgba(40, 167, 69, 0.35) !important;
    border-radius: 6px !important;
    transition: all 0.25s ease !important;
    margin: 8px 0 !important;
    line-height: 1 !important;
}

.stock.in-stock::before,
p.stock.in-stock::before,
.bundled_product .stock.in-stock::before,
.bundle_item .woocommerce-variation-availability .stock.in-stock::before,
.bundled_item_cart_content .stock.in-stock::before,
.woocommerce-variation-availability .stock.in-stock::before {
    content: "" !important;
    display: inline-block !important;
    width: 16px !important;
    height: 16px !important;
    flex-shrink: 0 !important;
    background-color: #28a745 !important;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z' clip-rule='evenodd'/%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z' clip-rule='evenodd'/%3E%3C/svg%3E") !important;
    -webkit-mask-repeat: no-repeat !important;
    mask-repeat: no-repeat !important;
    -webkit-mask-size: contain !important;
    mask-size: contain !important;
}

/* --- OUT OF STOCK --- */
.stock.out-of-stock,
p.stock.out-of-stock,
.bundled_product .stock.out-of-stock,
.bundled_product p.stock.out-of-stock,
.bundle_item .woocommerce-variation-availability .stock.out-of-stock,
.bundled_item_cart_content .stock.out-of-stock,
.woocommerce-variation-availability .stock.out-of-stock {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    color: #dc3545 !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
    padding: 8px 16px 8px 10px !important;
    background: rgba(220, 53, 69, 0.10) !important;
    border: 2px solid #dc3545 !important;
    border-radius: 6px !important;
    transition: all 0.25s ease !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.12) !important;
    animation: oos-pulse 2.5s ease-in-out infinite !important;
    margin: 8px 0 !important;
    line-height: 1 !important;
}

.stock.out-of-stock::before,
p.stock.out-of-stock::before,
.bundled_product .stock.out-of-stock::before,
.bundle_item .woocommerce-variation-availability .stock.out-of-stock::before,
.bundled_item_cart_content .stock.out-of-stock::before,
.woocommerce-variation-availability .stock.out-of-stock::before {
    content: "" !important;
    display: inline-block !important;
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0 !important;
    background-color: #dc3545 !important;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z' clip-rule='evenodd'/%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z' clip-rule='evenodd'/%3E%3C/svg%3E") !important;
    -webkit-mask-repeat: no-repeat !important;
    mask-repeat: no-repeat !important;
    -webkit-mask-size: contain !important;
    mask-size: contain !important;
}

@keyframes oos-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.08); }
    50%       { box-shadow: 0 0 0 5px rgba(220, 53, 69, 0.18); }
}

/* ============================================================
   2. HIGHLIGHT OUT-OF-STOCK BUNDLE ITEM SECTION
   ============================================================ */

/* Applied via JS when a bundled item becomes out of stock */
.bundled_product.bundle-item-out-of-stock {
    border: 2px solid rgba(220, 53, 69, 0.45) !important;
    border-radius: 6px;
    background: rgba(220, 53, 69, 0.03);
    transition: border-color 0.3s ease, background 0.3s ease;
}

.bundled_product.bundle-item-in-stock {
    border-color: transparent !important;
    background: transparent;
    transition: border-color 0.3s ease, background 0.3s ease;
}

/* ============================================================
   3. ADD TO CART — DISABLED STATE + HELPER TEXT
   ============================================================ */

/* helper text removed */

/* Disabled add-to-cart button — bundle-specific */
.woocommerce-variation-add-to-cart-disabled .single_add_to_cart_button,
.bundle_add_to_cart_button:disabled,
.bundle_add_to_cart_button[disabled] {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
    pointer-events: none;
    filter: grayscale(20%);
}

/* ============================================================
   4. SUPPRESS THE GENERIC WC ERROR MESSAGE
      (replaced by custom modal — hidden via JS, but fallback hide)
   ============================================================ */

.woocommerce-error,
.wc-bundle-availability-message {
    /* We hide the default error; our modal takes over.
       JS will intercept the click; this is a fallback.  */
}

/* ============================================================
   5. MODAL OVERLAY
   ============================================================ */

#bundle-oos-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(15, 15, 20, 0.72);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

#bundle-oos-modal-overlay.is-visible {
    display: flex;
    opacity: 1;
}

/* Animate in */
@keyframes modal-slide-up {
    from { transform: translateY(20px) scale(0.97); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

/* Modal card */
#bundle-oos-modal {
    background: #ffffff;
    border-radius: 12px;
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.22),
        0 4px 16px rgba(0, 0, 0, 0.10);
    padding: 40px 36px 32px;
    max-width: 460px;
    width: 100%;
    text-align: center;
    animation: modal-slide-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    position: relative;
}

/* Warning icon circle */
#bundle-oos-modal .modal-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(220, 53, 69, 0.10);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    border: 2px solid rgba(220, 53, 69, 0.20);
}

#bundle-oos-modal .modal-icon svg {
    width: 34px;
    height: 34px;
    color: #dc3545;
    fill: #dc3545;
}

/* Heading */
#bundle-oos-modal .modal-heading {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 12px;
    line-height: 1.3;
}

/* Body copy */
#bundle-oos-modal .modal-body {
    font-size: 15px;
    color: #555;
    line-height: 1.6;
    margin: 0 0 28px;
}

#bundle-oos-modal .modal-body strong {
    color: #dc3545;
}

/* OK button */
#bundle-oos-modal .modal-ok-btn {
    display: inline-block;
    background: #dc3545;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 12px 40px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 14px rgba(220, 53, 69, 0.30);
}

#bundle-oos-modal .modal-ok-btn:hover,
#bundle-oos-modal .modal-ok-btn:focus {
    background: #b02a37;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(220, 53, 69, 0.38);
    outline: none;
}

#bundle-oos-modal .modal-ok-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Close × in corner */
#bundle-oos-modal .modal-close-x {
    position: absolute;
    top: 14px;
    right: 18px;
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: #aaa;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: color 0.2s;
}

#bundle-oos-modal .modal-close-x:hover {
    color: #555;
}

/* ============================================================
   6. RESPONSIVE
   ============================================================ */

@media (max-width: 480px) {
    #bundle-oos-modal {
        padding: 30px 22px 26px;
        border-radius: 10px;
    }

    #bundle-oos-modal .modal-heading {
        font-size: 18px;
    }

    #bundle-oos-modal .modal-body {
        font-size: 14px;
    }
}

/* ============================================================
   BUNDLE CTA BUTTON — Quick View
   ============================================================ */
.qv-bundle-cta-btn,
a.qv-bundle-cta-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding: 14px 24px !important;
    background: #1a1a1a !important;
    color: #ffffff !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    letter-spacing: 0.1em !important;
    text-transform: uppercase !important;
    text-decoration: none !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: background 0.25s ease, transform 0.2s ease, box-shadow 0.2s ease !important;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15) !important;
    margin-top: 8px !important;
}

.qv-bundle-cta-btn:hover,
a.qv-bundle-cta-btn:hover {
    background: #C82231 !important;
    color: #ffffff !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(200,34,49,0.30) !important;
    text-decoration: none !important;
}

/* Bundle note text under the button */
.qv-bundle-note {
    display: block;
    text-align: center;
    font-size: 11px;
    color: #999;
    margin-top: 8px;
    letter-spacing: 0.03em;
}