/* Interphysix Catalog - Custom Styles */

/* Hide duplicate "Read more" buttons in product loops */
.woocommerce ul.products li.product .button.product_type_simple,
.woocommerce ul.products li.product a.added_to_cart,
.products .product .woocommerce-loop-product__link + a.button {
    display: none !important;
}

/* Keep only ONE Read more button and style it nicely */
.woocommerce ul.products li.product a.button,
.woocommerce .products .product a.wc-forward,
a.button.product_type_simple {
    display: inline-block !important;
    background: linear-gradient(135deg, #00843D 0%, #006B31 100%) !important;
    color: #fff !important;
    padding: 12px 24px !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(0, 132, 61, 0.3) !important;
    margin-top: 15px !important;
}

.woocommerce ul.products li.product a.button:hover,
a.button.product_type_simple:hover {
    background: linear-gradient(135deg, #006B31 0%, #005528 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 132, 61, 0.4) !important;
    color: #fff !important;
}

/* Product card improvements */
.woocommerce ul.products li.product {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    text-align: center;
}

.woocommerce ul.products li.product:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    transform: translateY(-5px);
}

.woocommerce ul.products li.product .woocommerce-loop-product__title {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #1a1a2e !important;
    padding: 15px 0 10px !important;
    line-height: 1.4 !important;
}

.woocommerce ul.products li.product img {
    border-radius: 8px;
    margin-bottom: 10px;
}

/* Featured products section */
.woocommerce.columns-4 ul.products li.product {
    width: 22% !important;
    margin: 0 1.5% 30px !important;
}

/* Hide prices if in catalog mode */
.woocommerce ul.products li.product .price {
    display: none;
}

/* Search box styling for hero */
.dgwt-wcas-search-wrapp {
    max-width: 600px !important;
    margin: 0 auto !important;
}

.dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input {
    padding: 18px 25px !important;
    font-size: 16px !important;
    border-radius: 50px !important;
    border: 2px solid rgba(255,255,255,0.3) !important;
    background: rgba(255,255,255,0.95) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2) !important;
}

.dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input:focus {
    border-color: #00843D !important;
    box-shadow: 0 4px 25px rgba(0,132,61,0.3) !important;
}

.dgwt-wcas-search-wrapp .dgwt-wcas-search-submit {
    background: #00843D !important;
    border-radius: 0 50px 50px 0 !important;
    padding: 0 25px !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .woocommerce.columns-4 ul.products li.product {
        width: 46% !important;
        margin: 0 2% 20px !important;
    }
}

@media (max-width: 480px) {
    .woocommerce.columns-4 ul.products li.product {
        width: 100% !important;
        margin: 0 0 20px !important;
    }
}

/* === UNIFORMIZAR IMAGENS DOS PRODUTOS === */

/* Container da imagem com altura fixa */
.woocommerce ul.products li.product .woocommerce-loop-product__link {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.woocommerce ul.products li.product a img,
.woocommerce ul.products li.product img {
    width: 100% !important;
    height: 200px !important;
    object-fit: contain !important;
    object-position: center !important;
    background: #f8f9fa;
    border-radius: 8px !important;
    padding: 15px !important;
    box-sizing: border-box !important;
}

/* Para ecrãs maiores, imagens mais altas */
@media (min-width: 992px) {
    .woocommerce ul.products li.product a img,
    .woocommerce ul.products li.product img {
        height: 220px !important;
    }
}

/* Todos os cards com a mesma altura mínima */
.woocommerce ul.products li.product {
    display: flex !important;
    flex-direction: column !important;
    min-height: 380px !important;
}

.woocommerce ul.products li.product .woocommerce-loop-product__link {
    flex: 1 !important;
}

/* Título com altura fixa para alinhar botões */
.woocommerce ul.products li.product .woocommerce-loop-product__title {
    min-height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
}

/* Botão sempre no fundo do card */
.woocommerce ul.products li.product .button {
    margin-top: auto !important;
}

/* === FIX: Alta especificidade para imagens === */
body.woocommerce ul.products li.product a img.attachment-woocommerce_thumbnail,
body.woocommerce ul.products li.product img.attachment-woocommerce_thumbnail,
body.woocommerce-page ul.products li.product a img,
body.woocommerce-page ul.products li.product img,
.woocommerce-shop ul.products li.product img {
    width: 100% !important;
    height: 180px !important;
    object-fit: contain !important;
    object-position: center center !important;
    background-color: #f5f5f5 !important;
    border-radius: 8px !important;
    padding: 10px !important;
    box-sizing: border-box !important;
}

/* Cards com altura uniforme */
body.woocommerce ul.products li.product,
body.woocommerce-page ul.products li.product {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    min-height: 320px !important;
    background: #fff !important;
    border-radius: 10px !important;
    padding: 15px !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06) !important;
    transition: transform 0.2s, box-shadow 0.2s !important;
}

body.woocommerce ul.products li.product:hover,
body.woocommerce-page ul.products li.product:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1) !important;
}

/* Título alinhado */
body.woocommerce ul.products li.product .woocommerce-loop-product__title,
body.woocommerce-page ul.products li.product .woocommerce-loop-product__title {
    font-size: 14px !important;
    font-weight: 600 !important;
    min-height: 40px !important;
    margin: 10px 0 !important;
    line-height: 1.3 !important;
}

/* Botão no fundo */
body.woocommerce ul.products li.product .button,
body.woocommerce-page ul.products li.product a.button {
    margin-top: auto !important;
    width: 100% !important;
    text-align: center !important;
}

/* === WOOCOMMERCE BLOCKS (Gutenberg) === */

/* Product Collection Block - Grid uniforme */
.wp-block-woocommerce-product-collection .wc-block-product-template {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 25px !important;
}

/* Cada produto no bloco */
.wp-block-woocommerce-product-collection .wc-block-product-template > * {
    background: #fff !important;
    border-radius: 10px !important;
    padding: 15px !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06) !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 280px !important;
    transition: transform 0.2s, box-shadow 0.2s !important;
}

.wp-block-woocommerce-product-collection .wc-block-product-template > *:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1) !important;
}

/* Imagens dos blocos - ALTURA UNIFORME */
.wc-block-components-product-image,
.wp-block-woocommerce-product-image {
    width: 100% !important;
    height: 160px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #f8f9fa !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    margin-bottom: 12px !important;
}

.wc-block-components-product-image img,
.wp-block-woocommerce-product-image img {
    max-width: 100% !important;
    max-height: 140px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
}

/* Título do produto no bloco */
.wp-block-woocommerce-product-collection h3,
.wp-block-woocommerce-product-collection .wp-block-post-title {
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    margin: 8px 0 !important;
    flex-grow: 1 !important;
}

/* Botão no bloco */
.wp-block-woocommerce-product-collection .wp-block-button,
.wc-block-components-product-button {
    margin-top: auto !important;
}

.wp-block-woocommerce-product-collection .wp-block-button__link,
.wc-block-components-product-button a {
    width: 100% !important;
    text-align: center !important;
    background: linear-gradient(135deg, #00843D 0%, #006B31 100%) !important;
    color: #fff !important;
    padding: 10px 20px !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    font-size: 13px !important;
}

/* Esconder preço */
.wc-block-components-product-price,
.wp-block-woocommerce-product-price {
    display: none !important;
}

/* Esconder a grelha duplicada do template PHP */
body.woocommerce-shop > .site-content .woocommerce ul.products.columns-4 {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .wp-block-woocommerce-product-collection .wc-block-product-template {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .wp-block-woocommerce-product-collection .wc-block-product-template {
        grid-template-columns: 1fr !important;
    }
}

/* === FIX FINAL: Containers de imagem com altura fixa === */
.wp-block-woocommerce-product-collection .wc-block-product-template li,
.wp-block-woocommerce-product-collection .wc-block-product-template > div {
    display: flex !important;
    flex-direction: column !important;
}

/* Container da imagem - altura fixa absoluta */
.wp-block-woocommerce-product-collection figure.wc-block-components-product-image,
.wp-block-woocommerce-product-collection .wp-block-woocommerce-product-image {
    height: 180px !important;
    min-height: 180px !important;
    max-height: 180px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #f5f5f5 !important;
    border-radius: 8px !important;
    margin: 0 0 15px 0 !important;
    padding: 10px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

/* Imagem dentro - adapta-se ao container */
.wp-block-woocommerce-product-collection figure.wc-block-components-product-image img,
.wp-block-woocommerce-product-collection .wp-block-woocommerce-product-image img {
    max-width: 100% !important;
    max-height: 160px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    margin: 0 auto !important;
}

/* Título - altura mínima para alinhar botões */
.wp-block-woocommerce-product-collection .wp-block-post-title,
.wp-block-woocommerce-product-collection h3.wp-block-post-title {
    min-height: 52px !important;
    font-size: 13px !important;
    line-height: 1.35 !important;
    margin-bottom: 10px !important;
}

/* === HEADER: Esconder título duplicado === */
.ast-site-identity .ast-site-title-wrap,
.site-branding .site-title {
    display: none !important;
}

/* Logo com tamanho adequado */
.site-logo-img img.custom-logo {
    max-height: 45px !important;
    width: auto !important;
}

/* === MARCAS: Logos maiores e organizados === */
/* Secção de marcas na homepage */
div[style*='display:flex'][style*='flex-wrap:wrap'][style*='justify-content:center'] {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 25px !important;
    padding: 30px !important;
    max-width: 1000px !important;
    margin: 0 auto !important;
    flex-wrap: unset !important;
}

div[style*='display:flex'][style*='flex-wrap:wrap'][style*='justify-content:center'] > a {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    background: white !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06) !important;
    transition: all 0.3s ease !important;
    min-height: 90px !important;
}

div[style*='display:flex'][style*='flex-wrap:wrap'][style*='justify-content:center'] > a:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1) !important;
}

div[style*='display:flex'][style*='flex-wrap:wrap'][style*='justify-content:center'] > a img {
    max-height: 60px !important;
    height: auto !important;
    max-width: 150px !important;
    width: auto !important;
    object-fit: contain !important;
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
}

/* Responsive */
@media (max-width: 900px) {
    div[style*='display:flex'][style*='flex-wrap:wrap'][style*='justify-content:center'] {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 600px) {
    div[style*='display:flex'][style*='flex-wrap:wrap'][style*='justify-content:center'] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }
    div[style*='display:flex'][style*='flex-wrap:wrap'][style*='justify-content:center'] > a img {
        max-height: 45px !important;
    }
}

/* === ÁREAS DE ACTUAÇÃO: Melhor design === */
.wp-block-columns.alignwide {
    gap: 25px !important;
}

/* Cards das áreas */
.wp-block-columns.alignwide .wp-block-column .wp-block-group {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%) !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 16px !important;
    padding: 35px 25px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06) !important;
    transition: all 0.3s ease !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

.wp-block-columns.alignwide .wp-block-column .wp-block-group:hover {
    transform: translateY(-6px) !important;
    box-shadow: 0 12px 35px rgba(0,0,0,0.12) !important;
    border-color: #00843D !important;
}

/* Título da área */
.wp-block-columns.alignwide .wp-block-column h3 {
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    color: #1a1a2e !important;
    margin-bottom: 15px !important;
}

/* Descrição */
.wp-block-columns.alignwide .wp-block-column .wp-block-group p {
    color: #64748b !important;
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
    flex-grow: 1 !important;
}

/* Botão Ver Produtos */
.wp-block-columns.alignwide .wp-block-column .wp-block-button__link {
    background: linear-gradient(135deg, #00843D 0%, #006B31 100%) !important;
    color: #fff !important;
    padding: 12px 28px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    text-transform: none !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 3px 10px rgba(0,132,61,0.3) !important;
}

.wp-block-columns.alignwide .wp-block-column .wp-block-button__link:hover {
    background: linear-gradient(135deg, #006B31 0%, #005528 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 5px 15px rgba(0,132,61,0.4) !important;
}

/* Ícones maiores */
.wp-block-columns.alignwide .wp-block-column h3 {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
}

/* === PÁGINAS DE CATEGORIA: Mesmo estilo === */
.woocommerce-page.tax-product_cat ul.products li.product,
.archive.tax-product_cat ul.products li.product {
    background: #fff !important;
    border-radius: 10px !important;
    padding: 15px !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06) !important;
    transition: all 0.2s ease !important;
}

.woocommerce-page.tax-product_cat ul.products li.product:hover,
.archive.tax-product_cat ul.products li.product:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1) !important;
}

.woocommerce-page.tax-product_cat ul.products li.product img,
.archive.tax-product_cat ul.products li.product img {
    height: 160px !important;
    object-fit: contain !important;
    background: #f5f5f5 !important;
    border-radius: 8px !important;
    padding: 10px !important;
}

.woocommerce-page.tax-product_cat ul.products li.product .button,
.archive.tax-product_cat ul.products li.product .button {
    background: linear-gradient(135deg, #00843D 0%, #006B31 100%) !important;
    color: #fff !important;
    padding: 10px 20px !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    width: 100% !important;
    text-align: center !important;
}

/* === PRODUTOS EM DESTAQUE (Homepage) === */
.woocommerce.columns-4 ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 25px !important;
}

.woocommerce.columns-4 ul.products li.product {
    width: 100% !important;
    margin: 0 !important;
    background: #fff !important;
    border-radius: 12px !important;
    padding: 20px !important;
    box-shadow: 0 3px 15px rgba(0,0,0,0.08) !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 320px !important;
}

.woocommerce.columns-4 ul.products li.product:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 8px 25px rgba(0,0,0,0.12) !important;
}

.woocommerce.columns-4 ul.products li.product img {
    width: 100% !important;
    height: 180px !important;
    object-fit: contain !important;
    background: #f5f5f5 !important;
    border-radius: 8px !important;
    padding: 15px !important;
    margin-bottom: 15px !important;
}

.woocommerce.columns-4 ul.products li.product .woocommerce-loop-category__title,
.woocommerce.columns-4 ul.products li.product .woocommerce-loop-product__title {
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    min-height: 45px !important;
    margin: 0 0 10px !important;
    color: #1a1a2e !important;
}

/* Esconder categoria nos produtos destaque */
.woocommerce.columns-4 ul.products li.product .ast-woo-product-category {
    display: none !important;
}

.woocommerce.columns-4 ul.products li.product .button {
    margin-top: auto !important;
    background: linear-gradient(135deg, #00843D 0%, #006B31 100%) !important;
    color: #fff !important;
    padding: 12px 24px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    text-align: center !important;
    width: 100% !important;
}

/* Responsive */
@media (max-width: 992px) {
    .woocommerce.columns-4 ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 576px) {
    .woocommerce.columns-4 ul.products {
        grid-template-columns: 1fr !important;
    }
}
