/* =====================================================================
   pedido.css (10/11) — Nanda do Café
   1. Barra de categorias + busca FIXA no topo do site (logo abaixo do cabeçalho)
   2. Itens pedíveis na lista do cardápio
   3. Opções do item (tamanho, "sem ...", adicionais, observação, quantidade)
   4. Sacola: botão no cabeçalho, barra "Ver sacola" e gaveta com o pedido
   ===================================================================== */

:root { --catbar-h: 52px; }
@media (min-width: 900px) { :root { --catbar-h: 60px; } }

html.tem-catbar { scroll-padding-top: calc(var(--header-h-s) + var(--catbar-h) + 8px); }
.sacola [hidden], .dish [hidden] { display: none !important; }

/* ---------- 1. Barra fixa no topo ---------- */
/* Com a barra, o cabeçalho tem fundo desde o início (os dois formam um bloco só) */
.tem-catbar .header::before {
  background: rgba(15, 11, 8, .88);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
}
.tem-catbar .header:not(.is-open)::before { border-color: transparent; }
.tem-catbar .header::after { display: none; }

.catbar {
  position: fixed;
  z-index: 49;
  left: 0; right: 0;
  top: var(--header-h);
  height: var(--catbar-h);
  background: rgba(15, 11, 8, .88);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transition: top .45s var(--ease);
}
.catbar:empty { display: none; }
.header.is-scrolled ~ .catbar { top: var(--header-h-s); }
/* linha de progresso da leitura no pé da barra (--progresso vem do main.js) */
.catbar::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--gold-grad);
  transform: scaleX(var(--progresso, 0));
  transform-origin: left;
  pointer-events: none;
}

.catbar .menu-bar {
  position: relative;
  top: auto;
  z-index: auto;
  height: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.catbar .tabs { flex: 1; align-self: stretch; align-items: center; }
.catbar .tab { min-height: 100%; padding: 0 12px; color: var(--muted); }
.catbar .tab:first-child { padding-left: 0; }
.catbar .tab:hover { color: var(--text); }
.catbar .tab[aria-selected='true'] { color: var(--text); }
.catbar .tabs-ink { bottom: 0; height: 2px; }

.catbar .msearch {
  display: none;
  height: 40px;
  border-color: var(--line-2);
  background: rgba(245, 237, 226, .06);
  color: var(--text);
}
.catbar .msearch:focus-within { background: rgba(245, 237, 226, .09); box-shadow: 0 0 0 3px rgba(238, 138, 43, .2); }
.catbar .msearch input { color: var(--text); }
.catbar .msearch input::placeholder { color: var(--muted); }
.catbar .msearch > .icon { color: var(--gold); }
.catbar .msearch-clear:hover { background: rgba(245, 237, 226, .08); }

.msearch-toggle {
  flex: none;
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  color: var(--text);
  transition: border-color .3s, background-color .3s;
}
.msearch-toggle .icon { width: 18px; height: 18px; }
.msearch-toggle:hover { border-color: var(--gold); background: rgba(238, 138, 43, .1); }

/* celular: a lupa abre o campo por cima das categorias */
@media (max-width: 899px) {
  .catbar.is-search .msearch {
    display: flex;
    position: absolute;
    inset: 6px 0;
    height: auto;
    animation: buscaAbre .3s var(--ease-out);
  }
  .catbar.is-search .tabs, .catbar.is-search .msearch-toggle { visibility: hidden; }
  .catbar .msearch-clear { visibility: visible; }
}
@keyframes buscaAbre { from { opacity: 0; transform: scaleX(.96); } }

@media (min-width: 900px) {
  .catbar .msearch-toggle { display: none; }
  .catbar .msearch { display: flex; flex: none; width: clamp(220px, 22vw, 300px); }
  .catbar .tab { padding: 0 14px; }
  .tem-catbar .hero--cartaz .hero-content { padding-top: calc(var(--header-h) + var(--catbar-h) + 32px); }
}

/* ---------- 2. Itens pedíveis na lista ---------- */
.clist.is-pedivel li { padding: 0; }
.clist-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% + 16px);
  margin-inline: -8px;
  padding: 10px 8px;
  border-radius: 8px;
  text-align: left;
  transition: background-color .3s var(--ease);
}
.clist-btn .clist-dots { align-self: baseline; }
.clist-btn:hover, .clist-btn:focus-visible { background: rgba(238, 138, 43, .08); }
.clist-btn:active { background: rgba(238, 138, 43, .14); }
.clist-btn .item-open { flex: none; margin-top: 0; width: 24px; height: 24px; }
.clist-btn:hover .item-open { background: var(--gold); border-color: var(--gold); color: var(--on-gold); transform: rotate(90deg); }
@media (max-width: 599px) {
  .item-open { display: grid; width: 24px; height: 24px; margin-top: 6px; }
}

/* ---------- 3. Opções do item (janela escura) ---------- */
/* Computador: janela numa coluna só (foto larga em cima, opções embaixo), como nos apps de delivery */
@media (min-width: 760px) {
  .dish { width: min(100% - 32px, 600px); }
  .dish-card, .dish-card.has-photo { grid-template-columns: none; grid-template-rows: auto minmax(0, 1fr); }
  .dish-visual { min-height: 120px; border-right: 0; border-bottom: 1px solid var(--line); }
  .dish-card.has-photo .dish-visual { min-height: 0; aspect-ratio: 2 / 1; }
  .dish-emblem { flex-direction: row; text-align: left; gap: 16px; }
  .dish-ring { width: 70px; height: 70px; }
}
.dish-preco .price { font-size: 1.35rem; }
.opts { display: grid; gap: 20px; margin-top: 4px; }
.opt-grupo { min-width: 0; margin: 0; padding: 0; border: 0; }
.opt-grupo legend, .opt-obs-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin-bottom: 10px;
  padding: 0;
  font: 600 .76rem/1.2 var(--font-sans);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text);
}
.opt-grupo legend small, .opt-obs-label small {
  padding: 4px 9px;
  border-radius: 99px;
  background: rgba(245, 237, 226, .07);
  font: 500 .7rem/1 var(--font-sans);
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}
.opt-lista { display: grid; overflow: hidden; border: 1px solid var(--line-2); border-radius: 12px; }
.opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background-color .25s;
}
.opt + .opt { border-top: 1px solid var(--line); }
.opt:hover { background: rgba(245, 237, 226, .04); }
.opt:has(input:checked) { background: rgba(238, 138, 43, .09); }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt-box {
  flex: none;
  width: 20px; height: 20px;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(245, 237, 226, .35);
  border-radius: 50%;
  transition: border-color .2s, background-color .2s, box-shadow .2s;
}
.opt input:checked + .opt-box { border-color: var(--gold); background: var(--gold); box-shadow: inset 0 0 0 4px var(--wood); }
.opt-box--check { border-radius: 6px; }
.opt-box--check .icon { width: 14px; height: 14px; color: var(--on-gold); stroke-width: 2.4; opacity: 0; transform: scale(.6); transition: opacity .2s, transform .25s var(--ease-out); }
.opt input:checked + .opt-box--check { box-shadow: none; }
.opt input:checked + .opt-box--check .icon { opacity: 1; transform: none; }
.opt input:focus-visible + .opt-box, .opt input:focus-visible + .opt-nome { outline: 2px solid var(--gold); outline-offset: 3px; }
.opt-nome { flex: 1; min-width: 0; color: var(--text); font-size: .95rem; line-height: 1.3; }
.opt-preco { flex: none; color: var(--gold-hi); font: 600 .88rem/1 var(--font-sans); white-space: nowrap; }

/* "Sem manteiga", "Sem tomate": pílulas */
.opt-lista--chips { display: flex; flex-wrap: wrap; gap: 8px; overflow: visible; border: 0; border-radius: 0; }
.opt--chip { min-height: 40px; padding: 8px 15px; border: 1px solid var(--line-2); border-radius: 99px; }
.opt--chip + .opt--chip { border-top: 1px solid var(--line-2); }
.opt--chip .opt-nome { flex: none; font-size: .88rem; }
.opt--chip input:checked + .opt-nome { color: var(--gold-hi); font-weight: 600; text-decoration: line-through; text-decoration-color: rgba(246, 162, 76, .55); }
.opt--chip:has(input:checked) { border-color: var(--gold); background: rgba(238, 138, 43, .12); }

.opt-obs {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: rgba(0, 0, 0, .25);
  color: var(--text);
  font-size: 1rem;
  transition: border-color .25s, box-shadow .25s;
}
.opt-obs::placeholder { color: #7d6f63; }
.opt-obs:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(238, 138, 43, .18); }

/* rodapé da janela: quantidade + "Adicionar R$ ..." sempre à vista */
.opt-rodape {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 -2px;
  padding: 14px 2px calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--wood);
}
/* o rodapé "gruda" no pé da janela: sem o espaço de baixo do corpo, senão o conteúdo aparece por baixo dele */
.dish-body:has(.opts) { padding-bottom: 0; }
.dish-body:has(.opts) .dish-nav { padding-bottom: 22px; }
.qtd {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 50px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
}
.qtd-btn { width: 42px; height: 100%; display: grid; place-items: center; color: var(--text); border-radius: 10px; transition: background-color .2s, color .2s; }
.qtd-btn:hover:not(:disabled) { background: rgba(238, 138, 43, .12); color: var(--gold-hi); }
.qtd-btn:disabled { opacity: .3; cursor: default; }
.qtd-btn .icon { width: 18px; height: 18px; }
.qtd-num { min-width: 24px; text-align: center; font: 600 1rem/1 var(--font-sans); font-variant-numeric: tabular-nums; }
.qtd--sm { height: 38px; border-radius: 10px; }
.qtd--sm .qtd-btn { width: 36px; }
.qtd--sm .qtd-btn .icon { width: 16px; height: 16px; }
.opt-add { flex: 1; min-width: 0; padding: 0 16px; gap: 10px; }
.opt-add .icon { width: 18px; height: 18px; }
.opt-total { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.dish-nav { margin-top: 4px; }

/* ---------- 4. Sacola ---------- */
/* botão no cabeçalho */
.bag-btn {
  position: relative;
  width: 46px; height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  color: var(--text);
  transition: border-color .3s, background-color .3s;
}
.bag-btn .icon { width: 21px; height: 21px; }
.bag-btn:hover { border-color: var(--gold); background: rgba(238, 138, 43, .1); }
.bag-count {
  position: absolute;
  top: -6px; right: -6px;
  min-width: 20px; height: 20px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--gold-grad);
  color: var(--on-gold);
  font: 700 .7rem/20px var(--font-sans);
  text-align: center;
}
.bag-count:empty { display: none; }
.is-pulse { animation: pulso .5s var(--ease-out); }
@keyframes pulso { 40% { transform: scale(1.12); } }

/* barra "Ver sacola" embaixo da tela */
.bag-bar {
  position: fixed;
  z-index: 46;
  left: 12px; right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  opacity: 0;
  transform: translateY(24px);
  pointer-events: none;
  transition: opacity .4s var(--ease), transform .5s var(--ease-out);
}
.bag-bar.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.bag-bar.is-pulse { animation: none; }
.bag-bar.is-pulse .bag-bar-btn { animation: pulso .5s var(--ease-out); }
.bag-bar-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 8px 18px 8px 10px;
  border-radius: 16px;
  background: var(--gold-grad);
  color: var(--on-gold);
  font: 600 1rem/1 var(--font-sans);
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, .75), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform .3s var(--ease);
}
.bag-bar-btn:hover { transform: translateY(-2px); }
.bag-bar-btn:active { transform: scale(.98); }
.bag-bar-ic { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: rgba(27, 16, 8, .14); }
.bag-bar-ic .icon { width: 21px; height: 21px; }
.bag-bar-ic .bag-count { background: #1b1008; color: #f6a24c; }
.bag-bar-total { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (min-width: 760px) {
  .bag-bar { left: auto; right: 24px; bottom: 24px; width: 340px; }
}
/* o botão do WhatsApp e os avisos sobem quando a barra aparece */
.tem-sacola .wa-float { bottom: calc(86px + env(safe-area-inset-bottom)); }
.tem-sacola .toasts { bottom: calc(86px + env(safe-area-inset-bottom)); }
@media (min-width: 760px) {
  .tem-sacola .wa-float { bottom: 98px; right: 24px; }
  .tem-sacola .toasts { bottom: 24px; left: 24px; transform: none; }
}

/* gaveta */
.sacola {
  width: min(100%, 440px);
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  overflow: visible;
}
.sacola::backdrop { background: rgba(8, 6, 4, .72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.sacola[open] { animation: gavetaEntra .5s var(--ease-out); }
.sacola[open]::backdrop { animation: fadeIn .4s var(--ease); }
.sacola.is-closing { animation: gavetaSai .26s var(--ease) forwards; }
.sacola.is-closing::backdrop { animation: fadeOut .26s var(--ease) forwards; }
@keyframes gavetaEntra { from { transform: translate3d(100%, 0, 0); } }
@keyframes gavetaSai { to { transform: translate3d(100%, 0, 0); } }

.sacola-card {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--wood);
  border-left: 1px solid var(--line-2);
  box-shadow: -30px 0 80px -30px #000;
}
.sacola-card:has(.sacola-vazia) { grid-template-rows: auto 1fr; }
.sacola-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.sacola-head h3 { font: 600 1.45rem/1.1 var(--font-serif); letter-spacing: -.015em; }
.sacola-head h3 small { margin-left: 6px; font: 500 .82rem/1 var(--font-sans); letter-spacing: 0; color: var(--muted); }
.sacola-head .dish-close { position: static; }
.sacola-corpo { overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px 22px; }

.sl { padding: 14px 0; border-bottom: 1px solid var(--line); animation: itemIn .4s var(--ease-out) both; }
.sl-top { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.sl-nome { font: 600 1rem/1.35 var(--font-sans); color: var(--text); }
.sl-preco { flex: none; font: 600 .98rem/1.35 var(--font-sans); color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.sl-det { margin-top: 2px; font-size: .86rem; line-height: 1.45; color: var(--muted); }
.sl-acoes { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.sl-remover { padding: 8px 0; color: var(--muted); font-size: .8rem; }
.sl-remover:hover { color: var(--text); }
.sacola-mais { margin-top: 8px; }

.sacola-form { display: grid; gap: 16px; margin-top: 14px; padding-top: 20px; border-top: 1px solid var(--line); }
.sacola-form .field-row { gap: 16px; }
.sacola-form small { color: var(--muted); font-size: .8rem; }
.sacola-previa {
  margin-top: 20px;
  padding: 14px 16px;
  border: 1px dashed rgba(238, 138, 43, .5);
  border-radius: 12px;
  background: rgba(238, 138, 43, .06);
  font-size: .86rem;
  line-height: 1.5;
  color: var(--text-2);
  animation: itemIn .4s var(--ease-out) both;
}
.sacola-previa strong { color: var(--text); }
.sacola-previa pre { margin: 10px 0 0; white-space: pre-wrap; word-break: break-word; font: 400 .82rem/1.55 ui-monospace, Consolas, 'Courier New', monospace; color: var(--text); }
.sacola-pe { padding: 14px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--wood); }
.sacola-total { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; color: var(--text-2); }
.sacola-total strong { font: 700 1.35rem/1 var(--font-sans); color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.sacola-vazia { display: grid; align-content: center; justify-items: center; gap: 10px; padding: 40px 28px; text-align: center; color: var(--text-2); }
.sacola-vazia > .icon { width: 46px; height: 46px; margin-bottom: 6px; color: var(--gold); }
.sacola-vazia strong { color: var(--text); font-weight: 600; }
.sacola-vazia .btn { margin-top: 12px; }

/* celular: a sacola sobe de baixo, como a janela do item */
@media (max-width: 759px) {
  .sacola { width: 100%; height: auto; margin: auto 0 0; }
  .sacola[open] { animation: sheetIn .5s var(--ease-out); }
  .sacola.is-closing { animation: sheetOut .28s var(--ease) forwards; }
  .sacola-card { height: auto; max-height: 92svh; border-left: 0; border-top: 1px solid var(--line-2); border-radius: 20px 20px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .is-pulse, .bag-bar.is-pulse .bag-bar-btn { animation: none; }
}
