/**
 * woocommerce.css - VERSÃO 1.9.8
 * CORREÇÃO: Lupa alinhada via Flexbox (Sem flutuar) + Grid Mobile 2 Colunas.
 */

/* =======================================================
   1. GERAL & HOME
   ======================================================= */
.woocommerce-page .site-main { padding: 40px 0; background-color: #fafafa; }
.woocommerce ul.products::before, .woocommerce ul.products::after { display: none !important; }

.price { color: var(--primary-color); font-weight: 800; letter-spacing: -0.5px; }
.price del { color: #aaa; opacity: 0.6; font-weight: 400; font-size: 0.85em; margin-right: 5px; }

/* Grid da Home */
body.home ul.products, body.archive ul.products, body.search ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 30px !important;
    margin-bottom: 50px !important;
    width: 100% !important;
}

/* Card Produto */
body.home ul.products li.product, body.archive ul.products li.product {
    background: #fff; border: 1px solid #eaeaea; border-radius: 8px;
    padding-bottom: 20px; display: flex; flex-direction: column; overflow: hidden;
    transition: all 0.3s ease; position: relative;
}
body.home ul.products li.product:hover {
    transform: translateY(-5px); box-shadow: 0 15px 30px rgba(0,0,0,0.08); border-color: transparent;
}

/* Texto Home */
body.home ul.products li.product .woocommerce-loop-product__title {
    padding: 20px 20px 5px !important; font-size: 1rem; font-weight: 600; color: #333;
    min-height: 2.8em; line-height: 1.4; margin-bottom: 5px;
}
body.home ul.products li.product .price { 
    padding: 0 20px !important; margin-top: auto; display: block; font-size: 1.1rem; 
}
/* Tag Oferta Home */
body.home ul.products li.product .onsale {
    position: absolute; top: 15px; left: 15px; background: #FF6B35; color: #fff; 
    padding: 5px 12px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; 
    z-index: 5; box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
/* Botão Home */
body.home ul.products li.product .button {
    margin: 15px 20px 0 !important; background: var(--primary-color); color: #fff !important;
    text-align: center; border-radius: 6px; padding: 10px; font-weight: 700;
    font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.5px;
    display: block !important; visibility: visible !important; opacity: 1 !important;
}

/* Container de Ações do Produto - Home */
body.home ul.products li.product .product-actions {
    padding: 0 20px; margin-top: auto; display: flex !important;
}

body.home ul.products li.product .product-actions .button {
    width: 100%; display: flex !important; flex-direction: column !important;
}

/* Também para páginas de arquivo */
body.archive ul.products li.product .button,
body.search ul.products li.product .button {
    display: block !important; visibility: visible !important; opacity: 1 !important;
}

/* =======================================================
   2. SINGLE PRODUCT
   ======================================================= */
body.single-product .product-top-section { padding: 50px 0; background: #fff; }
body.single-product .product-top-grid { display: grid; grid-template-columns: 55% 40%; gap: 5%; align-items: start; }

/* Tag Oferta Single */
body.single-product span.onsale {
    display: block !important; position: absolute; top: 25px; left: 25px; z-index: 100;
    background-color: #A00000; color: #fff; padding: 8px 18px;
    font-size: 0.85rem; font-weight: 800; text-transform: uppercase;
    border-radius: 4px; box-shadow: 0 4px 15px rgba(160, 0, 0, 0.25); letter-spacing: 1px;
}

/* Galeria */
body.single-product .woocommerce-product-gallery { position: relative; opacity: 1 !important; }
body.single-product .woocommerce-product-gallery__image { border: 1px solid #eee; border-radius: 12px; overflow: hidden; }
body.single-product .woocommerce-product-gallery__image img { width: 100% !important; height: auto !important; display: block; object-fit: contain; }
body.single-product .woocommerce-product-gallery__trigger {
    position: absolute; top: 20px; right: 20px; z-index: 99; background: #fff; border-radius: 50%; width: 45px; height: 45px;
    display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(0,0,0,0.1); text-indent: -9999px; cursor: pointer;
}
body.single-product .woocommerce-product-gallery__trigger::before { content: '🔍'; text-indent: 0; font-size: 18px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #333; }

/* Infos */
body.single-product .product-summary-column { display: flex; flex-direction: column; gap: 25px; }
body.single-product .product_title { font-size: 2.2rem; font-weight: 800; color: #1a1a1a; margin-bottom: 5px; line-height: 1.1; letter-spacing: -1px; }
body.single-product .price { font-size: 2.4rem !important; margin-bottom: 10px; display: block; color: var(--primary-color); }

/* =======================================================
   3. BOTÕES E QUANTIDADE
   ======================================================= */
body.single-product form.cart { 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
    margin-bottom: 30px; 
}

/* Garantir que o formulário simples está visível */
body.single-product form.cart.simple { 
    display: flex !important; 
    flex-direction: column !important; 
    gap: 15px !important; 
    margin-bottom: 30px !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Quantidade */
body.single-product .quantity {
    display: flex !important; align-items: center !important; 
    border: 2px solid #eee !important; border-radius: 50px !important; 
    width: 130px !important; height: 50px !important; 
    background: #fff !important; padding: 0 5px !important;
    margin-bottom: 15px !important;
    visibility: visible !important;
    opacity: 1 !important;
}
body.single-product .quantity-wrapper {
    display: block !important;
    margin-bottom: 15px !important;
    visibility: visible !important;
    opacity: 1 !important;
}
body.single-product .quantity:hover { border-color: #ccc !important; }
body.single-product .quantity input.qty {
    border: none !important; background: transparent !important; 
    width: 50px !important; height: 100% !important; 
    text-align: center !important; font-size: 1.2rem !important; 
    font-weight: 700 !important; color: #333 !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Garantir visibilidade de inputs de quantidade */
body.single-product input[type="number"],
body.single-product input.qty {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}
/* Botões +/- */
body.single-product .quantity button,
body.single-product .quantity .qty-btn,
body.single-product .quantity .plus,
body.single-product .quantity .minus {
    background: transparent !important; background-color: transparent !important;
    border: none !important; color: #999 !important; width: 35px !important; height: 100% !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
    font-size: 1.4rem !important; font-weight: 300 !important;
}
body.single-product .quantity button:hover { color: var(--primary-color) !important; background: transparent !important; }

/* =======================================================
   4. BOTÕES DE AÇÃO
   ======================================================= */
body.single-product button.single_add_to_cart_button {
    width: 100% !important; height: 55px !important; 
    background-color: #25D366 !important; color: #fff !important; 
    border: none !important; border-radius: 8px !important;
    font-size: 1rem !important; font-weight: 800 !important; letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.2);
}
body.single-product button.single_add_to_cart_button:hover { filter: brightness(0.95); transform: translateY(-2px); }

body.single-product button.buy_now_button,
body.single-product .wd-buy-now-btn button,
body.single-product button[name="add-to-cart"] + button, 
body.single-product button.single_add_to_cart_button + button {
    width: 100% !important; height: 55px !important; 
    background-color: #FF6B35 !important; color: #fff !important; 
    border: none !important; border-radius: 8px !important;
    font-size: 1rem !important; font-weight: 800 !important; letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.2);
    margin-top: 10px !important;
}
body.single-product button.buy_now_button:hover { filter: brightness(0.95); transform: translateY(-2px); }

/* Variações */
.variation-row { margin-bottom: 15px; }
.variation-row label { font-size: 0.9rem; font-weight: 700; text-transform: uppercase; margin-bottom: 8px; display: block; color: #555; }
.variation-button span {
    display: flex; align-items: center; justify-content: center;
    min-width: 45px; height: 40px; padding: 0 15px; border: 1px solid #ddd; border-radius: 6px; 
    font-weight: 600; cursor: pointer; color: #555; transition: all 0.2s;
}
.variation-button input:checked + span { 
    background: var(--primary-color); color: #fff; border-color: var(--primary-color); 
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* =======================================================
   5. SIDEBAR
   ======================================================= */
.product-related-box ul.products { display: flex !important; flex-direction: column !important; gap: 20px !important; width: 100% !important; margin: 0 !important; }
.product-related-box ul.products li.product {
    width: 100% !important; background: #fff; border: 1px solid #eaeaea; border-radius: 8px; 
    padding-bottom: 0 !important; margin-bottom: 0 !important; overflow: hidden; height: auto !important;
    transition: all 0.3s;
}
.product-related-box ul.products li.product:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0,0,0,0.05); }

.product-related-box ul.products li.product a img {
    width: 100% !important; height: auto !important; aspect-ratio: 11 / 13 !important; 
    object-fit: cover !important; object-position: top center !important; margin: 0 !important; padding: 0 !important;
    border-bottom: 1px solid #f9f9f9;
}
.product-related-box .product-title, .product-related-box h3 {
    display: block !important; width: 100% !important; box-sizing: border-box !important;
    padding: 15px 20px 5px 20px !important; text-align: left !important;
    font-size: 0.95rem !important; color: #333; font-weight: 700;
}
.product-related-box .product-price-wrapper, .product-related-box .price {
    display: block !important; width: 100% !important; box-sizing: border-box !important;
    padding-left: 20px !important; padding-right: 20px !important; padding-bottom: 20px !important;
    text-align: left !important; font-size: 1.1rem !important; 
}
.product-related-box ul.products li.product .button { display: none !important; }
.product-related-box h3.related-title-custom {
    font-size: 1.1rem; font-weight: 800; text-transform: uppercase;
    border-bottom: 3px solid var(--primary-color); display: inline-block;
    padding-bottom: 5px; margin-bottom: 25px; padding-left: 0 !important; color: #222;
}

/* Extras */
.product-bottom-section { background: #fafafa; padding: 60px 0; border-top: 1px solid #eee; }
.product-bottom-grid { display: grid; grid-template-columns: 1fr 300px; gap: 40px; align-items: start; }
.product-description-column { background: #fff; padding: 40px; border-radius: 12px; border: 1px solid #eee; box-shadow: 0 2px 10px rgba(0,0,0,0.02); }
.product-shipping-box { margin-top: 30px; padding-top: 30px; border-top: 1px solid #eee; }
.shipping-input-group input { border-radius: 6px; border: 1px solid #ddd; height: 48px; }
.shipping-input-group button { border-radius: 6px; height: 48px; font-weight: 700; }

/* =======================================================
   6. HEADER (A SOLUÇÃO DA LUPA - FLEXBOX)
   ======================================================= */
@media (min-width: 992px) {
    .header-top-content {
        display: flex !important; align-items: center !important; justify-content: space-between !important; gap: 30px !important;
    }
    
    .header-search {
        flex: 1 1 auto !important; margin: 0 40px !important; width: 100% !important; max-width: 100% !important;
    }
    
    /* A CÁPSULA BRANCA: Agora é um Flex Container */
    .header-search form.woocommerce-product-search {
        display: flex !important; 
        width: 100% !important; 
        height: 50px !important;
        background-color: #fff !important; 
        border-radius: 4px !important;
        align-items: center !important; 
        position: relative !important;
        border: 1px solid transparent !important;
    }
    
    /* INPUT: Cresce (flex: 1) para empurrar o botão */
    .header-search input.search-field {
        flex: 1 !important; /* Mágica: Ocupa todo o espaço disponível */
        height: 100% !important;
        border: none !important;
        background: transparent !important;
        padding-left: 20px !important;
        padding-right: 10px !important;
        font-size: 1rem !important;
        color: #333 !important;
        border-radius: 4px 0 0 4px !important;
        box-shadow: none !important;
        margin: 0 !important;
    }
    
    /* BOTÃO LUPA: Fixo, não encolhe, não flutua (static/flex) */
    .header-search button[type="submit"] {
        flex-shrink: 0 !important;
        position: static !important; /* Segredo: Fica dentro do fluxo */
        width: 60px !important;
        height: 100% !important;
        background: transparent !important;
        border: none !important;
        border-left: 1px solid #f0f0f0 !important;
        color: #555 !important;
        cursor: pointer !important;
        display: flex !important; align-items: center !important; justify-content: center !important;
        transition: all 0.2s;
        margin: 0 !important;
    }
    .header-search button[type="submit"]:hover { color: var(--primary-color) !important; background-color: #f9f9f9 !important; }
    
    .header-actions { flex-shrink: 0 !important; display: flex !important; gap: 20px !important; }
}

/* =======================================================
   7. HEADER (MOBILE) - Centralizado
   ======================================================= */
@media (max-width: 991px) {
    .header-top-content {
        display: flex !important; flex-direction: column !important;
        align-items: center !important; justify-content: center !important;
        padding: 20px 0 !important; gap: 15px !important;
    }
    .site-branding {
        width: 100% !important; text-align: center !important; margin-bottom: 5px !important;
        display: flex !important; justify-content: center !important;
    }
    .site-branding img { margin: 0 auto !important; max-height: 55px !important; width: auto !important; }
    
    .header-search { width: 100% !important; margin: 0 !important; order: 2 !important; }
    .header-search form.woocommerce-product-search {
        width: 100% !important; height: 45px !important; background: #fff !important;
        border-radius: 4px !important; display: flex !important; position: relative !important;
        align-items: center !important;
    }
    .header-search input.search-field {
        width: 100% !important; height: 100% !important; border: none !important;
        padding: 0 15px !important; background: transparent !important; flex: 1 !important;
    }
    .header-search button[type="submit"] {
        width: 45px !important; height: 100% !important; background: transparent !important;
        border: none !important; color: #555; position: static !important;
        display: flex; align-items: center; justify-content: center;
    }
    .header-actions {
        width: 100% !important; display: flex !important; justify-content: center !important;
        align-items: center !important; gap: 25px !important; order: 3 !important; margin-top: 5px !important;
    }
    .header-actions .whatsapp-button { display: none !important; }
    .header-user, .cart-link {
        display: flex !important; align-items: center !important; color: #fff !important; font-size: 0.9rem !important;
    }
    .header-user svg, .cart-link svg { margin-right: 6px; width: 24px; height: 24px; }
}

/* =======================================================
   8. RESPONSIVIDADE GERAL (2 COLUNAS NO MOBILE)
   ======================================================= */
@media (max-width: 992px) {
    body.home ul.products, body.archive ul.products { grid-template-columns: repeat(3, 1fr) !important; }
    body.single-product .product-top-grid, body.single-product .product-bottom-grid { grid-template-columns: 1fr; gap: 30px; }
    body.single-product .product-details-box { order: 1; }
    body.single-product .product-related-box { order: 2; }
    body.single-product .product-related-box ul.products { display: grid !important; grid-template-columns: repeat(3, 1fr) !important; gap: 15px !important; }
}

/* AQUI ESTÁ A GARANTIA DAS 2 COLUNAS NO MOBILE */
@media (max-width: 767px) {
    body.home ul.products, 
    body.archive ul.products,
    body.search ul.products { 
        grid-template-columns: repeat(2, 1fr) !important; 
        gap: 15px !important; 
    }
    
    body.single-product .product-related-box ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }

    body.home ul.products li.product a img { aspect-ratio: 11 / 13 !important; height: auto !important; padding: 0 !important; }
}

/* =======================================================
   HOME: remover botão "Adicionar ao carrinho" (card clean)
   Motivo: woocommerce.css força display do botão na home.
   ======================================================= */
body.home ul.products li.product .button,
body.home ul.products li.product a.button,
body.home ul.products li.product a.add_to_cart_button,
body.home ul.products li.product a.ajax_add_to_cart,
body.home ul.products li.product .add_to_cart_button,
body.home ul.products li.product .ajax_add_to_cart {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}
