/*!
 * FoxFarma Shop — camada comercial (tema foxshop).
 * Sobre a base foxshop.css (P3); carregada DEPOIS dela.
 * Reaproveita os tokens --fx-* existentes. Sem novas dependências.
 */

/* ==========================================================================
   1. Faixa de aviso acima do header (seção announce_bar, administrável
      no editor de seções; despublicada, a faixa sai da loja)
   ========================================================================== */

.fx-announce {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 16px;
  background-color: var(--fx-primary);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
}

/* Texto longo: quebra em palavras, sem estourar em 360 px. */
.fx-announce p {
  max-width: 60em;
  overflow-wrap: break-word;
}

.fx-announce a {
  color: #FFFFFF;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .fx-announce {
    /* Altura mínima estável: entrar/sair não desloca o layout além do próprio bloco. */
    contain: layout style;
  }
}

.fx-announce__muted {
  opacity: 0.85;
  font-weight: 400;
}

/* ==========================================================================
   2. Home — banner comercial (fx-banner, seção image_hero)
   --------------------------------------------------------------------------
   A home é 100% nativa por seções (editor Aparência → Temas →
   FoxFarma → Seções); este bloco estiliza apenas a seção image_hero
   (Banner FoxFarma). A faixa de aviso (seção 1 acima) é administrável
   no editor (announce_bar).
   ========================================================================== */

.fx-banner {
  position: relative;
  width: 100%;
  overflow: hidden;
  isolation: isolate;
}

/* Imagem: full-bleed, recorte central (composição segura no terço direito).
   Mobile 390/360: ~21:9 visual com altura mínima; Desktop: teto de altura. */
.fx-banner__image {
  display: block;
  width: 100%;
  height: clamp(300px, 58vw, 560px);
  object-fit: cover;
  object-position: center;
}

/* Scrim: gradiente escuro no terço inferior garante contraste do texto
   (branco >= 7:1) independentemente da arte. */
.fx-banner__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(10, 30, 60, 0) 0%,
    rgba(10, 30, 60, 0) 38%,
    rgba(10, 30, 60, 0.42) 62%,
    rgba(10, 30, 60, 0.82) 100%
  );
}

/* Painel de texto: ancorado ao rodapé, largura útil limitada.
   Mobile-first: 24px de gutter; desktop: alinhado ao container 1180px. */
.fx-banner__panel {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 24px 20px 28px;
  max-width: 1180px;
  margin: 0 auto;
}

.fx-banner__title {
  margin: 0;
  color: #FFFFFF;
  font-family: var(--fx-font-heading);
  font-size: clamp(24px, 5.6vw, 40px);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 2px rgba(10, 30, 60, 0.35);
}

.fx-banner__sub {
  margin: 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(15px, 3.8vw, 18px);
  line-height: 1.5;
  text-shadow: 0 1px 2px rgba(10, 30, 60, 0.35);
}

/* CTA: azul da marca, texto branco (5.08:1), alvo >=44px, foco visível. */
.fx-banner__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  margin-top: 4px;
  padding: 0 22px;
  border-radius: 12px;
  background: var(--fx-primary);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color var(--fx-dur-fast) var(--fx-ease-out);
}

.fx-banner__cta:hover { background: var(--fx-primary-strong); }
.fx-banner__cta:focus-visible {
  outline: 2px solid #FFFFFF;
  outline-offset: 2px;
}

/* Desktop: painel respiro maior. */
@media (min-width: 1024px) {
  .fx-banner__panel {
    padding: 32px 24px 44px;
    gap: 12px;
  }
}

/* Reduced motion: sem transições decorativas aqui (transform none). */
@media (prefers-reduced-motion: reduce) {
  .fx-banner__cta { transition: none; }
}

/* Estado neutro (sem arte real): painel textual verdadeiro sobre fundo suave
   da marca — não finge banner final e não exibe arte demonstrativa. */
.fx-banner--neutral {
  background: linear-gradient(135deg, var(--fx-primary-soft) 0%, var(--fx-bg) 100%);
}

.fx-banner__neutral {
  max-width: 1180px;
  margin: 0 auto;
  padding: 56px 20px 60px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.fx-banner__neutral-title {
  margin: 0;
  color: var(--fx-ink);
  font-family: var(--fx-font-heading);
  font-size: clamp(26px, 6vw, 44px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.fx-banner__neutral-sub {
  margin: 0;
  max-width: 34em;
  color: var(--fx-ink-secondary);
  font-size: clamp(15px, 3.8vw, 18px);
  line-height: 1.55;
}

.fx-banner__neutral-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  margin-top: 6px;
  padding: 0 22px;
  border-radius: 12px;
  background: var(--fx-primary);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color var(--fx-dur-fast) var(--fx-ease-out);
}

.fx-banner__neutral-cta:hover { background: var(--fx-primary-strong); }
.fx-banner__neutral-cta:focus-visible {
  outline: 2px solid var(--fx-primary-strong);
  outline-offset: 2px;
}

@media (min-width: 1024px) {
  .fx-banner__neutral { padding: 72px 24px 76px; }
}

@media (prefers-reduced-motion: reduce) {
  .fx-banner__neutral-cta { transition: none; }
}


/* ==========================================================================
   7. PDP — coluna de compra sticky, preço, CTA sticky no mobile
   ========================================================================== */

/* Coluna de compra (o bloco relative max-w-[590px] do template da PDP) */
[class*="max-w-[590px]"] {
  position: sticky;
  top: 96px;
  align-self: start;
}

/* Preço em destaque tabular (v-html do price_html) */
[class*="max-w-[590px]"] .text-2xl,
[class*="max-w-[590px]"] .text-3xl {
  font-family: var(--fx-font-heading);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* CTA principal — sticky no mobile (o botão primário da PDP) */
[class*="max-w-[470px]"] .primary-button {
  position: sticky;
  bottom: 10px;
  z-index: 5;
  box-shadow: 0 -1px 0 var(--fx-border), 0 -8px 16px rgba(10, 30, 60, 0.06);
}

/* "Adicionar ao Carrinho" da PDP vem nativo como secondary-button (outline);
   é a ação comercial primária da página → eleva ao estilo preenchido. */
[class*="max-w-[470px]"] .secondary-button {
  background: var(--fx-primary);
  border-color: var(--fx-primary);
  color: #fff;
}

[class*="max-w-[470px]"] .secondary-button:hover {
  background: var(--fx-primary-strong);
  border-color: var(--fx-primary-strong);
  color: #fff;
}

[class*="max-w-[470px]"] .secondary-button:focus-visible {
  outline: 2px solid var(--fx-primary-strong);
  outline-offset: 2px;
}

/* ==========================================================================
   8. Strip de serviços — oculta via layout (include desativado, ver blade),
      regra CSS removida: colidia com o carrossel de produtos (mesmo seletor).
   ========================================================================== */

/* ==========================================================================
   9. Formulário de endereço (conta) — ordem BR-first
   ========================================================================== */

.fx-form .control-group { margin-bottom: 16px; }

.fx-form input[type="text"],
.fx-form input[type="email"],
.fx-form input[type="tel"],
.fx-form select {
  min-height: 46px;
  font-size: 16px; /* evita zoom de iOS */
}

.fx-form__cep {
  display: flex;
  gap: 10px;
  align-items: center;
}

.fx-form__cep input {
  max-width: 200px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.fx-form__cep .fx-form__hint {
  color: var(--fx-ink-muted);
  font-size: 13px;
  line-height: 1.4;
}

.fx-form__grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

@media (max-width: 480px) {
  .fx-form__grid2 { grid-template-columns: 1fr; gap: 0; }
}

.fx-form__legenda {
  margin: 6px 0 14px;
  color: var(--fx-ink-muted);
  font-size: 13px;
}

/* ==========================================================================
   10. Auth — cartões mais brand
   ========================================================================== */

.fx-auth-card {
  max-width: 440px;
  margin: 0 auto;
  padding: 28px;
  border: 1px solid var(--fx-border);
  border-radius: 16px;
  background: var(--fx-surface);
  box-shadow: var(--fx-shadow-card);
}

/* ==========================================================================
   11. Rodapé slim (estrutura no blade override; aqui só o estilo)
   ========================================================================== */

.fx-footer { border-top: 1px solid var(--fx-border); background: var(--fx-surface); }

.fx-footer__main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px 24px;
  display: grid;
  /* P15-B: +2 colunas fixas (BENEFÍCIOS + CONTA) sobre o grid do P3B. */
  grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr;
  gap: 32px;
}

.fx-footer__brand img { height: 28px; width: auto; }

.fx-footer__brand p {
  margin-top: 10px;
  color: var(--fx-ink-secondary);
  font-size: 14px;
  line-height: 1.5;
  max-width: 300px;
}

.fx-footer__title {
  color: var(--fx-ink);
  font-family: var(--fx-font-heading);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.fx-footer__links { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.fx-footer__links a { color: var(--fx-ink-secondary); font-size: 14px; }
.fx-footer__links a:hover { color: var(--fx-primary-strong); }

/* Newsletter: faixa única e discreta */
.fx-footer__news {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--fx-border);
}

.fx-footer__news form { display: flex; flex: 1; gap: 8px; max-width: 440px; }
.fx-footer__news input {
  flex: 1;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--fx-border-input);
  border-radius: 10px;
  font-size: 15px;
}
.fx-footer__news input:focus { border-color: var(--fx-primary); outline: none; box-shadow: 0 0 0 3px var(--fx-primary-soft); }

.fx-footer__news .fx-hero__cta { height: 44px; padding: 0 18px; font-size: 14px; }

.fx-footer__label { color: var(--fx-ink-secondary); font-size: 14px; font-weight: 500; }

.fx-footer__legal {
  border-top: 1px solid var(--fx-border);
  background: var(--fx-bg);
}

.fx-footer__legal div {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px;
  color: var(--fx-ink-muted);
  font-size: 12.5px;
  line-height: 1.5;
}

@media (max-width: 1024px) {
  .fx-footer__main { grid-template-columns: 1fr 1fr; gap: 24px; }
}

@media (max-width: 560px) {
  .fx-hero__inner { padding: 36px 20px 32px; }
  .fx-hero__search { flex-direction: column; align-items: stretch; }
  .fx-cats { grid-template-columns: 1fr; gap: 10px; }
  .fx-trust__row { grid-template-columns: 1fr; gap: 10px; }
  .fx-footer__main { grid-template-columns: 1fr; gap: 20px; padding: 32px 20px 20px; }
  .fx-footer__news { padding: 0 20px 24px; flex-direction: column; align-items: stretch; }
  .fx-footer__news form { max-width: none; }
}

/* ==========================================================================
   13. Listagem/busca mobile + desktop (barra fixa, cards inteiros)
   Corrige: (a) card de listagem sem caixa real (a <a class="fx-card__img">
   era display:inline e a body transbordava o card — a fileira seguinte e o
   rodapé pintavam por cima dos cards); (b) barra fixa FILTRO/ORDENAR
   cobrindo o último card e ignorando safe-area; (c) composição do grid no
   desktop com 1–2 produtos; (d) estados vazios contextualizados.
   ========================================================================== */

/* --- Card: caixa real para a imagem (1:1) e body em fluxo --------------- */
.fx-card { overflow: hidden; }

.fx-card__img {
  display: block;
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.fx-card__body {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 12px 14px 14px;
}

.fx-card__name {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--fx-ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1.35em * 2); /* 2 linhas reservadas = cards alinhados */
}

.fx-card__price {
  font-weight: 700;
  font-size: 15px;
  color: var(--fx-ink);
  font-variant-numeric: tabular-nums;
}

.fx-card__price * { font-variant-numeric: tabular-nums; }

/* CTA do card: alvo de toque ≥44px, sempre visível (mobile incluído) */
.fx-card__cta {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--fx-border);
  border-radius: 8px;
  background: var(--fx-fill);
  color: var(--fx-ink);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  padding: 0 16px;
}

.fx-card__cta:hover { background: var(--fx-fill-strong); }

.fx-card__cta:disabled { opacity: 0.5; cursor: not-allowed; }

/* Badges do card (estrutura existia no protótipo sem estilo) */
.fx-card__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  color: #fff;
}

.fx-card__badge--promo { background: #DC2626; }

.fx-card__badge--novo { background: var(--fx-primary); }

/* --- Barra fixa FILTRO/ORDENAR (mobile) --------------------------------- */
/* Reserva safe-area (iOS home indicator) e empurra o conteúdo de <main>
   para que a barra não cubra o último card. Quando a barra não renderiza
   (estado vazio), o :has() deixa de casar e o offset desaparece sozinho. */
.fx-mbar { padding-bottom: env(safe-area-inset-bottom, 0px); }

main:has(.fx-mbar) {
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

/* --- Composição do grid com 1–2 produtos (desktop) ---------------------- */
/* Grids marcados com .fx-grid: com 1 produto, 1 coluna centrada; com 2,
   duas colunas centradas e limitadas; com 3+, o padrão nativo (3 colunas).
   Só aplica ≥768px (no mobile o grid já é 2 colunas estreitas). */
@media (min-width: 768px) {
  .fx-grid:has(> :nth-child(1)):not(:has(> :nth-child(3))) {
    grid-template-columns: repeat(2, minmax(0, 320px));
    justify-content: center;
  }

  .fx-grid:has(> :nth-child(1)):not(:has(> :nth-child(2))) {
    grid-template-columns: minmax(0, 320px);
  }
}

/* --- Estados vazios (busca sem resultado × categoria vazia) ------------- */
/* Base .fx-empty já existe no tema (foxshop.css §9). Aqui só título e ações. */
.fx-empty .fx-empty__title {
  margin: 0 auto 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--fx-ink);
}

.fx-empty .fx-empty__title strong { font-weight: 700; }

.fx-empty__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.fx-empty__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 8px;
  background: var(--fx-primary);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
}

.fx-empty__cta:hover { background: var(--fx-primary-strong); }

.fx-empty__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 8px;
  color: var(--fx-primary-strong);
  font-weight: 600;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ==========================================================================
   12. Movimento respeitoso
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .fx-card, .fx-cat, .fx-hero__cta, .fx-card__cta,
  .fx-empty__cta, .fx-empty__link { transition: none; }
}
