/* Tela de autenticação (leitor de QR): fundo roxo, caixa preta com cantos verdes e modal de instruções. */

:root {
  --auth-roxo-esq: #49029b;
  --auth-roxo-dir: #6c00cf;
  --auth-verde: #3fa94d; /* cantos do leitor */
  --auth-verde-texto: #7cf4a0;
  --auth-botao-verde-esq: #00b83a;
  --auth-botao-verde-dir: #00e664;
  --auth-lilas: #f4ecf8;
  --auth-escurecer-modal: rgba(0, 0, 0, 0.52);
}

.auth-screen {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.3;
  /* degradê horizontal roxo + leve escurecimento embaixo */
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.14) 100%),
    linear-gradient(90deg, var(--auth-roxo-esq), var(--auth-roxo-dir));
}

.auth-col {
  width: 100%;
  max-width: 420px;
  min-height: 100%;
  padding: 4px 12px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-logo {
  height: 58px;
  width: auto;
  display: block;
}

/* ---- caixa do leitor ---- */
.scanner {
  position: relative;
  width: 100%;
  aspect-ratio: 347 / 267;
  margin-top: 26px;
  background: #000;
  border: 1px solid #8f86c4;
  border-radius: 14px;
  overflow: hidden;
}

.scanner-rotulo {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--auth-verde-texto);
  font-size: 22px;
  font-weight: 700;
}

/* O leitor (html5-qrcode) injeta um <video>; os !important vencem os estilos que ele coloca inline. */
#leitor {
  position: absolute !important;
  inset: 0;
  z-index: 1;
  border: 0 !important;
  padding: 0 !important;
}

#leitor > div,
#leitor video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

/* Quatro cantos verdes desenhados por cima do vídeo */
.canto {
  position: absolute;
  z-index: 2;
  width: 46px;
  height: 46px;
  border: 0 solid var(--auth-verde);
  pointer-events: none;
}

.canto.se { top: 3.4%; left: 14%; border-width: 2px 0 0 2px; border-top-left-radius: 14px; }
.canto.sd { top: 3.4%; right: 14%; border-width: 2px 2px 0 0; border-top-right-radius: 14px; }
.canto.ie { bottom: 3.4%; left: 14%; border-width: 0 0 2px 2px; border-bottom-left-radius: 14px; }
.canto.id { bottom: 3.4%; right: 14%; border-width: 0 2px 2px 0; border-bottom-right-radius: 14px; }

.barra {
  width: calc(100% - 14px);
  height: 16px;
  margin-top: 24px;
  background: #fff;
  border-radius: 8px;
}

/* ---- textos de orientação (os dois ocupam o mesmo lugar; o estado escolhe qual aparece) ---- */
.dicas {
  display: grid;
  margin-top: 46px;
  width: 100%;
}

.dica {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  text-align: center;
  font-size: 19px;
  font-weight: 700;
}

.dica p { margin: 0; }

.icone-info {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: #fff;
  color: #6b00b6;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 700;
}

.auth-screen[data-estado="aguardando"] .dica-lendo,
.auth-screen[data-estado="lendo"] .dica-aguardando {
  visibility: hidden;
}

.auth-screen[data-estado="aguardando"] .dica-aguardando {
  padding-top: 70px; /* sem o ícone, o texto fica na altura em que aparece atrás do modal */
}

.mensagem {
  min-height: 22px;
  margin-top: 16px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
}

.mensagem.sucesso { color: var(--auth-verde-texto); }
.mensagem.erro { color: #ffb4ab; }

.btn-parar {
  width: calc(100% - 14px);
  height: 50px;
  margin-top: auto; /* empurra o botão para o rodapé */
  border: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--auth-botao-verde-esq), var(--auth-botao-verde-dir));
  color: #fff;
  font: inherit;
  font-size: 20px;
  cursor: pointer;
}

.auth-screen[data-estado="aguardando"] .btn-parar { visibility: hidden; }

/* ---- modal de instruções ---- */
.modal-fundo {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  justify-content: center;
  align-items: flex-start;
  padding: 100px 4px 24px;
  overflow-y: auto;
  background: var(--auth-escurecer-modal);
}

.auth-screen[data-estado="aguardando"] .modal-fundo { display: flex; }

.modal {
  width: 100%;
  max-width: 420px;
  padding: 28px 26px 26px;
  background: #fff;
  color: #000;
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.passo {
  display: grid;
  grid-template-columns: 26px 1fr;
  column-gap: 12px;
  margin-bottom: 24px;
}

.passo-numero {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #7a3cf2, #c000f7);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.passo h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #000;
}

.passo p {
  margin: 2px 0 0;
  font-size: 16px;
  color: #444;
}

.passo svg {
  display: block;
  width: 62px;
  height: 62px;
  margin-top: 10px;
  fill: #d0d0d0;
}

.modal .mensagem { margin: 0 0 10px; min-height: 0; font-size: 14px; }
.modal .mensagem.erro { color: #c62828; }

.btn-autenticar {
  display: block;
  width: 80%;
  height: 50px;
  margin: 0 auto;
  border: 0;
  border-radius: 25px;
  background: linear-gradient(90deg, #5451f5 0%, #8a00f5 55%, #c000f7 100%);
  color: #fff;
  font-family: Arial, Helvetica, sans-serif; /* igual nas duas telas (a página do produto usa outra fonte) */
  font-size: 18px;
  cursor: pointer;
}

.btn-autenticar:disabled { opacity: 0.6; cursor: wait; }

.btn-parar:focus-visible,
.btn-autenticar:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
