/* NYM4 Delivery — cardapio.css
   Específico de index.html (cardápio público): cabeçalho da loja, selo
   aberto/fechado, aviso de loja fechada, busca, trilha de categorias,
   grade de produtos e formulário de checkout. Reaproveita chip, chips,
   cartao-produto, estepe, gaveta, item-carrinho, barra-flutuante e botao
   de componentes.css — depende de tokens.css + base.css + componentes.css
   (carregar antes). */

body {
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}

/* ---------------- cabeçalho da loja ---------------- */

.cabecalho {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--esp-3);
  padding: var(--esp-3) var(--esp-4);
  background: var(--cor-fundo-elevado);
  border-bottom: 1px solid var(--cor-borda);
}

.cabecalho__logo {
  width: 44px;
  height: 44px;
  border-radius: var(--raio-campo);
  object-fit: cover;
  background: var(--cor-superficie-alt);
  flex-shrink: 0;
}

.cabecalho__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cabecalho__nome {
  font-family: var(--fonte-titulo);
  font-size: var(--fs-lg);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------- selo aberto / fechado ---------------- */

.selo {
  display: inline-flex;
  align-items: center;
  gap: var(--esp-1);
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 2px var(--esp-2);
  border-radius: var(--raio-pill);
  width: fit-content;
}

.selo::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.selo--aberto {
  color: var(--estado-entregue-texto);
  background: var(--estado-entregue-fundo);
}

.selo--fechado {
  color: var(--estado-cancelado-texto);
  background: var(--estado-cancelado-fundo);
}

/* ---------------- faixa de loja fechada ---------------- */

.aviso-fechado {
  margin: var(--esp-3) var(--esp-4) 0;
  padding: var(--esp-3) var(--esp-4);
  background: var(--estado-cancelado-fundo);
  color: var(--estado-cancelado-texto);
  border-radius: var(--raio-campo);
  font-size: var(--fs-sm);
}

.aviso-fechado__titulo {
  font-weight: 700;
  margin: 0 0 var(--esp-2);
  color: var(--cor-texto);
}

.aviso-fechado__texto {
  margin: 0 0 var(--esp-2);
}

.aviso-fechado__lista {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
  color: var(--cor-texto-suave);
}

.aviso-fechado__lista li {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-xs);
}

/* ---------------- busca ---------------- */

.busca {
  position: sticky;
  top: 68px;
  z-index: 25;
  padding: var(--esp-3) var(--esp-4) var(--esp-2);
  background: var(--cor-fundo);
}

.busca__campo {
  width: 100%;
  min-height: var(--alvo-toque);
  padding: 0 var(--esp-4);
  border-radius: var(--raio-pill);
  border: 1px solid var(--cor-borda);
  background: var(--cor-superficie);
  color: var(--cor-texto);
  transition: border-color var(--dur-rapida) var(--facil);
}

.busca__campo::placeholder {
  color: var(--cor-texto-suave);
}

.busca__campo:focus-visible {
  border-color: var(--cor-foco);
}

/* ---------------- trilha de categorias ---------------- */

.categorias {
  position: sticky;
  top: 124px;
  z-index: 24;
  padding: var(--esp-2) var(--esp-4) var(--esp-3);
  background: var(--cor-fundo);
  border-bottom: 1px solid var(--cor-borda);
}

/* ---------------- grade de produtos ---------------- */

.secao-categoria {
  padding: var(--esp-4);
}

.secao-categoria__titulo {
  font-family: var(--fonte-titulo);
  font-size: var(--fs-md);
  font-weight: 600;
  margin-bottom: var(--esp-3);
}

.grade-produtos {
  display: grid;
  gap: var(--esp-3);
  grid-template-columns: 1fr;
}

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

@media (min-width: 960px) {
  .grade-produtos { grid-template-columns: repeat(3, 1fr); }
}

.sem-resultado {
  text-align: center;
  color: var(--cor-texto-suave);
  padding: var(--esp-6) var(--esp-4);
  font-size: var(--fs-sm);
}

/* ---------------- carrinho (resumo + estado vazio) ---------------- */

.carrinho-vazio {
  text-align: center;
  color: var(--cor-texto-suave);
  padding: var(--esp-5) 0;
}

.resumo {
  display: grid;
  gap: var(--esp-1);
  padding-top: var(--esp-3);
  border-top: 1px solid var(--cor-borda);
  font-size: var(--fs-sm);
}

.resumo__linha {
  display: flex;
  justify-content: space-between;
  color: var(--cor-texto-suave);
}

.resumo__linha--desconto {
  color: var(--estado-entregue-texto);
  font-weight: 600;
}

.resumo__linha--total {
  color: var(--cor-texto);
  font-weight: 700;
  font-size: var(--fs-md);
  padding-top: var(--esp-2);
}

/* ---------------- cupom de desconto (carrinho) ---------------- */

.bloco-cupom {
  display: flex;
  flex-direction: column;
  gap: var(--esp-2);
  padding: var(--esp-3);
  border: 1px solid var(--cor-borda);
  border-radius: var(--raio-campo);
  background: var(--cor-superficie);
}

.cupom-form-linha {
  display: flex;
  flex-direction: column;
  gap: var(--esp-1);
}

.cupom-form-linha__controles {
  display: flex;
  gap: var(--esp-2);
}

.cupom-form-linha__controles input {
  flex: 1;
  min-width: 0;
  min-height: var(--alvo-toque);
  padding: var(--esp-2) var(--esp-3);
  border-radius: var(--raio-campo);
  border: 1px solid var(--cor-borda);
  background: var(--cor-fundo);
  color: var(--cor-texto);
  text-transform: uppercase;
  transition: border-color var(--dur-rapida) var(--facil);
}

.cupom-form-linha__controles input:focus-visible {
  border-color: var(--cor-foco);
}

.cupom-aplicado-linha {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--esp-2);
  flex-wrap: wrap;
}

.cupom-aplicado-linha__texto {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--estado-entregue-texto);
}

.aviso-minimo {
  font-size: var(--fs-xs);
  color: var(--estado-cancelado-texto);
  background: var(--estado-cancelado-fundo);
  border-radius: var(--raio-campo);
  padding: var(--esp-2) var(--esp-3);
}

/* ---------------- formulário de checkout ---------------- */

.form-checkout {
  display: flex;
  flex-direction: column;
  gap: var(--esp-3);
  padding: var(--esp-4);
}

.campo {
  display: flex;
  flex-direction: column;
  gap: var(--esp-1);
}

.campo__label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--cor-texto-suave);
}

.campo input,
.campo textarea,
.campo select {
  min-height: var(--alvo-toque);
  padding: var(--esp-2) var(--esp-3);
  border-radius: var(--raio-campo);
  border: 1px solid var(--cor-borda);
  background: var(--cor-fundo);
  color: var(--cor-texto);
  transition: border-color var(--dur-rapida) var(--facil);
}

.campo input:focus-visible,
.campo textarea:focus-visible,
.campo select:focus-visible {
  border-color: var(--cor-foco);
}

.campo textarea {
  min-height: 72px;
  resize: vertical;
  padding-top: var(--esp-2);
}

.campo-quando {
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--esp-1);
}

.campo-quando legend {
  padding: 0;
}

.aviso-quando-fechada {
  font-size: var(--fs-xs);
  color: var(--estado-preparando-texto);
  background: var(--estado-preparando-fundo);
  border-radius: var(--raio-campo);
  padding: var(--esp-2) var(--esp-3);
  margin: 0;
}

.campo-agendamento {
  display: flex;
  flex-wrap: wrap;
  gap: var(--esp-3);
}

.campo-agendamento .campo {
  flex: 1 1 140px;
  min-width: 140px;
}

.campo-agendamento .erro-campo {
  flex-basis: 100%;
}

.grupo-pagamento {
  display: flex;
  gap: var(--esp-2);
  flex-wrap: wrap;
}

.opcao-pagamento {
  flex: 1;
  min-height: var(--alvo-toque);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--cor-borda);
  border-radius: var(--raio-campo);
  background: var(--cor-fundo);
  color: var(--cor-texto);
  padding: 0 var(--esp-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  position: relative;
  transition: border-color var(--dur-rapida) var(--facil), background var(--dur-rapida) var(--facil),
    color var(--dur-rapida) var(--facil);
}

.opcao-pagamento input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.opcao-pagamento:has(input:checked) {
  border-color: var(--negocio-primaria);
  background: color-mix(in srgb, var(--negocio-primaria) 16%, transparent);
  color: var(--cor-texto);
}

.opcao-pagamento:has(input:focus-visible) {
  outline: 2px solid var(--cor-foco);
  outline-offset: 3px;
}

.erro-campo {
  font-size: var(--fs-xs);
  color: var(--estado-cancelado-texto);
  min-height: 1em;
}

.mensagem-envio {
  font-size: var(--fs-sm);
  padding: var(--esp-2) var(--esp-3);
  border-radius: var(--raio-campo);
  background: var(--estado-cancelado-fundo);
  color: var(--estado-cancelado-texto);
}

/* ---------------- gaveta ancorada no desktop ---------------- */

@media (min-width: 720px) {
  .gaveta {
    left: auto;
    right: var(--esp-5);
    bottom: var(--esp-5);
    width: min(420px, 92vw);
    max-height: 80vh;
    border-radius: var(--raio-painel);
    border-bottom: 1px solid var(--cor-borda);
  }

  .barra-flutuante {
    left: auto;
    width: min(420px, 92vw);
  }

  .folha-escolhas {
    left: auto;
    right: var(--esp-5);
    bottom: var(--esp-5);
    width: min(420px, 92vw);
    max-height: 80vh;
    border-radius: var(--raio-painel);
    border-bottom: 1px solid var(--cor-borda);
  }
}

/* ---------------- folha de escolha de opções (bottom sheet) ---------------- */

.fundo-folha {
  position: fixed;
  inset: 0;
  z-index: 51;
  background: rgba(2, 4, 12, 0.6);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-media) var(--facil);
}

.fundo-folha--visivel {
  opacity: 1;
  pointer-events: auto;
}

.folha-escolhas {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 52;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: var(--cor-fundo-elevado);
  border: 1px solid var(--cor-borda);
  border-bottom: none;
  border-radius: var(--raio-painel) var(--raio-painel) 0 0;
  box-shadow: var(--sombra-flutuante);
  transform: translateY(100%);
  transition: transform var(--dur-media) var(--facil);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.folha-escolhas:focus-visible {
  outline: none;
}

.folha-escolhas--aberta {
  transform: translateY(0);
}

.folha-escolhas__alca {
  width: 40px;
  height: 4px;
  border-radius: var(--raio-pill);
  background: var(--cor-borda);
  margin: var(--esp-2) auto;
}

.folha-escolhas__cabecalho {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--esp-3);
  padding: 0 var(--esp-4) var(--esp-3);
  border-bottom: 1px solid var(--cor-borda);
}

.folha-escolhas__titulo {
  font-family: var(--fonte-titulo);
  font-size: var(--fs-lg);
  font-weight: 600;
}

.folha-escolhas__corpo {
  overflow-y: auto;
  padding: var(--esp-4);
  display: flex;
  flex-direction: column;
  gap: var(--esp-5);
}

.folha-escolhas__grupo {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--esp-2);
}

.folha-escolhas__legenda {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0;
  font-weight: 600;
  color: var(--cor-texto);
  font-size: var(--fs-md);
}

.folha-escolhas__regra {
  font-weight: 500;
  font-size: var(--fs-xs);
  color: var(--cor-texto-suave);
}

.opcao-escolha {
  display: flex;
  align-items: center;
  gap: var(--esp-3);
  min-height: var(--alvo-toque);
  padding: var(--esp-2) var(--esp-3);
  border: 1px solid var(--cor-borda);
  border-radius: var(--raio-campo);
  background: var(--cor-fundo);
  cursor: pointer;
  transition: border-color var(--dur-rapida) var(--facil), background var(--dur-rapida) var(--facil);
}

.opcao-escolha:has(input:checked) {
  border-color: var(--negocio-primaria);
  background: color-mix(in srgb, var(--negocio-primaria) 12%, transparent);
}

.opcao-escolha:has(input:focus-visible) {
  outline: 2px solid var(--cor-foco);
  outline-offset: 2px;
}

.opcao-escolha:has(input:disabled) {
  opacity: 0.5;
  cursor: not-allowed;
}

.opcao-escolha input {
  width: 20px;
  height: 20px;
  accent-color: var(--negocio-primaria);
  flex-shrink: 0;
}

.opcao-escolha__nome {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-sm);
  font-weight: 500;
}

.opcao-escolha__preco {
  font-size: var(--fs-xs);
  color: var(--cor-texto-suave);
  white-space: nowrap;
}

.folha-escolhas__rodape {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--esp-3);
  padding: var(--esp-3) var(--esp-4);
  border-top: 1px solid var(--cor-borda);
}

.folha-escolhas__total {
  font-family: var(--fonte-titulo);
  font-size: var(--fs-lg);
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  .selo,
  .busca__campo,
  .campo input,
  .campo textarea,
  .campo select,
  .opcao-pagamento,
  .fundo-folha,
  .folha-escolhas,
  .opcao-escolha {
    transition: none;
  }
}
