/**
 * Product Quantity Button Alignment Fix
 *
 * Fixes issue where +/- quantity buttons appear slightly shifted
 * relative to the input field.
 *
 * @package eRide
 * @version 1.0.0
 * @since 1.1.6
 *
 * Issue: #6.4 - Qty layout shift on product pages
 */

/* ==========================================================================
   Single Product Qty Alignment Fix
   ========================================================================== */

/* Ensure perfect vertical centering of quantity selector */
.wp-block-woocommerce-add-to-cart-form .quantity,
.woocommerce-variation-add-to-cart .quantity,
form.cart .quantity {
    display: inline-flex;
    align-items: center;
}

/* Fix qty container flexbox alignment */
.quantity .qty-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ensure qty buttons and input are perfectly aligned */
.quantity .qty-container button,
.quantity .qty-container .qty-button,
.wc-block-components-quantity-selector button {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Fix input vertical alignment */
.quantity input.qty,
.wc-block-components-quantity-selector input {
    line-height: 1;
    vertical-align: middle;
}

/* Ensure consistent sizing on buttons to prevent shift */
.quantity .qty-container button,
.quantity .qty-container .qty-button {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
}

/* ==========================================================================
   WooCommerce Block Qty Selector Fix
   ========================================================================== */

/* Fix WooCommerce Block qty selector alignment */
.wc-block-components-quantity-selector {
    display: flex;
    align-items: center;
    gap: 0;
}

/* Ensure buttons are centered in their allocated space */
.wc-block-components-quantity-selector .wc-block-components-quantity-selector__button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

/* Fix the minus button (sometimes shifted up) */
.wc-block-components-quantity-selector .wc-block-components-quantity-selector__button--minus,
.wc-block-components-quantity-selector .wc-block-components-quantity-selector__button--plus {
    margin: 0;
}

/* Input field alignment */
.wc-block-components-quantity-selector .wc-block-components-quantity-selector__input {
    text-align: center;
    -moz-appearance: textfield; /* Hide spinner in Firefox */
}

/* Hide number input spinners (they can cause alignment issues) */
.wc-block-components-quantity-selector .wc-block-components-quantity-selector__input::-webkit-inner-spin-button,
.wc-block-components-quantity-selector .wc-block-components-quantity-selector__input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
