* { box-sizing: border-box; margin: 0; padding: 0; }

/* Travamos a página inteira. A rolagem acontece só dentro do feed */
body, html { 
    height: 100dvh;
    overflow: hidden; 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; 
    background: #ffffff; 
    color: #000000; 
    -webkit-font-smoothing: antialiased; 
    touch-action: manipulation;
}

/* O Cabeçalho Fixo (Alinhamento Vertical Perfeito) */
.header-fixo { 
    position: fixed; 
    top: 0; left: 0; width: 100%; 
    min-height: 80px;
    background: #ffffff; 
    border-bottom: 2px solid #000000; 
    z-index: 100; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.header-topo {
    display: grid;
    grid-template-columns: 65px 1fr 65px; 
    gap: 10px; 
    align-items: center;
    width: 100%;
    max-width: 480px; 
    padding: 0 20px;
    margin-top: 2px;
}


.header-textos {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.header-textos:active {
    transform: scale(0.96); 
}

.header-textos h1 { 
    font-size: 18px; 
    font-weight: 900; 
    letter-spacing: -0.5px; 
    text-transform: uppercase; 
    line-height: 1;
    margin: 0;
}

.header-textos p { 
    font-size: 10px; 
    color: #666666; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
    font-weight: 800; 
    margin-top: 4px; 
    line-height: 1;
    margin-bottom: 0;
}

.botoes-grupo {
    display: flex;
    gap: 12px;
    align-items: center;
}

.botoes-direita {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
}

#btn-busca, #btn-tema, #btn-layout, #btn-whatsapp {
    background: none;
    border: none;
    color: #000000;
    cursor: pointer;
    padding: 2px;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

#btn-busca:hover, #btn-tema:hover, #btn-layout:hover, #btn-whatsapp:hover { 
    transform: scale(1.1); 
}

#caixa-busca {
    width: 100%;
    max-width: 420px;
    padding: 0 20px 0 20px;
    transition: all 0.3s ease;
    margin-top: 0;
    margin-bottom: 5px;
}

#caixa-busca.escondida { display: none; }

#input-busca {
    width: 100%;
    padding: 6px 10px;
    border: 2px solid #000000;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    outline: none;
    background: #f9f9f9;
    border-radius: 4px;
    box-sizing: border-box;
}

#input-busca:focus {
    background: #ffffff;
    box-shadow: 4px 4px 0px #000000;
}

/* O MOTOR DO SCROLL MAGNÉTICO */
.feed-snap {
    height: 100dvh;
    width: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory; 
    scroll-behavior: smooth;
}

.feed-snap::-webkit-scrollbar { display: none; }

.snap-section {
    height: 100dvh;
    width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 140px 20px 20px 20px; 
}

.card-produto { 
    width: 100%;
    max-width: 420px;
    height: 100%;
    max-height: 650px;
    border: 2px solid #000000; 
    background: #ffffff; 
    display: flex; 
    flex-direction: column; 
    box-shadow: 6px 6px 0px #000000; 
}

.box-imagem { 
    width: 100%; 
    height: 30%; 
    min-height: 180px;
    border-bottom: 2px solid #000000; 
    display: flex; align-items: center; justify-content: center; 
    padding: 15px; background: #ffffff; 
    flex-shrink: 0;
    position: relative;
}

.box-imagem img { max-width: 100%; max-height: 100%; object-fit: contain; }

.conteudo-produto { 
    padding: 20px; 
    display: flex; 
    flex-direction: column; 
    flex-grow: 1; 
    overflow: hidden;
}

.conteudo-produto > div {
    flex-grow: 1;
    overflow-y: auto; 
    margin-bottom: 15px;
    padding-right: 5px;
    pointer-events: auto; 
}

.conteudo-produto > div::-webkit-scrollbar { width: 4px; }
.conteudo-produto > div::-webkit-scrollbar-thumb { background: #000000; }
.conteudo-produto > div::-webkit-scrollbar-track { background: #f0f0f0; }

@media (max-width: 600px) {
    .feed-snap:not(.modo-lista) .conteudo-produto > div {
        overflow: hidden;
        pointer-events: none;
    }
    .feed-snap:not(.modo-lista) .conteudo-produto > div a {
        pointer-events: auto;
    }
}

.texto-oferta { font-size: 15px; white-space: pre-wrap; color: #000000; margin-bottom: 5px; font-weight: 600; letter-spacing: -0.2px; text-align: center; }
.data-post { font-size: 11px; color: #999999; text-transform: uppercase; margin-bottom: 15px; display: block; font-weight: 800;}

.btn-comprar { 
    display: block; text-align: center; background: #000000; color: #ffffff; 
    text-decoration: none; padding: 15px; font-weight: 900; font-size: 14px; 
    text-transform: uppercase; letter-spacing: 1px; transition: all 0.2s; border: 2px solid #000000; 
    flex-shrink: 0;
}

.btn-comprar:hover { background: #ffffff; color: #000000; }

@media (max-width: 600px) { 
    .header-fixo { height: auto; min-height: 75px; }
    .header-fixo h1 { font-size: 15px; }
    .header-fixo p { font-size: 9px; }
    .header-topo { gap: 8px; padding: 0 15px; margin-top: 4px; padding-bottom: 8px; }
    
    .snap-section { padding: 100px 15px 15px 15px; }
    
    .card-produto { box-shadow: 4px 4px 0px #000000; max-height: 98%; }
    .box-imagem { height: 30%; min-height: 140px; padding: 10px; }
    .conteudo-produto { padding: 12px 15px; }
    .btn-comprar { padding: 12px; }
}

/* MODO ESCURO */
body.modo-escuro { background: #121212; color: #ffffff; }
.modo-escuro .header-fixo { background: #121212; border-bottom-color: #ffffff; }
.modo-escuro .card-produto { background: #121212; border-color: #ffffff; box-shadow: 6px 6px 0px #ffffff; }
.modo-escuro .box-imagem { background: #121212; border-bottom-color: #ffffff; }
.modo-escuro .texto-oferta { color: #ffffff; }
.modo-escuro .header-textos p, .modo-escuro .data-post { color: #aaaaaa; }

.modo-escuro #btn-busca, .modo-escuro #btn-tema, .modo-escuro #btn-layout, .modo-escuro #btn-whatsapp { color: #ffffff; }

.modo-escuro .btn-comprar { background: #ffffff; color: #000000; border-color: #ffffff; }
.modo-escuro .btn-comprar:hover { background: #000000; color: #ffffff; }

.modo-escuro #input-busca { background: #222222; color: #ffffff; border-color: #ffffff; }
.modo-escuro #input-busca:focus { background: #121212; box-shadow: 4px 4px 0px #ffffff; }

@media (max-width: 600px) { 
    .modo-escuro .card-produto { box-shadow: 4px 4px 0px #ffffff; }
}

/* MODO LISTA */
.feed-snap.modo-lista {
    scroll-snap-type: none;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 95px 12px 40px 12px;
    align-items: stretch;
    max-width: 900px;
    margin: 0 auto;
}

.modo-lista .snap-section {
    height: auto; 
    scroll-snap-align: none;
    padding: 0;
    display: block;
}

.modo-lista .card-produto {
    max-height: none; 
    height: 100%; 
    width: 100%;
    max-width: none; 
    margin: 0; 
    box-shadow: 4px 4px 0px #000000;
}

.modo-lista .box-imagem {
    height: 120px;
    min-height: 120px;
    padding: 8px;
}

.modo-lista .conteudo-produto {
    padding: 12px;
}

.modo-lista .texto-oferta {
    font-size: 12px; 
    line-height: 1.3;
    margin-bottom: 10px;
}

.modo-lista .data-post {
    font-size: 9px;
    margin-bottom: 8px;
}

.modo-lista .btn-comprar {
    padding: 10px;
    font-size: 12px;
    letter-spacing: 0px;
}

.modo-lista .conteudo-produto > div {
    overflow: visible;
}

.modo-escuro #btn-layout { color: #ffffff; }
#btn-layout { background: none; border: none; color: #000000; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform 0.2s; }
#btn-layout:hover { transform: scale(1.1); }

/* Etiqueta de Oferta Nova */
.badge-novo {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #ef5350; /* Vermelho vibrante */
    color: white;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    z-index: 10; /* Reduzido para passar por baixo do cabeçalho */
    box-shadow: 2px 2px 0px #000;
}

/* =======================================
   MELHORIA DE FLUIDEZ PARA PC
   ======================================= */
@media (min-width: 601px) {
    /* Força aceleração de hardware em tudo */
    .feed-snap,
    .snap-section,
    .card-produto,
    .box-imagem,
    .conteudo-produto,
    .btn-comprar {
        transform: translateZ(0);
        will-change: transform, scroll-position;
        backface-visibility: hidden;
    }
    
    /* Transições mais suaves */
    .btn-comprar,
    .header-textos,
    #btn-busca,
    #btn-tema,
    #btn-layout,
    #btn-whatsapp {
        transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    
    /* Scroll ultra suave */
    .feed-snap {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    
    /* Animação de entrada dos cards */
    .snap-section {
        animation: fadeInUp 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
    }
    
    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    /* Hover mais fluido nos cards */
    .card-produto {
        transition: box-shadow 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                    transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    
    .card-produto:hover {
        transform: translateY(-2px);
        box-shadow: 8px 8px 0px #000000;
    }
    
    .modo-escuro .card-produto:hover {
        box-shadow: 8px 8px 0px #ffffff;
    }
}
/* =======================================
   O VERDADEIRO MODO LISTA MOBILE (FORÇA BRUTA + TRAVA 50% + TEXTO FORMATADO)
   ======================================= */
@media (max-width: 600px) {
    body .feed-snap.modo-lista {
        display: grid !important;
        grid-template-columns: calc(50% - 3px) calc(50% - 3px) !important; 
        gap: 6px !important; 
        padding: 100px 6px 40px 6px !important; 
        justify-content: center !important;
    }
    
    body .feed-snap.modo-lista .card-produto {
        width: 100% !important;
        min-width: 0 !important; 
        box-shadow: 2px 2px 0px #000000 !important; 
    }
    
    body .feed-snap.modo-lista .box-imagem {
        flex-basis: auto !important;
        height: 100px !important;
        min-height: 100px !important;
        padding: 4px !important; 
    }
    
    body .feed-snap.modo-lista .conteudo-produto {
        padding: 8px !important; 
    }
    
    body .feed-snap.modo-lista .texto-oferta {
        font-size: 10.5px !important; 
        line-height: 1.35 !important; /* Aumentado sutilmente para os parágrafos respirarem */
        margin-bottom: 4px !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        /* A MÁGICA QUE DEVOLVE A FORMATAÇÃO ORIGINAL DA IA: */
        white-space: pre-wrap !important; 
    }

    body .feed-snap.modo-lista .data-post {
        font-size: 8px !important;
        margin-bottom: 4px !important;
    }
    
    body .feed-snap.modo-lista .btn-comprar {
        padding: 6px 4px !important; 
        font-size: 10px !important; 
        letter-spacing: 0px !important;
    }

    body .feed-snap.modo-lista .badge-novo {
        font-size: 8px !important;
        padding: 2px 4px !important;
        top: 4px !important; 
        left: 4px !important;
    }
}
/* =======================================
   IMPLEMENTAÇÃO 4 COLUNAS NO DESKTOP (MODO LISTA)
   ======================================= */
@media (min-width: 901px) {
    .feed-snap.modo-lista {
        /* Define 4 colunas iguais ocupando 100% da largura máxima */
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 15px !important;
        padding: 145px 20px 40px 20px !important;
        max-width: 1400px !important; /* Permite que o site cresça mais em telas largas */
    }

    .modo-lista .card-produto {
        box-shadow: 5px 5px 0px #000000 !important;
        transition: transform 0.2s ease !important;
    }

    .modo-lista .card-produto:hover {
        transform: scale(1.02) !important; /* Efeito de destaque ao passar o mouse */
    }
    
    .modo-lista .box-imagem {
        height: 160px !important; /* Um pouco maior no desktop para melhor visualização */
        min-height: 160px !important;
    }

    .modo-lista .texto-oferta {
        font-size: 13px !important; /* Volta para uma fonte mais legível no PC */
        line-height: 1.4 !important;
    }
}
/* =======================================
   ESTILO DO MENU DE CATEGORIAS (CORRIGIDO)
   ======================================= */
.menu-categorias {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding: 12px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    width: 100%;
    justify-content: center; /* A MÁGICA: Centraliza no PC */
    scrollbar-width: none; 
}
.menu-categorias::-webkit-scrollbar { display: none; }

.btn-cat {
    background: white;
    border: 1px solid #d1d1d1;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    white-space: nowrap; 
    transition: 0.2s ease;
}

.btn-cat.ativo {
    background: #00a884; 
    color: white;
    border-color: #00a884;
}

/* Suporte automático para o Modo Escuro */
.modo-escuro .menu-categorias { background: #121212; border-top: 1px solid #333; }
.modo-escuro .btn-cat { background: #222; color: #fff; border-color: #444; }
.modo-escuro .btn-cat.ativo { background: #ffffff; color: #000000; border-color: #ffffff; }

@media (max-width: 600px) {
    .menu-categorias {
        justify-content: flex-start; /* No celular, encosta na esquerda para dar scroll de dedo */
        padding: 10px 15px;
    }
}
/* =======================================
   RESPIRO DO CABEÇALHO (APENAS PARA COMPUTADOR)
   ======================================= */
@media (min-width: 601px) {
    .header-fixo {
        min-height: 95px !important; 
    }
    
    .header-topo {
        max-width: 800px !important; 
        gap: 30px !important; 
        margin-top: 0 !important; /* Remove o empurrão antigo para baixo */
        padding: 15px 20px 20px 20px !important; /* Define exatamente: 15px de teto e 20px de chão */
    }
    
    .header-textos h1 {
        font-size: 22px !important;
    }
    
    .header-textos p {
        font-size: 12px !important;
        margin-top: 6px !important;
    }
}
/* =======================================
   DESTAQUES DE PREÇO E DESCONTO
   ======================================= */
/* O texto das sirenes fica vermelho com um fundo suave */
.destaque-desconto { 
    color: #e53935; 
    font-weight: 900; 
    background: #ffebee; 
    padding: 3px 8px; 
    border-radius: 6px; 
    display: inline-block; 
    margin-bottom: -5px;
    border: 1px solid #ffcdd2;
}

/* O preço antigo fica cinza e riscado */
.preco-riscado { 
    text-decoration: line-through; 
    color: #888888; 
    font-size: 0.9em; 
    font-weight: 500;
}

/* O preço novo fica gigante e com o verde do WhatsApp/PromoJato */
.destaque-preco { 
    color: #00a884; 
    font-weight: 900; 
    font-size: 1.3em; 
    display: inline-block;
    margin-top: 2px;
}

/* =======================================
   SUPORTE PARA O MODO ESCURO
   ======================================= */
.modo-escuro .destaque-desconto { 
    background: #2b1111; 
    color: #ff8a80; 
    border-color: #4a1d1d;
}

.modo-escuro .preco-riscado { 
    color: #999999; 
}

/* ✅ LOADING SKELETON */
.skeleton-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    box-shadow: 6px 6px 0px #000000;
}

.skeleton-image {
    height: 180px;
    background: #f0f0f0;
    border-radius: 4px;
    margin-bottom: 15px;
    animation: pulse 1.5s infinite;
}

.skeleton-text-line {
    height: 16px;
    background: #f0f0f0;
    margin-bottom: 10px;
    border-radius: 4px;
    animation: pulse 1.5s infinite;
}

.skeleton-button {
    height: 40px;
    background: #000000;
    border-radius: 4px;
    margin-top: 20px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 0.2; }
    100% { opacity: 0.6; }
}

/* ✅ SKELETON NO MODO ESCURO */
.modo-escuro .skeleton-card { background: #121212; }
.modo-escuro .skeleton-image, 
.modo-escuro .skeleton-text-line, 
.modo-escuro .skeleton-button { background: #222; }

/* ✅ TRANSIÇÃO SUAVE DO SKELETON AO CARREGAR */
.feed-snap.loaded .skeleton-card {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-out;
}

/* ✅ LOADING SPINNER NO BOTÃO - ALINHAMENTO PERFEITO */
.btn-comprar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-comprar .loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}

/* ✅ Ajuste para modo claro */
:not(.modo-escuro) .btn-comprar .loading-spinner {
    border-color: #000000;
    border-top-color: transparent;
}

.modo-escuro .btn-comprar .loading-spinner {
    border-color: #ffffff;
    border-top-color: transparent;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ✅ Corrigindo alinhamento do spinner no botão */
.btn-comprar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-comprar .loading-text {
    opacity: 0.7;
}

.btn-comprar[disabled] {
    cursor: not-allowed;
}
