/* =================================================================== */
/* ARQUIVO DE ESTILO DEFINITIVO - Farma Rocha                          */
/* Refatorado para padronização completa, design moderno e responsivo. */
/* =================================================================== */

/* --- 1. VARIÁVEIS DE COR E CONFIGURAÇÕES GLOBAIS --- */
:root {
    --farma-rocha-amarelo: #FFC107;
    --farma-rocha-vermelho: #DC3545;
    --farma-rocha-preto: #212529;
    --farma-rocha-cinza: #6c757d;
}

body {
    padding-top: 70px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #f0f2f5;
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}


/* =================================================================== */
/* 2. O GABARITO DO CARD DE PRODUTO (SOLUÇÃO REFORÇADA)                */
/* Este bloco agora controla o card em TODAS as telas.                */
/* =================================================================== */

.product-card {
    display: flex;
    flex-direction: column;
    height: 100%; /* Força altura total, essencial para alinhar linhas */
    border-radius: 0.75rem;
    transition: all 0.3s ease-in-out;
    overflow: hidden;
    border: none;
    background-color: #ffffff;
}
.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.18) !important;
}
.product-card a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.product-card .card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}
.product-image-container {
    width: 100%;
    aspect-ratio: 1 / 1; /* Força o contêiner a ser um quadrado */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 0.5rem;
}
.product-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Usa 'contain' para mostrar o produto inteiro */
    transition: transform 0.3s ease-in-out;
}
.product-card:hover .product-image-container img {
    transform: scale(1.05);
}
.product-info-container {
    flex-grow: 1; /* Empurra o preço para baixo */
}
.product-name {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--farma-rocha-preto);
    min-height: 2.8em; /* Reserva espaço para 2 linhas de texto */
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.product-section-info {
    font-size: 0.8rem;
    color: var(--farma-rocha-cinza);
    min-height: 1.2em;
    margin-bottom: 0.75rem;
}
.product-price-buy-container {
    margin-top: auto; /* A MÁGICA: alinha o preço e o botão na base */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid #eee;
}
.product-price-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 52px;
}
.product-price-details .preco-antigo {
    font-size: 0.85rem;
    text-decoration: line-through;
    color: var(--farma-rocha-cinza);
}
.product-price-details .preco-novo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--farma-rocha-vermelho);
}
.product-price-details .preco-normal {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--farma-rocha-preto);
}
.product-buy-button .btn {
    width: 48px;
    height: 48px;
    font-size: 1.2rem;
    border-radius: 50% !important;
    flex-shrink: 0;
    transition: all 0.2s ease-in-out;
}
.product-buy-button .btn:hover {
    transform: scale(1.1);
}

/* =================================================================== */
/* 3. LAYOUT RESPONSIVO DO CATÁLOGO                                   */
/* =================================================================== */

/* --- OTIMIZAÇÃO PARA MOBILE: 1 PRODUTO POR LINHA --- */

/* --- ORDEM DO MENU LATERAL NO MOBILE --- */
@media (max-width: 991px) { /* Ativa em tablets e celulares */
    .catalogo-container {
        display: flex; /* Necessário para a propriedade 'order' funcionar */
        flex-direction: column;
    }
    .catalogo-produtos {
        order: 1; /* Produtos primeiro */
    }
    .catalogo-sidebar {
        order: 2; /* Filtros depois */
        margin-top: 30px;
    }
}

/* O resto do seu CSS (banner, footer, barra de carrinho, etc.) continua aqui... */

/* =================================================================== */
/* 4. ESTILOS DE COMPONENTES (CARROSSÉIS, FOOTER, ETC)                 */
/* =================================================================== */

.section-title {
    font-weight: 700;
    color: #333;
    border-left: 4px solid var(--farma-rocha-amarelo);
    padding-left: 1rem;
}

.bg-primary {
    background-color: var(--farma-rocha-amarelo) !important;
}

.footer {
    background-color: var(--farma-rocha-preto) !important;
    color: white !important;
}
.footer a {
    color: var(--farma-rocha-amarelo) !important;
}

.product-carousel-wrapper {
    position: relative;
}
.product-carousel {
    display: flex;
    overflow-x: auto;
    gap: 1rem;
    padding: 1rem;
    scroll-snap-type: x mandatory;
}
.product-carousel::-webkit-scrollbar { display: none; }
.product-carousel { -ms-overflow-style: none; scrollbar-width: none; }

.carousel-product-item {
    scroll-snap-align: start;
    flex: 0 0 220px;
}
.carousel-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background-color: white;
    border: 1px solid #ddd;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: none;
}
.carousel-nav-btn.prev-btn { left: -15px; }
.carousel-nav-btn.next-btn { right: -15px; }

@media (min-width: 768px) {
    .carousel-product-item {
        flex: 0 0 250px;
    }
    .carousel-nav-btn {
        display: block;
    }
}

/* =================================================================== */
/* 5. ANIMAÇÕES CUSTOMIZADAS (NOVO)                                    */
/* =================================================================== */

/* Animação de pulsar para o selo de oferta */
@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
  }
  70% {
    transform: scale(1.1);
    box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
  }
}

.promo-badge-pulse {
  /* Aplica a animação 'pulse' ao elemento */
  animation: pulse 2s infinite;
}
/* Adicione estas seções ao seu arquivo style.css */

/* Adicione estas seções ao final do seu arquivo style.css */

/* --- Estilos para a Barra de Pesquisa com Sugestões --- */
.search-container {
    position: relative;
    flex-grow: 1;
    max-width: 500px; /* Limita a largura da barra de pesquisa */
}

.search-results-wrapper {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0 0 0.375rem 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    display: none; /* Começa oculto */
}

.search-results-wrapper .list-group-item {
    border: none;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

.search-results-wrapper .list-group-item:last-child {
    border-bottom: none;
}

.search-results-wrapper .list-group-item:hover {
    background-color: #f8f9fa;
}

.search-item-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin-right: 15px;
    border-radius: 0.25rem;
}

.search-item-info .nome-produto {
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.25rem;
}

.search-item-info .preco-final {
    font-weight: 700;
    color: #dc3545;
}

.search-item-info .preco-original {
    font-size: 0.85rem;
    text-decoration: line-through;
    color: #6c757d;
}

/* --- Estilos para Filtros com Scroll --- */
.filter-list-scrollable {
    max-height: 250px;
    overflow-y: auto;
    padding-right: 10px;
}

/* Customização da barra de rolagem (opcional) */
.filter-list-scrollable::-webkit-scrollbar {
  width: 8px;
}
.filter-list-scrollable::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}
.filter-list-scrollable::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 10px;
}
.filter-list-scrollable::-webkit-scrollbar-thumb:hover {
  background: #999;
}
/* =============================================== */
/* OTIMIZAÇÃO DO CATÁLOGO PARA DISPOSITIVOS MÓVEIS */
/* =============================================== */



/* Ajuste opcional para garantir que as imagens dentro dos cards se comportem bem */
.card-produto img {
    max-width: 100%;
    height: auto;
    object-fit: cover; /* Garante que a imagem cubra o espaço sem distorcer */
}
/* ========================================= */
/* OTIMIZAÇÃO DA HOMEPAGE E ELEMENTOS GERAIS */
/* ========================================= */

/* Garante que os containers principais da home se adaptem */
.home-container, .home-section {
    display: flex;
    flex-direction: column; /* Organiza os filhos em coluna por padrão */
    width: 100%;
    padding: 15px;
}

/* Em telas maiores (desktop), permite que os elementos fiquem lado a lado se necessário */
@media (min-width: 768px) {
    .home-container, .home-section {
        flex-direction: row; /* Volta ao layout de linha em telas maiores */
        justify-content: space-between;
        align-items: center;
    }
}

/* Garante que imagens na home nunca ultrapassem a largura da tela */
.home-section img {
    max-width: 100%;
    height: auto;
    margin-bottom: 15px; /* Espaçamento abaixo da imagem no mobile */
}

@media (min-width: 768px) {
    .home-section img {
        margin-bottom: 0;
    }
}
/* ========================================================== */
/* ESTILIZAÇÃO FINAL DO BANNER DA HOMEPAGE (PC E MOBILE) */
/* ========================================================== */

/* 1. Estilo BASE para o banner (se aplica a ambos) */
.banner-container .carousel {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px B2px rgba(0, 0, 0, 0.1);
}

.banner-container .carousel-item img {
    display: block;
    width: 100%;
    object-fit: cover; /* Cobre o espaço sem distorcer */
    object-position: center; /* Centraliza a imagem antes de cortar */
}

/* 2. Estilo para DESKTOP (telas MAIORES que 767px) */
.banner-container .carousel-item img {
    height: 400px; /* Altura padrão para desktop. Ajuste se desejar. */
}

/* 3. Estilo para MOBILE (telas com 767px de largura OU MENOS) */
/* Este valor agora corresponde EXATAMENTE ao do seu HTML */
@media (max-width: 767px) {
    .banner-container .carousel-item img {
        height: 200px; /* Altura específica para mobile. Ajuste se desejar. */
    }
}
/* ================================================================= */
/* CSS FINAL E UNIFICADO PARA O CATÁLOGO (PC E MOBILE)               */
/* ================================================================= */



/* 2. OTIMIZAÇÃO PARA MOBILE: 1 PRODUTO POR LINHA */

/* 3. ORDEM DO MENU LATERAL NO MOBILE */
@media (max-width: 991px) {
    .catalogo-container {
        flex-direction: column;
    }
    .catalogo-produtos {
        order: 1; /* Produtos primeiro */
    }
    .catalogo-sidebar {
        order: 2; /* Filtros depois */
        margin-top: 30px;
    }
}

/* =============================== */
/* BARRA FIXA DO CARRINHO (MOBILE) */
/* =============================== */

.fixed-bottom-cart-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #FFC107; /* Cor primária do seu site */
    color: #fff;
    padding: 10px 15px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
}

.cart-bar-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
    text-decoration: none;
}

.cart-bar-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.cart-bar-info .item-count {
    font-size: 0.9rem;
    opacity: 0.9;
}

.cart-bar-info .total-price {
    font-size: 1.1rem;
    font-weight: bold;
}

.cart-bar-action {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    background-color: #fff;
    color: #FFC107;
    padding: 8px 16px;
    border-radius: 50px;
}

.cart-bar-action i {
    font-size: 1.4rem;
    margin-left: 5px;
}
/* =================================================================== */
/* CSS FINAL E COMPLETO (CARDS DO CATÁLOGO + PÁGINA DE DETALHES)      */
/* =================================================================== */

/* --- SEÇÃO 1: ESTILO DOS CARDS DE PRODUTO NO CATÁLOGO --- */
.product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    border: 1px solid #eee;
    border-radius: 0.75rem;
    background-color: #fff;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}
.product-card > a {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    text-decoration: none;
    color: inherit;
}
.product-card .card-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 1rem;
}
.product-image-container {
    aspect-ratio: 1 / 1;
    margin-bottom: 0.75rem;
}
.product-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.product-info-container {
    flex-grow: 1;
}
.product-name {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
    min-height: 44px;
    margin-bottom: 0.25rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.product-section-info {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}
.product-price-buy-container {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.product-price-details { display: flex; flex-direction: column; }
.preco-antigo { text-decoration: line-through; color: #6c757d; font-size: 0.85rem; }
.preco-novo { font-size: 1.3rem; font-weight: 700; color: #DC3545; }
.preco-normal { font-size: 1.3rem; font-weight: 700; }
.product-buy-button .btn { width: 45px; height: 45px; font-size: 1.1rem; }
.product-card .card-footer { flex-shrink: 0; background-color: #f8f9fa; }

/* --- SEÇÃO 2: ESTILO DA GALERIA NA PÁGINA DE DETALHES DO PRODUTO (RESTAURADO) --- */
.product-image-main-container {
    border: 1px solid #e9ecef;
    border-radius: 0.75rem;
    overflow: hidden;
    background-color: #fff;
    height: 450px; /* Altura fixa para a imagem principal */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.product-image-main-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.product-thumbnail-gallery {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}
.product-thumbnail-item {
    width: 80px;
    height: 80px;
    border: 2px solid #ddd;
    border-radius: 0.5rem;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s ease;
    padding: 4px;
    background-color: #fff;
}
.product-thumbnail-item:hover,
.product-thumbnail-item.active {
    border-color: #0d6efd; /* Cor primária do Bootstrap */
}
.product-thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 0.25rem;
}

/* --- SEÇÃO 3: LAYOUT RESPONSIVO DO CATÁLOGO --- */
@media (max-width: 576px) {
    .grade-produtos > .col {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
    }
}
@media (max-width: 991px) {
    .catalogo-container {
        flex-direction: column;
    }
    .catalogo-produtos { order: 1; }
    .catalogo-sidebar { order: 2; margin-top: 30px; }
}

/* =================================================================== */
/* 3. LAYOUT RESPONSIVO DO CATÁLOGO (JÁ ESTAVA CORRETO)                */
/* =================================================================== */

@media (max-width: 576px) {
    .grade-produtos > .col {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
    }
}

@media (max-width: 991px) {
    .catalogo-container {
        flex-direction: column;
    }
    .catalogo-produtos { order: 1; }
    .catalogo-sidebar { order: 2; margin-top: 30px; }
}
/* Ajuste para posicionar o botão de compra no card */
.product-card {
    position: relative; /* Torna o card um container de posicionamento */
}

.product-buy-button {
    position: absolute;
    bottom: 60px; /* Ajuste a distância do fundo */
    right: 15px;  /* Ajuste a distância da direita */
    z-index: 5;
}

/* Garante que o link não interfira com o botão */
.product-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}