/**
 * Ozado V2 - Botones de cantidad +/- (reemplazo de Quantity Plus Minus Button)
 *
 * Look e-commerce profesional: stepper compacto tipo Amazon/Shopify, ancho
 * exacto al contenido (sin huecos), divisores sutiles, hover gris suave,
 * focus accesible por anillo (no por cambio de fondo, así no se queda
 * "pegado" tras un click).
 * Conserva clases del plugin original (.qib-button-wrapper, .qib-button,
 * .quantity) para que el template y JS originales sigan funcionando.
 */

/* -------- Wrapper: stepper compacto al tamaño del contenido -------- */
body .qib-button-wrapper {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    width: -moz-fit-content;
    width: fit-content;
    max-width: 100%;
    margin: 3px auto;
    padding: 0;
    white-space: nowrap;
    background: #ffffff;
    border: 1px solid #d8dde3;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Refuerzo: si un slider/builder rompe el layout, mantener fila y compacto. */
.slick-slide .qib-button-wrapper,
.owl-item .qib-button-wrapper,
.sa_hover_container .qib-button-wrapper,
.wpb_wrapper .qib-button-wrapper,
form.cart .qib-button-wrapper {
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    width: -moz-fit-content !important;
    width: fit-content !important;
    flex: 0 0 auto !important;
}
body .qib-button-wrapper > .quantity.wqpmb_quantity,
body .qib-button-wrapper > .minus.qib-button,
body .qib-button-wrapper > .plus.qib-button {
    display: inline-flex !important;
    flex: 0 0 auto;
}

/* -------- Botones +/- -------- */
body .qib-button-wrapper button.qib-button {
    position: relative;
    padding: 0;
    height: 40px;
    width: 40px;
    min-width: 40px;
    background: #ffffff;
    border: 0;
    color: #475569;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    font-weight: 400;
    font-family: inherit;
    transition: background 0.15s ease, color 0.15s ease;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
/* Divisores sutiles que no llegan al borde. */
body .qib-button-wrapper .minus.qib-button::after,
body .qib-button-wrapper .plus.qib-button::before {
    content: "";
    position: absolute;
    top: 9px;
    bottom: 9px;
    width: 1px;
    background: #e6eaee;
}
body .qib-button-wrapper .minus.qib-button::after { right: 0; }
body .qib-button-wrapper .plus.qib-button::before { left: 0; }

/* Hover solo cuando el dispositivo puede hacer hover (no en touch). */
@media (hover: hover) {
    body .qib-button-wrapper button.qib-button:hover {
        background: #f4f6f8;
        color: var(--theme-color-1, #005b77);
    }
}
body .qib-button-wrapper button.qib-button:active {
    background: #e9eef2;
    color: var(--theme-color-1, #005b77);
}
/* Focus accesible: anillo en el wrapper, no en el botón individual,
   y el botón NO cambia de fondo (así no se queda azul tras click). */
body .qib-button-wrapper button.qib-button:focus {
    outline: 0;
}
body .qib-button-wrapper:focus-within {
    border-color: var(--theme-color-1, #005b77);
    box-shadow: 0 0 0 3px rgba(0, 91, 119, 0.12);
}
body .qib-button-wrapper button.qib-button:disabled,
body .qib-button-wrapper button.qib-button[disabled] {
    color: #cbd2d9;
    cursor: not-allowed;
    background: #ffffff;
}

/* -------- Input central -------- */
body .qib-button-wrapper .quantity.wqpmb_quantity {
    display: inline-flex;
    align-items: center;
    height: 40px;
    margin: 0 !important;
    background: #ffffff;
}
body .qib-button-wrapper .quantity input.input-text.qty.text,
body .qib-button-wrapper .quantity input.wqpmb_input_text {
    height: 40px;
    width: 44px;
    padding: 0 4px;
    text-align: center;
    background: transparent;
    border: 0;
    color: #1f2937;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    line-height: 40px;
    box-shadow: none;
    margin: 0 !important;
    outline: 0;
    -moz-appearance: textfield;
}
.qib-button-wrapper input::-webkit-outer-spin-button,
.qib-button-wrapper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

span.wqpmb_plain_input.hidden { display: none; }

/* -------- Compatibilidad con vistas WooCommerce -------- */
.woocommerce-page div.product form.cart div.quantity.wqpmb_quantity,
.woocommerce div.product form.cart .quantity.wqpmb_quantity,
.woocommerce div.product .quantity.wqpmb_quantity {
    margin: 0 !important;
}
.woocommerce div.product form.cart .qib-button-wrapper div.quantity {
    margin: 0;
}
body.cart tr.woocommerce-cart-form__cart-item.cart_item .qib-button-wrapper {
    margin: inherit;
}
body.cart tr.woocommerce-cart-form__cart-item.cart_item .quantity.wqpmb_quantity {
    display: inline-flex;
}

/* En las tarjetas del loop el wrapper se centra dentro de su columna. */
.woocommerce ul.products li.product form.cart .qib-button-wrapper,
.woocommerce-page ul.products li.product form.cart .qib-button-wrapper {
    margin-left: auto;
    margin-right: auto;
}

/* -------- Mobile -------- */
/* Móvil del proyecto (< 480px): stepper más compacto. */
@media only screen and (max-width: 479.98px) {
    body .qib-button-wrapper button.qib-button {
        height: 38px;
        width: 38px;
        min-width: 38px;
        font-size: 18px;
    }
    body .qib-button-wrapper .quantity.wqpmb_quantity,
    body .qib-button-wrapper .quantity input.input-text.qty.text {
        height: 38px;
    }
    body .qib-button-wrapper .quantity input.input-text.qty.text {
        width: 40px;
        line-height: 38px;
        font-size: 14px;
    }
}
