/* ====== CORES — modo claro (verdinho claro) ====== */
:root {
  --fundo: #e4f5e7;
  --topo: #f4fbf5;
  --cartao: #ffffff;
  --texto: #1d3b24;
  --texto-suave: #4d6b55;
  --titulo: #1f5c2e;
  --verde: #2e7d43;
  --verde-texto: #ffffff;
  --destaque: #ffc400;
  --borda: rgba(31, 92, 46, .12);
  --sombra: 0 4px 14px rgba(20, 60, 30, .12);
  --sombra-forte: 0 10px 26px rgba(20, 60, 30, .22);
  --placeholder: #d6eedb;
  --onda: rgba(46, 125, 67, .22);
  color-scheme: light;
}

/* ====== CORES — modo escuro (verde escuro) ======
   Vale quando o sistema está escuro (e a pessoa não escolheu o claro)
   ou quando a pessoa escolheu o escuro no botão sol/lua. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fundo: #0a2012;
    --topo: #0f2c19;
    --cartao: #153821;
    --texto: #e3f3e6;
    --texto-suave: #a9c7b0;
    --titulo: #9fe0ae;
    --verde: #5cc97a;
    --verde-texto: #0a2012;
    --borda: rgba(159, 224, 174, .14);
    --sombra: 0 4px 14px rgba(0, 0, 0, .45);
    --sombra-forte: 0 10px 26px rgba(0, 0, 0, .6);
    --placeholder: #1d4529;
    --onda: rgba(159, 224, 174, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fundo: #0a2012;
  --topo: #0f2c19;
  --cartao: #153821;
  --texto: #e3f3e6;
  --texto-suave: #a9c7b0;
  --titulo: #9fe0ae;
  --verde: #5cc97a;
  --verde-texto: #0a2012;
  --borda: rgba(159, 224, 174, .14);
  --sombra: 0 4px 14px rgba(0, 0, 0, .45);
  --sombra-forte: 0 10px 26px rgba(0, 0, 0, .6);
  --placeholder: #1d4529;
  --onda: rgba(159, 224, 174, .25);
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--fundo);
  color: var(--texto);
  font-size: 17px;
  min-height: 100vh;
  transition: background-color .35s ease, color .35s ease, opacity .22s ease, transform .22s ease;
  animation: entrar .35s ease backwards;
}
body.saindo { opacity: 0; transform: translateY(-6px); }
@keyframes entrar { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; -webkit-tap-highlight-color: transparent; }

.container { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* ====== TOPO ====== */
.topo {
  position: sticky; top: 0; z-index: 10;
  background: var(--topo);
  border-bottom: 1px solid var(--borda);
  box-shadow: var(--sombra);
  transition: background-color .35s ease;
}
.topo .container { display: flex; align-items: center; gap: 10px; min-height: 68px; }
.marca { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.marca img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; object-position: center 35%; flex-shrink: 0; }
.marca strong { display: block; font-size: 1rem; color: var(--titulo); line-height: 1.2; white-space: nowrap; }

.abas { display: flex; gap: 4px; align-items: center; }
.aba {
  position: relative; overflow: hidden;
  padding: 10px 14px; border-radius: 12px; font-weight: 600; font-size: .92rem;
  color: var(--texto-suave);
  transition: background-color .2s ease, color .2s ease, transform .12s ease;
}
.aba.ativa { background: var(--verde); color: var(--verde-texto); }

/* ====== BOTÃO SOL/LUA ====== */
.tema {
  position: relative; overflow: hidden;
  width: 44px; height: 44px; flex-shrink: 0;
  border: 1px solid var(--borda); border-radius: 50%;
  background: var(--cartao); color: var(--titulo);
  display: grid; place-items: center; cursor: pointer;
  box-shadow: var(--sombra);
  transition: transform .12s ease, background-color .35s ease;
}
.tema svg { width: 24px; height: 24px; grid-area: 1 / 1; opacity: 0; transform: rotate(-90deg) scale(.4); transition: transform .45s ease, opacity .3s ease; }
/* o ícone mostra o modo ATUAL: meio sol/meio lua = sistema */
:root:not([data-theme]) .tema .auto,
:root[data-theme="light"] .tema .sol,
:root[data-theme="dark"] .tema .lua { opacity: 1; transform: none; }

/* aviso rápido "Modo claro" etc. */
.aviso-tema {
  position: fixed; left: 50%; top: 80px; z-index: 30;
  background: var(--verde); color: var(--verde-texto);
  padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: .92rem;
  box-shadow: var(--sombra-forte); pointer-events: none;
  opacity: 0; transform: translate(-50%, -10px);
  transition: opacity .25s ease, transform .25s ease;
}
.aviso-tema.mostrar { opacity: 1; transform: translate(-50%, 0); }

main { padding: 24px 0 40px; }

h1 { font-size: 1.6rem; color: var(--titulo); margin-bottom: 4px; }
h2 { font-size: 1.3rem; color: var(--titulo); margin: 34px 0 14px; display: flex; align-items: center; gap: 8px; }
h2.primeiro { margin-top: 8px; }
.intro { color: var(--texto-suave); font-size: .95rem; margin-bottom: 18px; }

/* ====== CARROSSEL ====== */
.carrossel {
  overflow-x: auto; margin: 0 -6px; padding: 6px;
  scroll-snap-type: x mandatory; scroll-padding-inline: 6px;
  overscroll-behavior-x: contain; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; cursor: grab;
}
.carrossel::-webkit-scrollbar { display: none; }
.carrossel.sem-snap { scroll-snap-type: none; }
.carrossel.arrastando { scroll-snap-type: none; cursor: grabbing; }
.carrossel.arrastando .cartao { pointer-events: none; }
.trilho { display: flex; gap: 14px; }
.trilho .cartao { scroll-snap-align: start; }
.trilho .cartao { flex: 0 0 calc((100% - 14px) / 2); border: 2px solid var(--destaque); }
@media (min-width: 720px) { .trilho .cartao { flex-basis: calc((100% - 28px) / 3); } }

/* ====== CARTÃO DE PRODUTO ====== */
.grade { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 720px) { .grade { grid-template-columns: repeat(4, 1fr); } }

.cartao {
  position: relative;
  background: var(--cartao); border-radius: 18px; overflow: hidden;
  box-shadow: var(--sombra); display: flex; flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease, background-color .35s ease;
}
@media (hover: hover) { .cartao:hover { transform: translateY(-4px); box-shadow: var(--sombra-forte); } }

.foto-produto {
  aspect-ratio: 1; width: 100%; object-fit: cover; display: block;
  background: var(--placeholder);
  transition: transform .35s ease, background-color .35s ease;
}
img.foto-produto.inteira { object-fit: contain; }
div.foto-produto { display: flex; align-items: center; justify-content: center; font-size: 3.2rem; }
@media (hover: hover) { .cartao:hover .foto-produto { transform: scale(1.05); } }

.cartao .info { position: relative; background: var(--cartao); padding: 12px 12px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; transition: background-color .35s ease; }
.cartao .nome { font-weight: 600; font-size: .95rem; line-height: 1.3; }
.cartao .ver { margin-top: auto; font-size: .82rem; font-weight: 600; color: var(--verde); }
.cartao .ver.shopee { color: #e8452a; }
:root[data-theme="dark"] .cartao .ver.shopee { color: #ff8a6b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cartao .ver.shopee { color: #ff8a6b; } }

/* ====== CATEGORIAS ====== */
.categorias { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .categorias { grid-template-columns: repeat(4, 1fr); } }
.categoria {
  position: relative; overflow: hidden;
  background: var(--cartao); border-radius: 18px; box-shadow: var(--sombra);
  padding: 16px 12px; text-align: center; display: flex; flex-direction: column; gap: 4px; align-items: center;
  font-weight: 600; font-size: .95rem; line-height: 1.25;
  transition: transform .18s ease, box-shadow .18s ease, background-color .35s ease;
}
@media (hover: hover) { .categoria:hover { transform: translateY(-3px); box-shadow: var(--sombra-forte); } }
.categoria .emoji { font-size: 2.2rem; line-height: 1; margin-bottom: 4px; transition: transform .25s ease; }
@media (hover: hover) { .categoria:hover .emoji { transform: scale(1.15) rotate(-6deg); } }
.categoria.aberta { outline: 3px solid var(--verde); outline-offset: -3px; }
.categoria small { font-weight: 400; font-size: .78rem; color: var(--texto-suave); }

/* ====== PÁGINA DO PRODUTO ====== */
.voltar { position: relative; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--verde); margin-bottom: 16px; padding: 6px 0; transition: transform .15s ease; }
@media (hover: hover) { .voltar:hover { transform: translateX(-3px); } }
.produto { max-width: 480px; margin: 0 auto; text-align: center; }
.produto .foto-produto { border-radius: 20px; box-shadow: var(--sombra); margin-bottom: 18px; }
.produto img.foto-produto.inteira { aspect-ratio: auto; height: auto; }
.produto h1 { font-size: 1.45rem; line-height: 1.3; }
.produto .descricao { color: var(--texto-suave); margin-top: 6px; }
.produto .chamada { margin: 22px 0 12px; font-weight: 600; }

.lojas { display: flex; flex-direction: column; gap: 14px; }
.loja {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 64px; padding: 14px 20px; border-radius: 16px;
  font-weight: 700; font-size: 1.12rem; box-shadow: var(--sombra);
  transition: transform .15s ease, box-shadow .15s ease;
}
@media (hover: hover) { .loja:hover { transform: translateY(-2px); box-shadow: var(--sombra-forte); } }
.loja svg { width: 32px; height: 32px; flex-shrink: 0; }
.loja.minhaloja { background: #ffd600; color: #2a2000; --onda: rgba(255, 255, 255, .55); box-shadow: 0 6px 20px rgba(255, 196, 0, .45); }
@media (hover: hover) { .loja.minhaloja:hover { box-shadow: 0 10px 28px rgba(255, 196, 0, .6); } }
.loja.shopee { background: #ee4d2d; color: #fff; --onda: rgba(255, 255, 255, .35); }
.loja.mercadolivre { background: #ffe600; color: #2d3277; --onda: rgba(45, 50, 119, .2); }
.loja.amazon { background: #232f3e; color: #fff; --onda: rgba(255, 153, 0, .35); }

/* entrada em sequência dos botões das lojas */
.lojas .loja { animation: subir .45s ease backwards; }
.lojas .loja:nth-child(2) { animation-delay: .08s; }
.lojas .loja:nth-child(3) { animation-delay: .16s; }
@keyframes subir { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ====== SELO "USO VETERINÁRIO" ====== */
.selo-vet {
  position: absolute; top: 8px; left: 8px; z-index: 1;
  display: inline-flex; align-items: center; gap: 5px;
  background: #1565c0; color: #fff; border: 2px solid #fff;
  padding: 4px 9px 4px 7px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; line-height: 1.2; letter-spacing: .01em;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .25);
}
.selo-vet svg { width: 12px; height: 12px; flex-shrink: 0; }
.foto-com-selo { position: relative; }
.foto-com-selo .selo-vet { top: 12px; left: 12px; font-size: .9rem; padding: 6px 13px 6px 10px; }
.foto-com-selo .selo-vet svg { width: 15px; height: 15px; }
.alerta-vet {
  margin-top: 14px; padding: 12px 14px; border-radius: 14px; text-align: left;
  background: rgba(21, 101, 192, .1); border: 2px solid #1565c0;
  font-size: .9rem; line-height: 1.5;
}
.alerta-vet b { color: #1565c0; }
:root[data-theme="dark"] .alerta-vet b { color: #90caf9; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .alerta-vet b { color: #90caf9; } }

.aviso { font-size: .78rem; color: var(--texto-suave); margin-top: 22px; line-height: 1.5; }
.vazio { color: var(--texto-suave); text-align: center; padding: 30px 0; }

/* ====== CATEGORIAS NA PÁGINA INICIAL ====== */
#categorias, #lista-categoria { scroll-margin-top: 84px; }
#lista-categoria { margin-top: 18px; padding: 16px; border-radius: 20px; background: var(--placeholder); transition: background-color .35s ease; }
#lista-categoria.abrindo { animation: subir .4s ease; }
.painel-topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.painel-topo h3 { color: var(--titulo); font-size: 1.15rem; }
.fechar-painel {
  position: relative; overflow: hidden; flex-shrink: 0;
  border: none; cursor: pointer; border-radius: 12px; padding: 9px 14px;
  background: var(--cartao); color: var(--texto); font-weight: 600; font-size: .88rem;
  box-shadow: var(--sombra); transition: transform .12s ease;
}

/* ====== RODAPÉ ====== */
.rodape { margin-top: 12px; padding: 28px 16px 90px; border-top: 1px solid var(--borda); text-align: center; color: var(--texto-suave); }
.ajuda { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px; }
.botao-ajuda {
  position: relative; overflow: hidden;
  border: 2px solid var(--verde); background: transparent; color: var(--verde);
  border-radius: 14px; padding: 12px 18px; font-weight: 600; font-size: .95rem; cursor: pointer;
  transition: transform .12s ease, background-color .2s ease;
}
@media (hover: hover) { .botao-ajuda:hover { background: var(--cartao); } }
.redes { display: flex; gap: 12px; justify-content: center; margin-bottom: 14px; }
.redes a {
  position: relative; overflow: hidden;
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--cartao); color: var(--texto-suave); box-shadow: var(--sombra);
  transition: transform .15s ease, color .2s ease;
}
.redes a svg { width: 18px; height: 18px; }
@media (hover: hover) {
  .redes a:hover { transform: translateY(-2px); }
  .redes a.yt:hover { color: #ff0000; }
  .redes a.ig:hover { color: #dd2a7b; }
}
.direitos { font-size: .75rem; line-height: 1.5; }

/* ====== JANELAS (Como usar / Dúvidas) ====== */
html.travado { overflow: hidden; }
.janela {
  margin: auto; padding: 0; border: none; background: transparent; color: var(--texto);
  width: min(560px, calc(100% - 32px)); max-width: none; max-height: min(86vh, 760px);
  overflow: visible;
}
.janela::backdrop {
  background: rgba(4, 20, 10, .45);
  -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px);
  animation: aparecer .25s ease;
}
.janela[open] { animation: janela-entra .3s cubic-bezier(.2, .9, .3, 1.2); }
.janela.fechando { animation: janela-sai .2s ease forwards; }
.janela.fechando::backdrop { animation: sumir .2s ease forwards; }
@keyframes aparecer { from { opacity: 0; } }
@keyframes sumir { to { opacity: 0; } }
@keyframes janela-entra { from { opacity: 0; transform: translateY(24px) scale(.96); } }
@keyframes janela-sai { to { opacity: 0; transform: translateY(16px) scale(.97); } }

.janela-caixa {
  background: var(--cartao); border-radius: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
  display: flex; flex-direction: column; max-height: min(86vh, 760px); overflow: hidden;
}
.janela-topo {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 16px 14px 20px; border-bottom: 1px solid var(--borda);
}
.janela-topo h2 { margin: 0; font-size: 1.2rem; }
.fechar {
  position: relative; overflow: hidden; flex-shrink: 0;
  width: 48px; height: 48px; border-radius: 50%; border: none; cursor: pointer;
  background: #c62828; color: #fff; display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(198, 40, 40, .4);
  transition: transform .12s ease;
}
.fechar svg { width: 22px; height: 22px; }
.janela-corpo { padding: 18px 20px 22px; overflow-y: auto; overscroll-behavior: contain; line-height: 1.55; font-size: .98rem; }

.passos { list-style: none; counter-reset: passo; display: flex; flex-direction: column; gap: 14px; }
.passos li { counter-increment: passo; position: relative; padding-left: 46px; }
.passos li::before {
  content: counter(passo); position: absolute; left: 0; top: 0;
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--verde); color: var(--verde-texto); font-weight: 700;
}
.dica { margin-top: 16px; padding: 12px 14px; border-radius: 14px; background: var(--placeholder); font-size: .92rem; }

.pergunta { border-bottom: 1px solid var(--borda); }
.pergunta summary {
  list-style: none; cursor: pointer; padding: 14px 30px 14px 0; font-weight: 600; position: relative;
  -webkit-tap-highlight-color: transparent;
}
.pergunta summary::-webkit-details-marker { display: none; }
.pergunta summary::after {
  content: "+"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  font-size: 1.4rem; color: var(--verde); transition: transform .25s ease;
}
.pergunta[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.pergunta p { padding: 0 0 14px; color: var(--texto-suave); animation: subir .3s ease; }

.botao-whats {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 20px; min-height: 56px; padding: 12px 16px; border-radius: 16px;
  background: #25d366; color: #fff; font-weight: 700; text-align: center; line-height: 1.3;
  box-shadow: var(--sombra); transition: transform .12s ease;
}
.botao-whats svg { width: 26px; height: 26px; flex-shrink: 0; }

/* ====== ANIMAÇÕES DE CLIQUE ====== */
/* "aperta" ao tocar */
.cartao:active, .categoria:active, .loja:active, .aba:active, .tema:active, .subir-topo:active,
.botao-ajuda:active, .fechar:active, .fechar-painel:active, .redes a:active, .botao-whats:active { transform: scale(.94); }
/* onda que sai do ponto do toque */
.onda {
  position: absolute; border-radius: 50%; pointer-events: none; z-index: 2;
  background: var(--onda); transform: scale(0);
  animation: onda .6s ease-out forwards;
}
@keyframes onda { to { transform: scale(1); opacity: 0; } }
/* giro do sol/lua ao trocar */
.tema.girando { animation: girar .5s ease; }
@keyframes girar { 50% { transform: rotate(180deg) scale(.85); } }

/* ====== APARECER AO ROLAR ====== */
.revelar { opacity: 0; translate: 0 18px; transition: opacity .5s ease, translate .5s ease, transform .18s ease, box-shadow .18s ease, background-color .35s ease; }
.revelar.visivel { opacity: 1; translate: 0 0; }

/* ====== VOLTAR AO TOPO ====== */
.subir-topo {
  position: fixed; right: 16px; bottom: 18px; z-index: 9;
  width: 50px; height: 50px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--verde); color: var(--verde-texto);
  display: grid; place-items: center;
  box-shadow: var(--sombra-forte);
  opacity: 0; translate: 0 20px; pointer-events: none;
  transition: opacity .25s ease, translate .25s ease, transform .12s ease;
}
.subir-topo svg { width: 24px; height: 24px; }
.subir-topo.mostrar { opacity: 1; translate: 0 0; pointer-events: auto; }

.cartao .ver { white-space: nowrap; }
@media (max-width: 420px) {
  .marca { gap: 8px; }
  .marca img { width: 40px; height: 40px; }
  .marca strong { font-size: .84rem; }
  .cartao .ver { font-size: .78rem; }
  .abas { gap: 2px; }
  .aba { padding: 8px 8px; font-size: .8rem; }
  .tema { width: 40px; height: 40px; }
}
@media (max-width: 360px) {
  .marca strong { font-size: .76rem; }
  .aba { padding: 8px 6px; font-size: .76rem; }
}

/* monitor grande: usa mais da largura */
@media (min-width: 1200px) {
  .container { max-width: 1160px; }
  .grade, .categorias { grid-template-columns: repeat(5, 1fr); }
  .trilho .cartao { flex-basis: calc((100% - 42px) / 4); }
}

/* celular deitado (tela baixa): cartões menores para caber inteiros na tela */
@media (orientation: landscape) and (max-height: 520px) {
  .topo .container { min-height: 56px; }
  .marca img { width: 36px; height: 36px; }
  .tema { width: 38px; height: 38px; }
  main { padding-top: 14px; }
  h2 { margin-top: 24px; }
  .trilho .cartao { flex-basis: calc((100% - 42px) / 4); }
  .grade, .categorias { grid-template-columns: repeat(4, 1fr); }
  .foto-produto { aspect-ratio: 4 / 3; }
  div.foto-produto { font-size: 2.4rem; }
  .categoria { padding: 12px 10px; }
  .categoria .emoji { font-size: 1.8rem; }
  .janela, .janela-caixa { max-height: 92vh; }
  .janela-topo { padding: 10px 12px 10px 18px; }
  .fechar { width: 42px; height: 42px; }
}

/* quem pediu no celular para reduzir movimento não recebe animação */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .revelar { opacity: 1; translate: none; }
}
