/* =========================================================================
   STOREFRONT BUTTON SYSTEM (2026-11-11)
   Pill buttons: solid black + white text  ->  hover / active: solid red.
   (Colors only come from the variables below; shape/size are in section 1.)

   Loaded last in resources/views/frontEnd2/includes/header.blade.php.
   Scope: every rule starts with  :root body#storefront  (the id is on <body>
   in resources/views/frontEnd2/master.blade.php). The admin panel and the
   standalone campaign landing pages don't have that id, so nothing here
   reaches them. The button lists sit in :where() (zero specificity), so every
   rule weighs exactly (1,1,1) + its state: enough to win over the older purple
   !important button rules (header.blade.php, product-cards.css, page-level
   <style> blocks, even #apply_coupon_btn.btn-apply-coupon) without editing
   them, while the size exceptions in section 5 can still override section 1.

   Only the text buttons listed below are restyled (an allowlist, not a
   global `button {}` rule), so icon buttons, close (X) buttons, qty +/-,
   variant chips, slider arrows/dots, the header search button, the chat
   widget and the cart badge are untouched.
   ========================================================================= */

:root {
    --btn-black: #000000;   /* <<< default button background + border */
    --btn-red: #E10B1F;     /* <<< hover / active / selected button background (also used by other storefront accents) */
    --btn-text: #FFFFFF;    /* button text + icons, in every state */
}

/* ---- 1. Default: black pill, 1px black border, white text -------------- */
:root body#storefront :where(
    .btn:not(.qty-btn):not(.btn-close):not(.btn-link),
    input[type="submit"],
    input[type="button"],
    form button:not([class]),
    .storefront-card-add-btn,
    .storefront-qv-add-btn,
    .storefront-qv-details-btn,
    .add_to_event,
    .btn-add-to-bag,
    .buy-now-btn,
    .btn-call-order,
    .btn-whatsapp-order,
    .btn-wholesale-whatsapp,
    .rr-write-btn,
    .rr-first-btn,
    .storefront-product-view-more,
    .btn-custom,
    .btn-checkout,
    .btn-apply-coupon,
    .go_cart,
    .filter-submit-btn,
    .filter-reset-btn,
    .pill-btn,
    .shop-toolbar-filter-btn,
    .submit-btn,
    .invoice_btn,
    .receipt-btn-home,
    .receipt-btn-invoice,
    .alphabet-btn
),
/* Product page Add to cart / Buy now: that page forces purple with two-id rules
   (#purchaseActionButtons #addToCartBtn), so these selectors carry the same ids. */
:root body#storefront #purchaseActionButtons :where(#addToCartBtn, #buyNowBtn) {
    background: var(--btn-black) !important;
    background-color: var(--btn-black) !important;
    background-image: none !important;
    border: 1px solid var(--btn-black) !important;
    border-radius: 999px !important;
    color: var(--btn-text) !important;
    -webkit-text-fill-color: var(--btn-text) !important;
    padding: 8px 24px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    cursor: pointer !important;
    box-shadow: none !important;
    transform: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease !important;
}

/* Icons and text inside a button follow the button's color (white in every state) */
:root body#storefront :where(
    .btn:not(.qty-btn):not(.btn-close):not(.btn-link),
    form button:not([class]),
    .storefront-card-add-btn,
    .storefront-qv-add-btn,
    .storefront-qv-details-btn,
    .add_to_event,
    .btn-add-to-bag,
    .buy-now-btn,
    .btn-call-order,
    .btn-whatsapp-order,
    .btn-wholesale-whatsapp,
    .rr-write-btn,
    .rr-first-btn,
    .storefront-product-view-more,
    .btn-custom,
    .btn-checkout,
    .btn-apply-coupon,
    .go_cart,
    .filter-submit-btn,
    .filter-reset-btn,
    .pill-btn,
    .shop-toolbar-filter-btn,
    .submit-btn,
    .invoice_btn,
    .receipt-btn-home,
    .receipt-btn-invoice,
    .alphabet-btn
) *,
:root body#storefront #purchaseActionButtons :where(#addToCartBtn, #buyNowBtn) * {
    color: inherit !important;
    -webkit-text-fill-color: currentColor !important;
    transform: none !important;
}

/* ---- 2. Hover + active/selected: solid red, white text ----------------- */
:root body#storefront :where(
    .btn:not(.qty-btn):not(.btn-close):not(.btn-link),
    input[type="submit"],
    input[type="button"],
    form button:not([class]),
    .storefront-card-add-btn,
    .storefront-qv-add-btn,
    .storefront-qv-details-btn,
    .add_to_event,
    .btn-add-to-bag,
    .buy-now-btn,
    .btn-call-order,
    .btn-whatsapp-order,
    .btn-wholesale-whatsapp,
    .rr-write-btn,
    .rr-first-btn,
    .storefront-product-view-more,
    .btn-custom,
    .btn-checkout,
    .btn-apply-coupon,
    .go_cart,
    .filter-submit-btn,
    .filter-reset-btn,
    .pill-btn,
    .shop-toolbar-filter-btn,
    .submit-btn,
    .invoice_btn,
    .receipt-btn-home,
    .receipt-btn-invoice,
    .alphabet-btn
):is(:hover, .active, .is-active, .active-red, [aria-pressed="true"], [aria-selected="true"]),
:root body#storefront #purchaseActionButtons :where(#addToCartBtn, #buyNowBtn):is(:hover, .active) {
    background: var(--btn-red) !important;
    background-color: var(--btn-red) !important;
    background-image: none !important;
    border-color: var(--btn-red) !important;
    color: var(--btn-text) !important;
    -webkit-text-fill-color: var(--btn-text) !important;
    box-shadow: none !important;
    transform: none !important;
}

/* ---- 3. Keyboard focus: white gap + red ring (visible on black, red and white) */
:root body#storefront :where(
    .btn:not(.qty-btn):not(.btn-close):not(.btn-link),
    input[type="submit"],
    input[type="button"],
    form button:not([class]),
    .storefront-card-add-btn,
    .storefront-qv-add-btn,
    .storefront-qv-details-btn,
    .add_to_event,
    .btn-add-to-bag,
    .buy-now-btn,
    .btn-call-order,
    .btn-whatsapp-order,
    .btn-wholesale-whatsapp,
    .rr-write-btn,
    .rr-first-btn,
    .storefront-product-view-more,
    .btn-custom,
    .btn-checkout,
    .btn-apply-coupon,
    .go_cart,
    .filter-submit-btn,
    .filter-reset-btn,
    .pill-btn,
    .shop-toolbar-filter-btn,
    .submit-btn,
    .invoice_btn,
    .receipt-btn-home,
    .receipt-btn-invoice,
    .alphabet-btn
):focus-visible,
:root body#storefront #purchaseActionButtons :where(#addToCartBtn, #buyNowBtn):focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px var(--btn-red) !important;
}

/* ---- 4. Disabled / out of stock: faded, no hover ----------------------- */
:root body#storefront :where(
    .btn:not(.qty-btn):not(.btn-close):not(.btn-link),
    input[type="submit"],
    input[type="button"],
    form button:not([class]),
    .storefront-card-add-btn,
    .storefront-qv-add-btn,
    .add_to_event,
    .btn-add-to-bag,
    .buy-now-btn,
    .btn-checkout,
    .btn-apply-coupon,
    .filter-submit-btn,
    .filter-reset-btn,
    .submit-btn
):is(:disabled, .disabled, [aria-disabled="true"], .is-disabled, .is-out-of-stock),
:root body#storefront :where(
    .btn:not(.qty-btn):not(.btn-close):not(.btn-link),
    input[type="submit"],
    input[type="button"],
    form button:not([class]),
    .storefront-card-add-btn,
    .storefront-qv-add-btn,
    .add_to_event,
    .btn-add-to-bag,
    .buy-now-btn,
    .btn-checkout,
    .btn-apply-coupon,
    .filter-submit-btn,
    .filter-reset-btn,
    .submit-btn
):is(:disabled, .disabled, [aria-disabled="true"], .is-disabled, .is-out-of-stock):hover,
:root body#storefront #purchaseActionButtons :where(#addToCartBtn, #buyNowBtn):is(:disabled, :disabled:hover) {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    background: var(--btn-black) !important;
    background-color: var(--btn-black) !important;
    background-image: none !important;
    border-color: var(--btn-black) !important;
    color: var(--btn-text) !important;
    -webkit-text-fill-color: var(--btn-text) !important;
    box-shadow: none !important;
}

/* ---- 5. Size exceptions (keep these buttons' existing compact sizing) ---
   A-Z brand index: 26 letters in one row; 24px side padding would break it. */
:root body#storefront .alphabet-btn {
    padding: 4px 8px !important;
    font-size: inherit !important;
}

@media (max-width: 767.98px) {
    :root body#storefront .alphabet-btn {
        padding: 5px 0 !important;
        font-size: 10px !important;
    }

    /* Product-card "Add to cart" sits in narrow 2-column cards on phones */
    :root body#storefront .storefront-card-add-btn {
        padding: 8px 10px !important;
        font-size: 13px !important;
    }
}
