/* Acompanhamento de entrega — Unitrac. Mobile first. */

:root {
  --vermelho: #FF2D28;
  --magenta: #D9254C;
  --magenta-escuro: #B81D3F;
  --roxo: #7A11A8;
  --azul-violeta: #590BC7;
  --verde: #1E9E5A;
  --verde-fundo: #E8F6EE;
  --roxo-fundo: #F3E9F9;
  --texto: #111114;
  --texto-suave: #55565E;
  --borda: #E3E3E8;
  --fundo: #F6F6F8;
  --branco: #FFFFFF;
  --aviso-fundo: #FFF4E5;
  --aviso-texto: #7A4B00;
  --erro-fundo: #FDECEE;
  --erro-texto: #A3162F;
  --gradiente: linear-gradient(135deg, #FF2D28 0%, #D9254C 30%, #7A11A8 70%, #590BC7 100%);
  --raio: 16px;
  --sombra: 0 1px 2px rgba(17, 17, 20, .06), 0 4px 16px rgba(17, 17, 20, .06);
  --fonte: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--fonte);
  font-size: 16px;
  line-height: 1.5;
  color: var(--texto);
  background: var(--fundo);
}

[hidden] { display: none !important; }

.faixa-marca { height: 4px; background: var(--gradiente); }

.tela { max-width: 520px; margin: 0 auto; padding: 0 16px 40px; }

/* ---------- Logo ---------- */
.logo { width: 180px; max-width: 60vw; height: auto; display: block; margin: 28px auto 20px; }
.topo--compacto { display: flex; justify-content: center; border-bottom: 1px solid var(--borda); margin: 0 -16px 16px; background: var(--branco); }
.topo--compacto .logo { width: auto; height: 48px; margin: 12px 16px; }

/* ---------- Cartões ---------- */
.cartao {
  background: var(--branco);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  box-shadow: var(--sombra);
  padding: 20px;
}

h1 { font-size: 1.375rem; line-height: 1.25; margin: 0 0 6px; }
.apoio { color: var(--texto-suave); margin: 0 0 20px; }

/* ---------- Formulário ---------- */
.campo { margin-bottom: 16px; }
.campo label { display: block; font-weight: 600; margin-bottom: 6px; }
.campo input {
  width: 100%;
  font: inherit;
  font-size: 1.125rem;          /* >= 16px evita zoom automático no iOS */
  padding: 12px 14px;
  border: 1.5px solid #C9C9D1;
  border-radius: 10px;
  background: var(--branco);
  color: var(--texto);
}
.campo input:focus { outline: none; border-color: var(--roxo); box-shadow: 0 0 0 3px rgba(122, 17, 168, .2); }
.campo input[aria-invalid="true"] { border-color: var(--erro-texto); }

/* ---------- Botões ---------- */
.botao {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 20px;
  -webkit-tap-highlight-color: transparent;
}
.botao:focus-visible { outline: 3px solid var(--azul-violeta); outline-offset: 2px; }
.botao[disabled] { cursor: progress; opacity: .75; }

.botao-principal { width: 100%; color: var(--branco); background: var(--magenta); font-size: 1.0625rem; }
.botao-principal:hover { background: var(--magenta-escuro); }

.botao-secundario { color: var(--roxo); background: var(--branco); border: 1.5px solid var(--borda); }
.botao-secundario:hover { border-color: var(--roxo); }
.botao-pequeno { min-height: 40px; padding: 8px 14px; font-size: .9375rem; }

.botao-link {
  display: flex;
  margin: 24px auto 0;
  background: none;
  color: var(--magenta-escuro);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.carregando {
  display: none;
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255, 255, 255, .45);
  border-top-color: var(--branco);
  border-radius: 50%;
  animation: girar .8s linear infinite;
}
.botao.ocupado .carregando { display: inline-block; }
.botao-secundario.ocupado svg { animation: girar .8s linear infinite; }

@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Mensagens ---------- */
.mensagem { border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; font-size: .9375rem; }
.mensagem-erro { background: var(--erro-fundo); color: var(--erro-texto); }
.mensagem-aviso { background: var(--aviso-fundo); color: var(--aviso-texto); }

/* ---------- Tela de status ---------- */
.barra-status { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.atualizado { margin: 0; color: var(--texto-suave); font-size: .9375rem; }

.lista-entregas { display: grid; gap: 16px; }

.entrega { position: relative; overflow: hidden; }
.entrega::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; }
.entrega.pendente::before { background: var(--gradiente); }
.entrega.entregue::before { background: var(--verde); }

.entrega-cabecalho { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.selo {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 24px;
}
.entrega.entregue .selo {
  background-color: var(--verde-fundo);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231E9E5A' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
.entrega.pendente .selo {
  background-color: var(--roxo-fundo);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237A11A8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2'/%3E%3Cpath d='M15 18H9'/%3E%3Cpath d='M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.62l-3.48-4.35A1 1 0 0 0 17.52 8H14'/%3E%3Ccircle cx='17' cy='18' r='2'/%3E%3Ccircle cx='7' cy='18' r='2'/%3E%3C/svg%3E");
}
.entrega-titulo { font-size: 1.25rem; line-height: 1.25; margin: 0; }
.entrega.entregue .entrega-titulo { color: var(--verde); }
.entrega.pendente .entrega-titulo { color: var(--roxo); }

.entrega-data { margin: 0 0 12px; font-weight: 600; }

.estimativa { margin: 16px 0; padding: 16px; border-radius: 12px; background: var(--roxo-fundo); }
.estimativa-valores { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.estimativa-rotulo { display: block; font-size: .8125rem; color: var(--texto-suave); text-transform: uppercase; letter-spacing: .04em; }
.estimativa-valor { display: block; font-size: 1.75rem; font-weight: 700; line-height: 1.2; color: var(--texto); font-variant-numeric: tabular-nums; }
.estimativa-nota { margin: 12px 0 0; font-size: .8125rem; color: var(--texto-suave); }

.estimativa-indisponivel { margin: 16px 0; padding: 12px 14px; border-radius: 10px; background: var(--fundo); color: var(--texto-suave); }

.detalhes { margin: 12px 0 0; display: grid; gap: 10px; }
.detalhe { display: grid; gap: 2px; }
.detalhe dt { font-size: .8125rem; color: var(--texto-suave); }
.detalhe dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.valor-placa { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; letter-spacing: .06em; }

.posicao { margin: 14px 0 0; font-size: .8125rem; color: var(--texto-suave); }

/* ---------- Carregamento ---------- */
.esqueleto-cartao { height: 220px; background: linear-gradient(90deg, #fff 0%, #f0f0f3 50%, #fff 100%); background-size: 200% 100%; animation: brilho 1.4s ease-in-out infinite; }
@keyframes brilho { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (min-width: 600px) {
  .tela { padding-left: 24px; padding-right: 24px; }
  .logo { width: 240px; margin-top: 48px; }
  .topo--compacto { margin: 0 -24px 24px; }
  .cartao { padding: 28px; }
  .detalhes { grid-template-columns: 1fr 1fr; }
  .detalhe-endereco { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
