/*
  Falex Design System v1.0 | componentes de referência
  Consome apenas tokens semânticos (--fx-*). Prefixo de classe: fx-
  Serve de especificação para a implementação no catálogo (React, Vue ou HTML puro).
*/

/* ---------- Ícone ---------- */
.fx-icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Botão ---------- */
.fx-btn {
  --_h: 44px;
  --_px: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--fx-space-2);
  min-height: var(--_h);
  padding: 0 var(--_px);
  border: 1.5px solid transparent;
  border-radius: var(--fx-radius-pill);
  font: var(--fx-weight-semibold) var(--fx-text-base)/1 var(--fx-font-body);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--fx-dur) var(--fx-ease-out),
    border-color var(--fx-dur) var(--fx-ease-out),
    color var(--fx-dur) var(--fx-ease-out),
    transform var(--fx-dur-fast) var(--fx-ease-out);
}
.fx-btn:active:not(:disabled, [aria-disabled="true"]) { transform: translateY(1px) scale(0.99); }
.fx-btn:focus-visible { outline: 3px solid var(--fx-focus); outline-offset: 2px; }
.fx-btn:disabled,
.fx-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.fx-btn--sm { --_h: 36px; --_px: 14px; font-size: var(--fx-text-sm); }
.fx-btn--lg { --_h: 52px; --_px: 28px; font-size: var(--fx-text-md); }
.fx-btn--block { width: 100%; }
.fx-btn--icon { --_px: 0; width: var(--_h); }

.fx-btn--primary { background: var(--fx-brand); color: var(--fx-on-brand); }
.fx-btn--primary:hover:not(:disabled, [aria-disabled="true"]) { background: var(--fx-brand-hover); }
.fx-btn--secondary { background: var(--fx-surface); color: var(--fx-text); border-color: var(--fx-border-strong); }
.fx-btn--secondary:hover:not(:disabled, [aria-disabled="true"]) { background: var(--fx-surface-2); border-color: var(--fx-text-subtle); }
.fx-btn--ghost { background: transparent; color: var(--fx-brand-text); }
.fx-btn--ghost:hover:not(:disabled, [aria-disabled="true"]) { background: var(--fx-brand-soft); }
.fx-btn--accent { background: var(--fx-accent); color: var(--fx-on-accent); }
.fx-btn--accent:hover:not(:disabled, [aria-disabled="true"]) { filter: brightness(0.95); }
.fx-btn--whatsapp { background: var(--fx-whatsapp); color: #ffffff; }
.fx-btn--whatsapp:hover:not(:disabled, [aria-disabled="true"]) { filter: brightness(1.1); }

.fx-btn[aria-busy="true"] { position: relative; color: transparent; pointer-events: none; }
.fx-btn[aria-busy="true"]::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--fx-on-brand);
  border-right-color: transparent;
  animation: fx-spin 0.7s linear infinite;
}

/* ---------- Campos ---------- */
.fx-field { display: grid; gap: 6px; }
.fx-label { font: var(--fx-weight-semibold) var(--fx-text-sm)/1.3 var(--fx-font-body); color: var(--fx-text); }
.fx-hint { font-size: var(--fx-text-xs); line-height: 1.4; color: var(--fx-text-subtle); }

.fx-input,
.fx-select {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  background: var(--fx-surface);
  color: var(--fx-text);
  border: 1.5px solid var(--fx-border-strong);
  border-radius: var(--fx-radius-sm);
  font: var(--fx-weight-regular) var(--fx-text-base)/1.2 var(--fx-font-body);
  transition: border-color var(--fx-dur) var(--fx-ease-out), box-shadow var(--fx-dur) var(--fx-ease-out);
}
.fx-input::placeholder { color: var(--fx-text-subtle); }
.fx-input:hover,
.fx-select:hover { border-color: var(--fx-text-subtle); }
.fx-input:focus,
.fx-select:focus {
  outline: none;
  border-color: var(--fx-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--fx-focus) 28%, transparent);
}
.fx-input--mono { font-family: var(--fx-font-mono); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.fx-field[data-state="error"] .fx-input { border-color: var(--fx-danger); }
.fx-field[data-state="error"] .fx-hint { color: var(--fx-danger); display: flex; gap: 6px; align-items: center; }

.fx-select { appearance: none; padding-right: 42px; cursor: pointer; }
.fx-select-wrap { position: relative; }
.fx-select-wrap > .fx-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  translate: 0 -50%;
  color: var(--fx-text-muted);
  pointer-events: none;
}

.fx-search { position: relative; display: flex; align-items: center; }
.fx-search > .fx-icon { position: absolute; left: 16px; color: var(--fx-text-subtle); pointer-events: none; }
.fx-search .fx-input { border-radius: var(--fx-radius-pill); padding-left: 46px; }

/* ---------- Chip de filtro ---------- */
.fx-chips {
  display: flex;
  gap: var(--fx-space-2);
  overflow-x: auto;
  padding-block: 3px;
  scrollbar-width: none;
}
.fx-chips::-webkit-scrollbar { display: none; }
.fx-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1.5px solid var(--fx-border);
  border-radius: var(--fx-radius-pill);
  background: var(--fx-surface);
  color: var(--fx-text-muted);
  font: var(--fx-weight-semibold) var(--fx-text-sm)/1 var(--fx-font-body);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--fx-dur) var(--fx-ease-out), color var(--fx-dur) var(--fx-ease-out), border-color var(--fx-dur) var(--fx-ease-out);
}
.fx-chip:hover { border-color: var(--fx-border-strong); color: var(--fx-text); }
.fx-chip:focus-visible { outline: 3px solid var(--fx-focus); outline-offset: 2px; }
.fx-chip[aria-pressed="true"] { background: var(--fx-inverse); border-color: var(--fx-inverse); color: var(--fx-on-inverse); }
.fx-chip__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fx-brand); }

/* ---------- Etiquetas (tags) ---------- */
.fx-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 0 8px;
  border-radius: var(--fx-radius-xs);
  font: var(--fx-weight-bold) var(--fx-text-2xs)/1 var(--fx-font-body);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.fx-tag .fx-icon { width: 12px; height: 12px; stroke-width: 2.6; }
.fx-tag--free { background: var(--fx-success-soft); color: var(--fx-success); }
.fx-tag--allergen { background: var(--fx-warning-soft); color: var(--fx-warning); }
.fx-tag--neutral { background: var(--fx-sunken); color: var(--fx-text-muted); }
.fx-tag--season { background: var(--fx-brand-soft); color: var(--fx-brand-text); }

/* Selo adesivo: contorno branco + anel de marca, como o logotipo */
.fx-tag--new {
  min-height: 26px;
  padding: 0 11px;
  border-radius: var(--fx-radius-pill);
  background: var(--fx-accent);
  color: var(--fx-on-accent);
  font-size: var(--fx-text-xs);
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 3.5px var(--fx-brand);
  rotate: -4deg;
}

/* ---------- Lupa ANVISA (RDC 429/2020 e IN 75/2020) ----------
   Desenho regulado: preto e branco, sem cor de marca, sem cantos arredondados.
   Não muda com o tema. Na dúvida, usar a arte oficial do rótulo. */
.fx-anvisa {
  display: inline-flex;
  align-items: stretch;
  border: 1.5px solid #000000;
  background: #ffffff;
  color: #000000;
  font: 700 9.5px/1.05 Arial, Helvetica, sans-serif;
  letter-spacing: 0;
  text-transform: uppercase;
  vertical-align: middle;
}
.fx-anvisa__lupa { display: flex; align-items: center; gap: 3px; padding: 3px 5px; }
.fx-anvisa__lupa svg { width: 14px; height: 14px; }
.fx-anvisa__item { display: flex; align-items: center; padding: 3px 6px; background: #000000; color: #ffffff; max-width: 12ch; }
.fx-anvisa__item + .fx-anvisa__item { border-left: 1.5px solid #ffffff; }

/* ---------- Quantidade em caixas ---------- */
.fx-stepper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 44px;
  padding: 3px;
  border: 1.5px solid var(--fx-brand);
  border-radius: var(--fx-radius-pill);
  background: var(--fx-brand-soft);
}
.fx-stepper--block { display: flex; width: 100%; justify-content: space-between; }
.fx-stepper button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--fx-surface);
  color: var(--fx-brand-text);
  cursor: pointer;
  transition: background-color var(--fx-dur-fast) var(--fx-ease-out);
}
.fx-stepper button:hover:not(:disabled) { background: var(--fx-brand); color: var(--fx-on-brand); }
.fx-stepper button:disabled { opacity: 0.35; cursor: not-allowed; }
.fx-stepper button:focus-visible { outline: 3px solid var(--fx-focus); outline-offset: 1px; }
.fx-stepper output {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  min-width: 6ch;
  font: var(--fx-weight-medium) var(--fx-text-sm)/1 var(--fx-font-body);
  color: var(--fx-text);
}
.fx-stepper output b { font: var(--fx-weight-bold) var(--fx-text-md)/1 var(--fx-font-mono); font-variant-numeric: tabular-nums; }
.fx-stepper output small { font: var(--fx-weight-regular) var(--fx-text-xs)/1 var(--fx-font-mono); color: var(--fx-text-subtle); }

/* ---------- Card de produto ---------- */
.fx-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 8px;
  background: var(--fx-surface);
  border: 1px solid var(--fx-border);
  border-radius: var(--fx-radius-lg);
  transition: box-shadow var(--fx-dur) var(--fx-ease-out), border-color var(--fx-dur) var(--fx-ease-out);
}
.fx-card:hover { box-shadow: var(--fx-shadow-md); border-color: var(--fx-border-strong); }
.fx-card__media {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  max-width: 100%;
  background: var(--fx-vitrine);
  border-radius: var(--fx-radius-md);
  overflow: hidden;
}
.fx-card__media > img { width: 100%; height: 100%; object-fit: contain; transition: transform var(--fx-dur-slow) var(--fx-ease-out); }
.fx-card:hover .fx-card__media > img { transform: scale(1.04); }
.fx-card__media--empty { background: var(--fx-surface-2); border: 1.5px dashed var(--fx-border-strong); }
.fx-card__nophoto { display: grid; justify-items: center; gap: 10px; color: var(--fx-text-subtle); font-size: var(--fx-text-xs); font-weight: var(--fx-weight-semibold); }
.fx-card__nophoto img { width: 44%; height: auto; opacity: 0.9; }
.fx-card__sticker { position: absolute; top: 14px; right: 14px; }
.fx-card__body { display: flex; flex-direction: column; gap: 10px; flex: 1; padding: 12px 8px 8px; }
.fx-card__eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font: var(--fx-weight-semibold) var(--fx-text-2xs)/1.2 var(--fx-font-body);
  letter-spacing: var(--fx-tracking-caps);
  text-transform: uppercase;
  color: var(--fx-text-subtle);
}
.fx-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--fx-brand); }
.fx-card__title {
  margin: 0;
  font: var(--fx-weight-bold) var(--fx-text-md)/1.15 var(--fx-font-display);
  letter-spacing: -0.012em;
  text-wrap: balance;
  color: var(--fx-text);
}
.fx-card__desc { margin: -4px 0 0; font-size: var(--fx-text-sm); line-height: 1.35; color: var(--fx-text-muted); }
.fx-card__tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fx-spec { display: grid; gap: 4px; margin: 0; font-size: var(--fx-text-xs); }
.fx-spec > div { display: flex; justify-content: space-between; gap: 8px; }
.fx-spec dt { color: var(--fx-text-subtle); }
.fx-spec dd { margin: 0; font-family: var(--fx-font-mono); font-variant-numeric: tabular-nums; color: var(--fx-text); text-align: right; }
/* Picote de rótulo separa dado técnico de ação */
.fx-card__foot { display: grid; gap: 10px; margin-top: auto; padding-top: 12px; border-top: 1.5px dashed var(--fx-border); }

.fx-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; min-height: 26px; }
.fx-price__value { font: var(--fx-weight-bold) var(--fx-text-lg)/1 var(--fx-font-display); font-variant-numeric: tabular-nums; color: var(--fx-text); }
.fx-price__unit { font-size: var(--fx-text-xs); color: var(--fx-text-subtle); }
.fx-price--locked { align-items: center; font-size: var(--fx-text-xs); color: var(--fx-text-subtle); }
.fx-price--locked .fx-icon { width: 14px; height: 14px; }

/* ---------- Linha de lista (recompra rápida) ---------- */
.fx-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto minmax(160px, auto);
  gap: 16px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--fx-border);
}
.fx-row__thumb { width: 56px; height: 56px; object-fit: contain; background: var(--fx-vitrine); border-radius: var(--fx-radius-sm); }
.fx-row__name { font-weight: var(--fx-weight-semibold); }
.fx-row__meta { font: var(--fx-text-xs)/1.4 var(--fx-font-mono); color: var(--fx-text-subtle); font-variant-numeric: tabular-nums; }
.fx-row__box { font-size: var(--fx-text-xs); color: var(--fx-text-muted); white-space: nowrap; }
@media (max-width: 620px) {
  .fx-row { grid-template-columns: 48px minmax(0, 1fr); gap: 8px 12px; }
  .fx-row__thumb { width: 48px; height: 48px; grid-row: span 3; align-self: start; }
  .fx-row > :nth-child(n + 3) { grid-column: 2; }
}

/* ---------- Alertas ---------- */
.fx-alert {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid;
  border-radius: var(--fx-radius-md);
  font-size: var(--fx-text-sm);
  line-height: 1.45;
  color: var(--fx-text);
}
.fx-alert > .fx-icon { margin-top: 1px; }
.fx-alert strong { display: block; font-weight: var(--fx-weight-bold); }
.fx-alert--info { background: var(--fx-info-soft); border-color: color-mix(in srgb, var(--fx-info) 30%, transparent); }
.fx-alert--info > .fx-icon { color: var(--fx-info); }
.fx-alert--success { background: var(--fx-success-soft); border-color: color-mix(in srgb, var(--fx-success) 30%, transparent); }
.fx-alert--success > .fx-icon { color: var(--fx-success); }
.fx-alert--warning { background: var(--fx-warning-soft); border-color: color-mix(in srgb, var(--fx-warning) 35%, transparent); }
.fx-alert--warning > .fx-icon { color: var(--fx-warning); }
.fx-alert--danger { background: var(--fx-danger-soft); border-color: color-mix(in srgb, var(--fx-danger) 30%, transparent); }
.fx-alert--danger > .fx-icon { color: var(--fx-danger); }

/* ---------- Medidor de pedido mínimo ---------- */
.fx-meter { display: grid; gap: 6px; }
.fx-meter__label { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fx-text-xs); color: var(--fx-text-muted); }
.fx-meter__label b { font-family: var(--fx-font-mono); color: var(--fx-text); font-variant-numeric: tabular-nums; }
.fx-meter__track { height: 10px; border-radius: var(--fx-radius-pill); background: var(--fx-sunken); overflow: hidden; }
.fx-meter__fill {
  height: 100%;
  border-radius: inherit;
  background: repeating-linear-gradient(-45deg, var(--fx-brand) 0 7px, var(--fx-brand-hover) 7px 14px);
  transition: width var(--fx-dur-slow) var(--fx-ease-out);
}
.fx-meter[data-done] .fx-meter__fill { background: var(--fx-success); }

/* ---------- Resumo do pedido ---------- */
.fx-summary {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  background: var(--fx-surface);
  border: 1px solid var(--fx-border);
  border-radius: var(--fx-radius-lg);
}
.fx-summary__title { margin: 0; font: var(--fx-weight-bold) var(--fx-text-lg)/1.1 var(--fx-font-display); }
.fx-summary__list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.fx-summary__item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: var(--fx-text-sm); }
.fx-summary__item img,
.fx-summary__item .fx-summary__ph { width: 40px; height: 40px; object-fit: contain; background: var(--fx-vitrine); border-radius: 8px; }
.fx-summary__item .fx-summary__ph { background: var(--fx-surface-2); }
.fx-summary__qty { font-family: var(--fx-font-mono); font-size: var(--fx-text-xs); color: var(--fx-text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.fx-summary__totals { display: grid; gap: 6px; padding-top: 12px; border-top: 1.5px dashed var(--fx-border); font-size: var(--fx-text-sm); }
.fx-summary__totals > div { display: flex; justify-content: space-between; gap: 8px; }
.fx-summary__totals dd { margin: 0; font-family: var(--fx-font-mono); font-variant-numeric: tabular-nums; font-weight: var(--fx-weight-semibold); }
.fx-summary__totals dt { color: var(--fx-text-muted); }

/* ---------- Faixa B2B e cabeçalho do catálogo ---------- */
.fx-banner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 18px;
  padding: 8px 16px;
  background: var(--fx-inverse);
  color: var(--fx-on-inverse);
  font-size: var(--fx-text-xs);
  font-weight: var(--fx-weight-semibold);
  letter-spacing: 0.02em;
  text-align: center;
}
.fx-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 12px 16px;
  background: var(--fx-surface);
}
.fx-header__logo { height: 48px; width: auto; }
.fx-header .fx-search { flex: 1 1 240px; order: 0; }
.fx-header__actions { display: flex; gap: 8px; margin-left: auto; }
.fx-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--fx-radius-pill);
  background: var(--fx-accent);
  color: var(--fx-on-accent);
  font: var(--fx-weight-bold) var(--fx-text-xs)/1 var(--fx-font-mono);
}
.fx-count.is-bump { animation: fx-pop var(--fx-dur-slow) var(--fx-ease-spring); }

/* ---------- Estado vazio e carregamento ---------- */
.fx-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 40px 20px;
  text-align: center;
  background: var(--fx-surface);
  border: 1.5px dashed var(--fx-border-strong);
  border-radius: var(--fx-radius-lg);
}
.fx-empty img { width: 132px; height: auto; }
.fx-empty h4 { margin: 0; font: var(--fx-weight-bold) var(--fx-text-xl)/1.15 var(--fx-font-display); text-wrap: balance; }
.fx-empty p { margin: 0; max-width: 42ch; color: var(--fx-text-muted); font-size: var(--fx-text-sm); }
.fx-skeleton {
  border-radius: var(--fx-radius-sm);
  background: linear-gradient(90deg, var(--fx-sunken) 0%, var(--fx-surface-2) 50%, var(--fx-sunken) 100%);
  background-size: 200% 100%;
  animation: fx-shimmer 1.4s linear infinite;
}

/* ---------- Aviso rápido ---------- */
.fx-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(440px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: var(--fx-radius-md);
  background: var(--fx-inverse);
  color: var(--fx-on-inverse);
  font-size: var(--fx-text-sm);
  box-shadow: var(--fx-shadow-lg);
}
.fx-toast > .fx-icon { color: var(--fx-accent); }

/* ---------- Padrões de rótulo ---------- */
/* Listra de bala: faixas verticais das embalagens */
.fx-listra {
  height: 48px;
  background: repeating-linear-gradient(
    90deg,
    var(--fx-stripe-a) 0 var(--fx-stripe-width),
    var(--fx-stripe-b) var(--fx-stripe-width) calc(var(--fx-stripe-width) * 2)
  );
}
.fx-listra--sm { height: 8px; --fx-stripe-width: 12px; }
/* Recorte: barra com renda de meia-lua e furinho, como a borda dos rótulos */
.fx-recorte { position: relative; height: 6px; background: var(--fx-stripe-a); }
.fx-recorte::after {
  content: "";
  position: absolute;
  inset: 100% 0 auto;
  height: var(--fx-scallop);
  background:
    radial-gradient(circle at 50% 30%, var(--fx-recorte-furo, var(--fx-bg)) 1.4px, transparent 2px) 0 0 / calc(var(--fx-scallop) * 2) var(--fx-scallop) repeat-x,
    radial-gradient(circle at 50% 0, var(--fx-stripe-a) calc(var(--fx-scallop) - 0.5px), transparent var(--fx-scallop)) 0 0 / calc(var(--fx-scallop) * 2) var(--fx-scallop) repeat-x;
}

/* ---------- Animações ---------- */
@keyframes fx-spin { to { rotate: 360deg; } }
@keyframes fx-shimmer { to { background-position: -200% 0; } }
@keyframes fx-pop { 0% { scale: 1; } 40% { scale: 1.35; } 100% { scale: 1; } }

@media (prefers-reduced-motion: reduce) {
  .fx-btn,
  .fx-card,
  .fx-card__media > img,
  .fx-meter__fill,
  .fx-chip { transition: none; }
  .fx-card:hover .fx-card__media > img { transform: none; }
  .fx-skeleton,
  .fx-count.is-bump { animation: none; }
  .fx-btn[aria-busy="true"]::after { animation-duration: 2s; }
}
