/* ImperiumFood V2 — Cliente SPA CSS */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent:   #f97316;
  --accent-h: #ea580c;
  --bg:       #0f0f0f;
  --surface:  #1a1a1a;
  --surface2: #242424;
  --border:   #2a2a2a;
  --text:     #f0f0f0;
  --muted:    #888;
  --success:  #4caf78;
  --danger:   #e05252;
  --warning:  #e0a252;
  --info:     #4a9eff;
  --header-h: 60px;
  --cat-h:    44px;
}

html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: system-ui, sans-serif; font-size: 15px; line-height: 1.5; }

/* ── Screens ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

.screen-init {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  z-index: 999;
}

.screen-erro {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.erro-box { text-align: center; max-width: 360px; }
.erro-icon { font-size: 48px; margin-bottom: 16px; }
.erro-box h1 { font-size: 22px; margin-bottom: 8px; }
.erro-box p { color: var(--muted); }

/* ── Header ────────────────────────────────────────────────────────────────── */
.app-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}
.header-inner {
  max-width: 720px; margin: 0 auto;
  height: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
}
.header-logo { font-weight: 700; font-size: 18px; color: var(--accent); }
.header-actions { display: flex; gap: 8px; align-items: center; }
.btn-icon-round {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.btn-carrinho {
  position: relative;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); border: none;
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.carrinho-count {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ── Categorias bar ────────────────────────────────────────────────────────── */
.categorias-bar {
  position: sticky; top: var(--header-h); z-index: 90;
  background: var(--surface); border-bottom: 1px solid var(--border);
  height: var(--cat-h);
  display: flex; gap: 4px;
  overflow-x: auto; padding: 0 12px;
  scrollbar-width: none;
}
.categorias-bar::-webkit-scrollbar { display: none; }
.cat-btn {
  flex-shrink: 0;
  padding: 0 14px; height: 100%;
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 500;
  white-space: nowrap; transition: color .15s, border-color .15s;
}
.cat-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Main content ───────────────────────────────────────────────────────────── */
.main-content {
  max-width: 720px; margin: 0 auto;
  padding: 0 0 100px;
}
#page-container { padding: 0 16px; }

/* ── Cardápio vazio ─────────────────────────────────────────────────────────── */
.cardapio-vazio {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 80px 24px; text-align: center;
}
.cardapio-vazio-icon { font-size: 56px; opacity: .5; }
.cardapio-vazio h2 { font-size: 20px; font-weight: 700; }
.cardapio-vazio p { color: var(--muted); font-size: 14px; }

/* ── Secção categoria ───────────────────────────────────────────────────────── */
.categoria-secao { padding-top: 24px; }
.categoria-titulo {
  font-size: 16px; font-weight: 700; margin-bottom: 12px;
  color: var(--text);
}

/* ── Produto card ───────────────────────────────────────────────────────────── */
.produtos-lista { display: flex; flex-direction: column; gap: 8px; }
.produto-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border-radius: 10px;
  padding: 12px; cursor: pointer;
  border: 1px solid var(--border);
  transition: border-color .15s;
}
.produto-card:hover { border-color: var(--accent); }
.produto-img {
  width: 80px; height: 80px; border-radius: 8px;
  object-fit: cover; background: var(--surface2); flex-shrink: 0;
}
.produto-img-placeholder {
  width: 80px; height: 80px; border-radius: 8px;
  background: var(--surface2); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.produto-info { flex: 1; min-width: 0; }
.produto-nome { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.produto-desc { color: var(--muted); font-size: 12px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.produto-preco { color: var(--accent); font-weight: 700; font-size: 15px; margin-top: 6px; }
.produto-indisponivel { opacity: .5; cursor: not-allowed; }
.produto-tag-indisponivel { font-size: 11px; color: var(--danger); }

/* ── Modal produto ─────────────────────────────────────────────────────────── */
.modal-produto-img { width: 100%; border-radius: 8px; margin-bottom: 12px; }
.modal-produto-nome { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.modal-produto-desc { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.modal-produto-preco { font-size: 22px; font-weight: 700; color: var(--accent); margin-bottom: 16px; }
.qty-control {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.qty-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.qty-btn:hover { background: var(--accent); border-color: var(--accent); }
.qty-valor { font-size: 18px; font-weight: 700; min-width: 24px; text-align: center; }
.obs-label { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.obs-input {
  width: 100%; padding: 10px; border-radius: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; resize: vertical; min-height: 70px;
}
.obs-input:focus { outline: none; border-color: var(--accent); }

/* ── Carrinho bar flutuante ─────────────────────────────────────────────────── */
.carrinho-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  padding: 12px 16px 16px;
  background: linear-gradient(transparent, var(--bg) 30%);
}
.carrinho-bar .btn { display: flex; justify-content: space-between; align-items: center; }

/* ── Carrinho page ──────────────────────────────────────────────────────────── */
.carrinho-header { padding: 20px 0 8px; }
.carrinho-header h2 { font-size: 20px; font-weight: 700; }
.carrinho-vazio { padding: 40px 0; text-align: center; color: var(--muted); }
.carrinho-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.carrinho-item-nome { flex: 1; font-weight: 500; font-size: 14px; }
.carrinho-item-preco { color: var(--accent); font-weight: 600; }
.carrinho-item-obs { font-size: 12px; color: var(--muted); margin-top: 2px; }
.carrinho-total-row {
  display: flex; justify-content: space-between;
  padding: 12px 0; font-weight: 700; font-size: 16px;
}

/* ── Checkout ───────────────────────────────────────────────────────────────── */
.checkout-section { margin-bottom: 20px; }
.checkout-section-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }
.tipo-entrega-btns { display: flex; gap: 8px; }
.tipo-btn {
  flex: 1; padding: 12px; border-radius: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 500; text-align: center;
  transition: all .15s;
}
.tipo-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.resumo-linha {
  display: flex; justify-content: space-between;
  padding: 6px 0; font-size: 14px; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.resumo-linha.total { color: var(--text); font-weight: 700; font-size: 16px; border-bottom: none; padding-top: 10px; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 8px; font-size: 15px; font-weight: 600;
  cursor: pointer; border: none; transition: background .15s, opacity .15s;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }
.btn-ghost { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Inputs ─────────────────────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); font-size: 14px;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); }

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.7);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
.modal {
  background: var(--surface); width: 100%; max-width: 600px;
  border-radius: 16px 16px 0 0;
  max-height: 90vh; overflow-y: auto;
  padding: 0 0 24px;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-header h3 { font-size: 17px; }
.modal-body { padding: 16px 20px; }
.modal-footer { padding: 0 20px; display: flex; gap: 8px; }
.btn-icon { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 18px; padding: 4px; }

/* ── Toast ───────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 80px; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 1000; pointer-events: none;
}
.toast {
  padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 500;
  max-width: 320px; text-align: center;
  opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s;
  pointer-events: auto;
}
.toast--visible { opacity: 1; transform: translateY(0); }
.toast--sucesso { background: var(--success); color: #fff; }
.toast--erro    { background: var(--danger);  color: #fff; }
.toast--info    { background: var(--info);    color: #fff; }
.toast--aviso   { background: var(--warning); color: #000; }

/* ── Loading spinner ────────────────────────────────────────────────────────── */
.loading-spinner {
  width: 24px; height: 24px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .7s linear infinite; display: inline-block;
}
.loading-spinner--lg { width: 48px; height: 48px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ────────────────────────────────────────────────────────────── */
.empty-state { padding: 48px 16px; text-align: center; color: var(--muted); }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text); }
