/* ==========================================================================
   ЛИПКА ПАНЕЛЬ ТОВАРУ
   ========================================================================== */

@media (min-width: 768px) {
    .allo-sticky-bar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        z-index: 99999 !important;
        background-color: #ffffff !important;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.40) !important;
        transform: translateY(-100%) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transition: transform 0.8s ease, opacity 0.8s ease, visibility 0.8s ease !important;
        margin: 0 !important;
        padding-left: 40px !important;
        padding-right: 60px !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        gap: 20px !important;
    }

    .allo-sticky-bar [class*="part"],
    .allo-sticky-bar [class*="mono"],
    .allo-sticky-bar [class*="privat"],
    .allo-sticky-bar [class*="pumb"],
    .allo-sticky-bar [class*="credit"],
    .allo-sticky-bar .payment-parts,
    .allo-sticky-bar .tech-banks-wrapper {
        display: none !important;
    }

    @media (min-width: 1690px) {
        .allo-sticky-bar {
            padding-left: calc((100% - 1630px) / 2 + 20px) !important;
            padding-right: calc((100% - 1630px) / 2 + 60px) !important;
        }
    }

    .allo-sticky-bar.show-allo-bar {
        transform: translateY(0) !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    .allo-sticky-bar .my-sticky-thumb img,
    .allo-sticky-bar .sticky-allo-thumb img {
        width: 60px !important;
        height: 60px !important;
        max-width: 60px !important;
        max-height: 60px !important;
        object-fit: contain !important;
        border-radius: 4px !important;
        margin: 0 !important;
        display: block !important;
    }

    .allo-sticky-bar .elementor-column,
    .allo-sticky-bar .elementor-widget {
        width: auto !important;
        max-width: max-content !important;
        flex: 0 0 auto !important;
    }

    .allo-sticky-bar .elementor-element:has(.price) {
        margin-left: auto !important;
    }

    .allo-sticky-bar .price,
    .allo-sticky-bar .single_add_to_cart_button,
    .allo-sticky-bar .wd-action-btn {
        opacity: 0 !important;
        visibility: hidden !important;
        transition: opacity 0.4s ease, visibility 0.4s ease !important;
    }

    .allo-sticky-bar.show-right-side .price,
    .allo-sticky-bar.show-right-side .single_add_to_cart_button,
    .allo-sticky-bar.show-right-side .wd-action-btn {
        opacity: 1 !important;
        visibility: visible !important;
    }

    .allo-sticky-bar .price {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important;
        gap: 0 !important;
        margin-bottom: 0 !important;
        line-height: 1.2 !important;
    }

    .allo-sticky-bar .price del,
    .allo-sticky-bar .price del span.woocommerce-Price-amount {
        color: #8c8c8c !important;
        font-size: 13px !important;
        font-weight: 500 !important;
        display: block !important;
    }

    .allo-sticky-bar .price ins,
    .allo-sticky-bar .price ins span.woocommerce-Price-amount {
        color: #eb2214 !important;
        font-size: 18px !important;
        font-weight: 700 !important;
        text-decoration: none !important;
    }

    .allo-sticky-bar .price > span.woocommerce-Price-amount {
        color: #333333 !important;
        font-size: 18px !important;
        font-weight: 700 !important;
        display: block !important;
    }

    .allo-sticky-bar .quantity,
    .allo-sticky-bar .wd-add-btn-wrapp,
    .allo-sticky-bar .wd-buy-now-btn,
    .allo-sticky-bar .woodmart-buy-now-btn {
        display: none !important;
    }

    .allo-sticky-bar .single_add_to_cart_button {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: 40px !important;
        height: 40px !important;
        min-width: 130px !important;
        border-radius: 20px !important;
        text-transform: none !important;
        padding: 0 16px !important;
        margin: 0 !important;
        background-color: #E62900 !important;
        border: none !important;
    }

    .allo-sticky-bar .single_add_to_cart_button.added {
        background-color: #FF7A8A !important;
    }

    .allo-sticky-bar .single_add_to_cart_button::before,
    .allo-sticky-bar .single_add_to_cart_button::after {
        display: none !important;
        content: none !important;
    }

    .allo-sticky-bar .custom-btn-text {
        font-size: 16px !important;
        font-weight: bold !important;
        color: #ffffff !important;
        line-height: 1 !important;
        display: inline-block !important;
    }

    .allo-sticky-bar .single_add_to_cart_button .icon-cart-check { display: none !important; }
    .allo-sticky-bar .single_add_to_cart_button.added .icon-cart-plus { display: none !important; }
    .allo-sticky-bar .single_add_to_cart_button.added .icon-cart-check { display: inline-block !important; }
    .allo-sticky-bar .wd-action-btn { margin: 0 !important; }
}

@media (max-width: 767px) {
    .allo-sticky-bar {
        position: fixed !important;
        top: auto !important;
        bottom: 50px !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        z-index: 99998 !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 0 16px !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        transform: translateY(150%) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transition: transform 0.8s ease, opacity 0.8s ease, visibility 0.8s ease !important;
        margin: 0 !important;
        overflow: hidden !important;
    }

    .allo-sticky-bar.show-mobile-bar {
        transform: translateY(0) !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    .allo-sticky-bar [class*="part"],
    .allo-sticky-bar [class*="mono"],
    .allo-sticky-bar [class*="privat"],
    .allo-sticky-bar [class*="pumb"],
    .allo-sticky-bar [class*="credit"],
    .allo-sticky-bar .payment-parts,
    .allo-sticky-bar .tech-banks-wrapper {
        display: none !important;
    }

    .wd-sticky-btn-wrapper,
    .wd-sticky-btn,
    .woodmart-sticky-btn-wrapper,
    .woodmart-sticky-btn,
    .wd-sticky-btn-cart {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
    }

    .allo-sticky-bar .my-sticky-thumb,
    .allo-sticky-bar .sticky-allo-thumb,
    .allo-sticky-bar .price,
    .allo-sticky-bar .wd-action-btn,
    .allo-sticky-bar .single_add_to_cart_button svg:not(.icon-cart-plus):not(.icon-cart-check) {
        display: none !important;
    }

    .allo-sticky-bar .elementor-column,
    .allo-sticky-bar .elementor-widget {
        display: none !important;
    }

    .allo-sticky-bar .elementor-column:has(.single_add_to_cart_button),
    .allo-sticky-bar .elementor-widget:has(.single_add_to_cart_button),
    .allo-sticky-bar .elementor-widget-container,
    .allo-sticky-bar form.cart {
        display: flex !important;
        width: 100% !important;
        max-width: 100% !important;
        flex: 1 1 100% !important;
    }

    .allo-sticky-bar .single_add_to_cart_button {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        height: 48px !important;
        background-color: #E62900 !important;
        border-radius: 10px !important;
        border: none !important;
        box-shadow: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .allo-sticky-bar .single_add_to_cart_button.added {
        background-color: #FF7A8A !important;
    }

    .allo-sticky-bar .custom-btn-text {
        font-size: 17px !important;
        font-weight: bold !important;
        color: #ffffff !important;
        line-height: 1 !important;
        text-transform: none !important;
    }

    .single-product .quantity,
    .single-product .wd-buy-now-btn,
    .single-product .woodmart-buy-now-btn,
    .scrollToTop,
    .wd-scroll-top,
    .scroll-to-top {
        display: none !important;
    }
}

/* ==========================================================================
   КНОПКИ НАЯВНОСТІ (WoodMart waitlist + попап для гостей)
   ========================================================================== */

/* Світлофор: email ховаємо завжди; гостям — WoodMart, авторизованим — попап */
.wd-wtl-form input[type="email"],
.wd-wtl-form-fields input[type="email"] {
    display: none !important;
}

body:not(.logged-in) .allo-btn-style .wd-wtl-form {
    display: none !important;
}

body.logged-in .knopka-nayavnosti {
    display: none !important;
}

/* Спільна висота 46px і групування іконки з текстом */
.allo-btn-style .wd-wtl-subscribe,
.allo-btn-style .wd-wtl-unsubscribe,
.allo-btn-style .wd-wtl-form-fields > button,
.knopka-nayavnosti .wd-open-popup {
    min-height: 46px !important;
    height: 46px !important;
    padding: 10px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
}

.allo-btn-style a.wd-wtl-subscribe::before,
.allo-btn-style a.wd-wtl-unsubscribe::before {
    position: static !important;
    display: inline-block !important;
    flex-shrink: 0 !important;
    margin: 0 5px 0 0 !important;
    padding: 0 !important;
    min-width: 0 !important;
    width: auto !important;
}

.allo-btn-style a.wd-wtl-subscribe span,
.allo-btn-style a.wd-wtl-unsubscribe span,
.knopka-nayavnosti .wd-open-popup span {
    flex: none !important;
    width: auto !important;
    text-align: left !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Попап гостей: шрифт і іконка як у WoodMart */
.knopka-nayavnosti .wd-open-popup,
.knopka-nayavnosti .wd-open-popup span.wd-btn-text {
    font-size: 14px !important;
    font-weight: 400 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    line-height: 1.2 !important;
}

.knopka-nayavnosti .wd-open-popup span.wd-btn-icon,
.knopka-nayavnosti .wd-open-popup i,
.knopka-nayavnosti .wd-open-popup svg {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 20px !important;
    height: 20px !important;
    font-size: 16px !important;
    margin: 0 6px 0 0 !important;
    padding: 0 !important;
    position: static !important;
    flex-shrink: 0 !important;
}

/* ПК: 272px, вирівнювання з «Купити» */
@media (min-width: 768px) {
    .allo-btn-style .wd-wtl-form,
    .allo-btn-style .wd-wtl-form-fields,
    .allo-btn-style form.cart {
        display: flex !important;
        justify-content: flex-start !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .allo-btn-style .elementor-widget-container .wd-wtl-form a.wd-wtl-subscribe,
    .allo-btn-style .elementor-widget-container .wd-wtl-form a.wd-wtl-unsubscribe,
    .knopka-nayavnosti .wd-button-wrapper a.wd-open-popup {
        width: 272px !important;
        min-width: 272px !important;
        max-width: 272px !important;
        margin: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .knopka-nayavnosti .elementor-widget-container,
    .knopka-nayavnosti .wd-button-wrapper {
        display: flex !important;
        justify-content: flex-start !important;
        text-align: left !important;
        width: 100% !important;
    }
}

/* Смартфони: 100% ширини. Обгортки лише віджетів кнопок — не чіпаємо сусідні плашки банків */
@media (max-width: 767px) {
    html body.single-product .e-con-inner:has(> .allo-btn-style),
    html body.single-product .e-con-inner:has(> .knopka-nayavnosti) {
        flex-wrap: wrap !important;
    }

    html body.single-product .allo-btn-style,
    html body.single-product:not(.logged-in) .knopka-nayavnosti {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        flex: 1 1 100% !important;
        align-self: stretch !important;
        --width: 100%;
        --container-widget-width: 100%;
        box-sizing: border-box !important;
    }

    html body.single-product .allo-btn-style .elementor-widget-container,
    html body.single-product .allo-btn-style .wd-wtl-form,
    html body.single-product .allo-btn-style .wd-wtl-form-fields,
    html body.single-product:not(.logged-in) .knopka-nayavnosti .elementor-widget-container,
    html body.single-product:not(.logged-in) .knopka-nayavnosti .wd-button-wrapper,
    html body.single-product:not(.logged-in) .knopka-nayavnosti .wd-button-wrapper.text-center {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        text-align: left !important;
        box-sizing: border-box !important;
    }

    /* form.cart — колонка з відступом: «Купити» і «Кредит» не накладаються */
    html body.single-product .allo-btn-style form.cart,
    html body.single-product form.cart {
        display: flex !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        align-items: stretch !important;
        gap: 12px !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    html body.single-product .allo-btn-style form.cart .single_add_to_cart_button,
    html body.single-product .allo-btn-style form.cart .wd-buy-now-btn,
    html body.single-product form.cart .single_add_to_cart_button,
    html body.single-product form.cart .wd-buy-now-btn {
        display: flex !important;
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 auto !important;
        margin: 0 !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        box-sizing: border-box !important;
    }

    html body.single-product .allo-btn-style .elementor-widget-container .wd-wtl-form a.wd-wtl-subscribe,
    html body.single-product .allo-btn-style .elementor-widget-container .wd-wtl-form a.wd-wtl-unsubscribe,
    html body.single-product .allo-btn-style .wd-wtl-form-fields > button,
    html body.single-product:not(.logged-in) .knopka-nayavnosti .wd-button-wrapper > a.btn.wd-open-popup {
        display: flex !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    html body.single-product .allo-btn-style .wd-action-btn {
        display: inline-flex !important;
        margin: 12px 0 0 15px !important;
        width: auto !important;
    }

    html body.single-product .allo-btn-style .elementor-widget-container:has(.wd-action-btn) {
        display: flex !important;
        justify-content: flex-end !important;
        width: 100% !important;
    }
}

/* Банки ховаємо лише коли товару немає. Не використовувати body:has(.wd-wtl-form)
   чи body:has(.knopka-nayavnosti) — ці блоки є в DOM і на товарах у наявності. */
body.single-product.outofstock .tech-banks-wrapper,
body.single-product.outofstock .payment-parts,
body.single-product.outofstock [class*="bank_installment"] {
    display: none !important;
}
