/*
Theme Name: Ferragens Camboatá - V2 Compacto
Theme URI: https://ferragenscamboata.com.br/
Author: (Seu Nome Aqui)
Author URI: (Seu Site Aqui)
Description: Tema personalizado para a loja de ferragens Camboatá, focado em catálogo via WhatsApp. Versão com botão Ver Mais ao lado do título.
Version: 2.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ferragens-camboata
Tags: woocommerce, custom-theme, e-commerce
*/

/* Nossos estilos CSS começarão aqui embaixo */

body {
    background-color: #f0f0f0;
    font-family: Arial, sans-serif;
    line-height: 1.6;
}

.site-header {
    background-color: #ffffff;
    padding: 20px;
    border-bottom: 2px solid #dddddd;
}

.site-title a {
    text-decoration: none;
    color: #333333;
    font-size: 28px;
    font-weight: bold;
}

.site-footer {
    background-color: #333333;
    color: #ffffff;
    padding: 20px;
    text-align: center;
    margin-top: 30px;
}

/* Hero Section (Banner principal) */
.hero-bg {
    background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('https://teste.ferragenscamboata.com.br/wp-content/uploads/2025/10/atual_novo_banner_ferragenscamboata.jpeg');
    background-size: cover;
    background-position: center center;
    padding-top: 6rem; 
    padding-bottom: 6rem;
    min-height: 50vh; 
    display: flex;
    align-items: center; 
    justify-content: center; 
    text-align: center;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.product-card:hover {
    transform: scale(1.10);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.cart-item:hover {
    background-color: #f9f9f9;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fadeIn {
    animation: fadeIn 0.5s ease-in-out;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2e7d32;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Vamos esconder os estilos antigos que não usamos mais */
.site-header, .site-footer {
    background: none;
    padding: 0;
    border: none;
    color: inherit;
    margin: 0;
}

.site-title a {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

/* Solução Imagem de Produto Quadrada (com corte) */
.woocommerce ul.products li.product .woocommerce-loop-product__link img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: center;
}

/* --- LAYOUT DE CATEGORIAS LADO A LADO (CORRIGIDO) --- */

/* Container principal das categorias - Grid responsivo */
#categoriesContainer {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr)); /* Flexível - mínimo 500px por coluna */
    gap: 2rem;
}

/* Categoria section com altura mínima adequada */
.categoria-section {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 0;
    min-height: 400px; /* Altura mínima para não cortar o conteúdo */
    display: flex;
    flex-direction: column;
}

.categoria-section:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
}

/* Grid dos produtos dentro da categoria - garante que o card tenha espaço */
.categoria-section > div:last-child {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Card do produto com altura adequada */
.categoria-section .product-card {
    min-height: 280px; /* Altura mínima para caber tudo */
    display: flex;
    flex-direction: column;
}

/* Garante que o conteúdo do card seja distribuído corretamente */
.categoria-section .product-card > div:last-child {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Botão ver mais */
.ver-mais-btn {
    white-space: nowrap;
    font-size: 0.875rem;
    flex-shrink: 0; /* Não encolhe */
}

.ver-mais-btn:hover {
    transform: translateX(3px);
}

/* --- RESPONSIVIDADE --- */

/* Telas grandes (acima de 1400px) - 2 colunas confortáveis */
@media (min-width: 1400px) {
    #categoriesContainer {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Telas médias (1024px - 1399px) - Auto-ajusta baseado no espaço */
@media (min-width: 1024px) and (max-width: 1399px) {
    #categoriesContainer {
        grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
        gap: 1.5rem;
    }
}

/* Tablets (768px - 1023px) - 1 coluna */
@media (min-width: 768px) and (max-width: 1023px) {
    #categoriesContainer {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .categoria-section {
        min-height: 350px;
    }
}

/* Mobile (até 767px) */
@media (max-width: 767px) {
    #categoriesContainer {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .categoria-section {
        min-height: auto; /* Remove altura mínima em mobile */
    }
    
    .categoria-section .flex.justify-between {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }

    .categoria-section .ver-mais-btn {
        width: 100%;
        justify-content: center;
    }
    
    .categoria-section .product-card {
        min-height: auto; /* Remove altura mínima em mobile */
    }
}

/* Ajuste especial para zoom - mantém lado a lado até 1200px */
@media (min-width: 1200px) {
    #categoriesContainer {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ================================================
   🖼️ LIGHTBOX - Visualização de Imagens Grande
   CSS SUPER REFORÇADO - Versão 1.9.0
   ================================================ */

/* Lightbox Container - Fundo escuro em tela cheia */
#imageLightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-sizing: border-box;
}

/* IMPORTANTE: Esconder o lightbox quando tem classe hidden */
#imageLightbox.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Wrapper do conteúdo do lightbox */
#imageLightbox .lightbox-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 95vw;
    max-height: 95vh;
}

/* ⭐ IMAGEM - A estrela do show! GRANDE E VISÍVEL */
#lightboxImage {
    max-width: 90vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    cursor: zoom-out;
    background: #fff;
}

/* Legenda da imagem */
#lightboxCaption {
    color: #ffffff;
    background: rgba(0, 0, 0, 0.7);
    padding: 12px 24px;
    border-radius: 25px;
    text-align: center;
    margin-top: 20px;
    font-size: 18px;
    font-weight: 500;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    max-width: 80vw;
}

/* Botão de Fechar (X) - Bem visível */
#closeLightboxBtn {
    position: fixed;
    top: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.95);
    color: #333333;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 28px;
    font-weight: bold;
    line-height: 50px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    z-index: 100000;
}

#closeLightboxBtn:hover {
    background: #f44336;
    color: #ffffff;
    transform: scale(1.1) rotate(90deg);
}

/* Responsividade Mobile */
@media (max-width: 768px) {
    #imageLightbox {
        padding: 10px;
    }

    #lightboxImage {
        max-width: 95vw;
        max-height: 70vh;
    }

    #lightboxCaption {
        font-size: 14px;
        padding: 10px 16px;
        margin-top: 15px;
        max-width: 95vw;
    }

    #closeLightboxBtn {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 22px;
        line-height: 40px;
    }
}

/* Animações suaves */
@keyframes lightboxFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes lightboxZoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

#imageLightbox:not(.hidden) {
    animation: lightboxFadeIn 0.3s ease;
}

#imageLightbox:not(.hidden) #lightboxImage {
    animation: lightboxZoomIn 0.3s ease;
}

/* Prevenir scroll no body quando lightbox aberto */
body.lightbox-open {
    overflow: hidden !important;
}