/* ==========================================================================
   AstraOptima - Universal Modern Button Loading Spinner & Checkmark Confirmation
   ========================================================================== */

/* 1. Pure Rotating Keyframes */
@keyframes ast-modern-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@-webkit-keyframes ast-modern-spin {
    0% { -webkit-transform: rotate(0deg); }
    100% { -webkit-transform: rotate(360deg); }
}

/* 2. Pop Animation for Confirmation Checkmark */
@keyframes ao-pop-check {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.25); }
    100% { transform: scale(1); opacity: 1; }
}

/* 3. Neutralize native spinners/icons ONLY during LOADING state */
.woocommerce li.product .add_to_cart_button.loading::after,
.woocommerce li.product .add_to_cart_button.loading::before,
.single_add_to_cart_button.loading::after,
.single_add_to_cart_button.loading::before,
.woocommerce .blockUI.blockOverlay::before,
.woocommerce a.button.loading::before,
.woocommerce button.button.loading::before {
    display: none !important;
    content: none !important;
}

/* 4. Button Loading State - Force Text Transparency with Maximum Specificity */
.ast-btn-loading,
.ast-btn-loading *,
.ast-grid-btn.ast-btn-loading,
.ast-grid-btn.loading,
button.ast-btn-loading,
a.ast-btn-loading,
.button.ast-btn-loading,
.ast-unify-wc-loop .button.ast-btn-loading,
.ast-unify-wc-loop ul.products li.product .button.ast-btn-loading,
.ast-unify-wc-loop ul.products li.product a.button.ast-btn-loading,
input[type="submit"].ast-btn-loading,
.single_add_to_cart_button.ast-btn-loading,
ul.products li.product .button.ast-btn-loading,
ul.products li.product .button.loading,
.add_to_cart_button.ast-btn-loading,
.add_to_cart_button.loading,
.ast-button.ast-btn-loading,
#place_order.ast-btn-loading,
#co_apply_btn.ast-btn-loading {
    position: relative !important;
    color: transparent !important;
    -webkit-text-fill-color: transparent !important;
    text-shadow: none !important;
    pointer-events: none !important;
    user-select: none !important;
    cursor: wait !important;
    opacity: 1 !important;
}

/* Hide all children elements and icons cleanly during loading */
.ast-btn-loading *,
.ast-grid-btn.ast-btn-loading *,
.ast-grid-btn.loading *,
ul.products li.product .button.loading *,
ul.products li.product .button.ast-btn-loading *,
.ast-unify-wc-loop .button.ast-btn-loading * {
    opacity: 0 !important;
    visibility: hidden !important;
    color: transparent !important;
    -webkit-text-fill-color: transparent !important;
}

/* 5. Render Pure Modern Rotating Ring during loading */
.ast-btn-loading::after,
.ast-grid-btn.ast-btn-loading::after,
.ast-grid-btn.loading::after,
button.ast-btn-loading::after,
a.ast-btn-loading::after,
.button.ast-btn-loading::after,
.ast-unify-wc-loop .button.ast-btn-loading::after,
.ast-unify-wc-loop ul.products li.product .button.ast-btn-loading::after,
input[type="submit"].ast-btn-loading::after,
.single_add_to_cart_button.ast-btn-loading::after,
ul.products li.product .button.ast-btn-loading::after,
ul.products li.product .button.loading::after,
.add_to_cart_button.ast-btn-loading::after,
.add_to_cart_button.loading::after,
#place_order.ast-btn-loading::after {
    content: "" !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 18px !important;
    height: 18px !important;
    margin-top: -9px !important;
    margin-left: -9px !important;
    background: transparent !important;
    background-color: transparent !important;
    border: 2.5px solid rgba(255, 255, 255, 0.25) !important;
    border-top-color: #ffffff !important;
    border-radius: 50% !important;
    box-sizing: border-box !important;
    animation: ast-modern-spin 0.65s linear infinite !important;
    -webkit-animation: ast-modern-spin 0.65s linear infinite !important;
    display: block !important;
    z-index: 999 !important;
}

/* 6. Compact Spinner for Coupons & Small Inputs */
#co_apply_btn.ast-btn-loading::after,
.coupon button.ast-btn-loading::after,
.woocommerce-form-coupon button.ast-btn-loading::after {
    width: 15px !important;
    height: 15px !important;
    margin-top: -7.5px !important;
    margin-left: -7.5px !important;
    border-width: 2px !important;
    background: transparent !important;
}

/* 7. Confirmation Checkmark Icon (✔) on Success (.added state) */
.ast-grid-btn.added::after,
.add_to_cart_button.added::after,
ul.products li.product .button.added::after,
.wc-block-grid__product-add-to-cart .button.added::after,
.wc-block-components-product-button .wc-block-components-product-button__button.added::after {
    content: " \2713" !important;
    display: inline-block !important;
    margin-left: 6px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    color: inherit !important;
    position: static !important;
    top: auto !important;
    left: auto !important;
    width: auto !important;
    height: auto !important;
    margin-top: 0 !important;
    border: none !important;
    animation: ao-pop-check 0.35s ease-out !important;
    -webkit-animation: ao-pop-check 0.35s ease-out !important;
}
