/* ============================================================
   O Armazém — Grãos e Naturais · estilos (vitrine + admin)
   Identidade tirada do logo: preto puro, mostarda da fita,
   traço de nanquim (bordas escuras, hachura diagonal).
   Tipos: Caveat Brush (letreiro, só em títulos) + Figtree (interface).
   ============================================================ */

:root {
  --black:       #000000;   /* fundo do logo */
  --ink:         #1A1712;   /* texto: nanquim quente */
  --mustard:     #E49A0E;   /* amarelo da fita (medido no logo) */
  --mustard-lt:  #F6D58E;
  --mustard-bg:  #FBEBC4;   /* fundo de pill/realce */
  --amber-text:  #8A5500;   /* mostarda escurecida p/ texto em fundo claro (contraste AA) */
  --paper:       #F3EEE3;   /* papel de saco de grão */
  --surface:     #FFFDF8;
  --muted:       #6E665A;
  --line:        #D9D0BE;
  --line-soft:   #E9E2D4;
  --danger:      #A12B1F;
  --wa:          #1D7F48;   /* verde WhatsApp escurecido: texto branco com contraste AA */
  --wa-hover:    #166238;
  --radius:      6px;
  --wrap:        1120px;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --hand: "Caveat Brush", "Segoe Print", "Comic Sans MS", cursive;
  /* hachura diagonal — eco do sombreamento da fita no logo */
  --hatch: repeating-linear-gradient(-55deg, var(--mustard) 0 3px, var(--black) 3px 7px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--mustard); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--mustard); outline-offset: 2px; border-radius: 3px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-block; font: inherit; font-weight: 600;
  padding: .6rem 1rem; border: 1.5px solid var(--ink);
  background: var(--surface); color: var(--ink);
  border-radius: var(--radius); cursor: pointer; text-decoration: none;
}
.btn:hover { text-decoration: none; background: var(--mustard-bg); }
.btn--primary { background: var(--black); border-color: var(--black); color: var(--mustard); }
.btn--primary:hover { background: var(--ink); color: var(--mustard-lt); }
.btn--danger { color: var(--danger); border-color: #D9B3AD; background: var(--surface); }
.btn--danger:hover { background: #FBEEEC; }
.btn--sm { padding: .35rem .6rem; font-size: .875rem; }

/* ---------- Header público: faixa preta com o logo ---------- */
.site { background: var(--black); position: relative; }
.site::after {             /* borda hachurada em mostarda */
  content: ""; display: block; height: 8px; background: var(--hatch);
}
.site__inner { display: flex; align-items: center; justify-content: center; padding: 14px 20px 12px; position: relative; }
.brand { display: inline-block; line-height: 0; }
.brand img { height: 150px; width: auto; }
.brand:hover { text-decoration: none; }

/* ---------- Hero + busca ---------- */
.hero { padding: 2.2rem 0 1.4rem; }
.hero__title {
  font-family: var(--hand); font-weight: 400;
  font-size: clamp(2rem, 4.4vw, 3rem); line-height: 1.05;
  margin: 0 0 1.2rem; max-width: 24ch;
}
.busca { display: flex; gap: .6rem; max-width: 640px; }
.busca__campo {
  flex: 1; font: inherit; padding: .75rem .9rem;
  border: 1.5px solid var(--ink); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
}
.busca__campo:focus { outline: none; box-shadow: 0 0 0 3px var(--mustard); }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.2rem; }
.chip {
  font-size: .92rem; font-weight: 500; padding: .35rem .85rem;
  border: 1.5px solid var(--ink); border-radius: 999px;
  background: var(--surface); color: var(--ink); text-decoration: none;
}
.chip:hover { text-decoration: none; background: var(--mustard-bg); }
.chip.is-on { background: var(--black); border-color: var(--black); color: var(--mustard); }

/* ---------- Barra de resultados / filtro de marca ---------- */
.resultbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  margin: 1.4rem 0 1rem; padding-top: 1rem;
  border-top: 1.5px dashed var(--line);
  color: var(--muted); font-size: .95rem;
}
.marca-filtro { display: flex; align-items: center; gap: .5rem; }
.marca-filtro select {
  font: inherit; padding: .4rem .6rem; border: 1.5px solid var(--ink);
  border-radius: var(--radius); background: var(--surface); color: var(--ink);
}

/* ---------- Grade de produtos ---------- */
.grade {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 1.2rem;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.card {
  background: var(--surface); border: 1.5px solid var(--ink);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow .12s ease, transform .12s ease;
}
/* sombra "carimbo" mostarda: resposta ao hover, não decoração fixa */
@media (hover: hover) {
  .card:hover { box-shadow: 5px 5px 0 var(--mustard); transform: translate(-2px, -2px); }
}
.card__link { color: inherit; display: block; text-decoration: none; flex: 1; }
.card__link:hover { text-decoration: none; }
.card__img { aspect-ratio: 1 / 1; background: var(--mustard-bg); border-bottom: 1.5px solid var(--ink); }
.card__img img { width: 100%; height: 100%; object-fit: cover; }
.card__body { padding: .8rem .9rem 1rem; }
.card__nome { font-weight: 600; font-size: .98rem; line-height: 1.3; margin: .45rem 0 0; }
.card__marca { margin: .3rem 0 0; font-size: .82rem; color: var(--muted); }
.card__preco { margin: .5rem 0 0; font-weight: 800; font-size: 1.05rem; color: var(--amber-text); }

.pill {
  display: inline-block; font-size: .74rem; font-weight: 600;
  padding: .15rem .5rem; border-radius: 3px;
  background: var(--mustard); color: var(--black);
}

/* ---------- Paginação ---------- */
.paginacao {
  display: flex; align-items: center; justify-content: center; gap: 1.2rem;
  margin: 2.2rem 0 1rem; color: var(--muted);
}
.paginacao a { font-weight: 700; }
.paginacao__info { font-size: .92rem; }

/* ---------- Estados vazios ---------- */
.vazio { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.vazio p { font-family: var(--hand); font-size: 1.8rem; color: var(--ink); margin: 0; }
.vazio .btn { margin-top: 1rem; }

/* ---------- Detalhe do produto ---------- */
.voltar { margin: 1.4rem 0 .4rem; }
.detalhe {
  display: grid; grid-template-columns: minmax(0, 440px) 1fr; gap: 2.4rem;
  align-items: start; margin: 1rem 0 3rem;
}
.detalhe__img {
  background: var(--surface); border: 1.5px solid var(--ink);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: 6px 6px 0 var(--mustard);
}
.detalhe__img img { width: 100%; aspect-ratio: 1/1; object-fit: cover; }
.detalhe__nome {
  font-weight: 700; letter-spacing: -.01em;
  font-size: clamp(1.4rem, 2.8vw, 1.9rem); line-height: 1.2; margin: .6rem 0 .4rem;
}
.detalhe__marca { color: var(--muted); margin: 0 0 .8rem; }
.detalhe__preco { font-size: 1.7rem; font-weight: 800; color: var(--amber-text); margin: .4rem 0 1rem; }
.detalhe__desc { margin: 1rem 0; max-width: 60ch; }
.detalhe__cod { color: var(--muted); font-size: .85rem; margin-top: 1.4rem; }

/* ---------- Rodapé ---------- */
.site-foot { background: var(--black); color: #CFC6B4; margin-top: 3rem; font-size: .9rem; }
.site-foot::before { content: ""; display: block; height: 8px; background: var(--hatch); }
.site-foot .wrap { padding-top: 1.6rem; padding-bottom: 1.8rem; }
.site-foot p { margin: .2rem 0; }
.site-foot__nome { font-family: var(--hand); font-size: 1.6rem; color: var(--mustard); line-height: 1.1; }
.site-foot__note { font-size: .82rem; color: #A39A89; }

/* ============================================================
   ADMIN
   ============================================================ */
.admin-body { background: var(--paper); }

.adminbar { background: var(--black); color: #E9E1CF; }
.adminbar::after { content: ""; display: block; height: 5px; background: var(--hatch); }
.adminbar__inner { display: flex; align-items: center; gap: 1.4rem; height: 60px; }
.adminbar__brand { font-family: var(--hand); color: var(--mustard); font-size: 1.5rem; text-decoration: none; }
.adminbar__brand:hover { text-decoration: none; color: var(--mustard-lt); }
.adminbar nav { display: flex; gap: 1.1rem; margin-left: .5rem; }
.adminbar nav a { color: #CFC6B4; font-weight: 500; text-decoration: none; }
.adminbar nav a:hover, .adminbar nav a.is-on { color: var(--mustard); }
.adminbar__right { margin-left: auto; display: flex; gap: 1.1rem; align-items: center; }
.adminbar__right a { color: #CFC6B4; text-decoration: none; }
.adminbar__right a:hover { color: var(--mustard); }

.admin-main { padding: 1.8rem 0 3rem; }
.admin-h1 { font-family: var(--hand); font-weight: 400; font-size: 2.1rem; line-height: 1; margin: 0 0 1.2rem; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.admin-head .admin-h1 { margin: 0; }

/* Flash */
.flash { padding: .7rem 1rem; border-radius: var(--radius); margin: 0 0 1rem; font-weight: 500; }
.flash--ok  { background: var(--mustard-bg); color: var(--ink); border: 1.5px solid var(--mustard); }
.flash--err { background: #FBEEEC; color: #7A2016; border: 1.5px solid #E2BDB6; }

/* Filtros admin */
.filtros {
  display: flex; gap: .6rem; flex-wrap: wrap; align-items: center;
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: .8rem; margin-bottom: 1.2rem;
}
.filtros input[type=search], .filtros input[type=text], .filtros select {
  font: inherit; padding: .5rem .6rem; border: 1.5px solid var(--line); border-radius: var(--radius); background: #fff;
}
.filtros input[type=search] { min-width: 240px; flex: 1; }
.filtros label.check { display: inline-flex; align-items: center; gap: .4rem; color: var(--ink); }

/* Tabela */
.tabela { width: 100%; border-collapse: collapse; background: var(--surface); border: 1.5px solid var(--ink); border-radius: var(--radius); overflow: hidden; }
.tabela th, .tabela td { text-align: left; padding: .7rem .8rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tabela th { background: var(--black); color: var(--mustard); font-weight: 600; font-size: .85rem; }
.tabela tr:last-child td { border-bottom: none; }
.tabela tr:hover td { background: #FCF6E8; }
.thumb { width: 46px; height: 46px; border-radius: 4px; object-fit: cover; background: var(--mustard-bg); border: 1px solid var(--line); }
.tag-sem-img { font-size: .72rem; color: var(--danger); font-weight: 600; }
.acoes { display: flex; gap: .4rem; }
.status-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; border: 1.5px solid var(--ink); }
.status-on { background: var(--mustard); }
.status-off { background: transparent; }

/* Formulário */
.form-card { background: var(--surface); border: 1.5px solid var(--ink); border-radius: var(--radius); padding: 1.4rem; max-width: 720px; }
.campo { margin-bottom: 1.1rem; }
.campo label { display: block; font-weight: 600; margin-bottom: .35rem; font-size: .92rem; }
.campo input[type=text], .campo input[type=number], .campo input[type=password],
.campo select, .campo textarea {
  width: 100%; font: inherit; padding: .6rem .7rem;
  border: 1.5px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink);
}
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--mustard-lt); }
.campo textarea { min-height: 120px; resize: vertical; }
.campo .hint { color: var(--muted); font-size: .82rem; margin-top: .3rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: .6rem; margin-top: 1.4rem; align-items: center; }

.img-atual { display: flex; align-items: center; gap: 1rem; margin-bottom: .6rem; }
.img-atual img { width: 96px; height: 96px; object-fit: cover; border-radius: 4px; border: 1.5px solid var(--ink); background: var(--mustard-bg); }
#preview { width: 96px; height: 96px; object-fit: cover; border-radius: 4px; border: 1.5px dashed var(--ink); display: none; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem; background: var(--black); }
.login-card { background: var(--surface); border-radius: 8px; padding: 1.6rem 2rem 2rem; width: 100%; max-width: 380px; box-shadow: 8px 8px 0 var(--mustard); }
.login-logo { width: 150px; height: auto; margin: 0 auto 1rem; border-radius: 6px; }
.login-card h1 { font-family: var(--hand); font-weight: 400; font-size: 1.9rem; line-height: 1; margin: 0 0 .3rem; text-align: center; }
.login-card p.sub { color: var(--muted); margin: 0 0 1.4rem; font-size: .92rem; text-align: center; }

/* ---------- Responsivo ---------- */
/* ============================================================
   VENDAS: WhatsApp, lista de pedido, relacionados, PWA
   ============================================================ */
.btn--wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn--wa:hover { background: var(--wa-hover); border-color: var(--wa-hover); }
.btn--lg { padding: .8rem 1.2rem; font-size: 1.02rem; }
.btn--full { width: 100%; text-align: center; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--mustard); text-underline-offset: 3px; }

.hero__como { margin: -.4rem 0 1.1rem; color: var(--muted); max-width: 60ch; }

/* Botão "Minha lista" no header preto */
.lista-btn {
  position: absolute; right: 20px; top: 50%; transform: translateY(-50%);
  font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer;
  background: transparent; color: var(--mustard); border: 1.5px solid var(--mustard);
  border-radius: 999px; padding: .4rem .9rem; display: inline-flex; align-items: center; gap: .45rem;
}
.lista-btn:hover { background: var(--mustard); color: var(--black); }
.lista-btn__qtd { background: var(--mustard); color: var(--black); border-radius: 999px; min-width: 1.4rem; padding: 0 .35rem; font-size: .8rem; text-align: center; }
.lista-btn:hover .lista-btn__qtd { background: var(--black); color: var(--mustard); }

/* Botão do card */
.card__add {
  font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer;
  border: 0; border-top: 1.5px solid var(--ink); padding: .65rem .8rem;
  background: var(--surface); color: var(--ink);
}
.card__add:hover { background: var(--mustard-bg); }
.card__add.is-on { background: var(--mustard); color: var(--black); }

/* Detalhe */
.detalhe__acoes { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0 .8rem; }
.detalhe__acoes [data-add].is-on { background: var(--mustard); border-color: var(--ink); }
.detalhe__share { font-size: .92rem; color: var(--muted); }

.vazio__sub { font-family: var(--sans) !important; font-size: 1rem !important; color: var(--muted) !important; margin: .6rem 0 1rem !important; }
.vazio .btn + .btn { margin-left: .5rem; }

/* Relacionados */
.relacionados { margin: 0 0 3rem; padding-top: 1.6rem; border-top: 1.5px dashed var(--line); }
.relacionados__titulo { font-family: var(--hand); font-weight: 400; font-size: 2rem; line-height: 1; margin: 0 0 1rem; }
.relacionados__lista { list-style: none; margin: 0 0 1.2rem; padding: 0; display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.mini { display: block; color: inherit; text-decoration: none; }
.mini img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border: 1.5px solid var(--ink); border-radius: var(--radius); background: var(--mustard-bg); }
.mini:hover img { box-shadow: 4px 4px 0 var(--mustard); }
.mini__nome { display: block; font-size: .86rem; font-weight: 600; line-height: 1.3; margin-top: .45rem; }
.mini__preco { display: block; font-size: .86rem; font-weight: 800; color: var(--amber-text); }

/* Rodapé em colunas */
.site-foot__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.site-foot__info a { color: var(--mustard); text-decoration-color: currentColor; }
.site-foot .wrap + .wrap { padding-top: 0; }
.site-foot .link-btn { color: var(--mustard); }

/* WhatsApp flutuante */
.wa-float {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 30;
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: #25D366; color: #fff; border: 2px solid var(--black); box-shadow: 3px 3px 0 var(--black);
}

.wa-float[hidden] { display: none; }

/* Barra fixa da lista */
.lista-barra {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  padding: .7rem max(20px, env(safe-area-inset-right)) calc(.7rem + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left));
  background: var(--black); color: var(--mustard); border-top: 3px solid var(--mustard);
}
.lista-barra[hidden] { display: none; }
.lista-barra__abrir { background: none; border: 0; color: var(--mustard); font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
body.tem-lista { padding-bottom: 76px; }

/* Gaveta da lista */
.lista {
  border: 0; padding: 0; margin: 0 0 0 auto; height: 100%; max-height: 100%;
  width: min(420px, 100%); background: var(--surface); color: var(--ink);
  border-left: 3px solid var(--black);
}
.lista::backdrop { background: rgba(0,0,0,.55); }
.lista[open] { display: flex; flex-direction: column; }
.lista__head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem; background: var(--black); color: var(--mustard); }
.lista__titulo { font-family: var(--hand); font-weight: 400; font-size: 1.9rem; line-height: 1; margin: 0; }
.lista__fechar { background: none; border: 0; color: var(--mustard); font-size: 2rem; line-height: 1; cursor: pointer; padding: 0 .2rem; }
.lista__itens { list-style: none; margin: 0; padding: .4rem 1.2rem; overflow-y: auto; flex: 1; }
.lista__item { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .8rem 0; border-bottom: 1px dashed var(--line); }
.lista__nome { display: block; font-weight: 600; font-size: .92rem; line-height: 1.3; }
.lista__sub { display: block; font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.lista__vazia { padding: 1.2rem; color: var(--muted); }
.lista__vazia[hidden], .lista__rodape[hidden] { display: none; }
.lista__rodape { padding: 1rem 1.2rem calc(1rem + env(safe-area-inset-bottom, 0px)); border-top: 1.5px solid var(--ink); display: grid; gap: .6rem; }
.lista__total { margin: 0; font-weight: 800; color: var(--amber-text); }
.lista__label { font-size: .85rem; font-weight: 600; }
.lista__obs { font: inherit; padding: .5rem .6rem; border: 1.5px solid var(--line); border-radius: var(--radius); resize: vertical; }
.lista__rodape .link-btn { justify-self: center; font-size: .88rem; color: var(--muted); }

.qtd { display: inline-flex; align-items: center; border: 1.5px solid var(--ink); border-radius: 999px; flex-shrink: 0; }
.qtd button { width: 2rem; height: 2rem; border: 0; background: none; font: inherit; font-size: 1.1rem; font-weight: 700; cursor: pointer; color: var(--ink); }
.qtd button:hover { background: var(--mustard-bg); border-radius: 999px; }
.qtd span { min-width: 1.6rem; text-align: center; font-weight: 700; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 92px; z-index: 40; transform: translate(-50%, 12px);
  background: var(--black); color: var(--mustard); padding: .55rem 1rem; border-radius: 999px;
  font-weight: 600; font-size: .92rem; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 720px) {
  .lista-btn { position: static; transform: none; margin-left: auto; font-size: .85rem; padding: .35rem .7rem; }
  .site__inner { justify-content: flex-start; gap: .8rem; }
  .site-foot__grid { grid-template-columns: 1fr; }
  .detalhe__acoes .btn { flex: 1 1 100%; text-align: center; }
  .lista-barra .btn { padding: .55rem .8rem; font-size: .9rem; }

  .brand img { height: 92px; }
  .detalhe { grid-template-columns: 1fr; gap: 1.4rem; }
  .row2 { grid-template-columns: 1fr; }
  .adminbar__inner { gap: .8rem; }
  .adminbar nav { gap: .8rem; }
  .tabela .col-hide { display: none; }
  .grade { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .9rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .card:hover { transform: none; }
}
