:root {
  --cor-principal: #ff5e3a;
  --cor-principal-dark: #e8491f;
  --bg: #f7f7f9;
  --card-bg: #ffffff;
  --text: #1c1c1e;
  --text-muted: #6b6b76;
  --border: #ebebee;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.16);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121214;
    --card-bg: #1c1c1f;
    --text: #f2f2f4;
    --text-muted: #a3a3ad;
    --border: #2b2b30;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.55);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(84px + var(--safe-bottom));
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ===== Header ===== */
.topo {
  background: linear-gradient(135deg, var(--cor-principal), var(--cor-principal-dark));
  color: #fff;
  padding: 18px 16px 20px;
  border-radius: 0 0 24px 24px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.topo__linha {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topo__logo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}

.topo__info {
  flex: 1;
  min-width: 0;
}

.topo__nome {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0 0 2px;
  line-height: 1.2;
}

.topo__slogan {
  font-size: 0.82rem;
  opacity: 0.92;
  margin: 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(4px);
}

.status-badge__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #37d67a;
  box-shadow: 0 0 0 0 rgba(55, 214, 122, 0.6);
  animation: pulse 2s infinite;
}

.status-badge.fechado .status-badge__dot {
  background: #ff6b6b;
  animation: none;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(55, 214, 122, 0.6);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(55, 214, 122, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(55, 214, 122, 0);
  }
}

/* ===== Nav categorias ===== */
.nav-categorias {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.nav-categorias::-webkit-scrollbar {
  display: none;
}

.nav-categorias__item {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease;
}

.nav-categorias__item:active {
  transform: scale(0.95);
}

.nav-categorias__item.ativo {
  background: var(--cor-principal);
  border-color: var(--cor-principal);
  color: #fff;
}

/* ===== Categorias / Produtos ===== */
main {
  padding: 4px 16px 24px;
  max-width: 720px;
  margin: 0 auto;
}

.categoria {
  margin-top: 26px;
}

.categoria__titulo {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0 0 12px;
  scroll-margin-top: 64px;
}

.grid-produtos {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.produto-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  display: flex;
  gap: 12px;
  padding: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  border: 1px solid transparent;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.produto-card.visivel {
  opacity: 1;
  transform: translateY(0);
}

.produto-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border);
}

.produto-card:active {
  transform: scale(0.98);
}

.produto-card__foto-wrap {
  position: relative;
  width: 92px;
  height: 92px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
}

.produto-card__foto {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.produto-card:hover .produto-card__foto {
  transform: scale(1.08);
}

.produto-card.esgotado .produto-card__foto {
  filter: grayscale(1);
  opacity: 0.6;
}

.tag-esgotado {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.produto-card__corpo {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.produto-card__nome {
  font-weight: 700;
  font-size: 0.96rem;
  margin: 0 0 4px;
}

.produto-card__desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.produto-card__rodape {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
}

.produto-card__preco {
  font-weight: 800;
  color: var(--cor-principal);
}

.btn-add-rapido {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--cor-principal);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}

.btn-add-rapido:hover {
  background: var(--cor-principal-dark);
}

.btn-add-rapido:active {
  transform: scale(0.85);
}

.btn-add-rapido:disabled {
  background: #c7c7cc;
  cursor: not-allowed;
}

/* ===== Botão carrinho flutuante ===== */
.btn-carrinho-flutuante {
  position: fixed;
  right: 16px;
  bottom: calc(16px + var(--safe-bottom));
  z-index: 30;
  background: var(--cor-principal);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.92rem;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-carrinho-flutuante.bump {
  transform: scale(1.12);
}

.btn-carrinho-flutuante__contador {
  background: #fff;
  color: var(--cor-principal);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
}

.btn-carrinho-flutuante[hidden] {
  display: none;
}

/* ===== Overlay / Modais ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.overlay.aberto {
  opacity: 1;
  pointer-events: auto;
}

.folha {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  background: var(--card-bg);
  border-radius: 24px 24px 0 0;
  max-height: 88vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: var(--shadow-lg);
  padding-bottom: calc(20px + var(--safe-bottom));
}

.folha.aberto {
  transform: translateY(0);
}

.folha__alca {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  margin: 10px auto 4px;
}

.folha__fechar {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
}

.folha__conteudo {
  padding: 8px 20px 10px;
}

/* Produto modal */
.produto-modal__foto {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}

.produto-modal__nome {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0 0 6px;
}

.produto-modal__desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 14px;
}

.produto-modal__preco {
  font-weight: 800;
  color: var(--cor-principal);
  font-size: 1.1rem;
  margin-bottom: 16px;
}

.bloco-titulo {
  font-weight: 700;
  font-size: 0.92rem;
  margin: 18px 0 8px;
}

.adicional-linha {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.adicional-linha label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  cursor: pointer;
  flex: 1;
}

.adicional-linha__preco {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: 8px;
}

textarea,
input[type="text"],
input[type="tel"],
input[type="number"],
input[type="time"],
input[type="color"],
select {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
}

textarea {
  resize: vertical;
  min-height: 64px;
}

.seletor-qtd {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
  margin: 10px 0 18px;
}

.seletor-qtd button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
}

.seletor-qtd span {
  font-weight: 800;
  font-size: 1.1rem;
  min-width: 24px;
  text-align: center;
}

.btn-primario {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--cor-principal);
  color: #fff;
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primario:hover {
  background: var(--cor-principal-dark);
}

.btn-primario:active {
  transform: scale(0.98);
}

.btn-primario:disabled {
  background: #c7c7cc;
  cursor: not-allowed;
}

.btn-secundario {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 8px;
}

/* Carrinho */
.carrinho-item {
  display: flex;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.carrinho-item__foto {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.carrinho-item__corpo {
  flex: 1;
  min-width: 0;
}

.carrinho-item__nome {
  font-weight: 700;
  font-size: 0.9rem;
  margin: 0 0 2px;
}

.carrinho-item__detalhe {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin: 0 0 6px;
}

.carrinho-item__rodape {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.carrinho-item__qtd {
  display: flex;
  align-items: center;
  gap: 8px;
}

.carrinho-item__qtd button {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
}

.carrinho-item__remover {
  border: none;
  background: none;
  color: #ff3b30;
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: underline;
}

.carrinho-vazio {
  text-align: center;
  padding: 40px 10px;
  color: var(--text-muted);
}

.carrinho-resumo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  font-weight: 800;
  font-size: 1.05rem;
}

/* Checkout */
.campo {
  margin-bottom: 14px;
}

.campo label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.segmento {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.segmento button {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

.segmento button.ativo {
  background: var(--cor-principal);
  border-color: var(--cor-principal);
  color: #fff;
}

/* Rodapé site */
.rodape {
  max-width: 720px;
  margin: 24px auto 0;
  padding: 20px 16px 10px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.rodape__horarios {
  display: inline-block;
  text-align: left;
  margin: 10px 0;
}

.rodape__horarios div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.8rem;
  padding: 2px 0;
}

.rodape__horarios .hoje {
  font-weight: 800;
  color: var(--cor-principal);
}

/* Toast */
.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translate(-50%, -140%);
  background: #1c1c1e;
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 60;
  transition: transform 0.3s ease;
  box-shadow: var(--shadow-lg);
}

.toast.mostrar {
  transform: translate(-50%, 0);
}

/* Loading */
.carregando {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  color: var(--text-muted);
  font-size: 0.9rem;
}

@media (min-width: 560px) {
  .grid-produtos {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 720px) {
  .folha {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    width: 440px;
    max-width: 92vw;
    transform: translate(-50%, -46%) scale(0.95);
    border-radius: 24px;
    opacity: 0;
    pointer-events: none;
  }

  .folha.aberto {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
  }

  .folha__alca {
    display: none;
  }
}

@media print {
  .nav-categorias,
  .btn-carrinho-flutuante,
  .overlay,
  .folha {
    display: none !important;
  }
}
