﻿* {
  box-sizing: border-box;
}

:root {
  --laranja: var(--cor-primaria);
  --laranja-escuro: #e64d00;
  --verde: #16a34a;
  --azul: #2563eb;
  --roxo: #7c3aed;
  --texto: #111827;
  --texto-fraco: #667085;
  --borda: #e5e7eb;
  --fundo: #f3f5f8;
  --card: #ffffff;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Arial, sans-serif;
  background: var(--fundo);
  color: var(--texto);
}

body {
  overflow-x: hidden;
}

.app {
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--fundo);
  padding: 12px 12px 82px;
}

/* CABEÇALHO SIMPLES */

.cabecalho-pedidos {
  position: relative;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  margin-bottom: 14px;
}

.btn-voltar-pedidos {
  position: absolute;
  left: 12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 12px;
  background: #f3f4f6;
  color: #111827;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.cabecalho-pedidos h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  color: var(--texto);
}

/* TABS */

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #fff;
  padding: 6px;
  border-radius: 18px;
  margin-bottom: 16px;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.07);
}

.tabs button {
  min-height: 44px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: #475467;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.tabs button.ativo {
  background: var(--laranja);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

/* LISTA */

#listaPedidos {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* CARD */

.card-pedido {
  background: var(--card);
  border-radius: 24px;
  padding: 16px;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(255,255,255,0.85);
}

.pedido-finalizado {
  opacity: 0.96;
}

.card-topo {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.pedido-numero {
  display: block;
  color: var(--laranja);
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 4px;
}

.card-pedido h3 {
  margin: 0;
  color: var(--texto);
  font-size: 21px;
  font-weight: 900;
}

.badge-tipo {
  background: #fff1e8;
  color: var(--laranja);
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* STATUS */

.status-area {
  background: #f8fafc;
  border-radius: 18px;
  padding: 13px;
  margin-bottom: 13px;
}

.status-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 9px;
}

.status-bar div {
  height: 7px;
  background: #d8dee8;
  border-radius: 999px;
}

.status-bar div.ativo {
  background: linear-gradient(90deg, #16a34a, #22c55e);
}

.status-texto {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  color: #667085;
  font-size: 11px;
  font-weight: 800;
}

.status-texto span:nth-child(2) {
  text-align: center;
}

.status-texto span:last-child {
  text-align: right;
}

/* INFOS */

.pedido-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-bottom: 13px;
}

.info-box {
  background: #f8fafc;
  border-radius: 17px;
  padding: 12px;
  border: 1px solid #edf0f4;
}

.info-box span {
  display: block;
  color: var(--texto-fraco);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
}

.info-box strong {
  display: block;
  color: var(--texto);
  font-size: 14px;
  font-weight: 900;
}

.total-box {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  grid-column: 1 / -1;
}

.total-box span {
  color: #667085;
}

.total-box strong {
  color: #111827;
  font-size: 20px;
}

/* ITENS */

.detalhes-itens {
  margin-top: 8px;
  padding-top: 13px;
  border-top: 1px solid var(--borda);
}

.titulo-itens {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--texto);
  margin-bottom: 10px;
}

.titulo-itens i {
  color: var(--laranja);
}

.titulo-itens strong {
  font-size: 15px;
  font-weight: 900;
}

.item-pedido {
  background: #f8fafc;
  border-radius: 15px;
  padding: 10px 12px;
  margin-top: 8px;
  border: 1px solid #edf0f4;
}

.item-pedido p {
  margin: 0;
  color: var(--texto);
  font-size: 14px;
  font-weight: 900;
}

.item-pedido small {
  display: block;
  margin-top: 4px;
  color: var(--texto-fraco);
  font-size: 12px;
  line-height: 1.35;
}

/* AÇÕES */

.acoes-pedido {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 14px;
}

.acoes-pedido button:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.acoes-pedido button {
  min-height: 46px;
  border: none;
  border-radius: 15px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.btn-whatsapp {
  background: #16a34a;
  color: #fff;
}

.btn-localizacao {
  background: #2563eb;
  color: #fff;
}

.btn-concluir {
  background: var(--laranja);
  color: #fff;
}

/* AVISOS */

.aviso-status {
  margin-top: 14px;
  border-radius: 18px;
  padding: 13px;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  border: 1px solid transparent;
}

.aviso-icone {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 16px;
}

.aviso-status strong {
  display: block;
  font-size: 14px;
  font-weight: 900;
  margin-bottom: 3px;
}

.aviso-status p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.aviso-neutro {
  background: #f8fafc;
  border-color: #e5e7eb;
  color: #475467;
}

.aviso-neutro .aviso-icone {
  background: #eef2ff;
  color: #4f46e5;
}

.aviso-preparo {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #92400e;
}

.aviso-preparo .aviso-icone {
  background: #ffedd5;
  color: #ea580c;
}

.aviso-entrega {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.aviso-entrega .aviso-icone {
  background: #dbeafe;
  color: #2563eb;
}

.aviso-pronto {
  background: #ecfdf3;
  border-color: #bbf7d0;
  color: #027a48;
}

.aviso-pronto .aviso-icone {
  background: #dcfce7;
  color: #16a34a;
}

.aviso-concluido {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.aviso-concluido .aviso-icone {
  background: #dcfce7;
  color: #16a34a;
}

/* VAZIO */

.estado-vazio,
.msg-vazia {
  background: #fff;
  border-radius: 22px;
  padding: 28px 18px;
  text-align: center;
  color: var(--texto-fraco);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.07);
}

.estado-vazio i {
  font-size: 32px;
  color: var(--laranja);
  margin-bottom: 10px;
}

.estado-vazio strong {
  display: block;
  color: var(--texto);
  font-size: 17px;
  font-weight: 900;
  margin-bottom: 5px;
}

.estado-vazio span {
  display: block;
  font-size: 13px;
}

/* MENU BOTTOM */

.menu-bottom {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  max-width: 430px;
  width: 100%;
  height: 64px;
  background: rgba(255,255,255,0.96);
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.menu-item {
  text-decoration: none;
  color: #667085;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.menu-item.active {
  color: var(--laranja);
}

.menu-item .icon {
  width: 24px;
  height: 24px;
  display: block;
  margin: 0 auto 2px;
}

.pedido-icon {
  position: relative;
}

.badge-menu {
  position: absolute;
  top: -7px;
  right: -10px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  display: grid;
  place-items: center;
}

/* FORM */

input,
select,
textarea {
  font-size: 16px;
}

button {
  font-family: inherit;
}

/* DARK */

body.dark {
  background: #000;
  color: #fff;
}

body.dark .app {
  background:
    radial-gradient(circle at top right, rgba(255, 91, 0, 0.10), transparent 28%),
    #000;
}

body.dark .cabecalho-pedidos,
body.dark .tabs,
body.dark .card-pedido,
body.dark .estado-vazio,
body.dark .msg-vazia,
body.dark .menu-bottom {
  background: #151518;
  border-color: #26262b;
}

body.dark .btn-voltar-pedidos,
body.dark .info-box,
body.dark .item-pedido,
body.dark .status-area,
body.dark .total-box {
  background: #1f1f23;
  border-color: #2a2a2f;
}

body.dark .cabecalho-pedidos h2,
body.dark .card-pedido h3,
body.dark .info-box strong,
body.dark .titulo-itens strong,
body.dark .item-pedido p,
body.dark .estado-vazio strong,
body.dark .total-box strong {
  color: #fff;
}

body.dark .btn-voltar-pedidos {
  color: #fff;
}

body.dark .info-box span,
body.dark .item-pedido small,
body.dark .status-texto,
body.dark .estado-vazio span,
body.dark .total-box span {
  color: #a1a1aa;
}

body.dark .detalhes-itens {
  border-color: #2a2a2f;
}

body.dark .tabs button {
  color: #d4d4d8;
}

body.dark .badge-tipo {
  background: rgba(255, 91, 0, 0.16);
  color: #ff7a1a;
}

/* DESKTOP */

@media (min-width: 768px) {
  body {
    background: #0b0b0c;
  }

  .app {
    max-width: 920px;
    padding: 18px 22px 90px;
  }

  #listaPedidos {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    align-items: start;
  }

  .card-pedido {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  .card-pedido:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.14);
  }

  .menu-bottom {
    max-width: 920px;
  }
}

@media (min-width: 1100px) {
  .app {
    max-width: 1120px;
  }

  #listaPedidos {
    grid-template-columns: repeat(3, 1fr);
  }

  .cabecalho-pedidos,
  .tabs {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 390px) {
  .app {
    padding-left: 9px;
    padding-right: 9px;
  }

  .pedido-info-grid {
    grid-template-columns: 1fr;
  }

  .acoes-pedido {
    grid-template-columns: 1fr;
  }

  .status-texto {
    font-size: 10px;
  }
}

/* =====================================================
   PEDIDOS - MODO CLARO VERMELHO / MODO ESCURO LARANJA
===================================================== */

/* MODO CLARO: trocar laranja por vermelho */
html:not(.dark) body .tabs button.ativo {
  background: var(--cor-primaria) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18) !important;
}

html:not(.dark) body .pedido-numero,
html:not(.dark) body .badge-tipo,
html:not(.dark) body .titulo-itens i,
html:not(.dark) body .estado-vazio i,
html:not(.dark) body .menu-item.active,
html:not(.dark) body .total-box strong {
  color: var(--cor-primaria) !important;
}

html:not(.dark) body .badge-tipo {
  background: #fff1f1 !important;
}

html:not(.dark) body .icone-painel {
  background: #fff1f1 !important;
  color: var(--cor-primaria) !important;
}

html:not(.dark) body .btn-concluir {
  background: var(--cor-primaria) !important;
  color: #fff !important;
}

html:not(.dark) body .btn-voltar-pedidos {
  color: #111827 !important;
}

html:not(.dark) body .badge-menu {
  background: #ef4444 !important;
}

/* Aviso de entrega no modo claro */
html:not(.dark) body .aviso-entrega {
  background: #fff1f1 !important;
  border-color: #fecaca !important;
  color: #b91c1c !important;
}

html:not(.dark) body .aviso-entrega .aviso-icone {
  background: #fee2e2 !important;
  color: var(--cor-primaria) !important;
}

/* MODO ESCURO: manter laranja */
html.dark body .tabs button.ativo,
body.dark .tabs button.ativo {
  background: var(--cor-primaria) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18) !important;
}

html.dark body .pedido-numero,
html.dark body .badge-tipo,
html.dark body .titulo-itens i,
html.dark body .estado-vazio i,
html.dark body .menu-item.active,
html.dark body .total-box strong,
body.dark .pedido-numero,
body.dark .badge-tipo,
body.dark .titulo-itens i,
body.dark .estado-vazio i,
body.dark .menu-item.active,
body.dark .total-box strong {
  color: var(--cor-primaria) !important;
}

html.dark body .badge-tipo,
body.dark .badge-tipo {
  background: rgba(255, 91, 0, 0.16) !important;
  color: var(--cor-primaria) !important;
}

html.dark body .icone-painel,
body.dark .icone-painel {
  background: rgba(255, 91, 0, 0.16) !important;
  color: var(--cor-primaria) !important;
}

html.dark body .btn-concluir,
body.dark .btn-concluir {
  background: var(--cor-primaria) !important;
  color: #fff !important;
}

html.dark body .aviso-entrega,
body.dark .aviso-entrega {
  background: rgba(255, 91, 0, 0.12) !important;
  border-color: rgba(255, 91, 0, 0.35) !important;
  color: #ffb27a !important;
}

html.dark body .aviso-entrega .aviso-icone,
body.dark .aviso-entrega .aviso-icone {
  background: rgba(255, 91, 0, 0.18) !important;
  color: var(--cor-primaria) !important;
}

html.dark body .historico-total,
body.dark .historico-total {
  color: #fff !important;
}

html.dark body .historico-itens-resumo,
body.dark .historico-itens-resumo {
  color: #9ca3af !important;
}

html.dark body .historico-data,
body.dark .historico-data {
  color: #9ca3af !important;
}

.card-pedido.pedido-cancelado {
  border: 1px solid #fecaca;
  background: linear-gradient(180deg, #fff5f5 0%, #ffffff 100%);
}

.card-pedido.pedido-cancelado .card-topo {
  border-bottom-color: #fecaca;
}

.card-pedido.pedido-cancelado .pedido-numero {
  color: #b91c1c;
}

.badge-cancelado {
  background: #fee2e2 !important;
  color: #b91c1c !important;
}

.aviso-cancelado {
  background: #fff1f2;
  border: 1px solid #fecaca;
}

.aviso-cancelado .aviso-icone {
  background: #fee2e2;
  color: #dc2626;
}

.aviso-cancelado strong {
  color: #b91c1c;
}

.btn-limpar-pedido {
  width: 100%;
  min-height: 46px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}
/* =====================================================
   HISTÓRICO — CARD COMPACTO
===================================================== */

.card-historico-compacto {
  transition: transform 0.15s, box-shadow 0.15s;
}

.card-historico-compacto:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0,0,0,0.10);
}

.card-historico-compacto .card-topo {
  align-items: flex-start;
}

.historico-itens-resumo {
  display: block;
  font-size: 12px;
  color: var(--texto-fraco);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.historico-lado-direito {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.historico-total {
  font-size: 16px;
  font-weight: 800;
  color: var(--texto);
}

.historico-data {
  font-size: 11px;
  color: var(--texto-fraco);
}

.badge-concluido {
  font-size: 11px;
  font-weight: 700;
  color: #16a34a;
  background: rgba(22,163,74,0.10);
  padding: 3px 8px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Prompt de login para histórico ─────────────── */
.historico-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 24px;
  gap: 14px;
}

.historico-prompt-icone {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(var(--cor-primaria), 0.08);
  background: #fff3ed;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: var(--cor-primaria);
  margin-bottom: 4px;
}

.historico-prompt strong {
  font-size: 18px;
  font-weight: 800;
  color: #111;
}

.historico-prompt p {
  font-size: 14px;
  color: #888;
  line-height: 1.6;
  max-width: 280px;
  margin: 0;
}

.historico-prompt-botoes {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 280px;
  margin-top: 8px;
}

.btn-prompt-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  border-radius: 14px;
  background: var(--cor-primaria);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

.btn-prompt-cadastro {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  border-radius: 14px;
  background: transparent;
  border: 2px solid var(--cor-primaria);
  color: var(--cor-primaria);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

html.dark .historico-prompt strong,
body.dark .historico-prompt strong {
  color: #fff;
}

html.dark .historico-prompt p,
body.dark .historico-prompt p {
  color: #666;
}

/* ── Etapas do pedido (linha do tempo) ──────────────────────── */
.etapas-pedido {
  display: grid;
  grid-template-columns: repeat(var(--total-etapas, 3), 1fr);
  list-style: none;
  margin: 0;
  padding: 0;
}

.etapa-pedido {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

/* linha ligando uma etapa à próxima */
.etapa-pedido:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 16px;
  left: calc(50% + 18px);
  right: calc(-50% + 18px);
  height: 3px;
  border-radius: 999px;
  background: #d8dee8;
}

.etapa-pedido.feita:not(:last-child)::after {
  background: #22c55e;
}

.etapa-pedido-icone {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: #e4e9f0;
  color: #98a2b3;
  transition: background 0.3s, color 0.3s;
}

.etapa-pedido.feita .etapa-pedido-icone {
  background: #22c55e;
  color: #fff;
}

.etapa-pedido.atual .etapa-pedido-icone {
  background: var(--laranja, #ff5b00);
  color: #fff;
  animation: etapa-pulso 1.8s ease-out infinite;
}

.etapa-pedido-nome {
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  color: #98a2b3;
}

.etapa-pedido.feita .etapa-pedido-nome {
  color: #16a34a;
}

.etapa-pedido.atual .etapa-pedido-nome {
  color: #111;
}

@keyframes etapa-pulso {
  0% { box-shadow: 0 0 0 0 rgba(255, 91, 0, 0.45); }
  100% { box-shadow: 0 0 0 10px rgba(255, 91, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .etapa-pedido.atual .etapa-pedido-icone { animation: none; }
}

body.dark .etapa-pedido-icone {
  background: #2a2a2f;
  color: #777;
}

body.dark .etapa-pedido:not(:last-child)::after {
  background: #2a2a2f;
}

body.dark .etapa-pedido.feita:not(:last-child)::after {
  background: #22c55e;
}

body.dark .etapa-pedido.atual .etapa-pedido-nome {
  color: #fff;
}

/* ── Botão "Pedir de novo" no histórico ─────────────────────── */
.btn-pedir-novamente {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
  padding: 10px 14px;
  border: 1.5px solid var(--laranja, #ff5b00);
  border-radius: 12px;
  background: transparent;
  color: var(--laranja, #ff5b00);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

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

/* ── Aviso de pedido aguardando pagamento ("Pagar agora") ── */
.aviso-pagamento-pendente {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  padding: 14px 16px;
  border: 1px solid #fde68a;
  border-radius: 16px;
  background: #fffbeb;
  color: #78350f;
}

.aviso-pagamento-pendente > i {
  flex-shrink: 0;
  font-size: 18px;
  color: #d97706;
}

.aviso-pagamento-pendente > div {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.aviso-pagamento-pendente strong { font-size: 14px; font-weight: 800; }
.aviso-pagamento-pendente small { font-size: 12px; color: #92400e; }

.aviso-pagamento-pendente a {
  flex-shrink: 0;
  padding: 9px 14px;
  border-radius: 12px;
  background: var(--cor-primaria, #ff5b00);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

body.dark .aviso-pagamento-pendente,
html.dark body .aviso-pagamento-pendente {
  background: #2a2110;
  border-color: #5c4513;
  color: #fde68a;
}

body.dark .aviso-pagamento-pendente small,
html.dark body .aviso-pagamento-pendente small { color: #fcd34d; }
