/* ============================================================
   Pira Vivo — Doe sua Nota Fiscal
   Paleta extraída do site oficial: roxo-vinho + gradiente magenta/laranja
   ============================================================ */

:root {
  --roxo-fundo: #642665;
  --roxo-escuro: #461149;
  --roxo-claro: #7d3a7e;
  --magenta: #e2085d;
  --laranja: #fd7124;
  --gradiente-marca: linear-gradient(135deg, var(--magenta) 0%, var(--laranja) 100%);
  --creme: #fbf2f5;
  --branco: #ffffff;
  --texto-claro: rgba(255, 255, 255, 0.86);
  --texto-claro-fraco: rgba(255, 255, 255, 0.6);
  --sombra-card: 0 24px 60px -20px rgba(34, 8, 36, 0.55);
  --raio: 22px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--roxo-fundo);
  color: var(--texto-claro);
  font-family: 'Work Sans', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

body {
  background-image:
    radial-gradient(circle at 12% -10%, rgba(253, 113, 36, 0.18), transparent 45%),
    radial-gradient(circle at 110% 30%, rgba(226, 8, 93, 0.22), transparent 50%);
  background-attachment: fixed;
}

h1, h2, h3, .titulo-display {
  font-family: 'Baloo 2', 'Work Sans', sans-serif;
  font-weight: 700;
  line-height: 1.15;
  margin: 0;
}

a { color: inherit; }

.faixa-topo {
  height: 6px;
  background: var(--gradiente-marca);
  width: 100%;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

/* ---------- Cabeçalho ---------- */

.cabecalho {
  text-align: center;
  margin-bottom: 28px;
}

.cabecalho .selo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--texto-claro-fraco);
  margin-bottom: 18px;
}

.cabecalho .selo strong {
  background: var(--gradiente-marca);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.cabecalho h1 {
  font-size: 30px;
  color: var(--branco);
  margin-bottom: 10px;
}

.cabecalho p {
  font-size: 15px;
  color: var(--texto-claro-fraco);
  margin: 0;
  line-height: 1.5;
}

/* ---------- Card principal ---------- */

.card {
  background: var(--creme);
  color: #2b142c;
  border-radius: var(--raio);
  padding: 26px 22px;
  box-shadow: var(--sombra-card);
}

.card + .card { margin-top: 16px; }

.passo-rotulo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--magenta);
  margin-bottom: 14px;
}

.passo-rotulo .numero {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gradiente-marca);
  color: var(--branco);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

/* ---------- Zona de upload ---------- */

.zona-upload {
  border: 2px dashed rgba(98, 38, 101, 0.3);
  border-radius: 16px;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: rgba(98, 38, 101, 0.03);
}

.zona-upload.arrastando,
.zona-upload:hover {
  border-color: var(--magenta);
  background: rgba(226, 8, 93, 0.05);
}

.zona-upload .icone {
  font-size: 34px;
  margin-bottom: 8px;
  display: block;
}

.zona-upload .principal {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}

.zona-upload .secundario {
  font-size: 13px;
  color: #7a5f7b;
}

.zona-upload input[type="file"] { display: none; }

.preview-arquivo {
  display: none;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--branco);
  border-radius: 12px;
  border: 1px solid rgba(98, 38, 101, 0.12);
}

.preview-arquivo.visivel { display: flex; }

.preview-arquivo img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.preview-arquivo .placeholder-pdf {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--gradiente-marca);
  color: var(--branco);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.preview-arquivo .info { flex: 1; min-width: 0; }
.preview-arquivo .nome { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-arquivo .tamanho { font-size: 12px; color: #7a5f7b; }

.preview-arquivo .remover {
  background: none;
  border: none;
  color: #b14a51;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
}

/* ---------- Identificação opcional ---------- */

.alternar-identificacao {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  padding: 4px 2px;
}

.alternar-identificacao .texto { font-size: 14px; font-weight: 600; }
.alternar-identificacao .texto small {
  display: block;
  font-weight: 400;
  font-size: 12.5px;
  color: #7a5f7b;
  margin-top: 2px;
}

.chave {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.chave input { opacity: 0; width: 0; height: 0; }

.chave .trilho {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #d8c9d9;
  border-radius: 999px;
  transition: 0.2s;
}

.chave .trilho::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: var(--branco);
  border-radius: 50%;
  transition: 0.2s;
}

.chave input:checked + .trilho { background: var(--magenta); }
.chave input:checked + .trilho::before { transform: translateX(20px); }

.campos-identificacao {
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.campos-identificacao.visivel { display: flex; }

.campo {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.campo label { font-size: 12.5px; font-weight: 600; color: #5b3a5c; }

.campo input {
  border: 1px solid rgba(98, 38, 101, 0.18);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 14.5px;
  font-family: inherit;
  background: var(--branco);
  color: #2b142c;
}

.campo input:focus {
  outline: none;
  border-color: var(--magenta);
  box-shadow: 0 0 0 3px rgba(226, 8, 93, 0.12);
}

/* ---------- Botões ---------- */

.botao {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 15px 18px;
  font-size: 15.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
}

.botao:active { transform: scale(0.98); }
.botao:disabled { opacity: 0.55; cursor: not-allowed; }

.botao-primario {
  background: var(--gradiente-marca);
  color: var(--branco);
  margin-top: 22px;
  box-shadow: 0 10px 24px -8px rgba(226, 8, 93, 0.55);
}

.botao-secundario {
  background: var(--branco);
  color: var(--roxo-fundo);
  border: 1px solid rgba(98, 38, 101, 0.18);
}

.botao-fantasma {
  background: transparent;
  color: var(--texto-claro);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 11px 16px;
  font-size: 13.5px;
}

/* ---------- Tela de sucesso ---------- */

.tela-sucesso { display: none; text-align: center; }
.tela-sucesso.visivel { display: block; }

.selo-protocolo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--gradiente-marca);
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  color: var(--branco);
  box-shadow: 0 14px 30px -10px rgba(226, 8, 93, 0.6);
}

.tela-sucesso h2 { font-size: 22px; color: var(--roxo-fundo); margin-bottom: 6px; }
.tela-sucesso p { font-size: 14px; color: #6b4d6c; margin: 0 0 18px; line-height: 1.5; }

.caixa-protocolo {
  background: var(--roxo-fundo);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 18px;
}

.caixa-protocolo .rotulo {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--texto-claro-fraco);
  margin-bottom: 4px;
}

.caixa-protocolo .codigo {
  font-family: 'Baloo 2', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--branco);
  letter-spacing: 0.03em;
}

/* ---------- Notificações ---------- */

.bloco-notificacao {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(98, 38, 101, 0.05);
  border: 1px solid rgba(98, 38, 101, 0.14);
  border-radius: 16px;
  padding: 16px;
  margin-top: 18px;
}

.bloco-notificacao .emoji { font-size: 22px; line-height: 1; }
.bloco-notificacao .texto { flex: 1; }
.bloco-notificacao .texto strong { display: block; font-size: 14px; color: #2b142c; margin-bottom: 3px; }
.bloco-notificacao .texto p { font-size: 13px; color: #6b4d6c; margin: 0 0 10px; line-height: 1.45; }

.aviso-ios {
  font-size: 12px;
  color: #7a5230;
  background: rgba(253, 113, 36, 0.1);
  border: 1px solid rgba(253, 113, 36, 0.3);
  border-radius: 10px;
  padding: 8px 10px;
  margin-top: 8px;
  display: none;
}

.aviso-ios.visivel { display: block; }

/* ---------- Consulta de protocolo ---------- */

.consulta-protocolo {
  margin-top: 18px;
  text-align: center;
}

.consulta-protocolo button {
  background: none;
  border: none;
  color: var(--texto-claro-fraco);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
}

/* ---------- Rodapé ---------- */

.rodape {
  text-align: center;
  margin-top: 28px;
  font-size: 12px;
  color: var(--texto-claro-fraco);
  line-height: 1.6;
}

/* ---------- Mensagens de erro ---------- */

.mensagem-erro {
  display: none;
  background: rgba(177, 74, 81, 0.12);
  border: 1px solid rgba(177, 74, 81, 0.3);
  color: #8a2e34;
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 13.5px;
  margin-top: 14px;
}

.mensagem-erro.visivel { display: block; }

/* ---------- Loading ---------- */

.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: var(--branco);
  border-radius: 50%;
  animation: girar 0.7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  .botao, .zona-upload, .chave .trilho, .chave .trilho::before { transition: none; }
}
