/* ==========================================================================
   TEMA do PDV — uma paleta só, usada pelo caixa (style.css) e pelo celular (garcom.css).
   Para trocar a identidade visual: mude as variáveis abaixo, ou escolha a cor da marca
   em "Empresa" (ela sobrescreve --marca sozinha).
   ========================================================================== */
:root {
  /* Marca (botões principais, foco, destaques). Padrão: violeta-índigo. */
  --marca: #5b4cf0;
  --marca-texto: #ffffff;               /* cor do texto sobre a marca (ajustada sozinha conforme a cor escolhida) */
  --marca-escura: #4535d4;
  --marca-clara: #eeecff;
  --marca-foco: rgb(91 76 240 / .35);

  /* Neutros */
  --tinta: #0f1530;                     /* menu e cabeçalho do celular */
  --tinta-2: #1b2455;                   /* ponta clara do degradê da tinta */
  --bg: #f2f3fa;
  --surface: #ffffff;
  --borda: #e2e5f1;
  --texto: #141a33;
  --suave: #596382;

  /* Ações */
  --ok: #15803d;      --ok-escuro: #116a32;
  --perigo: #dc2626;  --perigo-claro: #fee2e2;  --perigo-texto: #7f1d1d;
  --aviso-bg: #fef3c7; --aviso-texto: #78350f;

  /* Estado das MESAS (texto branco sobre cada cor: contraste mínimo 4.5:1) */
  --mesa-livre: #15803d;
  --mesa-ocupada: #dc2626;
  --mesa-reservada: #b45309;
  --mesa-bloqueada: #4b5563;

  /* Estado do ESTOQUE: azul claro (6+), laranja (1 a 5), vermelho (0 ou menos) */
  --est-ok-bg: #e0f2fe;     --est-ok-borda: #38bdf8;     --est-ok-texto: #0369a1;
  --est-baixo-bg: #ffedd5;  --est-baixo-borda: #f97316;  --est-baixo-texto: #c2410c;
  --est-zerado-bg: #fee2e2; --est-zerado-borda: #dc2626; --est-zerado-texto: #b91c1c;

  /* Forma e profundidade */
  --raio: 18px;
  --sombra-1: 0 1px 2px rgb(20 26 60 / .05), 0 3px 10px -2px rgb(20 26 60 / .08);
  --sombra-2: 0 14px 30px -12px rgb(20 26 60 / .38);
  --curva: cubic-bezier(.2, .8, .2, 1);
  --t-rapido: .12s;
  --t: .22s;
}

/* Com navegador moderno, as variações da marca são calculadas a partir de --marca */
@supports (color: color-mix(in srgb, red, blue)) {
  :root {
    --marca-escura: color-mix(in srgb, var(--marca) 82%, #000);
    --marca-clara: color-mix(in srgb, var(--marca) 11%, #fff);
    --marca-foco: color-mix(in srgb, var(--marca) 38%, transparent);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 16px/1.5 "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, Roboto, sans-serif; color: var(--texto);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  background: var(--bg);
  background: radial-gradient(1000px 520px at 108% -10%, color-mix(in srgb, var(--marca) 13%, transparent), transparent 70%),
    radial-gradient(760px 420px at -12% 112%, color-mix(in srgb, var(--marca) 8%, transparent), transparent 70%), var(--bg);
  background-attachment: fixed;
}
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
small { color: var(--suave); }
[hidden] { display: none !important; }

/* ---------- Botões: cheios, com brilho suave, e reagem ao toque ---------- */
button {
  --b: var(--marca); --bh: var(--marca-escura); --bt: var(--marca-texto);
  position: relative; overflow: hidden;
  font: inherit; font-weight: 650; letter-spacing: .005em;
  min-height: 44px; padding: 10px 18px;
  border: 1px solid transparent; border-radius: 13px;
  background-color: var(--b); background-image: linear-gradient(180deg, rgb(255 255 255 / .18), rgb(255 255 255 / 0) 70%); color: var(--bt);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .22), 0 8px 16px -9px color-mix(in srgb, var(--b) 75%, transparent);
  cursor: pointer; user-select: none; touch-action: manipulation;
  transition: transform var(--t-rapido) var(--curva), box-shadow var(--t) var(--curva), background-color var(--t), border-color var(--t), color var(--t), opacity var(--t), filter var(--t);
}
@media (hover: hover) {
  button:hover:not(:disabled) { background-color: var(--bh); transform: translateY(-1px); }
}
button:active:not(:disabled) { transform: translateY(1px) scale(.97); background-color: var(--bh); }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--marca-foco); outline-offset: 2px; }
button:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

button.sec { --b: var(--surface); --bh: var(--marca-clara); --bt: var(--texto); border-color: var(--borda); background-image: none; box-shadow: var(--sombra-1); }
@media (hover: hover) { button.sec:hover:not(:disabled) { border-color: var(--marca); color: var(--marca-escura); box-shadow: var(--sombra-2); } }
button.ok { --b: var(--ok); --bh: var(--ok-escuro); --bt: #fff; }

/* onda que nasce no ponto do toque (criada por efeitos.js) */
.onda { position: absolute; border-radius: 50%; background: currentColor; opacity: .22; transform: scale(0); pointer-events: none; animation: onda .55s var(--curva) forwards; }
@keyframes onda { to { transform: scale(1); opacity: 0; } }

/* ---------- Campos ---------- */
input, select, textarea {
  font: inherit; color: var(--texto); background: var(--surface);
  padding: 10px 13px; border: 1px solid var(--borda); border-radius: 12px; min-width: 0;
  box-shadow: inset 0 1px 2px rgb(20 26 60 / .04);
  transition: border-color var(--t), box-shadow var(--t), background-color var(--t);
}
input::placeholder, textarea::placeholder { color: #8d95b0; }
input:hover, select:hover { border-color: #c5cae0; }
input:focus, select:focus, textarea:focus { border-color: var(--marca); box-shadow: 0 0 0 4px var(--marca-foco); outline: none; }
input[type=checkbox], input[type=radio] { accent-color: var(--marca); width: 18px; height: 18px; padding: 0; box-shadow: none; }
input[type=color] { padding: 3px; width: 52px; height: 40px; cursor: pointer; }

/* ---------- Busca de produtos (caixa e celular) ---------- */
.campo-busca { position: relative; display: block; }
.campo-busca::before { content: "🔍"; position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 1.05rem; opacity: .75; pointer-events: none; }
.campo-busca input { width: 100%; min-height: 52px; padding: 12px 16px 12px 46px; font-size: 1.02rem; border-radius: 16px; box-shadow: var(--sombra-1); }
.dica { text-align: center; color: var(--suave); margin: 0; padding: 20px 12px; }

/* ---------- Lista suspensa de produtos (caixa e celular): abre com todos os itens e filtra ao digitar ---------- */
.combo { position: relative; }
.combo .campo-busca input { padding-right: 56px; }
.combo-seta { position: absolute; right: 6px; top: 6px; width: 40px; min-height: 40px; height: 40px; padding: 0; border-radius: 12px; font-size: 1.15rem; box-shadow: none; }
#lista-prod { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); max-height: min(58vh, 460px); overflow-y: auto; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--borda); border-radius: 18px; box-shadow: var(--sombra-2); }
#lista-prod li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; cursor: pointer; }
#lista-prod li[class*="est-"] { box-shadow: inset 4px 0 0 var(--est-borda); }
#lista-prod li:hover, #lista-prod li.ativo { background: var(--marca-clara); }
#lista-prod .opt-nome { flex: 1; min-width: 0; font-weight: 650; }
#lista-prod .opt-nome small { display: block; font-weight: 500; }
#lista-prod li b { font-variant-numeric: tabular-nums; white-space: nowrap; }
#lista-prod li.vazio { justify-content: center; color: var(--suave); cursor: default; }
#lista-prod li.vazio:hover { background: none; }


/* ---------- Cartões, avisos e textos ---------- */
.nota { background: var(--aviso-bg); color: var(--aviso-texto); padding: 11px 15px; border-radius: 14px; font-size: .92rem; margin: 10px 0; border: 1px solid color-mix(in srgb, var(--aviso-texto) 14%, transparent); }
.nota.erro, .bloqueio { background: var(--perigo-claro); color: var(--perigo-texto); border-color: color-mix(in srgb, var(--perigo-texto) 14%, transparent); }
.erro { color: var(--perigo); }
.total { font-size: 1.45rem; font-weight: 800; margin: 12px 0; letter-spacing: -.02em; }

/* ---------- Estado das mesas: cartão com degradê, brilho e etiqueta ---------- */
.mesa {
  --cor: var(--mesa-livre); --b: var(--cor); --bh: var(--cor); --bt: #fff;
  isolation: isolate; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  font-weight: 800; letter-spacing: -.01em; border: 0; border-radius: 22px; text-align: center;
  background: linear-gradient(155deg, var(--cor), color-mix(in srgb, var(--cor) 72%, #000));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .3), 0 14px 24px -14px color-mix(in srgb, var(--cor) 90%, transparent);
}
.mesa::before { content: ""; position: absolute; z-index: -1; right: -38%; top: -62%; width: 120%; aspect-ratio: 1; border-radius: 50%; background: rgb(255 255 255 / .11); }
@media (hover: hover) { .mesa:hover:not(:disabled) { transform: translateY(-3px); filter: brightness(1.07) saturate(1.05); } }
.mesa small { display: inline-block; max-width: 94%; margin: 0; padding: 3px 11px; border-radius: 999px; background: rgb(0 0 0 / .2); color: #fff; font-weight: 700; font-size: .8rem; line-height: 1.3; }
.mesa.livre { --cor: var(--mesa-livre); } .mesa.ocupada { --cor: var(--mesa-ocupada); }
.mesa.reservada { --cor: var(--mesa-reservada); } .mesa.bloqueada { --cor: var(--mesa-bloqueada); }

/* ---------- Estado do estoque ---------- */
.est-ok { --est-bg: var(--est-ok-bg); --est-borda: var(--est-ok-borda); --est-texto: var(--est-ok-texto); }
.est-baixo { --est-bg: var(--est-baixo-bg); --est-borda: var(--est-baixo-borda); --est-texto: var(--est-baixo-texto); }
.est-zerado { --est-bg: var(--est-zerado-bg); --est-borda: var(--est-zerado-borda); --est-texto: var(--est-zerado-texto); }
.est-txt { font-weight: 800; color: var(--est-texto); }
.est-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #e8ebf0; color: #3b4455; font-size: .8rem; font-weight: 600; }
.est-badge.est-ok { background: var(--est-ok-bg); color: var(--est-ok-texto); box-shadow: inset 0 0 0 1px var(--est-ok-borda); }
.est-badge.est-baixo { background: var(--est-baixo-borda); color: #fff; }
.est-badge.est-zerado { background: var(--est-zerado-borda); color: #fff; }
/* cartões de produto com estoque controlado ficam tingidos */
.produtos button.est-ok, .produtos button.est-baixo, .produtos button.est-zerado,
.fav-card.est-ok, .fav-card.est-baixo, .fav-card.est-zerado, .fav.est-ok, .fav.est-baixo, .fav.est-zerado,
.prod.est-ok, .prod.est-baixo, .prod.est-zerado, ul.itens li.est-ok, ul.itens li.est-baixo, ul.itens li.est-zerado {
  --b: var(--est-bg); --bh: color-mix(in srgb, var(--est-bg) 82%, var(--est-borda)); --bt: var(--texto); border-color: var(--est-borda);
}

/* ---------- Fotos ---------- */
.foto-vazia, .vazia { display: grid; place-items: center; background: linear-gradient(135deg, #eceefa, #dcdff0); color: #7a82a3; font-weight: 800; }

/* ---------- Entrada suave ao trocar de tela (efeitos.js liga a classe .entra só quando a tela muda) ---------- */
@keyframes entra { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
#app.entra > * { animation: entra .3s var(--curva) both; }
#app.entra > *:nth-child(2) { animation-delay: .04s; } #app.entra > *:nth-child(3) { animation-delay: .08s; }
#app.entra > *:nth-child(4) { animation-delay: .12s; } #app.entra > *:nth-child(n+5) { animation-delay: .16s; }

/* ---------- Aviso (toast) ---------- */
#aviso { position: fixed; left: 50%; bottom: 22px; z-index: 40; max-width: 92%; text-align: center; padding: 12px 20px; border-radius: 14px; font-weight: 600;
  background: linear-gradient(135deg, var(--tinta-2), var(--tinta)); color: #fff; box-shadow: var(--sombra-2); display: none; transform: translateX(-50%); }
#aviso.mostra { animation: toast .28s var(--curva) both; }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Quem prefere menos movimento: sem animações ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  button:hover:not(:disabled), button:active:not(:disabled) { transform: none; }
}
