/* ===========================================================
   FORCE HIDE ALL WC QUANTITY + / - (GLOBAL + CATEGORY)
=========================================================== */

body.popm-hide-quantity .quantity,
body.popm-hide-quantity-by-cat .quantity,

body.popm-hide-quantity .woocommerce-quantity,
body.popm-hide-quantity-by-cat .woocommerce-quantity,

body.popm-hide-quantity .quantity.buttons_added,
body.popm-hide-quantity-by-cat .quantity.buttons_added,

body.popm-hide-quantity input.qty,
body.popm-hide-quantity-by-cat input.qty,

body.popm-hide-quantity .qty,
body.popm-hide-quantity-by-cat .qty,

body.popm-hide-quantity .qty-plus,
body.popm-hide-quantity-by-cat .qty-plus,

body.popm-hide-quantity .qty-minus,
body.popm-hide-quantity-by-cat .qty-minus,

body.popm-hide-quantity .plus,
body.popm-hide-quantity-by-cat .plus,

body.popm-hide-quantity .minus,
body.popm-hide-quantity-by-cat .minus,

body.popm-hide-quantity button.plus,
body.popm-hide-quantity-by-cat button.plus,

body.popm-hide-quantity button.minus,
body.popm-hide-quantity-by-cat button.minus,

body.popm-hide-quantity .quantity-nav,
body.popm-hide-quantity-by-cat .quantity-nav,

body.popm-hide-quantity .quantity-nav-button,
body.popm-hide-quantity-by-cat .quantity-nav-button,

body.popm-hide-quantity .quantity-up,
body.popm-hide-quantity-by-cat .quantity-up,

body.popm-hide-quantity .quantity-down,
body.popm-hide-quantity-by-cat .quantity-down,

body.popm-hide-quantity .wc-quantity,
body.popm-hide-quantity-by-cat .wc-quantity,

body.popm-hide-quantity .wc-quantity-controls,
body.popm-hide-quantity-by-cat .wc-quantity-controls {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

/* Kill pseudo-elements (theme-generated +/-) */
body.popm-hide-quantity .quantity::before,
body.popm-hide-quantity .quantity::after,
body.popm-hide-quantity-by-cat .quantity::before,
body.popm-hide-quantity-by-cat .quantity::after {
    display: none !important;
    content: none !important;
}

/* Remove layout gaps caused by hidden quantity */
body.popm-hide-quantity form.cart {
    gap: 0 !important;
}

body.popm-hide-quantity .single_add_to_cart_button {
    margin-left: 0 !important;
}

/* Hide product details for restricted users */
body.popm-restricted-user .summary .price,
body.popm-restricted-user .woocommerce-product-details__short-description,
body.popm-restricted-user .related,
body.popm-restricted-user .upsells {
    display: none !important;
}

/* ===========================================================
   2. HIDE NATIVE ADD TO CART (NO LAYOUT DAMAGE)
=========================================================== */

/* Hide Add to Cart when Pay Monthly replaces it */
body.popm-hide-add-to-cart .single_add_to_cart_button {
    display: none !important;
}


/* ===========================================================
   3. CATEGORY OVERRIDE — ALLOW THEME TO HANDLE EVERYTHING
=========================================================== */

/* When category allows Add to Cart, do NOTHING else */
body.popm-show-add-to-cart-by-cat .single_add_to_cart_button {
    display: block !important;
}
/* ===========================================================
   4. FORCE HIDE PAY MONTHLY WHEN CART IS ENABLED BY CATEGORY
=========================================================== */

body.popm-force-hide-pay-monthly #popm-pay-monthly,
body.popm-force-hide-pay-monthly .popm-pay-monthly {
    display: none !important;
}

/* Match WooCommerce spacing below Add to Cart */
.popm-wrapper {
    margin-bottom: 2em;
}

/* ===========================================================
   5. POPM BUTTONS (MATCH WC ADD TO CART)
=========================================================== */

#popm-wrapper .popm-btn {
    cursor: pointer;
    white-space: nowrap;
}

/* Only color customization (allowed) */
#popm-wrapper .popm-btn.alt {
    background-color: var(--popm-btn-color, inherit);
    color: var(--popm-text-color, inherit);
}


/* Remove extra space on last button */
#popm-wrapper .popm-btn:last-child {
    margin-right: 0;
}

#popm-wrapper .popm-btn:hover {
    filter: brightness(1.1);
}

/* ===========================================================
   6. WHEN QUANTITY IS HIDDEN
=========================================================== */

body.popm-hide-quantity #popm-wrapper {
    margin-left: 0;
}

/* ===========================================================
   7. PAY MONTHLY DETAILS
=========================================================== */

#popm-monthly-details {
    margin-top: 8px;
}

/* ===========================================================
   8. PAYMENT SUMMARY MODAL
=========================================================== */

body.popm-modal-open {
    overflow: hidden !important;
}

#popm-summary-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2147483647;
    background: rgba(0, 0, 0, 0.45);
    padding: 12px;
}

#popm-summary-content {
    background: #fff;
    padding: 16px 18px;
    border-radius: 10px;
    max-width: 380px;
    width: 100%;
    max-height: 75vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 6px 14px rgba(0,0,0,0.2);
}

#popm-close-summary {
    position: absolute;
    top: 8px;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
}

#popm-summary-content p {
    margin: 6px 0;
}

/* Make POPM buttons match WooCommerce Add to Cart exactly */
#popm-wrapper .popm-btn {
    padding: 0.618em 1.415em;
    min-height: var(--wc-button-height, 45px);
    line-height: 1;
    font-size: inherit;
    border-radius: inherit;
    cursor: pointer;
    white-space: nowrap;
}
