/**
 * Módulo de Checkout - Responsividade Mobile e Correções de UI
 *
 * @package Treinacom_Core\Modules\Checkout\Assets\Css\Upsell
 */

/* ==========================================================================
   5. RESPONSIVIDADE MOBILE (TOUCH UI OTIMIZADA)
   ========================================================================== */

@media (max-width: 980px) {
    /* 1. Zeramento de margens nas cascas estruturais */
    html body.woocommerce-checkout #tc-header-spacer {
        margin-bottom: 0 !important;
    }

    html body.woocommerce-checkout #page-container,
    html body.woocommerce-checkout #et-main-area,
    html body.woocommerce-checkout #main-content {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }

    /* 2. Container único com largura total e padding lateral estrito de 10px em cada lado */
    html body.woocommerce-checkout #main-content > .container,
    html body.woocommerce-checkout #main-content .container,
    html body.woocommerce-checkout .container {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        margin-left: auto !important;
        margin-right: auto !important;
        box-sizing: border-box !important;
    }

    /* Desativa linha divisória vertical do Divi */
    html body.woocommerce-checkout #main-content .container:before {
        display: none !important;
    }

    /* 3. Filhos intermediários sem acúmulo de padding lateral */
    html body.woocommerce-checkout #content-area,
    html body.woocommerce-checkout #left-area,
    html body.woocommerce-checkout article,
    html body.woocommerce-checkout .entry-content,
    html body.woocommerce-checkout .woocommerce,
    html body.woocommerce-checkout form.checkout {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        float: none !important;
        box-sizing: border-box !important;
    }

    /* 4. Espaçamento mínimo de 10px entre a barra de upsell e o Header */
    .tc-checkout-top-upsell-wrapper {
        margin: 10px 0 10px 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    .tc-top-upsell-bar {
        padding: 8px 10px !important;
        border-radius: 8px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .tc-top-upsell-heading {
        margin-bottom: 4px !important;
        padding-bottom: 3px !important;
    }

    .tc-top-upsell-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .tc-top-upsell-title {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 4px;
        width: 100%;
    }

    .tc-top-truck-badge {
        display: inline-flex !important;
        align-items: center;
        white-space: nowrap !important;
        font-size: 10px !important;
        padding: 1px 5px !important;
        flex-shrink: 0;
    }

    .tc-top-upsell-title h3 {
        font-size: 13.5px !important;
        line-height: 1.2 !important;
        flex: 1;
        min-width: 160px;
    }

    .tc-top-upsell-counter {
        display: none;
    }

    /* Abas em formato de Chips/Pills no Mobile */
    .tc-top-upsell-tabs-nav {
        gap: 6px;
        padding-bottom: 4px;
        margin-bottom: 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tc-top-upsell-tabs-nav::-webkit-scrollbar {
        display: none;
    }

    .tc-top-tab-btn {
        flex: 0 0 auto !important;
        min-width: 145px !important;
        padding: 6px 10px !important;
        border-radius: 8px !important;
    }

    .tc-top-tab-header {
        margin-bottom: 3px;
    }

    .tc-top-tab-name {
        font-size: 13px !important;
        font-weight: 700 !important;
    }

    .tc-top-tab-badge {
        font-size: 11px !important;
        padding: 2px 5px !important;
    }

    .tc-top-tab-progress {
        height: 4px !important;
    }

    .tc-top-free-congrats {
        padding: 8px 10px !important;
        font-size: 13px !important;
        margin-bottom: 6px !important;
    }

    /* Carrossel Touch no Mobile com Scroll Suave */
    .tc-carousel-nav {
        display: none !important;
    }

    .tc-top-products-track {
        gap: 8px !important;
        padding: 4px 2px !important;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }

    /* Card Mobile Ampliado e Otimizado para Touch */
    .tc-top-product-card {
        flex: 0 0 155px !important;
        max-width: 165px !important;
        padding: 10px 8px 8px 8px !important;
        border-radius: 10px !important;
        min-height: 215px !important;
        box-sizing: border-box !important;
    }

    .tc-card-thumb {
        width: 68px !important;
        height: 68px !important;
        margin-bottom: 6px !important;
        border-radius: 6px !important;
    }

    .tc-card-zera-badge {
        font-size: 10px !important;
        padding: 2px 5px !important;
        top: 4px !important;
        right: 4px !important;
    }

    .tc-card-title {
        font-size: 13px !important;
        height: auto !important;
        min-height: 34px !important;
        max-height: 34px !important;
        line-height: 1.3 !important;
        font-weight: 700 !important;
        -webkit-line-clamp: 2 !important;
        margin-bottom: 4px !important;
        word-break: break-word !important;
    }

    .tc-card-price {
        font-size: 15px !important;
        font-weight: 800 !important;
        margin-bottom: 4px !important;
    }

    .tc-card-price del {
        font-size: 11.5px !important;
    }

    .tc-card-add-btn {
        padding: 7px 10px !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        border-radius: 6px !important;
        margin-top: auto !important;
        min-height: 34px !important;
    }
}

/* ==========================================================================
   6. ALINHAMENTO DE THUMBNAILS, TIPOGRAFIA E SELETORES (PADRÃO MINI-CART)
   ========================================================================== */

.sc-mc-thumb, 
.sc-item-thumb {
    position: relative !important;
    width: 96px !important;
    height: 96px !important;
    min-width: 96px !important;
    flex-shrink: 0 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
}

.sc-mc-thumb img, 
.sc-item-thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    transform: scale(1.06) !important;
}

.sc-cart-item .sc-item-name,
.sc-mini-cart-item .sc-mc-name {
    font-size: 17.5px !important;
    font-weight: 700 !important;
    color: #082c4b !important;
    line-height: 1.35 !important;
    margin-bottom: 6px !important;
}

.sc-cart-item .sc-mc-price,
.sc-cart-item .sc-item-total {
    font-size: 19.5px !important;
    font-weight: 800 !important;
    color: #082c4b !important;
}

.sc-cart-item .sc-mc-price del {
    font-size: 14.5px !important;
    color: #94a3b8 !important;
    font-weight: 500 !important;
}

.sc-cart-item .sc-mc-discount-tag {
    font-size: 12.5px !important;
    font-weight: 800 !important;
    background: #082c4b !important;
    color: #fff !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
}

.sc-qty-minus,
.sc-qty-plus {
    width: 36px !important;
    height: 34px !important;
    min-width: 36px !important;
    background: #f6a800 !important;
    color: #ffffff !important;
    font-size: 19px !important;
    font-weight: 900 !important;
    border-radius: 7px !important;
    box-shadow: 0 1px 2px rgba(246, 168, 0, 0.35) !important;
}

.sc-qty-input {
    width: 36px !important;
    height: 34px !important;
    font-size: 17px !important;
    font-weight: 800 !important;
    color: #082c4b !important;
}

.sc-mc-remove, 
.sc-item-remove-link {
    position: absolute !important;
    top: 5px !important;
    left: 5px !important;
    width: 26px !important;
    height: 26px !important;
    border-radius: 6px !important;
    color: #64748b !important;
    text-decoration: none !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid #cbd5e1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12) !important;
    z-index: 20 !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
    pointer-events: auto !important;
}

.sc-mc-remove svg,
.sc-item-remove-link svg,
.sc-mc-remove svg *,
.sc-item-remove-link svg * {
    pointer-events: none !important;
}

.sc-mc-remove:hover, 
.sc-item-remove-link:hover {
    color: #ef4444 !important;
    background: #fee2e2 !important;
    border-color: #fca5a5 !important;
    transform: scale(1.05) !important;
}

@media (max-width: 480px) {
    .sc-mc-thumb,
    .sc-item-thumb {
        width: 90px !important;
        height: 90px !important;
        min-width: 90px !important;
    }

    .sc-cart-item .sc-item-name,
    .sc-mini-cart-item .sc-mc-name {
        font-size: 16.5px !important;
    }

    .sc-cart-item .sc-mc-price,
    .sc-cart-item .sc-item-total {
        font-size: 18px !important;
    }
}

/* Oculta aviso de envio não incluso quando todos os fornecedores atingirem envio grátis garantido */
.tc-mini-cart-upsell-container.tc-all-free ~ .sc-shipping-notice,
.tc-mini-cart-upsell-container.tc-all-free ~ * .sc-shipping-notice,
.tc-all-free-active .sc-shipping-notice {
    display: none !important;
}

/* Ocultação de cupom e proteção de cliques */
.sc-coupon-section, .sc-mc-coupon-section, .woocommerce-form-coupon-toggle, .checkout_coupon { display: none !important; }
.sc-mini-cart-drawer.loading::before, .sc-mini-cart-drawer.loading::after { pointer-events: none !important; }

/* 7. CORREÇÃO BUG PHOTOSWIPE NO RODAPÉ DO CHECKOUT */
body.woocommerce-checkout #photoswipe-fullscreen-dialog,
body.woocommerce-checkout .pswp,
#photoswipe-fullscreen-dialog.pswp {
    display: none !important; visibility: hidden !important; opacity: 0 !important;
    height: 0 !important; width: 0 !important; max-height: 0 !important; max-width: 0 !important;
    margin: 0 !important; padding: 0 !important; border: none !important; overflow: hidden !important;
    pointer-events: none !important; position: absolute !important; clip: rect(0, 0, 0, 0) !important;
}
