/* =========================================================
   Catálogo público
   As cores --primary, --secondary, --accent e --button são
   definidas pelo painel (Configurações).
   ========================================================= */

:root {
  --primary: #123D91;
  --secondary: #0B2D70;
  --accent: #16854D;
  --button: #123D91;

  --ink: #141922;
  --ink-2: #394150;
  --muted: #6b7280;
  --line: #e4e6eb;
  --line-2: #eff1f4;
  --paper: #ffffff;
  --bg: #f4f5f7;
  --out: #b42318;
  --wa: #1FAF54;

  --radius: 16px;
  --shadow-lg: 0 18px 40px -12px rgba(16, 24, 40, .22);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
img { max-width: 100%; display: block; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; }

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

/* ---------- Cabeçalho ---------- */

.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.site-header .container { display: flex; align-items: center; gap: 16px; min-height: 76px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; min-width: 0; }
.brand-logo { height: 50px; width: auto; max-width: 170px; object-fit: contain; }
.brand-mark {
  flex: none; width: 46px; height: 46px; border-radius: 12px;
  background: var(--primary); color: #fff; display: grid; place-items: center;
  font-weight: 700; letter-spacing: .02em;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-size: 1.12rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.admin-link {
  margin-left: auto; flex: none; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 10px; color: var(--muted); opacity: .45; transition: opacity .2s, background .2s;
}
.admin-link:hover { opacity: 1; background: var(--bg); }

/* ---------- Capa ---------- */

.hero {
  position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}
.hero.has-image::before {
  content: ""; position: absolute; inset: 0;
  background: var(--hero-img) center / cover no-repeat;
}
.hero.has-image::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, var(--secondary) 0%, color-mix(in srgb, var(--secondary) 80%, transparent) 45%, color-mix(in srgb, var(--primary) 25%, transparent) 100%);
}
.hero-inner { position: relative; z-index: 1; padding-top: 68px; padding-bottom: 60px; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 10px; margin: 0 0 18px;
  font-size: .75rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; opacity: .85;
}
.hero-eyebrow::before { content: ""; width: 28px; height: 2px; background: var(--accent); }
.hero-title { margin: 0; max-width: 20ch; font-size: clamp(1.9rem, 4.6vw, 3.1rem); line-height: 1.08; letter-spacing: -.025em; font-weight: 750; }
.hero-text { margin: 18px 0 0; max-width: 56ch; font-size: clamp(1rem, 1.6vw, 1.12rem); opacity: .88; }
.hero-meta { margin: 28px 0 0; font-size: .85rem; opacity: .7; }

/* ---------- Busca e categorias ---------- */

.toolbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(244, 245, 247, .9);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.toolbar-inner { display: grid; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
@media (min-width: 900px) {
  .toolbar-inner { grid-template-columns: 320px minmax(0, 1fr); align-items: center; gap: 20px; }
}
.search { position: relative; display: block; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 48px; padding: 0 16px 0 42px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--paper);
  font-size: 1rem; transition: border-color .2s, box-shadow .2s;
}
.search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; margin: 0 -24px; padding: 0 24px; }
.chips::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .chips { margin: 0; padding: 0; flex-wrap: wrap; } }
.chip {
  flex: none; height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-2);
  font-size: .9rem; font-weight: 500; cursor: pointer; white-space: nowrap; transition: all .15s;
}
.chip:hover { border-color: var(--ink-2); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Seções ---------- */

.catalog { padding-top: 12px; padding-bottom: 140px; }
.section { margin-top: 40px; }
.section-head {
  display: flex; align-items: baseline; gap: 14px;
  padding-bottom: 12px; margin-bottom: 20px; border-bottom: 2px solid var(--ink);
}
.section-num { font-size: .9rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.section-title { margin: 0; font-size: 1.4rem; letter-spacing: -.015em; }
.section-count { margin-left: auto; font-size: .82rem; color: var(--muted); white-space: nowrap; }

/* ---------- Cards ---------- */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 20px; }

.card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  transition: box-shadow .25s, transform .25s, border-color .25s;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: transparent; }
.card-media { position: relative; aspect-ratio: 1 / 1; background: #f8f9fb; border-bottom: 1px solid var(--line-2); }
.card-media img { width: 100%; height: 100%; object-fit: contain; padding: 16px; }
.card-media .ph { position: absolute; inset: 0; display: grid; place-items: center; color: #c8ccd4; }
.card-sku {
  position: absolute; top: 10px; left: 10px; padding: 3px 8px; border-radius: 6px;
  background: rgba(255, 255, 255, .92); border: 1px solid var(--line-2);
  font-size: .68rem; color: var(--muted); font-weight: 600; letter-spacing: .02em;
}
.card.is-out .card-media img { filter: grayscale(1); opacity: .5; }

.card-body { display: flex; flex-direction: column; flex: 1; gap: 6px; padding: 16px 18px 18px; }
.card-cat { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--primary); }
.card-title { margin: 0; font-size: 1.02rem; font-weight: 650; line-height: 1.3; letter-spacing: -.005em; }
.card-desc {
  margin: 0; font-size: .87rem; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.price-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.price { font-size: 1.3rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.price-ask { font-size: 1rem; color: var(--ink-2); }
.stock { font-size: .78rem; font-weight: 600; white-space: nowrap; }
.stock.ok { color: var(--accent); }
.stock.out { color: var(--out); }

.btn-add {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--button); color: #fff; font-weight: 600; font-size: .95rem;
  transition: filter .15s, transform .1s, background .2s;
}
.btn-add:hover { filter: brightness(1.1); }
.btn-add:active { transform: scale(.98); }
.btn-add.added { background: var(--accent); }
.btn-add:disabled { background: #eceef1; color: #9aa1ad; cursor: not-allowed; filter: none; }

.empty { text-align: center; padding: 64px 16px; color: var(--muted); }
.empty p { margin: 4px 0; }
.empty strong { color: var(--ink); font-size: 1.05rem; }

/* ---------- Rodapé ---------- */

.site-footer { background: var(--secondary); color: rgba(255, 255, 255, .82); padding: 44px 0 24px; }
.footer-inner { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap; }
.footer-name { margin: 0 0 6px; color: #fff; font-weight: 700; font-size: 1.1rem; }
.footer-text { margin: 0; max-width: 60ch; font-size: .92rem; }
.footer-wa {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px;
  border-radius: 12px; background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; font-weight: 600;
}
.footer-wa:hover { background: rgba(255, 255, 255, .18); }
.footer-bottom { margin-top: 32px; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .8rem; opacity: .7; }

/* ---------- Barra do pedido ---------- */

.cart-bar {
  position: fixed; z-index: 30; left: 50%; bottom: max(16px, env(safe-area-inset-bottom));
  width: min(560px, calc(100% - 24px)); transform: translate(-50%, 160%);
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 20px;
  background: var(--secondary); color: #fff; border-radius: 18px; box-shadow: var(--shadow-lg);
  transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}
.cart-bar.show { transform: translate(-50%, 0); }
.cart-bar-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.cart-bar-count { font-size: .8rem; opacity: .8; }
.cart-bar-total { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.cart-bar-btn {
  height: 48px; padding: 0 22px; border: 0; border-radius: 12px; cursor: pointer;
  background: #fff; color: var(--secondary); font-weight: 700;
}

/* ---------- Painel lateral do pedido ---------- */

.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(10, 15, 25, .45); opacity: 0; pointer-events: none; transition: opacity .25s; }
.overlay.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; z-index: 50; top: 0; right: 0; height: 100%; width: min(440px, 100%);
  display: flex; flex-direction: column; background: var(--paper);
  transform: translateX(105%); transition: transform .35s cubic-bezier(.2, .8, .2, 1);
  box-shadow: var(--shadow-lg);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 1.2rem; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { background: var(--bg); }
.drawer-body { flex: 1; overflow-y: auto; padding: 4px 20px; overscroll-behavior: contain; }
.drawer-empty { color: var(--muted); text-align: center; padding: 48px 8px; }

.line-items { list-style: none; margin: 0; padding: 0; }
.line-item { display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 16px 0; border-bottom: 1px solid var(--line-2); }
.li-thumb { width: 60px; height: 60px; border-radius: 10px; background: #f6f7f9; border: 1px solid var(--line-2); overflow: hidden; }
.li-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.li-name { margin: 0; font-weight: 600; font-size: .93rem; line-height: 1.3; }
.li-price { margin: 2px 0 8px; font-size: .8rem; color: var(--muted); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.qty button { width: 38px; height: 36px; border: 0; background: var(--paper); cursor: pointer; font-size: 1.1rem; }
.qty button:hover { background: var(--bg); }
.qty-value { min-width: 34px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.li-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.li-sub { font-size: .95rem; font-variant-numeric: tabular-nums; }
.li-remove { border: 0; background: none; color: var(--muted); font-size: .8rem; cursor: pointer; padding: 4px 0; text-decoration: underline; }
.li-remove:hover { color: var(--out); }

.drawer-foot { padding: 16px 20px max(20px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fbfbfc; display: flex; flex-direction: column; gap: 12px; }
.drawer-total { display: flex; justify-content: space-between; align-items: baseline; }
.drawer-total span { color: var(--muted); }
.drawer-total strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.drawer-field { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.drawer-field em { font-weight: 400; font-style: normal; color: var(--muted); }
.drawer-field input, .drawer-field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; font-size: 1rem; font-weight: 400; resize: none;
}
.btn-whatsapp {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  height: 54px; border: 0; border-radius: 14px; cursor: pointer;
  background: var(--wa); color: #fff; font-size: 1.02rem; font-weight: 700;
}
.btn-whatsapp:hover { filter: brightness(1.06); }
.drawer-seller { margin: 0; text-align: center; font-size: .82rem; color: var(--muted); }
.btn-clear { border: 0; background: none; color: var(--muted); font-size: .85rem; cursor: pointer; padding: 4px; }
.btn-clear:hover { color: var(--out); }

.toast {
  position: fixed; z-index: 60; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 24px); opacity: 0;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px;
  background: var(--ink); color: #fff; font-size: .9rem; box-shadow: var(--shadow-lg);
  transition: transform .3s, opacity .3s; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
body.no-scroll .cart-bar { transform: translate(-50%, 160%); }

/* ---------- Botão flutuante do WhatsApp ---------- */

.float-wa {
  position: fixed; z-index: 35;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 20px 0 16px; border-radius: 999px;
  background: var(--wa); color: #fff; text-decoration: none; font-weight: 600; font-size: .95rem;
  box-shadow: 0 10px 26px -8px rgba(20, 120, 60, .55);
  transition: bottom .35s cubic-bezier(.2, .8, .2, 1), opacity .2s, filter .15s;
}
.float-wa:hover { filter: brightness(1.06); }
/* Quando a barra do pedido aparece, o botão sobe e fica acima dela */
body.has-cart .float-wa { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 80px); }
body.no-scroll .float-wa { opacity: 0; pointer-events: none; }
body.has-cart .toast { bottom: calc(160px + env(safe-area-inset-bottom)); }

.hero-seller {
  display: inline-flex; align-items: center; gap: 8px; margin: 22px 0 0; padding: 8px 14px;
  border-radius: 999px; background: rgba(255, 255, 255, .12); font-size: .9rem;
}
.hero-seller .dot { width: 8px; height: 8px; border-radius: 50%; background: #3ee07f; box-shadow: 0 0 0 3px rgba(62, 224, 127, .25); }
.hero-seller + .hero-meta { margin-top: 16px; }

/* ---------- Celular ---------- */

@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .chips { margin: 0 -16px; padding: 0 16px; }
  .site-header .container { min-height: 66px; }
  .brand-logo { height: 40px; max-width: 130px; }
  .brand-mark { width: 40px; height: 40px; }
  .hero-inner { padding-top: 44px; padding-bottom: 40px; }
  .section { margin-top: 32px; }
  .section-title { font-size: 1.2rem; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card { border-radius: 14px; }
  .card:hover { transform: none; }
  .card-media img { padding: 10px; }
  .card-body { padding: 12px; gap: 4px; }
  .card-title { font-size: .92rem; }
  .card-desc { font-size: .8rem; -webkit-line-clamp: 2; }
  .price { font-size: 1.08rem; }
  .stock { font-size: .72rem; }
  .btn-add { height: 44px; font-size: .9rem; }
  .card-sku { display: none; }

  .float-wa { width: 56px; padding: 0; justify-content: center; right: 16px; }
  .float-wa-label { display: none; }
  .cart-bar { width: calc(100% - 24px); }

  .drawer {
    top: auto; bottom: 0; height: 90vh; height: 90dvh; width: 100%;
    border-radius: 20px 20px 0 0; transform: translateY(105%);
  }
}

@media (max-width: 340px) {
  .grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
