
/* ==================================================================== */
/* 1. ESTILOS GERAIS & RESET */
/* ==================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    min-height: 100vh;
    font-size: 16px;
    /* Ajuste o padding do body para que o conteúdo não fique escondido atrás do footer fixo */
    padding-bottom: 50px; 
}

.container {
    padding: 15px;
    max-width: 100%;
}

/* ==================================================================== */
/* 2. HEADER & ELEMENTOS DE NAVEGAÇÃO (Topo) */
/* ==================================================================== */

/* Estilo Base do Header */
header {
    display: flex;
    justify-content: center; /* Centraliza o logo-container */
    align-items: center;
    background-color: #007bff;
    color: white;
    padding: 10px 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky; /* Mantém a regra original para sticky */
    top: 0;
    z-index: 10;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px; /* espaço entre a imagem e o texto */
}

.logo-mercadinho {
    width: 100%;       /* ocupa no máximo 100% do container */
    max-width: 600px;  /* nunca passa de 600px (bom pro PC) */
    height: auto;
    object-fit: contain;
}
header h1 {
    font-size: 30px;
    margin: 0;
    font-weight: bold;
}

.top-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.search input {
    width: 100%;
    height: 30px; 
    padding: 4px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

/* 🔹 Tarja de contato (Barra Azul abaixo do Header) */
.barra-contato {
    background-color: #0056b3;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    padding: 10px;
    font-size: 15px;
    flex-wrap: wrap;
}

.contato-link {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: bold;
}

.contato-link:hover {
    text-decoration: none;
    opacity: 0.85; /* opcional: leve destaque ao passar o mouse */
}

/* ==================================================================== */
/* 3. LISTAGEM DE CATEGORIAS */
/* ==================================================================== */

#categoriasContainer {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    padding: 10px 5px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    align-items: center;
}

#categoriasContainer button {
    flex: 0 0 auto;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid #007bff;
    background-color: white;
    color: #007bff;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    height: 36px;
    line-height: 1.2;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

#categoriasContainer button:hover {
    background-color: #007bff;
    color: white;
    transform: scale(1.05);
}

/* ==================================================================== */
/* /* ==================================================================== */
/* 4. GRID DE PRODUTOS (Cards Otimizados) */
/* ==================================================================== */

.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    /* Melhora a performance de renderização no celular */
    content-visibility: auto;
    contain-intrinsic-size: 500px; 
}

.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    text-align: center;
    padding-bottom: 10px;
    /* Reserva o espaço do card antes da imagem carregar (Evita CLS) */
    min-height: 250px; 
}

.card img {
    width: 100%;
    /* Definimos uma altura fixa ou aspecto para evitar saltos de layout */
    height: 150px; 
    aspect-ratio: 1 / 1;
    object-fit: cover; /* 'cover' é mais rápido de renderizar que 'contain' */
    background: #f4f4f4;
    border-bottom: 1px solid #ddd;
    /* Evita que a imagem bloqueie a renderização do texto */
    decoding: async; 
}

/* ==================================================================== */
/* 5. CARRINHO & BOTÃO FLUTUANTE (Cart) */
/* ==================================================================== */

/* Estilo base de botões de carrinho (usado antes do flutuante) */
.cart {
    background: #007bff; /* Ajustado para o azul padrão */
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.cart:hover {
    background: #0056b3;
}

/* 🛍️ ESTILO DO BOTÃO FLUTUANTE NO CANTO INFERIOR DIREITO */
/* 🛒 BOTÃO FLUTUANTE RESPONSIVO */
.cart-flutuante {
    position: fixed;
    bottom: 25px;
    right: 10px;
    z-index: 1000;

    background-color: #38c172;
    color: white;
    border: none;
    border-radius: 30px;
    padding: 10px 18px;

    /* Flexbox responsivo */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: nowrap;

    font-size: 16px;
    font-weight: bold;
    white-space: nowrap; /* evita quebra de linha */
    line-height: 1;
    cursor: pointer;

   
}

/* ÍCONE dentro do botão */
.cart-flutuante img {
    width: 25px;
    height: 25px;
    object-fit: contain;
}

/* 📱 Ajuste para telas menores */
@media (max-width: 600px) {
    .cart-flutuante {
        bottom: 25px;
        right: 10px;
        padding: 8px 14px;
        font-size: 14px;
        gap: 5px;
    }

    .cart-flutuante img {
        width: 22px;
        height: 22px;
    }
}


/* Regra para ícones Font Awesome (mantida, mas só será usada se você trocar para o <i>) */
.cart-flutuante i { 
    font-size: 18px;
    color: white; /* Garante ícone branco */
    /* 🚨 FORÇA O USO DA FONTE CORRETA PARA O ÍCONE (Apenas se Font Awesome for usado) */
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro" !important;
    font-weight: 900 !important; 
}


/* 🌊 DEFINIÇÃO DO EFEITO PULSE SUAVE (versão verde) */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05); /* Aumenta 5% */
        box-shadow: 0 0 0 6px rgba(56, 193, 114, 0.5); /* 💚 Sombra verde suave */
    }
    100% {
        transform: scale(1);
    }
}



/* ==================================================================== */
/* 6. MODAL (Pop-up do Carrinho) */
/* ==================================================================== */

.modal {
    display: none; 
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8); /* Escureci um pouco mais o fundo */
    z-index: 9999; !important;  /* Valor bem alto para cobrir o botão (que é 1000) */
    overflow-y: auto;
    display: none; /* O JS controla a exibição mudando para 'flex' */
    align-items: center; /* Centraliza o conteúdo verticalmente */
    justify-content: center; /* Centraliza o conteúdo horizontalmente */
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 450px;
    position: relative; /* Garante que respeite o z-index do pai */
    z-index: 10000;
}

.modal-content h2 {
    font-size: 20px;
    margin-bottom: 15px;
    text-align: center;
}

.modal-content ul {
    list-style: none;
    padding: 0;
}

.modal-content li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    font-size: 15px;
}

.btn-remover {
    background: #ff4d4d;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-remover:hover {
    background: #cc0000;
}

.total {
    font-size: 18px;
    font-weight: bold;
    color: #007bff;
    margin: 15px 0;
    text-align: center;
}

.modal-content label {
    display: block;
    font-size: 14px;
    margin-bottom: 5px;
    color: #333;
}

.modal-content input,
.modal-content select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 10px;
    outline: none;
}

#trocoContainer {
    display: none;
}

.finalizar,
.close {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    margin: 5px 0;
}

.finalizar {
    background: #28a745;
    color: white;
}

.finalizar:hover {
    background: #1e7e34;
}

.close {
    background: #ccc;
}

.close:hover {
    background: #999;
}

/* ==================================================================== */
/* 7. NOTIFICAÇÕES (Popup) */
/* ==================================================================== */

#notificacao-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #38c172;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    z-index: 10001 !important;
    font-size: 16px;
    display: none;
}

#notificacao-popup.show {
    opacity: 1;
    display: block;
}

/* ==================================================================== */
/* 8. RODAPÉ (Footer) - VERSÃO SLIM */
/* ==================================================================== */
#mainFooter {
    background: #007bff; /* Azul padrão */
    color: white;
    text-align: center;
    padding: 4px 0;      /* Altura mínima */
    font-size: 10px;     /* Texto pequeno para caber na tarja */
    font-weight: bold;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    line-height: 1.2;
}


/* ==================================================================== */
/* 9. MEDIA QUERIES (Responsividade) */
/* ==================================================================== */

/* ==================================================================== */
/* 9. MEDIA QUERIES (Responsividade) */
/* ==================================================================== */

/* --- TELAS ATÉ 600px (Celular) --- */
@media (max-width: 600px) {
    .barra-contato {
        flex-direction: row;
        gap: 10px;
        font-size: 12px;
        justify-content: center;
    }

    .cart-flutuante {
        bottom: 18px !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        padding: 12px 0 !important;
        border-radius: 0 !important;
        font-size: 16px !important;
    }
}

/* --- TELAS A PARTIR DE 768px (Tablet e PCs Pequenos) --- */
@media (min-width: 768px) {
    .grid {
        /* Aumentamos para 3 ou 4 colunas no PC para não ficar gigante */
        grid-template-columns: repeat(3, 1fr); 
        gap: 20px;
        padding: 20px;
    }

    .card {
        /* Define uma largura máxima para o card não esticar demais */
        max-width: 250px;
        margin: 0 auto;
        padding-bottom: 20px;
    }

    .card img {
        height: 180px; /* Imagem um pouco maior no PC */
    }

    .comprar {
        width: 80%; /* Botão mais elegante no PC */
        font-size: 14px;
    }
}

/* --- TELAS A PARTIR DE 1024px (Monitores Grandes) --- */
@media (min-width: 1024px) {
    .grid {
        /* 4 colunas em monitores grandes */
        grid-template-columns: repeat(4, 1fr);
        max-width: 1200px;
        margin: 0 auto;
    }

    .container {
        padding: 40px 20px;
    }
}



/* ==================================================================== */
/* ESTILOS DO BANNER (Otimização de LCP) */
/* ==================================================================== */

.banner-anuncio-imagem {
    margin: 20px auto;
    overflow: hidden;
    width: 100%;
    max-width: 850px;
    height: auto;
    aspect-ratio: 850 / 350; /* Informa ao navegador o espaço exato */
    border-radius: 8px;
    background: #eee; /* Cor de fundo enquanto a imagem não vem */
}

    .banner-anuncio-imagem img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
    }

    @media (max-width: 900px) {
        .banner-anuncio-imagem {
            width: 90%;
            height: auto;
            aspect-ratio: 850 / 350;
        }
    }

#notificacao-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Centraliza perfeitamente */
    background-color: #38c172;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    z-index: 10000;
    display: none;
    font-size: 16px;
}

#notificacao-popup.show {
    opacity: 1;
    display: block;
}

/* ==================================================================== */
/* 10. BOTÃO COMPRAR (Grid de Produtos) */
/* ==================================================================== */

.comprar {
    background-color: #28a745; /* Verde Sucesso */
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    width: 90%;
    margin: 5px auto;
    display: block;
    text-transform: uppercase;
}

.comprar:hover {
    background-color: #218838; /* Verde mais escuro no hover */
    transform: scale(1.03);
}

.comprar:active {
    transform: scale(0.95); /* Efeito de clique */
}

/* Ajuste no card para não esmagar o botão */
.card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.preco {
    font-weight: bold;
    color: #28a745;
    font-size: 16px;
    margin: 5px 0;
}

/* Estilo específico para o ícone dentro do botão */
.icon-carrinho {
    height: 1.2em;    /* Faz a imagem acompanhar o tamanho da fonte (1.2x o tamanho do texto) */
    width: auto;      /* Mantém a proporção da largura */
    display: inline-block;
    vertical-align: middle; /* Alinha o centro da imagem com o centro do texto */
    margin-right: 5px;      /* Dá um espacinho do texto */
}

/* Ajuste o botão para garantir o alinhamento central */
.cart-flutuante {
    display: flex;
    align-items: center;
    justify-content: center;
}



/* Garante que o modal de fechado fique por cima de tudo e centralizado */
#modalFechado {
    display: none;
    position: fixed;
    z-index: 99999; /* Valor altíssimo */
    left: 0; top: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    align-items: center;
    justify-content: center;
}
#modalFechado .modal-content {
    background: white;
    padding: 25px;
    border-radius: 15px;
    width: 85%;
    max-width: 400px;
}
