/**
 * Customizações do Tema Storefront Toro
 * 
 * Este arquivo contém todas as customizações de CSS do tema filho.
 * Mantido separado para melhor organização, cache e performance.
 * 
 * @package Storefront Toro
 * @version 2.0.1
 */

/* =========================
   LAYOUT E ESTRUTURA
   ========================= */

/**
 * Customização do container principal
 * Reduz de 1260px para 1024px e remove padding
 */
.col-full {
    max-width: 1024px !important;
    padding: 0 !important;
}

/**
 * Ocultar TODAS as mensagens/alertas do WooCommerce
 * Mensagens customizadas serão desenvolvidas separadamente quando necessário
 */
div.woocommerce-message,
div.woocommerce-error,
div.woocommerce-info,
.woocommerce-message,
.woocommerce-error,
.woocommerce-info,
.woocommerce-notices-wrapper,
.woocommerce ul.woocommerce-error,
.woocommerce ul.woocommerce-info,
.woocommerce ul.woocommerce-message {
    display: none !important;
}

/* =========================
   TIPOGRAFIA - ROBOTO
   ========================= */

/**
 * Aplica fonte Roboto em todo o site
 * Sobrescreve a fonte padrão do tema pai (Source Sans Pro)
 */
body,
button,
input,
select,
optgroup,
textarea,
h1, h2, h3, h4, h5, h6,
p, div, span,
a, li, td, th,
.site-title,
.site-description,
.main-navigation,
.site-content,
.widget,
.product,
.woocommerce,
.entry-title,
.entry-content,
.page-title,
.site-header,
.site-footer {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif !important;
}

/* Ajustes específicos de peso e tamanho */
.site-header .site-title {
    font-family: 'Roboto', sans-serif !important;
    font-weight: 500;
}

.main-navigation a {
    font-family: 'Roboto', sans-serif !important;
    font-weight: 400;
}

.woocommerce div.product .product_title {
    font-family: 'Roboto', sans-serif !important;
    font-weight: 500;
}

.woocommerce ul.products li.product h3,
.woocommerce ul.products li.product .woocommerce-loop-product__title {
    font-family: 'Roboto', sans-serif !important;
    font-weight: 400;
}

/* Botões do WooCommerce */
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit,
.woocommerce a.button.alt,
.woocommerce button.button.alt,
.woocommerce input.button.alt,
.woocommerce #respond input#submit.alt {
    font-family: 'Roboto', sans-serif !important;
    font-weight: 500;
}

/* Força Roboto em todos os elementos (fallback) */
* {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif !important;
}

/* =========================
   TABELA DO CARRINHO - CUSTOMIZAÇÕES
   ========================= */

/**
 * Layout da tabela do carrinho
 * - Imagem maior
 * - Nome, descrição e preço empilhados
 * - Botão remover no final
 */

/* Linha do produto - usar flexbox para reordenar */
#toro-cart-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 0px;
}

/* Primeiro item do carrinho */
#toro-cart-table tbody tr:first-child {
    padding-top: 20px;
}

/* Penúltimo item do carrinho */
#toro-cart-table tbody tr:nth-last-child(2) {
    padding-bottom: 20px;
}

#toro-cart-table td {
    padding: 5px 30px;
}

#toro-cart-table .woocommerce-cart-form__cart-item {
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
}

/* Colunas da tabela - ordem natural do HTML */
#toro-cart-table .product-thumbnail {
    flex: 0 0 150px;
}

#toro-cart-table .product-name {
    flex: 1;
    padding-left: 0px;
    display: flex;
    flex-direction: column;
    gap: 0px;
}

#toro-cart-table .product-remove {
    flex: 0 0 auto;
    margin-left: auto;
}

/* Imagem do produto - aumentar tamanho */
#toro-cart-table .product-thumbnail img {
    max-width: 230px !important;
    width: 230px;
    height: auto;
    border-radius: 0px;
}

/* Nome do produto */
#toro-cart-table .product-name h3 {
    font-weight: 700;
    margin: 0;
    line-height: normal;
}

#toro-cart-table .product-name a {
    font-size: 18px;
    font-weight: 500;
    color: #333;
    text-decoration: none;
}

#toro-cart-table .product-name a:hover {
    color: #5768FF;
}

/* Descrição do produto */
#toro-cart-table .product-short-description {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
    margin-top: 5px;
    max-width: 400px;
}

/* Preço do produto - estilizar dentro da coluna de nome */
#toro-cart-table .product-name .product-price-inline {
    margin-top: 8px;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

#toro-cart-table .product-name .product-price-inline {
    font-size: 15px;
    font-weight: 400;
    color: #000;
}

/* Preço com desconto */
#toro-cart-table .product-price-inline .original-price {
    opacity: 0.6;
    margin-right: 5px;
}

#toro-cart-table .product-price-inline .discounted-price {
    color: #28a745;
    font-weight: 600;
}

#toro-cart-table .product-price-inline .payment-info {
    font-size: 0.9em;
    color: #666;
    font-weight: 400;
}

/* Botão remover - estilizar com ícone SVG */
#toro-cart-table .product-remove a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: #999;
    border-radius: 50%;
    font-size: 0;
    text-decoration: none;
    transition: all 0.3s ease;
    background-image: url('../images/trash-icon.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 18px 18px;
}

#toro-cart-table .product-remove a:hover {
    background-color: #f5f5f5;
}

/* Esconder colunas que não são necessárias no layout mobile-first */
#toro-cart-table .product-quantity,
#toro-cart-table .product-subtotal {
    display: none;
}

#toro-cart-table .actions {
    background-color: #f1f1f1;
    padding: 5px 20px;
    width: 100%;
    border-radius: 0 0 20px 20px;
    border: 1px solid #d9d9d9;
    border-top: none;

}

#toro-cart-table .actions .coupon .coupon-fields {
    background-color: #fff;
    border-top-left-radius: 20px;
    border-bottom-left-radius: 20px;
    border-top-right-radius: 50px;
    border-bottom-right-radius: 50px;
}

#toro-cart-table .actions .coupon input {
    background-color: transparent;
    box-shadow: none;
}
    
#toro-cart-table .actions .coupon button {
    border-radius: 50px;
    background-color: #5768FF;
}

/* Cupons aplicados - Desktop */
#toro-cart-table .actions .coupon .applied-coupons-title {
    font-weight: 600;
    color: #333;
    display: inline;
}

#toro-cart-table .actions .coupon .coupon-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

#toro-cart-table .actions .coupon .coupon-code {
    font-weight: 400;
    color: #333;
    text-transform: uppercase;
}

#toro-cart-table .actions .coupon .remove-coupon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: #999;
    border-radius: 50%;
    font-size: 0;
    text-decoration: none;
    transition: all 0.3s ease;
    background-image: url('../images/trash-icon.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 14px 14px;
}

#toro-cart-table .actions .coupon .remove-coupon:hover {
    background-color: #f5f5f5;
}

/* Responsivo - mostrar mais informações em telas maiores */
@media (min-width: 768px) {
    #toro-cart-table .product-quantity,
    #toro-cart-table .product-subtotal {
        display: block;
    }
}

/* =========================
   AÇÕES DO CARRINHO - CUPOM E CHECKOUT
   ========================= */

/**
 * Layout da linha de ações (cupom + subtotal + botão avançar)
 * Cupom à esquerda, subtotal e botão à direita
 */
.cart-actions-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 10px 0;
}

.cart-actions-left {
    flex: 0 0 auto;
}

.cart-actions-right {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
}

/* Subtotal inline */
.cart-subtotal-inline {
    display: flex;
    align-items: start;
    gap: 10px;
}

.cart-subtotal-inline .subtotal-label {
    font-size: 19px;
    font-weight: 600;
    color: #333;
}

.cart-subtotal-inline .subtotal-value {
    font-size: 19px;
    font-weight: 400;
    color: #333;
}

/* Botão Avançar */
.cart-actions-right .checkout-button {
    background-color: #02A7A9;
    color: #fff;
    padding: 8px 60px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

/* Remove a seta do ::after */
.cart-actions-right .checkout-button::after {
    content: none !important;
    display: none !important;
}

.cart-actions-right .checkout-button:hover {
    background-color: #088688;
    color: #fff;
}

/* Esconder botão update_cart (já está escondido no plugin) */
.actions button[name="update_cart"] {
    display: none !important;
}

/* Responsivo */
@media (max-width: 768px) {
    .cart-actions-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .cart-actions-right {
        margin-left: 0;
        justify-content: space-between;
    }
    
    .cart-subtotal-inline .subtotal-label,
    .cart-subtotal-inline .subtotal-value {
        font-size: 20px;
    }
    
    .cart-actions-right .checkout-button {
        padding: 12px 30px;
        font-size: 16px;
    }
}

/* =========================
   RESPONSIVO MOBILE - CARRINHO
   ========================= */

@media (max-width: 768px) {
    /* Ajuste do step ativo - seta */
    #toro-cart .checkout-steps .step.active::after {
        border-bottom: 23px solid transparent !important;
        border-top: 24px solid transparent !important;
    }

    /* Ajuste de bordas */
    #toro-cart-table .woocommerce-cart-form__cart-item {
        padding-top: 15px;
    }

    #toro-cart-table tbody tr {
        padding-bottom: 15px!important;
    }
    
}

@media (max-width: 480px) {
    /* Header com padding-bottom */
    .site-header {
        padding-bottom: 20px !important;
    }
    
    /* Container e tabela - 100% da tela sem overflow */
    #toro-cart-table {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
    
    #toro-cart-table tbody,
    #toro-cart-table tbody tr {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Layout flexbox wrap para mobile */
    #toro-cart-table tbody tr {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: flex-start !important;
        gap: 10px !important;
        box-sizing: border-box !important;
    }
    
    /* Remove padding de todas as células */
    #toro-cart-table td {
        padding: 0 !important;
    }
    
    /* Ajuste de bordas */
    #toro-cart-table .woocommerce-cart-form__cart-item {
        border-left: none !important;
        border-right: none !important;
        border-bottom: 1px solid #e0e0e0 !important;
    }


    /* Imagem do produto - retângulo horizontal cortado à esquerda (apenas mobile) */
    #toro-cart-table .product-thumbnail,
    #toro-cart-table td.product-thumbnail {
        flex: 0 0 130px !important;
        width: 130px !important;
        height: 120px !important;
        max-width: 130px !important;
        min-width: 130px !important;
        margin-bottom: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        display: block !important;
    }
    
    #toro-cart-table .product-thumbnail img,
    #toro-cart-table td.product-thumbnail img {
        max-width: none !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 120px !important;
        object-fit: cover !important;
        object-position: left center !important;
        display: block !important;
    }
    
    #toro-cart-table .woocommerce-cart-form__cart-item {
        margin-bottom: 0px !important;
    }

    /* Nome do produto - coluna do meio com flex wrap interno */
    #toro-cart-table .product-name {
        flex: 1;
        min-width: 0;
        max-width: calc(100% - 130px - 40px);
        padding-left: 10px;
        padding-right: 10px;
        margin-bottom: 0;
        display: flex;
        flex-wrap: wrap;
        align-content: flex-start;
    }
    
    /* Título menor e mais compacto - 100% da coluna */
    #toro-cart-table .product-name a {
        flex: 0 0 100%;
        font-size: 14px;
        font-weight: 600;
        line-height: 1.3;
        margin-bottom: 5px;
    }
    
    /* Descrição - oculta no mobile */
    #toro-cart-table .product-name .product-short-description {
        display: none !important;
    }
    
    /* Preço - 100% da coluna, abaixo do título */
    #toro-cart-table .product-name .product-price-inline {
        flex: 0 0 100%;
        width: 100%;
        font-size: 14px;
        margin-top: 5px;
        font-weight: 600;
    }
    
    /* Payment info em bloco no mobile */
    #toro-cart-table .product-price-inline .payment-info {
        display: block;
    }
    
    /* Botão remover - coluna da direita */
    #toro-cart-table .product-remove {
        flex: 0 0 40px;
        width: 40px;
        text-align: right;
        align-self: flex-start;
        order: 3;
        border-top: 0px;
    }
    
    #toro-cart-table .product-remove a {
        display: inline-block;
        width: 24px;
        height: 24px;
    }
    
    /* Padding das células */
    #toro-cart-table td {
        padding: 0;
    }
        
    /* Cupom - container centralizado com flex */
    #toro-cart-table .actions {
        padding: 15px!important;
    }

    #toro-cart-table .actions .coupon .coupon-fields {
        width: 95% !important;
        margin: 0 auto !important;
        display: flex !important;
        gap: 10px !important;
        align-items: center !important;
        height: 45px;
    }
    
    /* Cupons aplicados */
    #toro-cart-table .actions .coupon .applied-coupons-title {
        font-weight: 600;
        color: #333;
        display: inline;
    }
    
    #toro-cart-table .actions .coupon .coupon-item {
        display: inline-flex;
        align-items: center;
        gap: 10px;
    }
    
    #toro-cart-table .actions .coupon .coupon-code {
        font-weight: 400;
        color: #333;
        text-transform: uppercase;
    }
    
    #toro-cart-table .actions .coupon .remove-coupon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
        color: #999;
        border-radius: 50%;
        font-size: 0;
        text-decoration: none;
        transition: all 0.3s ease;
        background-image: url('../images/trash-icon.png');
        background-repeat: no-repeat;
        background-position: center;
        background-size: 14px 14px;
    }
    
    #toro-cart-table .actions .coupon .remove-coupon:hover {
        background-color: #f5f5f5;
    }
    
    /* Campo de input do cupom */
    #toro-cart-table .actions .coupon input {
        flex: 1 !important;
    }
    
    /* Botão aplicar cupom */
    #toro-cart-table .actions .coupon button {
        flex-shrink: 0 !important;
    }
    
    /* Container subtotal e botão avançar */
    .cart-actions-right {
        width: 90% !important;
        margin: 0 auto !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    /* Botão avançar full width e centralizado */
    .cart-actions-right .checkout-button {
        width: 100% !important;
        text-align: center !important;
    }
}
