/* =====================================================================
 * Cardápio público — versão MOBILE (carregada só até 767px de largura)
 * Pensada como app: cabeçalho compacto com ações sobre a capa, barra fixa
 * com nome da loja + categorias + busca recolhível, lista enxuta, produto e
 * sacola como telas que sobem de baixo, áreas seguras do iPhone (env()) e
 * campos com fonte de 16px (o iOS dá zoom em campos menores).
 * ===================================================================== */

/* ---------- Base ---------- */
.m-body {
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
.m-body button, .m-body a, .m-body label { touch-action: manipulation; }
.m-wrap { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.m-body input, .m-body textarea, .m-body select { font-size: 16px !important; }

/* Sem "levantar" no toque (hover grudado no celular); resposta no aperto em vez disso */
@media (hover: none) {
  .m-item:hover, .m-feat-card:hover, .m-cartbar:hover { transform: none; box-shadow: var(--shadow-sm); border-color: var(--line); }
  .m-cartbar:hover { box-shadow: 0 14px 30px var(--brand-glow); }
  .m-pixbar:hover { filter: none; } /* sem "escurecido grudado" depois do toque */
  .m-pixbar.is-cancel:hover { box-shadow: 0 14px 30px rgb(220 38 38 / 30%); }
  .m-pixbar.is-done:hover { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line2), var(--shadow-lg); border-color: transparent; }
  .m-pixbar:active { filter: brightness(.93); }
  .m-item:hover .m-add, .m-feat-card:hover .m-add { background: var(--brand-soft); color: var(--brand); }
}
.m-item:active, .m-feat-card:active, .m-chip:active, .m-round:active, .m-btn:active, .m-cartbar:active { transform: scale(.98); }
.m-item, .m-feat-card, .m-chip, .m-round, .m-btn, .m-cartbar { transition: transform .12s ease, background .15s, border-color .15s; }

/* Faixa "loja fechada" fica abaixo do relógio/entalhe do iPhone */
.m-closed-banner { padding-top: calc(10px + env(safe-area-inset-top)); font-size: 13px; }

/* ---------- Capa + card da loja ---------- */
.m-hero { padding-bottom: 4px; }
.m-banner { height: calc(168px + env(safe-area-inset-top)); margin: 0 calc(-1 * max(16px, env(safe-area-inset-left))); border-radius: 0; }
.m-banner::after { background: linear-gradient(180deg, rgba(0,0,0,.28) 0%, rgba(0,0,0,0) 38%, rgba(0,0,0,.2) 100%); }

.m-store { margin-top: -54px; padding: 16px; border-radius: 20px; }
.m-store-top { flex-wrap: nowrap; align-items: center; gap: 14px; }
.m-logo { width: 64px; height: 64px; border-radius: 18px; }
.m-store-id h1 { font-size: 19px; line-height: 1.2; margin: 5px 0 1px; }
.m-slogan { font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.m-status { font-size: 12px; }
.m-status-pill { font-size: 12px; padding: 3px 9px; }

/* Ações (informações, tema, compartilhar) flutuam sobre a capa, no canto, como em apps */
/* Posição: 12px abaixo do topo útil da capa. Capa = 168px + área segura; o card sobe 54px sobre ela,
 * então o topo útil fica 114px acima do card (a área segura se cancela). */
.m-store-actions { position: absolute; right: 12px; top: -102px; width: auto; order: 0; gap: 8px; }
.m-store-actions .m-btn-sm, .m-store-actions .m-round {
  width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 50%; flex: none;
  background: rgba(15,17,21,.42); color: #fff; border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(10px) saturate(1.4); -webkit-backdrop-filter: blur(10px) saturate(1.4);
}
.m-store-actions .m-btn-sm span { display: none; }
.m-store-actions .m-btn-sm svg { width: 19px; height: 19px; }

/* Entrega / retirada / mesa / mínimo: uma linha que rola para o lado */
.m-delivery {
  display: flex; gap: 8px; margin: 14px -16px 0; padding: 0 16px 2px;
  overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
}
.m-delivery::-webkit-scrollbar { display: none; }
.m-pill { flex: none; min-width: 0; padding: 8px 12px 8px 8px; gap: 9px; border-radius: 12px; scroll-snap-align: start; }
.m-pill-ic { width: 30px; height: 30px; border-radius: 9px; }
.m-pill-ic svg { width: 16px; height: 16px; }
.m-pill b { font-size: 13px; }
.m-pill > div { font-size: 12px; white-space: nowrap; }

/* ---------- Barra fixa: nome da loja + categorias + busca ---------- */
.m-tabs { margin-top: 14px; padding-top: env(safe-area-inset-top); }
.m-appbar {
  display: flex; align-items: center; gap: 10px; height: 0; overflow: hidden; opacity: 0;
  transition: height .25s ease, opacity .2s ease;
}
.m-appbar img { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); }
.m-appbar b { font-size: 15px; font-weight: 700; color: var(--ink-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-body.m-scrolled .m-appbar { height: 44px; opacity: 1; }
.m-body:not(.m-scrolled) .m-tabs { padding-top: 0; }

.m-tabs-row { flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 8px; padding-top: 10px; padding-bottom: 10px; }
.m-body.m-scrolled .m-tabs-row { padding-top: 2px; }
.m-tabs-scroll { margin: 0; padding: 2px; flex: 1; }
.m-chip { height: 38px; font-size: 13.5px; padding-right: 14px; }
.m-chip-ic { width: 28px; height: 28px; font-size: 15px; }

.m-search-toggle { display: grid; flex: none; width: 40px; height: 40px; border-radius: 50%; }
.m-search { display: none; flex: 1 1 100%; order: -1; align-items: center; gap: 10px; }
.m-search input { height: 42px; padding-left: 42px; border-radius: 12px; }
.m-search svg { left: 14px; }
.m-search-cancel {
  display: inline-block; flex: none; background: none; border: none; padding: 8px 2px;
  color: var(--brand); font-size: 15px; font-weight: 700; cursor: pointer;
}
.m-search > svg + input { flex: 1; }
/* Busca aberta: ocupa a linha de cima; as categorias continuam embaixo */
.m-body.m-searching .m-tabs-row { flex-wrap: wrap; }
.m-body.m-searching .m-search { display: flex; position: relative; }
.m-body.m-searching .m-search-toggle { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .m-body.m-searching .m-search { animation: mm-down 220ms cubic-bezier(.16, 1, .3, 1); }
}

/* ---------- Lista de produtos ---------- */
.m-content { padding-bottom: 20px; }
.m-content section { scroll-margin-top: 150px; }
.m-sec-title { font-size: 18px; margin: 22px 0 10px; }
.m-grid { gap: 10px; }
.m-item { padding: 12px; gap: 12px; border-radius: 16px; }
.m-item strong { font-size: 14.5px; }
.m-item .d { font-size: 13px; margin-top: 3px; }
.m-item-foot { padding-top: 8px; }
.m-item .p { font-size: 15px; }
.m-item img { width: 92px; height: 92px; border-radius: 12px; }
.m-add { width: 30px; height: 30px; border-radius: 9px; }

/* Destaques: carrossel com cards menores; poucos destaques = card horizontal */
.m-feat { gap: 10px; margin: 0 -16px; padding: 2px 16px 8px; scroll-padding-left: 16px; }
.m-feat-card { width: 156px; border-radius: 14px; }
.m-feat-card img, .m-feat-card .noimg { height: 116px; }
.m-feat-info { padding: 10px 12px 12px; }
.m-feat-info strong { font-size: 13.5px; }
.m-feat.few { margin: 0; padding: 0; grid-template-columns: 1fr; gap: 10px; }
.m-feat.few .m-feat-card img, .m-feat.few .m-feat-card .noimg { width: 36%; min-height: 140px; }
.m-feat.few .m-feat-info { padding: 12px 14px; }
.m-feat.few .m-feat-info strong { font-size: 15px; }
.m-feat.few .m-feat-info .d { -webkit-line-clamp: 2; font-size: 13px; }

/* ---------- Barra "Ver sacola" / pedido em andamento ---------- */
.m-cartbar {
  width: calc(100% - 24px); bottom: calc(12px + env(safe-area-inset-bottom));
  margin: 6px auto 12px; padding: 14px 18px; border-radius: 16px; font-size: 15px;
}

/* ---------- Rodapé ---------- */
.m-footer { padding: 16px 0 calc(18px + env(safe-area-inset-bottom)); }
.m-footer .m-wrap { flex-direction: column; gap: 6px; text-align: center; }
.m-footer p { font-size: 13px; max-width: 100%; }

/* ---------- Produto: tela cheia que sobe de baixo ---------- */
.m-modal { inset: 0; border-radius: 0; }
.m-modal.active { animation: mm-up 320ms cubic-bezier(.16, 1, .3, 1); }
.m-prod-media img { height: min(300px, 42vh); }
.m-close {
  top: calc(12px + env(safe-area-inset-top)); right: 12px; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(15,17,21,.45); color: #fff; border: 1px solid rgba(255,255,255,.2);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 16px;
}
.m-close.static { background: var(--soft); color: var(--ink-strong); border: 1px solid var(--line); backdrop-filter: none; -webkit-backdrop-filter: none; }
.m-prod-head { padding: 20px 16px 14px; }
.m-prod-head h2 { font-size: 20px; margin-right: 0; }
.m-group-h { padding: 12px 16px; top: 0; }
.m-addon { padding: 12px 16px; min-height: 56px; }
.m-check { width: 24px; height: 24px; }
.m-obs { padding: 16px; }
.m-add-bar {
  position: sticky; bottom: 0; z-index: 3; gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 20px rgba(0,0,0,.06);
}
.m-add-bar .m-btn { min-height: 50px; }
.m-qty button { width: 44px; height: 50px; }
/* Sem foto: o botão de fechar fica sobre o título, então damos espaço */
.m-modal-inner:not(:has(.m-prod-media)) .m-prod-head { padding-top: calc(64px + env(safe-area-inset-top)); }

/* ---------- Sacola, finalização e acompanhamento: telas que sobem de baixo ---------- */
.m-drawer { inset: 0; width: auto; border-radius: 0; }
.m-drawer.active { animation: mm-up 320ms cubic-bezier(.16, 1, .3, 1); }
.m-drawer-h {
  position: sticky; top: 0; z-index: 2; background: var(--surface);
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
}
.m-drawer-h .m-close.static { width: 40px; height: 40px; border-radius: 50%; }
.m-drawer-body { padding: 4px 16px calc(28px + env(safe-area-inset-bottom)); }
.m-cart-item img { width: 56px; height: 56px; }
.m-pay { padding: 12px; min-height: 60px; }
.m-seg button { min-height: 44px; }
.m-field input, .m-field textarea { padding: 13px 14px; }
#btnSend { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 2; min-height: 52px; }

/* Acompanhamento do pedido e Pix */
.m-track { padding-top: 12px; }
.m-track-ic { width: 58px; height: 58px; }
.m-track-head h2 { font-size: 20px; }
.m-track-steps { padding: 12px 4px; }
.m-track-steps li { font-size: 11px; }
.m-pixpay-amount { font-size: 30px; }
.m-pixpay-qr { width: min(240px, 66vw); }

/* ---------- Bottom sheet (informações da loja, confirmações) ---------- */
.m-sheet { border-radius: 22px 22px 0 0; padding: 12px 16px calc(20px + env(safe-area-inset-bottom)); max-height: 88vh; }
.m-sheet::before {
  content: ''; display: block; width: 40px; height: 5px; margin: 0 auto 14px; border-radius: 999px; background: var(--line2);
}

/* ---------- Aviso no topo ---------- */
.m-toast { top: calc(12px + env(safe-area-inset-top)); }

/* ---------- Telas bem estreitas (iPhone SE, Galaxy compactos) ---------- */
@media (max-width: 360px) {
  .m-logo { width: 56px; height: 56px; border-radius: 16px; }
  .m-store-id h1 { font-size: 17px; }
  .m-item img { width: 80px; height: 80px; }
  .m-chip { padding-right: 12px; font-size: 13px; }
  .m-track-steps li span { font-size: 10px; }
}

/* ---------- Animações ---------- */
@keyframes mm-up { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes mm-down { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .m-modal.active, .m-drawer.active { animation: none; }
  .m-appbar { transition: none; }
}
