/**
 * Múltiplo de Venda Make+ - Frontend Styles
 *
 * @package MultiploDeVendaMakePlus
 */

/* ==========================================================================
   Geral - Sufixo de quantidade
   ========================================================================== */

.mdvmp-suffix {
    display: inline-block;
    margin-left: 8px;
    font-size: 14px;
    color: #666;
    vertical-align: middle;
    line-height: 1.5;
}

.mdvmp-multiple-info {
    font-size: 13px;
    color: #666;
    margin-top: 8px;
    font-style: italic;
}

/* ==========================================================================
   Página de produto único (Single Product) - Campo de quantidade com botões
   Layout: [ - ] [ quantidade ] [ + ] [Adicionar ao carrinho]
   ========================================================================== */

.single-product .quantity {
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.single-product .quantity .mdvmp-suffix {
    margin-left: 8px;
}

.single-product .mdvmp-product-data {
    display: none;
}

/* Wrapper de quantidade na página de produto único - SEM fundo */
.single-product .mdvmp-single-product-qty {
    display: inline-flex;
    align-items: stretch;
    background: transparent;
    border-radius: 0;
    padding: 0;
    gap: 0;
    /*border: 1px solid #ccc;*/
}

/* Botões - e + */
.single-product .mdvmp-single-product-qty .mdvmp-qty-btn {
    width: 48px;
    height: 48px;
    font-size: 24px;
    font-weight: 400;
    background: #fff;
    border: none;
    border-radius: 0;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

/* Botão menos - borda direita */
.single-product .mdvmp-single-product-qty .mdvmp-qty-minus {
    border-right: 1px solid #ccc;
}

/* Botão mais - borda esquerda */
.single-product .mdvmp-single-product-qty .mdvmp-qty-plus {
    border-left: 1px solid #ccc;
}

.single-product .mdvmp-single-product-qty .mdvmp-qty-btn:hover {
    background: #f5f5f5;
}

.single-product .mdvmp-single-product-qty .mdvmp-qty-btn:active {
    background: #eee;
}

/* Campo de quantidade - largura dinâmica baseada no conteúdo */
.single-product .mdvmp-single-product-qty .mdvmp-qty-input {
    /*width: auto;
    min-width: 60px;*/
    max-width: 150px;
    height: 48px;
    font-size: 18px;
    font-weight: 400;
    text-align: center;
    border: none;
    border-radius: 0;
    background: #fff;
    padding: 0 15px;
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Esconder setas do input number */
.single-product .mdvmp-single-product-qty .mdvmp-qty-input::-webkit-outer-spin-button,
.single-product .mdvmp-single-product-qty .mdvmp-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.single-product .mdvmp-single-product-qty .mdvmp-qty-input:focus {
    outline: none;
    background: #fafafa;
}

/* Estilo para a área de quantidade junto com o botão de adicionar ao carrinho */
.single-product form.cart {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.single-product form.cart .quantity {
    margin-bottom: 0;
    margin-right: 0;
}

/* Botão Adicionar ao Carrinho */
.single-product form.cart .single_add_to_cart_button {
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 30px;
}

/* Sufixo na página de produto único */
.single-product .mdvmp-suffix {
    font-size: 15px;
    font-weight: 500;
    color: #555;
    padding-left: 8px;
}

/* ==========================================================================
   Listagens de produtos - Campo de quantidade customizado
   ========================================================================== */

.mdvmp-archive-add-to-cart {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.mdvmp-quantity-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    /*background: #f5f5f5;*/
    border-radius: 4px;
    padding: 4px;
}

.mdvmp-qty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.mdvmp-qty-btn:hover {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

.mdvmp-qty-btn:active {
    transform: scale(0.95);
}

.mdvmp-qty-btn:disabled,
.mdvmp-qty-btn.mdvmp-btn-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.mdvmp-qty-btn:disabled:hover,
.mdvmp-qty-btn.mdvmp-btn-disabled:hover {
    background: #fff;
    border-color: #ddd;
    color: #333;
    transform: none;
}

.mdvmp-qty-input {
    width: 60px;
    height: 32px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    -moz-appearance: textfield;
    appearance: textfield;
}

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

.mdvmp-qty-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.mdvmp-quantity-wrapper .mdvmp-suffix {
    margin-left: 4px;
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

.mdvmp-add-to-cart {
    width: 100%;
    text-align: center;
}

/* ==========================================================================
   Carrinho - Sufixo de quantidade
   ========================================================================== */

.woocommerce-cart-form .mdvmp-cart-suffix {
    display: inline-block;
    margin-left: 8px;
    font-size: 13px;
    color: #666;
    vertical-align: middle;
}

.mdvmp-cart-multiple-info {
    display: block;
    font-size: 12px;
    color: #888;
    font-style: italic;
    margin-top: 4px;
}

/* Ajustar campo de quantidade no carrinho */
.woocommerce-cart-form .quantity {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   Checkout - Informações de múltiplo
   ========================================================================== */

.woocommerce-checkout .mdvmp-cart-multiple-info {
    font-size: 11px;
    color: #999;
}

/* ==========================================================================
   Responsivo
   ========================================================================== */

@media screen and (max-width: 768px) {
    .mdvmp-archive-add-to-cart {
        padding: 10px 0;
    }

    .mdvmp-quantity-wrapper {
        flex-wrap: wrap;
        justify-content: center;
    }

    .mdvmp-qty-btn {
        width: 36px;
        height: 36px;
    }

    .mdvmp-qty-input {
        width: 70px;
        height: 36px;
    }

    .woocommerce-cart-form .quantity {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .woocommerce-cart-form .mdvmp-cart-suffix {
        margin-left: 0;
    }

    /* Página de produto único - Mobile */
    .single-product .mdvmp-single-product-qty {
        padding: 0;
        gap: 0;
    }

    .single-product .mdvmp-single-product-qty .mdvmp-qty-btn {
        width: 44px;
        height: 44px;
        font-size: 22px;
    }

    .single-product .mdvmp-single-product-qty .mdvmp-qty-input {
        min-width: 50px;
        height: 44px;
        font-size: 16px;
        padding: 0 10px;
    }

    .single-product form.cart {
        flex-direction: column;
        align-items: stretch;
    }

    .single-product form.cart .quantity {
        width: 100%;
        justify-content: center;
        margin-bottom: 10px;
    }

    .single-product form.cart .single_add_to_cart_button {
        width: 100%;
        height: 48px;
    }
}

/* ==========================================================================
   Tema Storefront - Ajustes específicos (listagens)
   ========================================================================== */

.storefront .mdvmp-archive-add-to-cart .mdvmp-quantity-wrapper {
    background: #f7f7f7;
}

.storefront .mdvmp-archive-add-to-cart .mdvmp-qty-btn {
    background: #2c2d33;
    border-color: #2c2d33;
    color: #fff;
}

.storefront .mdvmp-archive-add-to-cart .mdvmp-qty-btn:hover {
    background: #96588a;
    border-color: #96588a;
}

.storefront .mdvmp-add-to-cart {
    background: #96588a;
    border-color: #96588a;
}

.storefront .mdvmp-add-to-cart:hover {
    background: #7f4e74;
    border-color: #7f4e74;
}

/* Storefront - Página de produto único */
.storefront.single-product .mdvmp-single-product-qty {
    background: transparent;
    border-color: #ccc;
}

.storefront.single-product .mdvmp-single-product-qty .mdvmp-qty-btn {
    background: #fff;
    color: #333;
}

.storefront.single-product .mdvmp-single-product-qty .mdvmp-qty-btn:hover {
    background: #f5f5f5;
}

.storefront.single-product .mdvmp-single-product-qty .mdvmp-qty-minus {
    border-right-color: #ccc;
}

.storefront.single-product .mdvmp-single-product-qty .mdvmp-qty-plus {
    border-left-color: #ccc;
}

.storefront.single-product .mdvmp-single-product-qty .mdvmp-qty-input {
    border: none;
    background: #fff;
}

.storefront.single-product .mdvmp-single-product-qty .mdvmp-qty-input:focus {
    background: #fafafa;
    box-shadow: none;
}

/* ==========================================================================
   Animações
   ========================================================================== */

@keyframes mdvmp-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 115, 170, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(0, 115, 170, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 115, 170, 0);
    }
}

.mdvmp-qty-input.mdvmp-updated {
    animation: mdvmp-pulse 0.5s ease-out;
}

/* ==========================================================================
   Estados de erro
   ========================================================================== */

.mdvmp-qty-input.mdvmp-error {
    border-color: #dc3232;
    background-color: #fff5f5;
}

.mdvmp-error-message {
    color: #dc3232;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

/* ==========================================================================
   Elementor Compatibility - Produtos Relacionados, Upsells, Cross-sells
   Garante que os controles de quantidade sejam exibidos corretamente
   em todos os widgets de produtos do Elementor
   ========================================================================== */

/* Container principal em contextos do Elementor */
.elementor-widget-woocommerce-products .mdvmp-archive-add-to-cart,
.elementor-widget-woocommerce-product-related .mdvmp-archive-add-to-cart,
.elementor-widget-woocommerce-product-upsell .mdvmp-archive-add-to-cart,
.elementor .products .mdvmp-archive-add-to-cart,
.elementor-widget-container .mdvmp-archive-add-to-cart,
.woocommerce .related.products .mdvmp-archive-add-to-cart,
.woocommerce .upsells.products .mdvmp-archive-add-to-cart,
.woocommerce .cross-sells .mdvmp-archive-add-to-cart {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    align-items: center !important;
    width: 100% !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Wrapper de quantidade em contextos do Elementor */
.elementor-widget-woocommerce-products .mdvmp-quantity-wrapper,
.elementor-widget-woocommerce-product-related .mdvmp-quantity-wrapper,
.elementor-widget-woocommerce-product-upsell .mdvmp-quantity-wrapper,
.elementor .products .mdvmp-quantity-wrapper,
.elementor-widget-container .mdvmp-quantity-wrapper,
.woocommerce .related.products .mdvmp-quantity-wrapper,
.woocommerce .upsells.products .mdvmp-quantity-wrapper,
.woocommerce .cross-sells .mdvmp-quantity-wrapper {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    border-radius: 4px !important;
    padding: 4px !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Input de quantidade em contextos do Elementor */
.elementor-widget-woocommerce-products .mdvmp-qty-input,
.elementor-widget-woocommerce-product-related .mdvmp-qty-input,
.elementor-widget-woocommerce-product-upsell .mdvmp-qty-input,
.elementor .products .mdvmp-qty-input,
.elementor-widget-container .mdvmp-qty-input,
.woocommerce .related.products .mdvmp-qty-input,
.woocommerce .upsells.products .mdvmp-qty-input,
.woocommerce .cross-sells .mdvmp-qty-input,
.products li.product .mdvmp-qty-input,
input.mdvmp-qty-input {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 60px !important;
    height: 32px !important;
    min-width: 50px !important;
    max-width: 80px !important;
    text-align: center !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    -moz-appearance: textfield !important;
    -webkit-appearance: none !important;
    background-color: #fff !important;
    color: #333 !important;
    padding: 0 5px !important;
    margin: 0 2px !important;
    line-height: 30px !important;
    box-sizing: border-box !important;
}

/* Remover setas do input number */
.elementor .mdvmp-qty-input::-webkit-outer-spin-button,
.elementor .mdvmp-qty-input::-webkit-inner-spin-button,
.products .mdvmp-qty-input::-webkit-outer-spin-button,
.products .mdvmp-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

/* Botões + e - em contextos do Elementor */
.elementor-widget-woocommerce-products .mdvmp-qty-btn,
.elementor-widget-woocommerce-product-related .mdvmp-qty-btn,
.elementor-widget-woocommerce-product-upsell .mdvmp-qty-btn,
.elementor .products .mdvmp-qty-btn,
.elementor-widget-container .mdvmp-qty-btn,
.woocommerce .related.products .mdvmp-qty-btn,
.woocommerce .upsells.products .mdvmp-qty-btn,
.woocommerce .cross-sells .mdvmp-qty-btn,
.products li.product .mdvmp-qty-btn,
button.mdvmp-qty-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    background: #fff !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 18px !important;
    font-weight: bold !important;
    color: #333 !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    transition: all 0.2s ease !important;
}

/* Hover nos botões */
.elementor .mdvmp-qty-btn:hover,
.products .mdvmp-qty-btn:hover {
    background: #0073aa !important;
    border-color: #0073aa !important;
    color: #fff !important;
}

/* Botão de adicionar ao carrinho em contextos do Elementor */
.elementor-widget-woocommerce-products .mdvmp-add-to-cart,
.elementor-widget-woocommerce-product-related .mdvmp-add-to-cart,
.elementor-widget-woocommerce-product-upsell .mdvmp-add-to-cart,
.elementor .products .mdvmp-add-to-cart,
.woocommerce .related.products .mdvmp-add-to-cart,
.woocommerce .upsells.products .mdvmp-add-to-cart,
.woocommerce .cross-sells .mdvmp-add-to-cart {
    width: 100% !important;
    text-align: center !important;
}

/* Sufixo em contextos do Elementor */
.elementor .mdvmp-suffix,
.products .mdvmp-suffix {
    margin-left: 4px !important;
    font-size: 12px !important;
    color: #666 !important;
    white-space: nowrap !important;
}
