/* ============================================================
   Nova Lojinha — e-commerce fictício com cara de loja de verdade
   ============================================================ */
:root {
  --azul: #1a4fd8;
  --azul-escuro: #0d3bb0;
  --laranja: #ff6a00;
  --verde: #00a650;
  --ink: #1f2430;
  --cinza: #6b7280;
  --linha: #e5e7eb;
  --fundo: #f4f5f7;
  --branco: #fff;
  --radius: 10px;
  --sombra: 0 1px 4px rgba(15, 23, 42, .08);
  --sombra-2: 0 8px 28px rgba(15, 23, 42, .14);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--fundo); color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.5;
}
button { font-family: inherit; cursor: pointer; }
a { color: var(--azul); text-decoration: none; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ---------- Header ---------- */
.topbar { background: var(--azul); color: #fff; font-size: .8rem; }
.topbar .wrap { display: flex; justify-content: space-between; padding: 6px 16px; }
.header { background: var(--azul); position: sticky; top: 0; z-index: 40; box-shadow: var(--sombra); }
.header .wrap { display: flex; align-items: center; gap: 18px; padding: 12px 16px; }
.logo { color: #fff; font-weight: 800; font-size: 1.5rem; letter-spacing: -.02em; white-space: nowrap; }
.logo .tm { font-size: .6rem; vertical-align: super; opacity: .8; }
.busca { flex: 1; display: flex; }
.busca input {
  flex: 1; border: none; border-radius: 8px 0 0 8px; padding: 11px 14px; font-size: .95rem; outline: none;
}
.busca button {
  border: none; background: #fff; border-left: 1px solid var(--linha);
  border-radius: 0 8px 8px 0; padding: 0 16px; font-size: 1.05rem;
}
.h-acoes { display: flex; align-items: center; gap: 10px; }
.chip {
  display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 999px;
  padding: 7px 14px; font-size: .85rem; white-space: nowrap;
}
.chip b { font-size: .95rem; }
.btn-carrinho {
  position: relative; background: var(--laranja); color: #fff; border: none;
  border-radius: 8px; padding: 10px 16px; font-weight: 700; font-size: .9rem;
}
.btn-carrinho .badge {
  position: absolute; top: -8px; right: -8px; background: #fff; color: var(--laranja);
  border: 2px solid var(--laranja); border-radius: 999px; min-width: 22px; height: 22px;
  font-size: .72rem; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.btn-pedidos { background: transparent; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 8px; padding: 9px 14px; font-size: .85rem; }

/* ---------- Aviso fake ---------- */
.aviso {
  background: #fff8e6; border-bottom: 1px solid #f3e2ad; color: #7a5d00;
  text-align: center; font-size: .82rem; padding: 7px 12px;
}

/* ---------- Categorias ---------- */
.cats { background: #fff; border-bottom: 1px solid var(--linha); }
.cats .wrap { display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px; }
.cat {
  border: 1px solid var(--linha); background: #fff; color: var(--ink);
  border-radius: 999px; padding: 7px 16px; font-size: .85rem; white-space: nowrap;
}
.cat.ativa { background: var(--azul); border-color: var(--azul); color: #fff; font-weight: 600; }

/* ---------- Banner ---------- */
.banner {
  background: linear-gradient(120deg, var(--azul) 0%, #6d28d9 100%);
  color: #fff; border-radius: var(--radius); margin: 18px auto; padding: 26px 30px;
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
}
.banner h1 { margin: 0 0 4px; font-size: 1.4rem; }
.banner p { margin: 0; opacity: .9; font-size: .95rem; }
.banner .mesada { text-align: right; white-space: nowrap; }
.banner .mesada b { font-size: 1.4rem; display: block; }

/* ---------- Grid de produtos ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; padding: 6px 0 40px; }
.card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--sombra);
  display: flex; flex-direction: column; overflow: hidden; transition: box-shadow .15s ease, transform .15s ease;
}
.card:hover { box-shadow: var(--sombra-2); transform: translateY(-2px); }
.foto {
  position: relative; aspect-ratio: 1/1; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f8fafc, #eef2f7); font-size: 72px;
}
.desconto {
  position: absolute; top: 10px; left: 10px; background: var(--verde); color: #fff;
  font-size: .72rem; font-weight: 800; border-radius: 6px; padding: 3px 8px;
}
.frete {
  position: absolute; bottom: 10px; left: 10px; background: #e8f8ef; color: var(--verde);
  font-size: .7rem; font-weight: 700; border-radius: 6px; padding: 2px 8px;
}
.card .info { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card .nome { font-size: .88rem; color: var(--ink); min-height: 2.6em; }
.estrelas { color: #f5a623; font-size: .78rem; }
.estrelas span { color: var(--cinza); }
.de { color: var(--cinza); font-size: .78rem; text-decoration: line-through; }
.preco { font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em; }
.parcelas { color: var(--verde); font-size: .78rem; margin-bottom: 8px; }
.card .acoes { display: flex; gap: 8px; margin-top: auto; }
.btn-add {
  flex: 1; border: 1px solid var(--azul); background: #fff; color: var(--azul);
  border-radius: 8px; padding: 9px 0; font-weight: 700; font-size: .85rem;
}
.btn-add:hover { background: #eef3ff; }
.btn-comprar {
  flex: 1; border: none; background: var(--azul); color: #fff;
  border-radius: 8px; padding: 9px 0; font-weight: 700; font-size: .85rem;
}
.btn-comprar:hover { background: var(--azul-escuro); }
.vazio { text-align: center; color: var(--cinza); padding: 60px 0; grid-column: 1/-1; }

/* ---------- Drawer (carrinho / pedidos) ---------- */
.escurece { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 50; opacity: 0; pointer-events: none; transition: opacity .2s; }
.escurece.aberto { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: -420px; width: 400px; max-width: 92vw; height: 100%;
  background: #fff; z-index: 60; box-shadow: var(--sombra-2); transition: right .25s ease;
  display: flex; flex-direction: column;
}
.drawer.aberto { right: 0; }
.drawer header { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--linha); }
.drawer header h2 { margin: 0; font-size: 1.05rem; }
.fechar { border: none; background: none; font-size: 1.3rem; color: var(--cinza); }
.drawer .corpo { flex: 1; overflow-y: auto; padding: 12px 18px; }
.item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--linha); }
.item .mini { font-size: 34px; width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; background: var(--fundo); border-radius: 8px; }
.item .inf { flex: 1; }
.item .inf .n { font-size: .84rem; }
.item .inf .p { font-weight: 700; }
.qtd { display: flex; align-items: center; gap: 8px; }
.qtd button { width: 26px; height: 26px; border: 1px solid var(--linha); background: #fff; border-radius: 6px; font-weight: 700; }
.drawer footer { border-top: 1px solid var(--linha); padding: 14px 18px; }
.linha-total { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: .9rem; }
.linha-total.total { font-size: 1.1rem; font-weight: 800; margin: 8px 0 12px; }
.btn-finalizar { width: 100%; border: none; background: var(--verde); color: #fff; border-radius: 8px; padding: 13px 0; font-weight: 800; font-size: 1rem; }
.btn-finalizar:disabled { background: #a7d9bd; cursor: not-allowed; }
.saldo-info { text-align: center; font-size: .8rem; color: var(--cinza); margin-top: 8px; }

/* extrato */
.ext-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--linha); }
.ext-ico { width: 40px; height: 40px; border-radius: 10px; background: var(--fundo); display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0; }
.ext-info { flex: 1; min-width: 0; }
.ext-desc { font-size: .85rem; }
.ext-meta { font-size: .74rem; color: var(--cinza); }
.ext-valor { font-weight: 800; font-size: .9rem; white-space: nowrap; }
.ext-valor.pos { color: var(--verde); }
.ext-valor.neg { color: #dc2626; }

/* pedidos */
.pedido { border: 1px solid var(--linha); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.pedido .cab { display: flex; justify-content: space-between; font-size: .8rem; color: var(--cinza); margin-bottom: 6px; }
.pedido .itens { font-size: 1.4rem; letter-spacing: 4px; }
.pedido .st { margin-top: 6px; font-size: .82rem; font-weight: 700; }
.st.s0 { color: var(--laranja); } .st.s1 { color: var(--azul); } .st.s2 { color: var(--verde); }
.barra { height: 6px; background: var(--fundo); border-radius: 99px; margin-top: 6px; overflow: hidden; }
.barra i { display: block; height: 100%; background: var(--verde); border-radius: 99px; transition: width .4s; }

.timeline { margin-top: 10px; border-left: 2px solid var(--linha); padding-left: 12px; display: grid; gap: 7px; }
.evento { font-size: .8rem; position: relative; }
.evento::before { content: ""; position: absolute; left: -17px; top: 5px; width: 8px; height: 8px; border-radius: 99px; background: var(--verde); }
.evento.pendente { color: var(--cinza); font-style: italic; }
.evento.pendente::before { background: var(--linha); }
.evento .hora { color: var(--cinza); font-weight: 700; margin-right: 4px; font-style: normal; }

/* ---------- Modais ---------- */
.modal-fundo { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 70; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-fundo.aberto { display: flex; }
.modal { background: #fff; border-radius: 14px; max-width: 440px; width: 100%; padding: 26px 26px 22px; box-shadow: var(--sombra-2); text-align: center; }
.modal h2 { margin: 0 0 6px; font-size: 1.25rem; }
.modal p { color: var(--cinza); font-size: .92rem; margin: 6px 0; }
.modal .grande { font-size: 56px; margin-bottom: 6px; }
.modal .btn-primario { width: 100%; border: none; background: var(--azul); color: #fff; border-radius: 8px; padding: 12px 0; font-weight: 800; font-size: .95rem; margin-top: 12px; }
.modal .btn-secundario { width: 100%; border: 1px solid var(--linha); background: #fff; color: var(--ink); border-radius: 8px; padding: 11px 0; font-weight: 600; font-size: .9rem; margin-top: 8px; }
.pagamentos { display: grid; gap: 8px; margin-top: 12px; text-align: left; }
.pag { display: flex; align-items: center; gap: 10px; border: 1px solid var(--linha); border-radius: 8px; padding: 11px 12px; font-size: .9rem; cursor: pointer; }
.pag input { accent-color: var(--azul); }
.pag.sel { border-color: var(--azul); background: #eef3ff; }

.chip.vermelho { background: #8a1c1c; border-color: #ffb4b4; }
.aviso.vermelho { background: #fde8e8; border-bottom-color: #f5b5b5; color: #8a1c1c; font-weight: 700; }
.pag.desabilitado { opacity: .45; pointer-events: none; }
.rotulo-parcelas { font-size: .8rem; color: var(--cinza); }
#sel-parcelas { width: 100%; padding: 10px 12px; border: 1px solid var(--linha); border-radius: 8px; font-family: inherit; font-size: .85rem; background: #fff; }
.carne { font-size: .8rem; color: #8a5a00; background: #fff7e0; border-radius: 6px; padding: 4px 8px; margin-top: 4px; }

/* confete */
.confete { position: fixed; top: -12px; z-index: 80; font-size: 18px; pointer-events: none; animation: cair linear forwards; }
@keyframes cair { to { transform: translateY(105vh) rotate(720deg); opacity: .9; } }

/* rodapé */
.rodape { text-align: center; color: var(--cinza); font-size: .8rem; padding: 26px 16px 34px; }

@media (max-width: 640px) {
  .header .wrap { flex-wrap: wrap; gap: 10px; }
  .busca { order: 3; width: 100%; flex-basis: 100%; }
  .banner { flex-direction: column; text-align: center; }
  .banner .mesada { text-align: center; }
  .chip.saldo-topo { display: none; }
}
