/*
 * HO4 2026-12-03 — mobile one-tap cart control and last-item feedback.
 *
 * On phones the product row/card exposes one green +1/cart button. The quantity
 * input remains in the DOM for the legacy desktop handler but is not presented.
 * Desktop quantity controls and cart markup are intentionally unchanged.
 */
body.demed-catalog-ui .ho4-mobile-add-one-label,
body.demed-catalog-ui .ho4-mobile-cart-icon {
    display: none;
}

@media (max-width: 767px) {
    /* Break the legacy table formatting context so result rows stay inside the viewport. */
    body.demed-catalog-ui .products-results table.table,
    body.demed-catalog-ui .products-results table.table > tbody {
        display: block !important;
        box-sizing: border-box !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    body.demed-catalog-ui .products-results table.table > tbody > tr.item {
        display: block !important;
        box-sizing: border-box !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    /* Catalogue result rows: reserve one compact action rail at the right edge. */
    body.demed-catalog-ui .products-results table.table tbody tr.item {
        padding-right: 74px !important;
    }

    body.demed-catalog-ui .products-results td.mobile-result-buy {
        position: absolute !important;
        top: 50% !important;
        right: 4px !important;
        bottom: auto !important;
        transform: translateY(-50%) !important;
        display: block !important;
        box-sizing: border-box !important;
        width: 66px !important;
        min-width: 66px !important;
        max-width: 66px !important;
        height: 38px !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    body.demed-catalog-ui .products-results td.mobile-result-buy .ho4-catalog-cart-control {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0 !important;
        width: 66px !important;
        min-width: 66px !important;
        max-width: 66px !important;
        height: 38px !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body.demed-catalog-ui .products-results td.mobile-result-buy .ho4-catalog-qty-control,
    body.demed-catalog-ui .products-results td.mobile-result-buy input.product-qty {
        display: none !important;
        width: 0 !important;
        min-width: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
    }

    body.demed-catalog-ui .products-results td.mobile-result-buy .ho4-catalog-cart-control .input-group-btn {
        display: inline-flex !important;
        align-items: center !important;
        width: auto !important;
    }

    body.demed-catalog-ui .products-results td.mobile-result-buy .btn-buy {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 5px !important;
        box-sizing: border-box !important;
        width: 64px !important;
        min-width: 64px !important;
        max-width: 64px !important;
        height: 36px !important;
        min-height: 36px !important;
        margin: 0 !important;
        padding: 4px 6px !important;
        border: 1px solid #4cae4c !important;
        border-radius: 8px !important;
        background: #5cb85c !important;
        color: #fff !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        line-height: 1 !important;
        white-space: nowrap !important;
    }

    body.demed-catalog-ui .products-results td.mobile-result-buy .btn-buy .fa {
        margin: 0 !important;
        font-size: 15px !important;
    }

    body.demed-catalog-ui .products-results td.mobile-result-buy .ho4-mobile-add-one-label,
    body.demed-catalog-ui .ho4-product-cart-control .ho4-mobile-add-one-label {
        display: inline-block !important;
    }

    /* Product detail card: keep the same one-tap action beside the price. */
    body.demed-catalog-ui .ho4-product-cart-control {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 0 !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin: 0 !important;
        vertical-align: middle !important;
    }

    body.demed-catalog-ui .ho4-product-cart-control input.product-qty {
        display: none !important;
        width: 0 !important;
        min-width: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
    }

    body.demed-catalog-ui .ho4-product-cart-control .input-group-btn {
        display: inline-flex !important;
        width: auto !important;
        vertical-align: middle !important;
    }

    body.demed-catalog-ui .ho4-product-cart-control .btn-buy,
    body.demed-catalog-ui .ho4-product-cart-control .btn-add {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        width: auto !important;
        min-width: 68px !important;
        max-width: 100% !important;
        height: 38px !important;
        min-height: 38px !important;
        margin: 0 !important;
        padding: 6px 10px !important;
        border: 1px solid #4cae4c !important;
        border-radius: 8px !important;
        background: #5cb85c !important;
        color: #fff !important;
        font-size: 14px !important;
        font-weight: 700 !important;
        line-height: 1 !important;
        white-space: nowrap !important;
    }

    body.demed-catalog-ui .ho4-product-cart-control .btn-buy .fa,
    body.demed-catalog-ui .ho4-product-cart-control .btn-add .fa {
        margin: 0 !important;
        font-size: 16px !important;
    }

    body.demed-catalog-ui .ho4-product-cart-control .ho4-desktop-buy-label {
        display: none !important;
    }

    body.demed-catalog-ui .ho4-product-cart-control .ho4-mobile-cart-icon {
        display: inline-block !important;
    }

    /* Compact cart popover. JS clamps its left edge to the current viewport. */
    .popover.ho4-mobile-cart-popover {
        z-index: 1205 !important;
        box-sizing: border-box !important;
        width: calc(100vw - 24px) !important;
        max-width: 320px !important;
        min-width: 0 !important;
        padding: 0 !important;
        border: 1px solid #d8e3eb !important;
        border-radius: 10px !important;
        background: #fff !important;
        box-shadow: 0 5px 22px rgba(28, 48, 65, .18) !important;
        white-space: normal !important;
    }

    .popover.ho4-mobile-cart-popover > .arrow {
        border-bottom-color: #d8e3eb !important;
    }

    .popover.ho4-mobile-cart-popover > .arrow:after {
        border-bottom-color: #fff !important;
    }

    .popover.ho4-mobile-cart-popover .popover-content {
        padding: 12px 14px !important;
        color: #30485a !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
    }

    .ho4-mobile-cart-notice__title {
        margin: 0 0 7px !important;
        color: #28734e !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        line-height: 1.25 !important;
    }

    .ho4-mobile-cart-notice__item {
        color: #243d50 !important;
        font-size: 14px !important;
        font-weight: 650 !important;
        line-height: 1.35 !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
    }

    .ho4-mobile-cart-notice__hint {
        margin-top: 10px !important;
        padding-top: 8px !important;
        border-top: 1px solid #e7edf1 !important;
        color: #536879 !important;
        font-size: 12px !important;
        font-weight: 400 !important;
        line-height: 1.35 !important;
    }
}


/* HO4 2026-12-03 — product-detail cart control.
 * Same 80x34 quantity stepper + separate 38x34 green cart button as the desktop
 * main catalogue. Unlike catalogue list rows, this control remains identical
 * on desktop and mobile; no breakpoint hides +/- or the quantity field.
 */
body.demed-catalog-ui .ho4-product-detail-cart-control {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
}

body.demed-catalog-ui .ho4-product-detail-cart-control .ho4-catalog-qty-control {
    display: inline-flex !important;
    align-items: stretch !important;
    box-sizing: border-box !important;
    flex: 0 0 80px !important;
    width: 80px !important;
    min-width: 80px !important;
    height: 34px !important;
    min-height: 34px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 1px solid #d9e2ec !important;
    border-radius: 7px !important;
    background: #fff !important;
}

body.demed-catalog-ui .ho4-product-detail-cart-control .ho4-product-detail-qty-step {
    appearance: none !important;
    -webkit-appearance: none !important;
    display: flex !important;
    flex: 0 0 19px !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    width: 19px !important;
    min-width: 19px !important;
    height: 32px !important;
    min-height: 32px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #f5f5f5 !important;
    color: #555 !important;
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 32px !important;
    text-align: center !important;
    cursor: pointer !important;
}

body.demed-catalog-ui .ho4-product-detail-cart-control .ho4-catalog-qty-down {
    border-right: 1px solid #d9e2ec !important;
}

body.demed-catalog-ui .ho4-product-detail-cart-control .ho4-catalog-qty-up {
    border-left: 1px solid #d9e2ec !important;
}

body.demed-catalog-ui .ho4-product-detail-cart-control input.product-qty {
    display: block !important;
    flex: 0 0 40px !important;
    box-sizing: border-box !important;
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    height: 32px !important;
    min-height: 32px !important;
    margin: 0 !important;
    padding: 0 2px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
    color: #555 !important;
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 32px !important;
    text-align: center !important;
    box-shadow: none !important;
}

body.demed-catalog-ui .ho4-product-detail-cart-control .btn-buy {
    display: inline-flex !important;
    flex: 0 0 38px !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    width: 38px !important;
    min-width: 38px !important;
    height: 34px !important;
    min-height: 34px !important;
    margin: 0 !important;
    padding: 6px 8px !important;
    border-radius: 7px !important;
    white-space: nowrap !important;
}

body.demed-catalog-ui .ho4-product-detail-cart-control .btn-buy .fa {
    margin: 0 !important;
    font-size: 15px !important;
}
