/* Visual do carrinho (carrinho.html) e dos pedidos (pedidos.html).
   Usa as cores e os cantos do estilo.css (variáveis do :root), então funciona nos 2 temas. */

/* cores só destas páginas (amarelo de alerta e verde, que mudam com o tema) */
:root { --alerta: #fbbf24; --alerta-fundo: rgba(251,191,36,.12); --verde: #4ade80; --verde-fundo: rgba(34,197,94,.12); --vermelho-fundo: rgba(239,68,68,.12); }
:root[data-tema="claro"] { --alerta: #a15c07; --alerta-fundo: rgba(245,158,11,.14); --verde: #15803d; --verde-fundo: rgba(34,197,94,.14); --vermelho-fundo: rgba(239,68,68,.1); }

/* só para leitor de tela */
.so-leitor { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* foco visível no teclado em tudo que dá para clicar */
.compras :is(a, button):focus-visible { outline: 3px solid var(--azul); outline-offset: 3px; }

.compras { max-width: 1180px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 40px) 64px; min-height: calc(100vh - 150px); min-height: calc(100dvh - 150px); }
.compras-titulo { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 22px; }
.compras-titulo h1 { margin: 0; font-size: clamp(28px, 4vw, 40px); font-weight: 800; letter-spacing: -.02em; }
.compras-titulo h1:focus { outline: none; }
.compras-titulo .contador { color: var(--texto-3); font-size: 16px; font-weight: 600; }

/* "Carregando..." */
.carregando { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 70px 20px; color: var(--texto-2); font-weight: 600; }
.girando { display: inline-block; flex: none; width: 20px; height: 20px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: girar .7s linear infinite; }
.botao-grande .girando { width: 16px; height: 16px; }

/* caixas (cartões) */
.caixa { background: var(--cartao); border: 1px solid var(--borda); border-radius: var(--raio-gg); padding: 24px; }
.caixa h2 { margin: 0 0 16px; font-size: 19px; }
.caixa h2:focus { outline: none; }
.caixa .explica { margin: -8px 0 20px; color: var(--texto-2); font-size: 14px; line-height: 1.5; }

/* ---------- carrinho ---------- */
.compra-grade { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 24px; align-items: start; }
.coluna { display: grid; gap: 24px; min-width: 0; }

.aviso ul { margin: 0; padding-left: 18px; }
.aviso li + li { margin-top: 4px; }

.itens { list-style: none; margin: 0; padding: 0; }
.item { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 18px 0; border-top: 1px solid var(--linha); }
.item:first-child { border-top: 0; padding-top: 2px; }
.item:last-child { padding-bottom: 0; }
.item-foto { width: 92px; aspect-ratio: 1; flex: none; display: grid; place-items: center; overflow: hidden; background: #fff; border-radius: var(--raio); font-size: 30px; }
.item-foto img { width: 100%; height: 100%; object-fit: contain; }
.item-nome { margin: 2px 0 6px; font-size: 14px; font-weight: 700; line-height: 1.35; text-transform: uppercase; overflow-wrap: anywhere; }
.item-preco { margin: 0; color: var(--texto-2); font-size: 13px; }
.item-preco span { color: var(--azul); font-weight: 700; }
.item-lado { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; text-align: right; }
.item-subtotal { font-size: 17px; font-weight: 800; white-space: nowrap; }
.item.indisponivel .item-foto { opacity: .45; filter: grayscale(1); }
.item.indisponivel .item-nome { color: var(--texto-3); }

.etiquetas { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.etiqueta { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.3; }
.etiqueta.erro { background: var(--vermelho-fundo); color: var(--erro); }
.etiqueta.alerta { background: var(--alerta-fundo); color: var(--alerta); }

/* quantidade: − 2 + */
.qtd-controle { display: inline-flex; align-items: center; border: 1.5px solid var(--borda-2); border-radius: 999px; padding: 2px; }
.qtd-controle button { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--texto); font: inherit; font-size: 20px; font-weight: 700; line-height: 1; cursor: pointer; transition: background-color .2s, color .2s; }
.qtd-controle button:hover:not(:disabled) { background: var(--hover); color: var(--azul); }
.qtd-controle button:disabled { opacity: .3; cursor: not-allowed; }
.qtd-numero { min-width: 30px; text-align: center; font-weight: 800; }
.tirar { display: inline-flex; align-items: center; gap: 6px; padding: 6px 4px; border: 0; background: none; color: var(--texto-3); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; border-radius: var(--raio-p); transition: color .2s; }
.tirar:hover { color: var(--erro); }

/* formulário do pedido */
.campos-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.campo textarea { width: 100%; min-height: 90px; padding: 13px 16px; border: 1.5px solid var(--borda-2); border-radius: var(--raio); background: var(--fundo); color: var(--texto); font: inherit; font-size: 16px; line-height: 1.45; resize: vertical; outline: 0; transition: border-color .2s, box-shadow .2s; }
.campo textarea::placeholder { color: var(--texto-4); }
.campo textarea:focus { border-color: var(--azul); box-shadow: 0 0 0 4px var(--sombra-azul); }
.campo .opcional { color: var(--texto-3); font-weight: 500; }
.dica-campo { color: var(--texto-3); font-size: 12px; }
.conta-letras { text-align: right; }
.campo-cep input { max-width: 220px; }

.grupo { margin: 4px 0 16px; padding: 0; border: 0; min-width: 0; }
.grupo legend { padding: 0; margin-bottom: 10px; font-size: 13px; font-weight: 700; }
.opcoes { display: grid; gap: 10px; }
.opcao { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border: 1.5px solid var(--borda-2); border-radius: var(--raio); cursor: pointer; transition: border-color .2s, background-color .2s, box-shadow .2s; }
.opcao:hover { border-color: var(--azul); }
.opcao input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--azul); cursor: pointer; }
.opcao input:focus { outline: none; }
.opcao span { display: grid; gap: 3px; min-width: 0; }
.opcao strong { font-size: 15px; }
.opcao small { color: var(--texto-2); font-size: 13px; line-height: 1.4; }
.opcao:has(input:checked) { border-color: var(--azul); background: var(--hover); box-shadow: inset 0 0 0 1px var(--azul); }
.opcao:has(input:focus-visible) { outline: 3px solid var(--azul); outline-offset: 2px; }
.selo-pix { margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--verde-fundo); color: var(--verde); font-size: 11px; font-style: normal; font-weight: 800; vertical-align: 1px; }
.opcao b { color: var(--azul); }

.loja-info { display: grid; gap: 6px; margin: -4px 0 18px; padding: 14px 16px; border-radius: var(--raio); background: var(--fundo); border: 1px dashed var(--borda-2); font-size: 14px; line-height: 1.45; }
.loja-info p { display: flex; gap: 8px; margin: 0; }
.nota { margin: -4px 0 18px; color: var(--texto-2); font-size: 13px; line-height: 1.45; }

/* resumo (fica parado do lado enquanto a página desce) */
.resumo { position: sticky; top: 100px; }
.contas { display: grid; gap: 10px; margin: 0; }
.contas > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.contas dt { color: var(--texto-2); font-size: 14px; }
.contas dt small { font-size: 12px; }
.contas dd { margin: 0; font-weight: 800; text-align: right; white-space: nowrap; }
.feito-resumo .contas dd, .pedido-detalhes dd { white-space: normal; }
.resumo .contas dd { font-size: 18px; }
.resumo .no-pix dt { color: var(--texto); font-weight: 700; }
.resumo .no-pix dd { color: var(--azul); font-size: 24px; }
.economia { margin: 10px 0 0; color: var(--verde); font-size: 13px; font-weight: 700; }
.economia:empty { display: none; }
.finalizar { display: grid; gap: 10px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--linha); }
.resumo .aviso { margin: 16px 0 0; }
.botao-enviar.zap { background: #15803d; color: #fff; }
.botao-enviar.zap:hover { background: #166534; box-shadow: 0 10px 24px rgba(21,128,61,.35); }
.botao-enviar[aria-disabled="true"], .botao-enviar:disabled:not([hidden]) { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.explica-final { margin: 0; color: var(--texto-3); font-size: 13px; line-height: 1.45; text-align: center; }
.explica-final:empty { display: none; }
.continuar { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; padding: 8px; color: var(--azul); font-size: 14px; font-weight: 700; border-radius: 999px; }
.continuar:hover { text-decoration: underline; }

/* pedido feito */
.feito { max-width: 620px; margin: 0 auto; text-align: center; animation: painel-entra .5s cubic-bezier(.2,.7,.2,1); }
.feito-icone { width: 84px; height: 84px; margin: 6px auto 18px; display: grid; place-items: center; border-radius: 50%; background: var(--verde-fundo); color: var(--verde); box-shadow: 0 0 0 8px var(--verde-fundo); }
.feito h1 { margin: 0 0 8px; font-size: clamp(28px, 5vw, 40px); font-weight: 800; letter-spacing: -.02em; }
.feito h1:focus { outline: none; }
.feito-texto { margin: 0 0 22px; color: var(--texto-2); font-size: 16px; }
.feito-resumo { text-align: left; margin-bottom: 18px; }
.feito-itens { list-style: none; margin: 0 0 16px; padding: 0 0 16px; border-bottom: 1px solid var(--linha); display: grid; gap: 8px; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.feito-qtd { color: var(--azul); font-weight: 800; }
.proximo-passo { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 18px; padding: 14px 16px; text-align: left; border-radius: var(--raio); background: var(--verde-fundo); border: 1px solid rgba(34,197,94,.35); font-size: 15px; line-height: 1.45; }
.proximo-passo p { margin: 0; }
.ver-pedidos { display: inline-block; margin-top: 16px; padding: 6px 10px; border-radius: 999px; }

/* ---------- meus pedidos ---------- */
.pedidos { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; }
.pedido { scroll-margin-top: 100px; transition: box-shadow .3s, border-color .3s; }
.pedido:focus { outline: none; }
.pedido.destacado { border-color: var(--azul); box-shadow: 0 0 0 3px var(--azul), 0 18px 40px var(--sombra-azul); animation: piscar-pedido 1.4s ease 2; }
@keyframes piscar-pedido { 50% { box-shadow: 0 0 0 6px var(--sombra-azul), 0 18px 40px var(--sombra-azul); } }
.pedido-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.pedido-topo h2 { margin: 0 0 4px; font-size: 20px; }
.pedido-data { margin: 0; color: var(--texto-3); font-size: 13px; }

.status { flex: none; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 800; background: var(--hover); color: var(--azul); }
.status-pago, .status-entregue { background: var(--verde-fundo); color: var(--verde); }
.status-separando { background: var(--alerta-fundo); color: var(--alerta); }
.status-cancelado { background: var(--vermelho-fundo); color: var(--erro); }

/* linha do tempo: Recebido → Pago → Separando → Enviado → Entregue */
.linha-tempo { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.linha-tempo li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--texto-3); font-size: 12px; font-weight: 600; }
.linha-tempo li::before { content: ""; position: absolute; top: 8px; right: 50%; width: 100%; height: 3px; background: var(--borda-2); border-radius: 3px; }
.linha-tempo li:first-child::before { display: none; }
.linha-tempo .ponto { position: relative; z-index: 1; width: 19px; height: 19px; border-radius: 50%; background: var(--cartao); border: 3px solid var(--borda-2); }
.linha-tempo li.passou, .linha-tempo li.atual { color: var(--texto); }
.linha-tempo li.passou::before, .linha-tempo li.atual::before { background: var(--azul); }
.linha-tempo li.passou .ponto { background: var(--azul); border-color: var(--azul); }
.linha-tempo li.atual .ponto { border-color: var(--azul); box-shadow: 0 0 0 5px var(--sombra-azul); }
.linha-tempo li.atual { font-weight: 800; color: var(--azul); }
.passo { overflow-wrap: anywhere; }
.cancelado-faixa { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 10px 14px; border-radius: var(--raio); background: var(--vermelho-fundo); color: var(--erro); font-weight: 800; }
.pedido-frase { margin: 0 0 18px; color: var(--texto-2); font-size: 14px; line-height: 1.5; }
.pedido.cancelado .ped-itens { opacity: .7; }

.rastreio { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 18px; padding: 12px 14px; border-radius: var(--raio); background: var(--fundo); border: 1px solid var(--borda); }
.rastreio-rotulo { width: 100%; color: var(--texto-3); font-size: 12px; font-weight: 700; }
.rastreio-codigo { font-family: Consolas, "Courier New", monospace; font-size: 16px; font-weight: 700; letter-spacing: .06em; overflow-wrap: anywhere; }
.botao-pequeno { padding: 6px 14px; border: 1.5px solid var(--borda-2); border-radius: 999px; background: none; color: var(--texto); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: border-color .2s, color .2s; }
.botao-pequeno:hover { border-color: var(--azul); color: var(--azul); }

.ped-itens { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 12px; }
.ped-item { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.ped-item .item-foto { width: 56px; font-size: 22px; border-radius: var(--raio-p); }
.ped-item-nome { margin: 0 0 3px; font-size: 13px; font-weight: 700; line-height: 1.35; text-transform: uppercase; overflow-wrap: anywhere; }
.ped-item-preco { margin: 0; color: var(--texto-3); font-size: 13px; }
.ped-item-total { font-size: 14px; white-space: nowrap; }

.pedido-baixo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 260px); gap: 18px 28px; padding-top: 16px; border-top: 1px solid var(--linha); margin-bottom: 18px; }
.pedido-detalhes { display: grid; gap: 12px; margin: 0; font-size: 14px; line-height: 1.45; }
.pedido-detalhes dt { color: var(--texto-3); font-size: 12px; font-weight: 700; }
.pedido-detalhes dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.pedido-detalhes small { display: block; color: var(--texto-3); font-size: 12px; }
.pedido-contas { align-content: start; }
.pedido-contas .desconto dd { color: var(--verde); }
.pedido-contas .total dt { color: var(--texto); font-weight: 800; }
.pedido-contas .total dd { color: var(--azul); font-size: 22px; }

.acoes-pedido { display: flex; flex-wrap: wrap; gap: 10px; }
.acoes-pedido .botao-grande { padding: 11px 22px; }
.botao-grande.perigo { color: var(--erro); border-color: rgba(239,68,68,.45); }
.botao-grande.perigo:hover { color: #fff; background: #dc2626; border-color: #dc2626; box-shadow: 0 10px 24px rgba(220,38,38,.3); }
.botao-grande:disabled { opacity: .6; cursor: wait; transform: none; box-shadow: none; }
.confirmar { padding: 14px 16px; border-radius: var(--raio); background: var(--vermelho-fundo); border: 1px solid rgba(239,68,68,.35); }
.confirmar p { margin: 0 0 12px; font-weight: 700; }
.pedido .aviso { margin-bottom: 14px; }
.pedidos-pagina > .aviso { margin-bottom: 18px; }

/* ---------- telas menores ---------- */
@media (max-width: 960px) {
  .compra-grade { grid-template-columns: minmax(0, 1fr); }
  .resumo { position: static; }
}
@media (max-width: 640px) {
  .compras { padding-top: 22px; }
  .caixa { padding: 18px 16px; border-radius: var(--raio-g); }
  .item { grid-template-columns: 72px minmax(0, 1fr); gap: 12px; }
  .item-foto { width: 72px; }
  /* quantidade, subtotal e remover vão para uma linha embaixo */
  .item-lado { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; text-align: left; }
  .item-lado .tirar { order: 3; }
  .item-subtotal { order: 2; margin-left: auto; }
  .campos-2 { grid-template-columns: minmax(0, 1fr); }
  .pedido-baixo { grid-template-columns: minmax(0, 1fr); }
  .pedido-topo { flex-wrap: wrap; }
  .acoes-pedido .botao-grande { flex: 1 1 auto; }
}
/* celular bem estreito: a linha do tempo fica em pé */
@media (max-width: 440px) {
  .linha-tempo { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .linha-tempo li { flex-direction: row; text-align: left; gap: 12px; font-size: 13px; }
  .linha-tempo li::before { top: auto; bottom: 50%; right: auto; left: 8px; width: 3px; height: calc(100% + 10px); }
  .linha-tempo .ponto { width: 19px; }
  .item-lado .tirar { order: 1; }
  .item-subtotal { order: 2; width: 100%; text-align: right; }
  .resumo .no-pix dd { font-size: 20px; }
  .compras .botao-enviar { height: auto; min-height: 52px; padding: 10px 16px; font-size: 13px; letter-spacing: 0; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  .feito, .pedido.destacado, .girando { animation: none; }
  .girando { border-right-color: currentColor; opacity: .6; }
}
