/* APM catalog controls, v2.1.2. Scoped to our wrapper; single product/cart fields are untouched. */
.vp-catalog-cart[data-vp-catalog-cart] {
    --vp-catalog-control-height: 40px;
    --vp-catalog-button-padding-inline: 10px;
    display: flex !important;
    flex-flow: row wrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    clear: both;
    margin: 10px 0 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
}

/* Theme rules for .button / .quantity can override the flex container's
   alignment through align-self, relative offsets or transforms. Reset only
   our catalog controls; keep single-product and cart quantities untouched. */
.vp-catalog-cart[data-vp-catalog-cart] > .vp-catalog-cart__quantity,
.vp-catalog-cart[data-vp-catalog-cart] [data-vp-catalog-add] {
    align-self: center !important;
    position: relative !important;
    inset: auto !important;
    float: none !important;
    margin: 0 !important;
    transform: none !important;
    translate: none !important;
    vertical-align: middle !important;
}

/* Some loop templates put the purchase anchor inside one or more containers.
   Only its ancestor chain inside this component is marked by the script.
   Keep those elements/events intact, but do not let their boxes offset the link. */
.vp-catalog-cart[data-vp-catalog-cart] .vp-catalog-cart__button-wrap {
    display: contents !important;
}

.vp-catalog-cart[data-vp-catalog-cart] .vp-catalog-cart__button-wrap > br {
    display: none !important;
}

/* Center the number and +/- inside the same control, regardless of theme
   input offsets. Relative positioning preserves focus indicator stacking. */
.vp-catalog-cart[data-vp-catalog-cart] .vp-catalog-cart__quantity .quantity,
.vp-catalog-cart[data-vp-catalog-cart] .vp-catalog-cart__quantity input.qty,
.vp-catalog-cart[data-vp-catalog-cart] button.vp-catalog-cart__step {
    align-self: center !important;
    position: relative !important;
    inset: auto !important;
    transform: none !important;
    translate: none !important;
    max-height: none !important;
    vertical-align: middle !important;
}

/* Without JS, only the unchanged WooCommerce purchase link is visible. */
.vp-catalog-cart[data-vp-catalog-cart] .vp-catalog-cart__quantity {
    display: none !important;
}

.vp-catalog-cart[data-vp-catalog-cart].vp-catalog-cart--ready .vp-catalog-cart__quantity {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100%;
    height: var(--vp-catalog-control-height) !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 1px solid #d8d8d8;
    border-radius: 5px;
    background: #fff;
    color: #252525;
    box-sizing: border-box;
    position: relative;
}

.vp-catalog-cart[data-vp-catalog-cart] .vp-catalog-cart__quantity .quantity {
    display: flex !important;
    align-items: center !important;
    float: none !important;
    flex: 0 0 32px !important;
    width: 32px !important;
    min-width: 0 !important;
    height: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    position: relative;
}

.vp-catalog-cart[data-vp-catalog-cart] .vp-catalog-cart__quantity input.qty {
    display: block !important;
    width: 32px !important;
    min-width: 0 !important;
    max-width: 32px !important;
    height: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 1px !important;
    text-align: center !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    color: inherit !important;
    font: inherit !important;
    font-size: 14px !important;
    line-height: normal !important;
    box-sizing: border-box;
    -moz-appearance: textfield;
    appearance: textfield;
}

.vp-catalog-cart[data-vp-catalog-cart] .vp-catalog-cart__quantity input.qty::-webkit-inner-spin-button,
.vp-catalog-cart[data-vp-catalog-cart] .vp-catalog-cart__quantity input.qty::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Hide theme-inserted +/- controls only inside this native quantity wrapper. */
.vp-catalog-cart[data-vp-catalog-cart] .vp-catalog-cart__quantity .quantity > :not(input):not(label) {
    display: none !important;
}

.vp-catalog-cart[data-vp-catalog-cart] .vp-catalog-cart__quantity label {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.vp-catalog-cart[data-vp-catalog-cart] button.vp-catalog-cart__step {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 24px !important;
    width: 24px !important;
    min-width: 24px !important;
    max-width: 24px !important;
    height: 100% !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 4px !important;
    background: transparent !important;
    color: inherit !important;
    box-shadow: none !important;
    font: inherit !important;
    font-size: 18px !important;
    line-height: 1 !important;
    cursor: pointer;
    touch-action: manipulation;
}

.vp-catalog-cart[data-vp-catalog-cart] button.vp-catalog-cart__step::before,
.vp-catalog-cart[data-vp-catalog-cart] button.vp-catalog-cart__step::after {
    content: none !important;
}

.vp-catalog-cart[data-vp-catalog-cart] button.vp-catalog-cart__step:disabled {
    opacity: .35;
    cursor: default;
}

.vp-catalog-cart[data-vp-catalog-cart] button.vp-catalog-cart__step:focus-visible,
.vp-catalog-cart[data-vp-catalog-cart] .vp-catalog-cart__quantity input.qty:focus-visible {
    outline: 2px solid currentColor !important;
    outline-offset: 1px;
    z-index: 1;
}

/* The theme keeps its purchase button colors and typography. Narrow cards wrap. */
.vp-catalog-cart[data-vp-catalog-cart] [data-vp-catalog-add] {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    float: none !important;
    flex: 0 1 auto !important;
    width: auto !important;
    min-width: 64px !important;
    max-width: 100%;
    height: auto !important;
    max-height: none !important;
    min-height: var(--vp-catalog-control-height) !important;
    margin: 0 !important;
    padding: 8px var(--vp-catalog-button-padding-inline) !important;
    line-height: 1.25 !important;
    text-align: center;
    white-space: normal !important;
    overflow-wrap: anywhere;
    box-sizing: border-box;
}

.vp-catalog-cart[data-vp-catalog-cart] a.added_to_cart {
    flex: 1 0 100%;
    width: 100%;
    margin: 2px 0 0 !important;
    text-align: center !important;
    box-sizing: border-box;
}

@media (max-width: 767px) {
    /* Keep short labels such as Add next to the quantity in two-column mobile grids. */
    .vp-catalog-cart[data-vp-catalog-cart] {
        --vp-catalog-button-padding-inline: 6px;
    }
    .vp-catalog-cart[data-vp-catalog-cart] .vp-catalog-cart__quantity input.qty {
        font-size: 16px !important;
    }
}
