* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--cor-fundo-pagina, #f7f7f8);
  color: #1f2937;
  padding-bottom: 90px;
}

/* TOPO */
.topo {
  background: var(--cor-fundo-cabecalho, #fff);
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topo-conteudo {
  max-width: 900px;
  margin: 0 auto;
  padding: 12px 16px 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}
.topo .logo { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.topo-info { min-width: 0; }
.topo h1 { margin: 0; font-size: 16px; line-height: 1.2; color: var(--cor-texto-cabecalho, #1f2937); }
.topo-msg { margin: 1px 0; color: var(--cor-texto-cabecalho, #1f2937); opacity: 0.65; font-size: 12px; line-height: 1.3; }
.topo-linha-status { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.topo-horario { color: var(--cor-texto-cabecalho, #1f2937); opacity: 0.65; font-size: 11px; }
.status-loja {
  padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 700;
  white-space: nowrap;
}
.status-loja.aberta { background: #dcfce7; color: #15803d; }
.status-loja.fechada { background: #fee2e2; color: #b91c1c; }

.seletor-categorias {
  max-width: 900px; margin: 0 auto; padding: 0 16px 10px; position: relative;
}
.seletor-categorias-botao {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border: 1px solid #e5e7eb; border-radius: 10px; background: var(--cor-fundo-menu, #fff);
  font-size: 14px; font-weight: 600; color: #1f2937; cursor: pointer;
}
.seletor-seta { transition: transform 0.2s; color: #6b7280; }
.seletor-categorias-botao.aberto .seletor-seta { transform: rotate(180deg); }

.seletor-categorias-lista {
  position: absolute; top: calc(100% + 4px); left: 16px; right: 16px;
  background: var(--cor-fundo-menu, #fff); border: 1px solid #e5e7eb; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.15); max-height: 60vh; overflow-y: auto; z-index: 30;
}
.seletor-categorias-lista[hidden] { display: none; }
.seletor-categorias-lista a {
  display: block; padding: 13px 16px; font-size: 14px; color: #374151;
  border-bottom: 1px solid #f3f4f6; text-decoration: none;
}
.seletor-categorias-lista a:last-child { border-bottom: none; }
.seletor-categorias-lista a:hover, .seletor-categorias-lista a.ativa { background: #f9fafb; font-weight: 600; }

/* CONTEÚDO */
.conteudo { max-width: 900px; margin: 0 auto; padding: 20px 16px; }
.aviso-fechado { background: #fef3c7; color: #92400e; padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; font-size: 14px; }
.vazio { text-align: center; color: #6b7280; padding: 60px 0; }

.categoria-secao { margin-bottom: 22px; scroll-margin-top: var(--altura-header, 160px); }
.categoria-secao h2 { font-size: 18px; margin-bottom: 8px; }

.grade-produtos {
  display: flex; flex-direction: column; background: #fff; border-radius: 12px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.produto-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px 14px; border-bottom: 1px solid #f0f1f3; cursor: pointer;
}
.produto-item:last-child { border-bottom: none; }
.produto-item:hover { background: #fafafa; }
.produto-item.indisponivel { opacity: .5; cursor: not-allowed; pointer-events: none; }
.produto-item-texto { flex: 1; min-width: 0; }
.produto-item-texto h3 { margin: 0; font-size: 14.5px; font-weight: 500; line-height: 1.3; }

/* Nome curto (menos de 20 caracteres): preço fica ao lado, na mesma linha */
.preco-mesma-linha .produto-preco-inline {
  display: inline-block; color: var(--cor-primaria, #16a34a); font-weight: 700; font-size: 13px; margin-left: 8px;
}

/* Nome longo (20+ caracteres): preço fica embaixo, numa linha própria */
.preco-abaixo .produto-preco-inline {
  display: block; color: var(--cor-primaria, #16a34a); font-weight: 700; font-size: 13px; margin-top: 2px;
}
.produto-item-img-wrap {
  position: relative; width: 56px; height: 56px; flex-shrink: 0; border-radius: 8px;
  overflow: visible; background: #f3f4f6;
}
.produto-item-img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 8px; }
.produto-item-mais {
  position: absolute; bottom: -5px; right: -5px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--cor-primaria, #16a34a); color: #fff; display: flex; align-items: center;
  justify-content: center; font-size: 15px; font-weight: 700; box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
/* Produto sem foto: nada de caixa vazia de 56x56, só um botão + compacto */
.produto-item-mais-solo {
  position: static; width: 30px; height: 30px; font-size: 17px; flex-shrink: 0;
}

/* CARRINHO FLUTUANTE */
.botao-carrinho-flutuante {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, var(--cor-primaria, #16a34a), var(--cor-secundaria, #065f46));
  color: #fff; border: none; padding: 14px 24px;
  border-radius: 99px; font-size: 14px; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,.2); z-index: 20;
}

/* MODAL */
.modal-fundo {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-fundo[hidden] { display: none; }
.modal-caixa {
  background: #fff; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  border-radius: 16px 16px 0 0; padding: 20px;
}
@media (min-width: 560px) {
  .modal-fundo { align-items: center; }
  .modal-caixa { border-radius: 16px; }
}
.modal-cabecalho { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal-cabecalho h2 { margin: 0; font-size: 18px; }

/* Só no modal de detalhes do produto: título centralizado, com o X
   fixo no canto (não mexe no modal do carrinho). */
#modalProduto .modal-cabecalho { position: relative; }
#modalProduto .modal-cabecalho h2 { width: 100%; text-align: center; }
#modalProduto .modal-cabecalho .fechar { position: absolute; right: 0; top: 50%; transform: translateY(-50%); }
.fechar { background: none; border: none; font-size: 26px; cursor: pointer; color: #6b7280; line-height: 1; }

.lista-carrinho { margin: 10px 0; }
.carrinho-vazio { color: #6b7280; text-align: center; padding: 20px 0; }

.botao-continuar {
  width: 100%; background: #fff; color: var(--cor-primaria, #16a34a); border: 1.5px solid var(--cor-primaria, #16a34a);
  padding: 10px; border-radius: 8px; font-size: 14px; font-weight: 700; cursor: pointer; margin: 10px 0 4px;
}
.botao-continuar:hover { background: #f0fdf4; }
.item-carrinho { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #f0f1f3; }
.item-info { display: flex; flex-direction: column; font-size: 14px; }
.item-info span { font-size: 12px; color: #6b7280; }
.item-editavel { cursor: pointer; }
.item-qtd { display: flex; align-items: center; gap: 10px; }
.qtd-btn {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid #d1d5db; background: #fff;
  font-size: 16px; cursor: pointer; line-height: 1;
}
.qtd-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.resumo-valores { border-top: 1px dashed #e5e7eb; padding-top: 10px; margin-top: 6px; }
.linha-valor { display: flex; justify-content: space-between; font-size: 14px; padding: 3px 0; color: #4b5563; }
.linha-valor[hidden] { display: none; }
.linha-valor.total { font-weight: 700; font-size: 16px; color: #111827; padding-top: 6px; }

.form-checkout { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; }
.form-checkout label { font-size: 13px; font-weight: 600; color: #374151; margin-top: 8px; }
.form-checkout input[type=text], .form-checkout input[type=tel], .form-checkout select, .form-checkout textarea {
  padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 16px; width: 100%;
}
.opcoes-entrega { display: flex; gap: 16px; padding: 4px 6px; border-radius: 8px; }
.opcao-radio { display: flex; align-items: center; gap: 6px; font-weight: 400 !important; font-size: 14px; }

.aviso-minimo { background: #fef3c7; color: #92400e; padding: 8px 12px; border-radius: 8px; font-size: 13px; }

.campo-invalido {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
  animation: campoInvalidoPulso 1.5s ease;
}
@keyframes campoInvalidoPulso {
  0%, 40% { background: rgba(220, 38, 38, 0.06); }
  100% { background: transparent; }
}

.info-retirada {
  background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; font-size: 13px;
  padding: 10px 12px; border-radius: 8px; margin: 6px 0 4px; line-height: 1.5;
}

.cep-status { font-size: 12px; margin: 4px 0 0; padding: 2px 0; }
.cep-status.buscando { color: #6b7280; }
.cep-status.ok { color: #15803d; font-weight: 600; }
.cep-status.erro { color: #b91c1c; }

.opcao-checkbox-manual {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: #6b7280;
  font-weight: 400 !important; margin: 8px 0 2px !important; cursor: pointer;
}
.opcao-checkbox-manual input { width: 15px; height: 15px; accent-color: var(--cor-primaria, #16a34a); }

.botao-enviar {
  margin-top: 14px; background: #25d366; color: #fff; border: none; padding: 14px; border-radius: 10px;
  font-size: 15px; font-weight: 700; cursor: pointer;
}
.botao-enviar:hover { filter: brightness(0.95); }

/* MODAL DE PRODUTO / ADICIONAIS */
.produto-modal-img {
  width: 100%; max-height: 180px; object-fit: cover; border-radius: 10px; margin-bottom: 12px; display: block;
}
.produto-modal-nome { margin: 0 0 4px; font-size: 17px; }
.produto-modal-desc { color: #6b7280; font-size: 14px; margin: 0 0 14px; }

.troco-lembrete {
  background: #f3f4f6; color: #374151; font-size: 12px; padding: 6px 10px;
  border-radius: 8px; margin: 6px 0 2px; display: inline-block;
}
.troco-lembrete strong { color: #111827; }

.input-com-prefixo {
  display: flex; align-items: center; border: 1px solid #d1d5db; border-radius: 8px; overflow: hidden;
}
.input-com-prefixo span {
  padding: 10px 8px 10px 12px; color: #6b7280; font-size: 16px; font-weight: 600; background: #f9fafb;
}
.input-com-prefixo input {
  border: none !important; border-radius: 0 !important; flex: 1;
}
.input-com-prefixo input:focus { outline: none; }

.grupo-adicional { border-top: 1px solid #f0f1f3; padding: 14px 0; }
.grupo-adicional:first-child { border-top: none; }
.grupo-cabecalho { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grupo-cabecalho strong { font-size: 15px; }
.grupo-badge {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px;
  background: #f3f4f6; color: #6b7280; white-space: nowrap;
}
.grupo-badge.obrigatorio { background: #fee2e2; color: #b91c1c; }
.grupo-legenda { font-size: 12px; color: #9ca3af; margin: 3px 0 10px; }

.opcao-linha {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 0; border-top: 1px solid #f7f7f8; cursor: default;
}
.opcao-linha:first-of-type { border-top: none; }
.opcao-clicavel { cursor: pointer; }
.opcao-info { display: flex; flex-direction: column; font-size: 14px; }
.opcao-preco { font-size: 12px; color: #16a34a; font-weight: 600; }
.opcao-checkbox { width: 20px; height: 20px; accent-color: var(--cor-primaria, #16a34a); cursor: pointer; }

.opcao-stepper { display: flex; align-items: center; gap: 10px; }
.opcao-stepper span { min-width: 16px; text-align: center; font-weight: 600; }

.produto-modal-rodape {
  display: flex; align-items: center; gap: 12px; margin-top: 16px; padding-top: 14px;
  border-top: 1px dashed #e5e7eb; position: sticky; bottom: 0; background: #fff;
}
.qtd-produto { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.qtd-produto span { min-width: 18px; text-align: center; font-weight: 700; }
.produto-modal-rodape .botao-enviar { margin-top: 0; flex: 1; background: var(--cor-primaria, #16a34a); }
.produto-modal-rodape .botao-enviar.botao-pendente { background: #9ca3af; }

.grupo-adicional.grupo-destaque {
  animation: grupoPulso 1.2s ease;
  border-radius: 10px;
}
@keyframes grupoPulso {
  0%   { background: rgba(220, 38, 38, 0.08); box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.25) inset; }
  100% { background: transparent; box-shadow: none; }
}

.item-adicional { font-size: 12px; color: #6b7280; padding-left: 2px; }
