/* =========================================================
   comprarIA — estilo (tema escuro por padrão, claro opcional)
   As cores ficam nas variáveis abaixo. Troque à vontade.
   ========================================================= */
:root {
  color-scheme: dark;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --bg: #0f1012;            /* fundo da página */
  --surface: #1a1b1f;       /* cards, chips, campo de texto */
  --surface-2: #24262b;     /* hover / balão do usuário */
  --text: #ececf1;
  --muted: #9a9ca6;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .16);

  --accent: #8b8cf8;        /* destaque (violeta-azul) */
  --accent-2: #5ec2ff;      /* segunda cor do gradiente */
  --accent-soft: rgba(139, 140, 248, .16);

  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, .14);
  --eco: #4ade80;
  --eco-soft: rgba(74, 222, 128, .12);

  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #ececf1;
  --text: #1b1c20;
  --muted: #6b6f7b;
  --border: rgba(0, 0, 0, .08);
  --border-strong: rgba(0, 0, 0, .16);
  --accent: #5b5ce6;
  --accent-2: #2f8fe8;
  --accent-soft: rgba(91, 92, 230, .12);
  --ok: #15803d;
  --warn: #b45309;
  --bad: #b91c1c;
  --bad-soft: rgba(185, 28, 28, .1);
  --eco: #15803d;
  --eco-soft: rgba(21, 128, 61, .09);
  --shadow: 0 8px 24px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button { font: inherit; }

/* ---------- cabeçalho ---------- */
.topo {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.topo-inner {
  max-width: 760px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.logo {
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}
.logo svg { width: 16px; height: 16px; }
.brand-texto { display: flex; flex-direction: column; line-height: 1.15; }
.brand-texto strong { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.brand-texto small { color: var(--muted); font-size: 12px; }
.acoes-topo { display: flex; gap: 6px; }
.btn-ghost, .btn-icone {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; cursor: pointer; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-ghost { padding: 7px 12px; }
.btn-icone { width: 34px; height: 34px; padding: 0; }
.btn-ghost:hover, .btn-icone:hover { color: var(--text); background: var(--surface); border-color: var(--border-strong); }
.btn-icone svg { width: 16px; height: 16px; }
.btn-icone .sol { display: none; }
:root[data-theme="light"] .btn-icone .sol { display: block; }
:root[data-theme="light"] .btn-icone .lua { display: none; }

/* ---------- chat ---------- */
main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }
#chat { display: flex; flex-direction: column; gap: 22px; padding: 28px 0 20px; }

.msg { display: flex; gap: 12px; animation: aparecer .25s ease both; }
.msg, .card { scroll-margin-top: 78px; }   /* ao rolar até um item, ele para logo abaixo do cabeçalho */
.msg.ia { align-self: stretch; }
.msg.user { align-self: flex-end; max-width: 80%; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none; margin-top: 3px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.avatar svg { width: 14px; height: 14px; }
.conteudo { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ia .bubble { padding: 4px 0; overflow-wrap: anywhere; }
.user .bubble {
  background: var(--surface-2); color: var(--text);
  padding: 10px 16px; border-radius: var(--radius); overflow-wrap: anywhere;
}
.bubble strong { font-weight: 600; }
.passo {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: 4px; font-weight: 600;
}
.dica { color: var(--muted); font-size: 13.5px; margin-top: 4px; }

/* estado "pensando" (estilo assistente de IA) */
.avatar.pensando { animation: brilho 2.4s ease-in-out infinite; }
.avatar.pensando svg { animation: faisca 2.4s ease-in-out infinite; }
.pensando-msg .bubble { padding: 4px 0; }
.pensando-texto {
  display: inline-block; font-size: 14.5px; font-weight: 500;
  background: linear-gradient(90deg, var(--muted) 0%, var(--muted) 40%, color-mix(in srgb, var(--text) 75%, var(--muted)) 50%, var(--muted) 60%, var(--muted) 100%);
  background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: brilho-texto 2.6s ease-in-out infinite; transition: opacity .25s ease;
}
.pensando-texto.trocando { opacity: 0; }
@keyframes brilho { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 4px var(--accent-soft); } }
@keyframes faisca { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.9); opacity: .7; } }
@keyframes brilho-texto { from { background-position: 100% 0; } to { background-position: -150% 0; } }
/* texto surgindo palavra por palavra */
.palavra { opacity: 0; animation: surgir .45s ease-out forwards; }
@keyframes surgir { from { opacity: 0; } to { opacity: 1; } }
/* resumo do raciocínio */
.raciocinio { font-size: 13px; color: var(--muted); }
.raciocinio summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.raciocinio summary::-webkit-details-marker { display: none; }
.raciocinio summary::before { content: "✦"; color: var(--accent); }
.raciocinio summary::after { content: "›"; font-size: 15px; transition: transform .15s; }
.raciocinio[open] summary::after { transform: rotate(90deg); }
.raciocinio ul { list-style: none; margin: 8px 0 0; padding: 0 0 0 4px; border-left: 2px solid var(--border-strong); display: flex; flex-direction: column; gap: 4px; }
.raciocinio li { padding-left: 12px; position: relative; }
.raciocinio li::before { content: "✓"; position: absolute; left: -2px; color: var(--ok); font-weight: 700; }

/* indicador "digitando" (não usado mais, mantido por compatibilidade) */
.typing { display: inline-flex; gap: 5px; padding: 12px 0; }
.typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .5;
  animation: pulso 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }

/* ---------- opções (chips) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 8px 14px; cursor: pointer; font-size: 14px; text-align: left;
  transition: background .15s, border-color .15s, transform .1s;
}
.chip strong { font-weight: 500; }
.chip:hover:not(:disabled) { background: var(--surface-2); border-color: var(--accent); }
.chip:active:not(:disabled) { transform: scale(.98); }
.chip:disabled { opacity: .4; cursor: default; }
.chip.selecionado { background: var(--accent-soft); border-color: var(--accent); opacity: 1; }
.chip-confirmar:not(:disabled) { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip-confirmar:not(:disabled):hover { background: var(--text); opacity: .88; }
.chip.grande { border-radius: 14px; padding: 12px 16px; min-width: 220px; }
.chip.grande .icone { font-size: 22px; }
.chip.grande span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.chip.grande strong { font-weight: 600; }
.chip.grande small { color: var(--muted); font-size: 12.5px; }
.select-wrap { display: flex; gap: 8px; margin-top: 12px; max-width: 420px; }
.select-wrap select {
  flex: 1; min-width: 0; background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 12px; padding: 9px 12px; font: inherit; font-size: 14px;
}
.select-wrap select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select-wrap select:disabled { opacity: .5; }

/* ---------- resultados ---------- */
.resultados { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px 18px;
}
.card.destaque { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft), 0 0 40px -10px var(--accent-soft); }
.card.eliminado { opacity: .7; }
.card-topo { display: grid; grid-template-columns: 112px 1fr; gap: 14px; align-items: start; }
.posicao {
  display: inline-grid; width: 28px; height: 28px; border-radius: 8px; place-items: center; margin: 0 8px 6px 0;
  background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: 12px; vertical-align: middle;
}
.destaque .posicao { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.card-foto { width: 112px; height: 112px; object-fit: contain; border-radius: 12px; background: #fff; border: 1px solid var(--border); }
.card-foto-vazia { display: grid; place-items: center; color: #5c6070; font-weight: 700; font-size: 22px; letter-spacing: -.03em; }
.card-info { min-width: 0; }
.card-info h3 { margin: 0; font-size: 16.5px; font-weight: 600; line-height: 1.35; letter-spacing: -.02em; }
.modelo { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.rotulo {
  display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 2px 8px; margin-bottom: 6px;
}
.destaque .rotulo { background: var(--accent); color: #fff; }
.marca { color: var(--muted); font-size: 13px; }
.specs { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.preco { font-weight: 700; font-size: 22px; letter-spacing: -.03em; margin-top: 8px; line-height: 1.15; }
.preco small { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-top: 2px; }
.card-acoes { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-top: 4px; }
.lojas-secundarias { display: flex; flex-direction: column; gap: 8px; }
.outras-lojas { font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.outras-lojas a { color: var(--text); text-decoration: none; border-bottom: 1px dotted var(--border-strong); }
.outras-lojas a:hover { border-bottom-color: var(--accent); color: var(--accent); }
.score { display: flex; align-items: center; gap: 10px; margin: 12px 0 8px; }
.barra { flex: 1; height: 6px; border-radius: 999px; background: var(--border-strong); overflow: hidden; }
.barra span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; transition: width .6s ease; }
.pct { font-size: 12.5px; color: var(--muted); white-space: nowrap; font-weight: 600; }
.motivos { list-style: none; padding: 0; margin: 6px 0 12px; display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; color: var(--text); }
.motivos li { padding-left: 22px; position: relative; }
.destaques { list-style: none; padding: 0; margin: 12px 0 4px; display: flex; flex-wrap: wrap; gap: 6px; }
.destaques li { font-size: 12.5px; line-height: 1.35; padding: 5px 10px; border-radius: 10px; background: var(--accent-soft); color: var(--text); }
.selo-economia {
  display: flex; align-items: center; gap: 12px; margin: 12px 0 2px; padding: 10px 14px; border-radius: 12px;
  background: var(--eco-soft); border: 1px solid var(--eco);
}
.selo-economia .selo-icone { font-size: 22px; line-height: 1; }
.selo-economia strong { display: block; color: var(--eco); font-size: 15px; }
.selo-economia span { display: block; font-size: 12.5px; color: var(--text); line-height: 1.4; }
.consumo { margin: 4px 0 12px; font-size: 13px; color: var(--muted); }
.consumo summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 13px; }
.consumo p { margin: 8px 0 0; line-height: 1.55; }
.consumo b { color: var(--text); font-weight: 600; }
.motivos li::before { position: absolute; left: 0; top: 0; font-weight: 700; }
.motivos li.bom::before { content: "✔"; color: var(--ok); }
.motivos li.neutro::before { content: "•"; color: var(--warn); }
.motivos li.ruim::before { content: "✖"; color: var(--bad); }
.tag-eliminado { display: inline-block; font-size: 11.5px; font-weight: 600; color: var(--bad); background: var(--bad-soft); border-radius: 6px; padding: 2px 8px; margin-top: 4px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--text); color: var(--bg); text-decoration: none; font-weight: 600;
  padding: 9px 16px; border-radius: 999px; font-size: 14px; border: 0; cursor: pointer;
  transition: opacity .15s;
}
.btn:hover { opacity: .92; }
.btn-comprar {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border-radius: 14px; padding: 13px 16px; font-size: 15px; line-height: 1.35;
  width: 100%; justify-content: center; text-align: center; white-space: normal;
}
.btn-loja, .btn-secundario {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  background: transparent; color: var(--text); text-decoration: none; font-weight: 600;
  border: 1px solid var(--border-strong); border-radius: 12px; padding: 10px 12px; font-size: 13.5px;
  cursor: pointer; line-height: 1.35;
}
.btn-loja:hover, .btn-secundario:hover { border-color: var(--accent); color: var(--accent); }
.custo-anos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 4px; }
.custo-anos div { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.custo-anos small, .custo-anos span { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; }
.custo-anos strong { display: block; font-size: 18px; letter-spacing: -.03em; margin: 2px 0; }

/* ---------- barra de entrada ---------- */
.composer {
  position: sticky; bottom: 0; z-index: 10; margin: 0;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  padding: 20px 16px calc(12px + env(safe-area-inset-bottom));
}
.composer-inner {
  max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 26px;
  padding: 7px 7px 7px 20px; box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.composer-inner:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
#entrada { flex: 1; border: 0; outline: 0; background: transparent; color: inherit; font: inherit; font-size: 15.5px; min-width: 0; }
#entrada::placeholder { color: var(--muted); }
.btn-enviar {
  width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer; flex: none;
  background: var(--text); color: var(--bg); display: grid; place-items: center;
  transition: opacity .15s;
}
.btn-enviar:hover { opacity: .85; }
.btn-enviar svg { width: 18px; height: 18px; }
.aviso { max-width: 760px; margin: 0 auto; padding: 4px 0 18px; text-align: center; color: var(--muted); font-size: 11.5px; }
.composer[hidden] { display: none; }

/* ---------- animações / responsivo ---------- */
@keyframes aparecer { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pulso { 0%, 80%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-4px); opacity: 1; } }
@media (max-width: 520px) {
  .msg.user { max-width: 90%; }
  .chip.grande { min-width: 100%; }
  .brand-texto small { display: none; }
  /* cards ocupam a largura toda (voltam para baixo do avatar), e o preço desce para uma linha própria */
  .conteudo > .card, .conteudo > .resultados, .conteudo > .folga { margin-left: -40px; }
  .card-topo { grid-template-columns: 84px 1fr; gap: 10px; }
  .card-foto { width: 84px; height: 84px; }
  .custo-anos { grid-template-columns: 1fr; }
  .preco { font-size: 20px; }
  .btn-ghost span { display: none; }
  .btn-ghost { width: 34px; height: 34px; padding: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .msg, .typing span, .barra span, .avatar.pensando, .avatar.pensando svg, .pensando-texto, .palavra { animation: none; transition: none; }
  .palavra { opacity: 1; }
  .pensando-texto { color: var(--muted); background: none; }
}
/* resumo do raciocínio colado à recomendação, sem avatar repetido */
.msg-raciocinio { margin-bottom: -14px; }
.msg-raciocinio .avatar { visibility: hidden; height: 0; margin: 0; }

/* data da consulta de preço no card */
.consulta { margin: 0 0 10px; font-size: 11.5px; color: var(--muted); }

/* ---------- home, progresso, páginas ---------- */
#home[hidden], #progresso[hidden], #respostas-rapidas[hidden] { display: none !important; }
.home { padding: 28px 0 12px; }
.home-kicker {
  margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent);
}
.home h1 { margin: 0 0 10px; font-size: clamp(28px, 6vw, 40px); line-height: 1.15; letter-spacing: -.03em; }
.home-lead { margin: 0 0 18px; color: var(--muted); font-size: 16px; }
.home-beneficios { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-direction: column; gap: 10px; }
.home-beneficios li { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.home-beneficios strong { display: block; font-size: 15px; }
.home-beneficios span { display: block; color: var(--muted); font-size: 13.5px; }
.home-ctas { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 22px; }
.home .btn-comprar { width: auto; min-width: 200px; }
.home-lojas-titulo { margin: 0 0 8px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.home-lojas { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 8px; }
.home-lojas li {
  border: 1px solid var(--border-strong); border-radius: 999px; padding: 5px 10px;
  font-size: 12px; font-weight: 700; color: var(--text); letter-spacing: .01em;
}
.progresso { display: flex; align-items: center; gap: 8px; min-width: 0; }
.progresso-trilha { width: 84px; height: 6px; border-radius: 999px; background: var(--border-strong); overflow: hidden; }
.progresso-trilha span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }
#progresso-texto { font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.respostas-rapidas { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0 0; }
.respostas-rapidas button {
  flex: none; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 6px 10px; font-size: 12.5px; cursor: pointer;
}
.respostas-rapidas button strong { color: var(--text); font-weight: 600; }
.respostas-rapidas button:hover { border-color: var(--accent); }
.btn-voltar {
  margin-top: 10px; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; font-size: 13px;
}
.btn-voltar:hover { color: var(--text); }
.folga {
  margin-top: 8px; padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--warn); background: rgba(251, 191, 36, .08);
}
.folga p { margin: 0; }
.rodape {
  max-width: 760px; margin: 8px auto 0; padding: 8px 16px 28px;
  color: var(--muted); font-size: 12.5px;
}
.rodape p { margin: 0 0 8px; }
.rodape nav { display: flex; gap: 14px; }
.rodape a { color: var(--text); text-decoration: none; font-weight: 600; }
.rodape a:hover { color: var(--accent); }
.pagina { max-width: 720px; margin: 0 auto; padding: 28px 16px 12px; }
.pagina h1 { margin: 0 0 12px; font-size: clamp(28px, 5vw, 36px); letter-spacing: -.03em; line-height: 1.15; }
.pagina h2 { margin: 26px 0 8px; font-size: 18px; }
.pagina p, .pagina li { color: var(--text); }
.pagina ul { padding-left: 18px; }
.pagina li { margin: 6px 0; }
@media (max-width: 520px) {
  .topo-inner { flex-wrap: wrap; }
  .progresso { order: 3; flex: 1 0 100%; }
  .progresso-trilha { flex: 1; width: auto; }
  .home .btn-comprar, .home .btn-secundario { width: 100%; }
}
