
:root {
  --bg: #0b0b0f;
  --surface: #17171d;
  --surface-2: #1f1f27;
  --border: #2b2b36;
  --border-strong: #3a3a48;
  --text: #f1f1f5;
  --muted: #9a9aa8;
  --muted-dim: #6d6d7a;
  --price: #34d977;
  --wa: #25d366;
  --wa-hover: #1ebe5a;
  --radius: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
       background: var(--bg); color: var(--text); min-height: 100vh;
       /* o marquee full-bleed usa 100vw (inclui a scrollbar) — sem isto sobraria
          uma tira de scroll horizontal de ~15px */
       overflow-x: hidden;
       -webkit-font-smoothing: antialiased;
       background-image:
         radial-gradient(1200px 480px at 50% -160px, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%); }
.container { max-width: 1120px; margin: 0 auto; padding: 40px 24px 72px; }
/* Estado inicial (sem busca): centraliza a caixa de busca na vertical, estilo
   Google. Ao buscar, o JS remove .home-empty e o layout volta ao topo. */
.container.home-empty { min-height: 88vh; display: flex; flex-direction: column; justify-content: center; padding-top: 24px; padding-bottom: 24px; }

/* ── Hero ─────────────────────────────────────────────────────────── */
.hero { text-align: center; padding: 24px 0 8px; }
.brand-logo { height: 40px; margin: 0 auto 16px; display: block; }
h1 { font-size: clamp(30px, 5vw, 44px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.05; }
.subtitle { color: var(--muted); font-size: clamp(14px, 2.2vw, 17px); margin-top: 12px; }
/* search-actions empilha a busca e o botão "Grupos de promoções" (pedido Pedro
   2026-07-15: abaixo da busca, não do lado — "um dedo de distância" = gap
   pequeno). Coluna centralizada em vez da linha lado-a-lado anterior. */
.search-actions { display: flex; flex-direction: column; justify-content: center;
                  align-items: center; gap: 14px; margin: 28px 0 8px; }
.search-actions .search-wrap { margin: 0; width: 100%; }
.search-wrap { display: flex; justify-content: center; }
/* Barra única (estilo Google): input transparente + botão embutido no mesmo pill. */
.search-box { width: 100%; max-width: 680px; display: flex; align-items: center; gap: 8px;
              background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
              padding: 6px 6px 6px 24px; transition: border-color .15s, box-shadow .15s; }
.search-box:focus-within { border-color: var(--brand);
                           box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent); }
.search-input { flex: 1; background: transparent; border: none; padding: 14px 0; font-size: 17px;
                color: var(--text); outline: none; }
.search-input::placeholder { color: var(--muted-dim); }
/* Placeholder animado (rotativo de produtos reais, scroll-up) — o atributo
   placeholder nativo não anima via CSS, por isso um overlay por cima do input
   (atrás do texto digitado, pointer-events:none pra nunca capturar clique). */
.search-input-wrap { position: relative; flex: 1; display: flex; align-items: center; }
.search-input-wrap .search-input { flex: 1; }
.placeholder-carousel { position: absolute; inset: 0; display: flex; align-items: center;
                         overflow: hidden; pointer-events: none; }
.placeholder-carousel-item { display: inline-block; color: var(--muted-dim); font-size: 17px;
                              white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
                              max-width: 100%; }
.placeholder-carousel-item.slide-out { animation: placeholderSlideOut .35s ease forwards; }
.placeholder-carousel-item.slide-in { animation: placeholderSlideIn .35s ease forwards; }
@keyframes placeholderSlideOut { to { transform: translateY(-140%); opacity: 0; } }
@keyframes placeholderSlideIn { from { transform: translateY(140%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.search-btn { background: var(--brand); color: #fff; border: none; border-radius: 999px;
              padding: 12px 28px; font-size: 15px; font-weight: 700; cursor: pointer;
              transition: filter .15s, transform .05s; }
.search-btn:hover { filter: brightness(1.08); }
.search-btn:active { transform: scale(.98); }
/* Botão secundário (outline, não compete com o CTA de Buscar) pra página dedicada de
   grupos — mesma altura/pill do search-btn, cor neutra. */
.groups-link-btn { display: inline-flex; align-items: center; background: var(--surface);
                    border: 1px solid var(--border); color: var(--text); border-radius: 999px;
                    padding: 14px 26px; font-size: 15px; font-weight: 700; text-decoration: none;
                    white-space: nowrap; transition: border-color .15s, transform .05s; }
.groups-link-btn:hover { border-color: var(--brand); }
.groups-link-btn:active { transform: scale(.98); }
/* Na tela de resultados (fora da home vazia) o botão do topo some — o acesso
   aos grupos vira o card "Veja mais grupos" no início da lista de Grupos. */
.container:not(.home-empty) .groups-link-btn { display: none; }

/* ── Section headings ─────────────────────────────────────────────── */
.section-head { display: flex; align-items: baseline; justify-content: space-between;
                gap: 12px; margin: 44px 0 18px; }
.section-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.section-head .hint { font-size: 13px; color: var(--muted); }

/* ── Results (busca) ──────────────────────────────────────────────── */
.search-shell { display: none; margin-top: 8px; }
.search-shell.active { display: block; }

/* ── Carrossel de frames (marquee lento, parte de baixo da home) ─────────────── */
/* Full-bleed (pedido Pedro 2026-07-17): a faixa ocupa 100% da viewport, escapando
   do max-width do .container via truque do 50%−50vw; o fade das bordas continua
   no .frame-marquee (mask). */
.frame-marquee-section { margin-top: 32px; width: 100vw; margin-left: calc(50% - 50vw); }
/* some quando há busca ativa — é conteúdo da landing (mesmo espírito do placeholder) */
.search-shell.active ~ .frame-marquee-section { display: none; }
.frame-marquee { overflow: hidden; width: 100%;
                 /* fade nas bordas pra faixa "entrar/sair" suave */
                 -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
                 mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.frame-marquee-track { display: flex; gap: 16px; width: max-content;
                       animation: frameMarquee 90s linear infinite; }
.frame-marquee:hover .frame-marquee-track { animation-play-state: paused; }
/* 2ª faixa (outros produtos): mesma animação tocada ao contrário = desliza pra ESQUERDA */
.frame-marquee-track.reverse { animation-direction: reverse; }
.frame-marquee + .frame-marquee { margin-top: 16px; }
.frame-slide { flex: 0 0 auto; display: block; }
/* Altura fluida (clamp por vh): encolhe o suficiente pra DUAS faixas caberem
   junto do hero na maioria das telas; o teto 230px evita frame gigante em
   monitor alto. */
.frame-slide img { height: clamp(150px, 21vh, 230px); width: auto; border-radius: 12px;
                   border: 1px solid var(--border); display: block; }
/* Tela baixa: não cabem 2 faixas sem estourar a dobra — mantém só a de cima
   (pedido Pedro 2026-07-17: "se faltar espaço, exibir apenas 1"). */
@media (max-height: 760px) {
  #frame-marquee-2 { display: none; }
  .frame-slide img { height: clamp(150px, 26vh, 220px); }
}
/* translateX(-50%)→0: a faixa (duplicada no JS) desliza pra DIREITA, devagar */
@keyframes frameMarquee { from { transform: translateX(-50%); } to { transform: translateX(0); } }
/* NOTA: não desligamos sob prefers-reduced-motion — é um elemento de marca
   decorativo que o Pedro quer animado sempre (2026-07-17). O guard de a11y
   estava fazendo o carrossel ficar ESTÁTICO em navegadores/OS com "reduzir
   movimento" ligado (era a causa do "carrossel fixo"). */

/* ── Grupos recomendados (topo da busca, recorte curado por termo buscado) ──────── */
.recommended-section { display: none; margin-bottom: 22px; }
.recommended-section.active { display: block; }
.recommended-list { display: flex; flex-wrap: wrap; gap: 10px; }
.recommended-btn { display: inline-flex; align-items: center; gap: 8px; background: var(--surface);
                    border: 1px solid var(--border); color: var(--text); border-radius: 999px;
                    padding: 10px 18px; font-size: 14px; font-weight: 600; text-decoration: none;
                    transition: border-color .15s, transform .15s; }
.recommended-btn:hover { border-color: var(--brand); transform: translateY(-2px); }

.sort-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.sort-btn { background: var(--surface); border: 1px solid var(--border); color: var(--muted);
            border-radius: 999px; padding: 8px 18px; font-size: 13px; font-weight: 600; cursor: pointer;
            transition: all .15s; }
.sort-btn:hover { border-color: var(--border-strong); color: var(--text); }
.sort-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.results-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.filters-sidebar { background: var(--surface); border: 1px solid var(--border);
                   border-radius: var(--radius); padding: 18px; display: flex;
                   flex-direction: column; gap: 16px; position: sticky; top: 24px; }
.filters-sidebar h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-group label { font-size: 12px; color: var(--muted); font-weight: 600; }
.filter-select, .filter-price-inputs input {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); padding: 10px 12px; font-size: 13px; width: 100%; }
.filter-select:focus, .filter-price-inputs input:focus { border-color: var(--brand); outline: none; }
.filter-price-inputs { display: flex; gap: 8px; }
.filter-price-inputs input { width: 0; flex: 1; }
.filter-apply { width: 100%; }
.filter-clear { background: none; border: none; color: var(--muted); font-size: 12px;
                cursor: pointer; text-decoration: underline; text-align: left; padding: 0; }
.results-main { min-width: 0; }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }

/* ── Result card (vertical, imagem grande) — CSS compartilhado (webui.CardCSS),
   único entre busca/home/target pra não divergir de novo. ─────────────────── */

.frame-wrap { position: relative; }
.frame-qr { position: absolute; right: 4%; top: 4%; width: 20%; aspect-ratio: 1;
            background: #fff; border-radius: 8%; padding: 2%; }
.frame-qr img { width: 100%; height: 100%; display: block; }
.result-card { background: var(--surface); border: 1px solid var(--border);
               border-radius: var(--radius); overflow: hidden; color: inherit;
               display: flex; flex-direction: column;
               transition: border-color .15s, transform .15s, box-shadow .15s; }
.result-card:hover { border-color: var(--border-strong); transform: translateY(-3px);
                     box-shadow: 0 12px 30px rgba(0,0,0,.35); }
.result-img-link { display: block; position: relative; aspect-ratio: 1 / 1; background: #fff; }
.result-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.result-info { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; }
.result-title { font-size: 14px; line-height: 1.4; font-weight: 500; color: var(--text);
                text-decoration: none; min-height: 2.8em; overflow: hidden; text-overflow: ellipsis;
                display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
                word-break: break-word; }
.result-title:hover { color: var(--brand); }
.result-price-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.result-price { font-size: 22px; font-weight: 800; color: var(--price); letter-spacing: -0.02em; }
.result-price-old { font-size: 13px; color: var(--muted-dim); text-decoration: line-through; }
.result-discount { font-size: 13px; font-weight: 800; color: #052e16; background: var(--price);
                   border-radius: 8px; padding: 3px 9px; align-self: center; }
.result-sent { font-size: 12px; color: var(--muted-dim); }
.result-actions { display: flex; gap: 8px; margin-top: 4px; }
.result-actions .btn { flex: 1; display: inline-flex; align-items: center; justify-content: center;
                       gap: 7px; height: 42px; padding: 0 14px; border-radius: 10px; border: none;
                       cursor: pointer; font-size: 14px; font-weight: 700;
                       background: var(--brand); color: #fff; text-decoration: none; }
.result-actions .btn svg { width: 17px; height: 17px; }
.result-actions .share-btn { flex: 0 0 auto; width: 46px; height: 42px; display: inline-flex;
                             align-items: center; justify-content: center; padding: 0; border: none;
                             border-radius: 10px; cursor: pointer; }
.result-actions .share-btn svg { width: 19px; height: 19px; }
.share-btn { background: var(--wa); color: #fff; }
.share-btn:hover { background: var(--wa-hover); }


/* ── Skeleton de carregamento ─────────────────────────────────────── */
.result-card.skeleton { pointer-events: none; }
.sk { background: linear-gradient(90deg, var(--surface-2) 25%, #2c2c38 37%, var(--surface-2) 63%);
      background-size: 400% 100%; animation: sk-shimmer 1.4s ease infinite; border-radius: 8px; }
.sk-img { aspect-ratio: 1 / 1; border-radius: 0; }
.sk-line { height: 12px; }
.sk-line.short { width: 55%; }
.sk-price { height: 22px; width: 42%; margin-top: auto; }
@keyframes sk-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* ── Header /grupos: título + busca compacta na mesma linha (pedido Pedro
   2026-07-17, screenshot da página) — mesmo estilo da search-box da home, só
   que menor e sem quebrar linha em desktop. ──────────────────────────────── */
.groups-header { display: flex; align-items: center; justify-content: space-between;
                 flex-wrap: wrap; gap: 16px; }
.groups-header h1 { margin: 0; }
.groups-search-form { display: flex; align-items: center; gap: 4px; flex: 0 1 260px;
                      background: var(--surface); border: 1px solid var(--border);
                      border-radius: 999px; padding: 4px 4px 4px 14px;
                      transition: border-color .15s; }
.groups-search-form:focus-within { border-color: var(--brand); }
.groups-search-input { flex: 1; min-width: 0; background: transparent; border: none;
                       padding: 8px 0; font-size: 14px; color: var(--text); outline: none; }
.groups-search-input::placeholder { color: var(--muted-dim); }
.groups-search-btn { flex-shrink: 0; width: 32px; height: 32px; display: flex; align-items: center;
                     justify-content: center; background: var(--brand); color: #fff; border: none;
                     border-radius: 999px; font-size: 14px; cursor: pointer; transition: filter .15s; }
.groups-search-btn:hover { filter: brightness(1.08); }

/* ── Grid de targets (grupos WhatsApp) — página dedicada /grupos. 4 colunas
   em desktop largo (pedido Pedro 2026-07-17: 3 colunas subaproveitava o
   espaço), com fallback 3/2/1 conforme a viewport encolhe. ──────────────── */
.targets-section { display: none; }
.targets-section.active { display: block; }
.subtitle + .targets-section { margin-top: 24px; }
/* auto-fill + minmax: cards ficam estreitos (~200px) e a grid encaixa quantos
   couberem na largura, sem esticar (antes travava em 4 col com cards largos e
   sobra de espaço — pedido Pedro 2026-07-17). Colapsa pra 1 col no mobile. */
.targets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
@media (max-width: 480px) { .targets-grid { grid-template-columns: 1fr; } }
.target-card { position: relative; background: var(--surface); border: 1px solid var(--border);
               border-radius: var(--radius); padding: 14px; text-decoration: none; color: inherit;
               display: flex; flex-direction: column; align-items: center; text-align: center;
               justify-content: center; min-height: 92px;
               transition: border-color .15s, transform .15s, box-shadow .15s; }
.target-card:hover { border-color: var(--brand); transform: translateY(-3px);
                     box-shadow: 0 12px 30px rgba(0,0,0,.35); }
.target-card.skeleton { pointer-events: none; }
.target-icon { font-size: 26px; line-height: 1; margin-bottom: 8px; }
.target-name { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; }

/* grid-column:1/-1 é o que realmente centraliza: .empty é item de um grid
   (.results usa auto-fill/minmax) e sem isso fica preso na 1ª coluna (esquerda)
   em vez de ocupar a linha toda — text-align:center sozinho não resolve, só
   centraliza o texto DENTRO da coluna estreita. max-width+margin:auto casa a
   largura do bloco com a search-box acima (pedido Pedro 2026-07-17). */
.empty { grid-column: 1 / -1; max-width: 640px; margin: 0 auto; color: var(--muted-dim);
         font-size: 14px; text-align: center; padding: 48px 0; }
.empty-request-btn { margin-top: 16px; background: var(--brand); color: var(--bg); border: none;
                      border-radius: 999px; padding: 12px 22px; font-size: 14px; font-weight: 700;
                      cursor: pointer; transition: filter .15s; }
.empty-request-btn:hover { filter: brightness(1.08); }
.empty-request-btn:disabled { opacity: .6; cursor: default; }
.empty-confirmed-msg { margin-bottom: 12px; }
.empty-groups-heading { color: var(--text); font-weight: 600; margin: 20px 0 4px; }
.empty-recommended-groups { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }
.empty-view-all-btn { display: inline-flex; align-items: center; margin-top: 20px;
                       background: var(--surface); border: 1px solid var(--border);
                       color: var(--text); border-radius: 999px; padding: 12px 24px;
                       font-size: 14px; font-weight: 700; text-decoration: none;
                       transition: border-color .15s, transform .05s; }
.empty-view-all-btn:hover { border-color: var(--brand); }

/* ── Sem resultado: só a mensagem (sem filtros/sort/grupos do topo, pedido Pedro 2026-07-16) ── */
.search-shell.no-results .sort-bar,
.search-shell.no-results .filters-sidebar,
.search-shell.no-results #results-heading,
.search-shell.no-results .recommended-section { display: none; }
.search-shell.no-results .results-layout { grid-template-columns: 1fr; }
/* Sem resultado sobra pouco conteúdo — centraliza a página inteira na vertical,
   mesmo tratamento do estado home-empty (pedido Pedro 2026-07-17), mas via classe
   própria (.vcenter) pra não reativar o botão do topo (esse só volta na home real). */
.container.vcenter { min-height: 88vh; display: flex; flex-direction: column; justify-content: center; padding-top: 24px; padding-bottom: 24px; }

/* ── Rodapé / disclosure de afiliado ──────────────────────────────── */
.disclosure { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--border);
              color: var(--muted-dim); font-size: 12px; line-height: 1.6; text-align: center; }

@media (max-width: 720px) {
  .container { padding: 28px 16px 56px; }
  /* Busca fixa no topo no mobile (pedido do Pedro): full-bleed, cola no topo ao
     rolar e fica acima do conteúdo. Margem negativa casa o padding do container. */
  /* Sem border-bottom (pedido Pedro 2026-07-17): a linha aparecia entre a busca
     e o botão de grupos na home vazia; o fundo opaco já separa a barra ao rolar. */
  .search-wrap { position: sticky; top: 0; z-index: 30; margin: 0 -16px 0; padding: 12px 16px;
                 background: var(--bg); }
  .results-layout { grid-template-columns: 1fr; }
  .filters-sidebar { position: static; }
  .results { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}

/* ── Classes legadas do channelTemplate (rota /canais/{id} desativada) ── */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--brand);
        text-decoration: none; font-size: 14px; margin-bottom: 32px; }
.group-list { display: flex; flex-direction: column; gap: 12px; }
.group-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
              padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; }
.group-name { font-size: 15px; font-weight: 500; }
.group-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.btn { display: inline-block; background: var(--brand); color: #fff; border-radius: 8px;
       padding: 8px 16px; font-size: 13px; font-weight: 600; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
