﻿/* QtyStepper - seletor de quantidade (substitui o touchspin) */

/* Evita o "flash" do input cru (largura cheia) antes do JS montar o stepper.
   Enquanto o input ainda nao virou .qty-stepper__value, fica invisivel mas
   reservando o espaco do stepper, para nao haver salto de layout.
   FAIL-SAFE (e-commerce): se em 2.5s o JS nao montou o stepper (erro/JS lento),
   a animacao revela o input sozinho, para a quantidade nunca ficar inacessivel. */
.qty-input:not(.qty-stepper__value) {
    display: inline-block;
    width: 118px !important;
    max-width: 118px !important;
    height: 40px !important;
    visibility: hidden;
    animation: qtyStepperFailSafe 0s linear 2.5s forwards;
}

@keyframes qtyStepperFailSafe {
    to {
        visibility: visible;
    }
}

.qty-stepper {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid #BCBCBC;
    border-radius: 25px;
    overflow: hidden;
    background: #fff;
    height: 40px;
    user-select: none;
    -webkit-user-select: none;
}

.qty-stepper__btn {
    flex: 0 0 auto;
    width: 38px;
    min-width: 38px;
    height: 100%;
    border: none;
    background: white;
    color: #212529;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color .15s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.qty-stepper__btn:hover {
    background: #e9ecef;
}

.qty-stepper__btn:active {
    background: #dee2e6;
}

.qty-stepper__btn:disabled {
    color: #adb5bd;
    background: #f8f9fa;
    cursor: not-allowed;
}

.qty-stepper__value {
    flex: 1 1 auto;
    width: 40px;
    min-width: 38px;
    max-width: 48px;
    height: 100%;
    border: none !important;
    border-radius: 0 !important;
    text-align: center;
    font-weight: 700;
    font-size: 1.05rem;
    color: #212529;
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    pointer-events: none; /* somente botoes controlam */
    -moz-appearance: textfield;
}

.qty-stepper__value:focus {
    outline: none;
    box-shadow: none !important;
}

.qty-stepper__value::-webkit-outer-spin-button,
.qty-stepper__value::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Toque um pouco maior no mobile, sem alargar demais */
@media (max-width: 767.98px) {
    .qty-stepper {
        height: 44px;
    }

    .qty-stepper__btn {
        width: 40px;
        min-width: 40px;
        font-size: 1.5rem;
    }

    .qty-stepper__value {
        width: 42px;
        font-size: 1.1rem;
    }
}
