/* WooCustom Toolkit - Single product add-to-cart and quantity */

:is(.elementor-product-simple .cart, .elementor-product-variable .woocommerce-variation-add-to-cart) {
    min-height: 52px;
    margin-top: 10px;
    display: flex;
    gap: 14px;
    align-items: stretch;
    flex-wrap: nowrap;
}

.fb-text-span {
    white-space: nowrap !important;
}

.quantity {
    width: auto;
    gap: 12px;
    display: flex;
    flex: 0 0 auto;
}

form.cart .quantity,
.woocommerce-variation-add-to-cart .quantity {
    display: flex !important;
    flex: 0 0 156px;
    max-width: 172px;
    margin: 0 !important;
}

.quantity .fb-quantity-container {
    display: flex;
    width: 100%;
    min-height: 52px;
    background: var(--woocustom-surface, #fff);
    justify-content: center;
    align-items: stretch;
    border-radius: var(--woocustom-radius-md, 12px);
    border: 1px solid var(--woocustom-border, #e5e7eb);
    padding: 5px;
    box-shadow: var(--woocustom-shadow-sm, 0 4px 14px rgba(15,23,42,.08));
    overflow: hidden;
}

.fb-quantity-container > div {
    flex-basis: 32%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.fb-quantity-box {
    position: relative;
    flex-direction: column;
    font-family: inherit;
    flex-grow: 1;
    justify-content: center !important;
    gap: 3px;
    color: var(--woocustom-text, #1f2937);
}

.fb-quantity-span {
    width: 100%;
    min-height: 20px;
    font-size: 1.05rem;
    line-height: 1;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
}

.fb-quantity-input {
    width: 100%;
    min-width: 0;
    min-height: 32px;
    margin: 0 !important;
    padding: 0 3px !important;
    border: 0 !important;
    border-radius: 6px;
    outline: 0;
    box-shadow: none !important;
    background: transparent !important;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    line-height: 1;
    text-align: center;
    direction: ltr;
    appearance: textfield;
    -moz-appearance: textfield;
}

.fb-quantity-input::-webkit-outer-spin-button,
.fb-quantity-input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.fb-quantity-input:focus {
    box-shadow: inset 0 0 0 2px var(--woocustom-primary-soft-strong, rgba(59, 130, 246, .2)) !important;
}

.fb-quantity-input.is-loading {
    visibility: visible;
    opacity: .65;
    cursor: progress;
}

.fb-quantity-box > .quantity-loader {
    position: absolute;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
}

.fb-text-span {
    font-size: .66rem;
    line-height: 1;
    opacity: .75;
    color: var(--woocustom-muted, #6b7280);
}

.fb-btn {
    min-width: 38px;
    min-height: 38px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--woocustom-radius-sm, 8px);
    cursor: pointer;
    color: var(--woocustom-color-primary);
    background: var(--woocustom-primary-soft, var(--woocustom-primary-soft));
    transition: background .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease;
    user-select: none;
}

.fb-btn svg {
    display: inline-block !important;
    width: 18px;
    height: 18px;
    fill: currentColor;
    transition: transform .2s ease;
}

.fb-btn:hover,
.fb-btn:focus-visible {
    color: #fff;
    background: var(--woocustom-color-primary);
    box-shadow: 0 8px 18px var(--woocustom-primary-soft-strong, var(--woocustom-primary-soft-strong));
    outline: none;
}

.fb-btn:hover svg,
.fb-btn:focus-visible svg {
    transform: scale(1.08);
}

.single_add_to_cart_button {
    margin: 0 !important;
    background: var(--woocustom-color-primary, var(--e-global-color-primary)) !important;
    border-radius: var(--woocustom-radius-md, 12px) !important;
    box-shadow: 0 10px 24px var(--woocustom-primary-soft-strong, var(--woocustom-primary-soft-strong));
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}

.single_add_to_cart_button:hover,
.single_add_to_cart_button:focus-visible {
    filter: brightness(.96);
    transform: translateY(-1px);
    outline: none;
}

.quantity-loader {
    --loader-width: 8px;
    --loader-color1: #fff;
    --loader-color2: rgba(255,255,255,.55);
    width: var(--loader-width);
    aspect-ratio: 1;
    border-radius: 50%;
    animation: loading 1s infinite linear alternate;
}

.fb-quantity-span .quantity-loader {
    --loader-width: 7px;
    width: var(--loader-width);
    --loader-color1: var(--woocustom-color-primary);
    --loader-color2: rgba(105, 105, 105, 0.35);
}

@keyframes loading {
    0%   { box-shadow: calc(3px + var(--loader-width)) 0 var(--loader-color1), calc(-1 * var(--loader-width) - 3px) 0 var(--loader-color2); background: var(--loader-color1); }
    33%  { box-shadow: calc(3px + var(--loader-width)) 0 var(--loader-color1), calc(-1 * var(--loader-width) - 3px) 0 var(--loader-color2); background: var(--loader-color2); }
    66%  { box-shadow: calc(3px + var(--loader-width)) 0 var(--loader-color2), calc(-1 * var(--loader-width) - 3px) 0 var(--loader-color1); background: var(--loader-color2); }
    100% { box-shadow: calc(3px + var(--loader-width)) 0 var(--loader-color2), calc(-1 * var(--loader-width) - 3px) 0 var(--loader-color1); background: var(--loader-color1); }
}

.single_add_to_cart_button.woocustom-atc-loading {
    pointer-events: none !important;
    opacity: .88 !important;
    gap: 10px;
}

.single_add_to_cart_button.woocustom-atc-loading::before,
.single_add_to_cart_button.woocustom-atc-loading::after,
.woocommerce .single_add_to_cart_button.woocustom-atc-loading::before,
.woocommerce .single_add_to_cart_button.woocustom-atc-loading::after,
.woocommerce button.button.single_add_to_cart_button.woocustom-atc-loading::after {
    content: none !important;
    display: none !important;
    animation: none !important;
}

.woocustom-atc-spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.45);
    border-top-color: #fff;
    display: inline-block;
    animation: woocustom-atc-spin .75s linear infinite;
    flex: 0 0 auto;
}

.woocustom-atc-loading-text {
    display: inline-flex;
    align-items: center;
}

@keyframes woocustom-atc-spin {
    to { transform: rotate(360deg); }
}

.woocustom-view-cart-button {
    all: unset;
    box-sizing: border-box;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    direction: rtl;
    width: auto;
    max-height: 0;
    min-height: 0;
    padding: 0 16px;
    margin: 0 !important;
    border-radius: 14px;
    background: #f8fafc !important;
    color: #111827 !important;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: -0.01em;
    white-space: normal;
    text-align: center;
    text-decoration: none !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .06) !important;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    pointer-events: none;
    transform: translateY(-4px);
    transition: max-height .22s ease, min-height .22s ease, opacity .18s ease, visibility .18s ease, transform .22s ease, color .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.woocustom-view-cart-button.is-visible {
    max-height: 72px;
    min-height: 48px;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.woocustom-view-cart-button__text {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.woocustom-view-cart-button__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    order: -1;
    color: #0f172a;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .06);
}

.woocustom-view-cart-button__svg {
    display: block;
    width: 15px;
    height: 15px;
}

.woocustom-view-cart-button:hover,
.woocustom-view-cart-button:focus {
    color: #0f172a !important;
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    text-decoration: none !important;
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(15, 23, 42, .09) !important;
    outline: none;
}

.woocustom-view-cart-button:hover .woocustom-view-cart-button__icon,
.woocustom-view-cart-button:focus .woocustom-view-cart-button__icon {
    border-color: #cbd5e1;
    background: #ffffff;
}

.woocustom-view-cart-button:focus-visible {
    outline: 2px solid #cbd5e1;
    outline-offset: 4px;
}

.single_add_to_cart_button.woocustom-product-in-cart {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

form.cart,
form.cart .woocommerce-variation-add-to-cart {
    display: flex;
    gap: 12px 14px;
    align-items: stretch;
    flex-wrap: wrap;
}

form.cart .single_add_to_cart_button,
form.cart .woocommerce-variation-add-to-cart .single_add_to_cart_button {
    min-height: 52px;
    display: inline-flex !important;
    justify-content: center;
    align-items: center;
    flex: 1 1 auto;
}

form.cart .woocustom-view-cart-button,
form.cart .woocommerce-variation-add-to-cart .woocustom-view-cart-button {
    display: inline-flex !important;
    justify-content: center;
    align-items: center;
    flex: 1 0 100%;
    width: 100%;
}

form.cart .woocustom-view-cart-button:not(.is-visible) {
    max-height: 0 !important;
    min-height: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

form.cart .woocustom-view-cart-button.is-visible {
    max-height: 68px !important;
    min-height: 48px !important;
    opacity: 1 !important;
    visibility: visible !important;
}

form.cart a.added_to_cart.wc-forward:not(.woocustom-view-cart-button),
.woocommerce-variation-add-to-cart a.added_to_cart.wc-forward:not(.woocustom-view-cart-button) {
    display: none !important;
}

.single_add_to_cart_button.woocustom-hidden-after-add,
.single_add_to_cart_button.woocustom-product-in-cart.woocustom-hidden-after-add {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

form.cart .woocustom-view-cart-button,
.woocommerce-variation-add-to-cart .woocustom-view-cart-button {
    flex: 1 0 100%;
    width: 100%;
    min-width: 0;
    line-height: 1.45;
    margin-top: 0 !important;
}

form.cart .woocustom-view-cart-button.is-visible,
.woocommerce-variation-add-to-cart .woocustom-view-cart-button.is-visible {
    margin-top: 4px !important;
}

form.cart .quantity + .single_add_to_cart_button,
.woocommerce-variation-add-to-cart .quantity + .single_add_to_cart_button {
    margin-inline-start: 0 !important;
}

/* المنتور فاصله بین تعداد و دکمه را با gap روی این نگهدارنده کنترل می‌کند؛ افزونه نباید margin ثابت اضافه کند. */
.e-atc-qty-button-holder {
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 12px 14px;
}

.e-atc-qty-button-holder .quantity + .single_add_to_cart_button,
.e-atc-qty-button-holder .quantity + .woocustom-view-cart-button {
    margin-inline-start: 0 !important;
    margin-inline-end: 0 !important;
}

@media (max-width: 480px) {
    form.cart .quantity,
    .woocommerce-variation-add-to-cart .quantity {
        flex-basis: 132px;
        max-width: 140px;
    }

    form.cart,
    form.cart .woocommerce-variation-add-to-cart,
    :is(.elementor-product-simple .cart, .elementor-product-variable .woocommerce-variation-add-to-cart) {
        gap: 10px;
    }

    form.cart .quantity + .single_add_to_cart_button,
    form.cart .quantity + .woocustom-view-cart-button,
    .woocommerce-variation-add-to-cart .quantity + .single_add_to_cart_button,
    .woocommerce-variation-add-to-cart .quantity + .woocustom-view-cart-button {
        margin-inline-start: 0 !important;
    }

    .fb-text-span {
        display: none;
    }
}

/* WooCustom 1.60.13 - prevent quantity box inside another box in Elementor Ajax ATC widget */
.elementor-widget-woocustom_ajax_add_to_cart form.cart .quantity,
.elementor-widget-woocustom_ajax_add_to_cart .woocommerce-variation-add-to-cart .quantity {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    min-height: auto !important;
    overflow: visible !important;
}

.elementor-widget-woocustom_ajax_add_to_cart .quantity .fb-quantity-container {
    box-shadow: none !important;
}

/* WooCustom v1.60.22 - protect Woo add-to-cart button from Hello Elementor generic button CSS. */
.woocommerce form.cart button.single_add_to_cart_button.woocustom-isolated-button,
form.cart button.single_add_to_cart_button.woocustom-isolated-button,
.woocommerce button.button.single_add_to_cart_button.woocustom-isolated-button {
    min-height: 52px !important;
    padding: 0 22px !important;
    border: 0 !important;
    border-radius: var(--woocustom-radius-md, 12px) !important;
    background: var(--woocustom-color-primary, var(--e-global-color-primary)) !important;
    background-color: var(--woocustom-color-primary, var(--e-global-color-primary)) !important;
    color: #fff !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
    text-align: center !important;
    white-space: normal !important;
    text-decoration: none !important;
    box-shadow: 0 10px 24px var(--woocustom-primary-soft-strong, rgba(0,0,0,.14)) !important;
}
