/* Telas de acesso (entrar, criar conta, recuperar senha).
   1. Ilustração animada do que o app faz: mapa com ruas, veículo seguindo a
      rota, cerca virtual, ignição, velocidade e o aviso de chegada.
      Só transform e opacity; pausa com a aba oculta e respeita movimento
      reduzido (fica parada na cena final).
   2. Organização do formulário: escolha do painel (Pessoal / Empresa),
      espaçamento uniforme, estados de erro e o passo de verificação em
      duas etapas.
   Carregado por último, depois de style.css, theme-home.css e public-mobile.css. */

/* ---------- 1. Ilustração ---------- */
.route-demo {
  --rd-t: 10s;
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  aspect-ratio: 16 / 9;
  margin-top: clamp(18px, 3vh, 30px);
  overflow: hidden;
  border: 1px solid #ffffff24;
  border-radius: 18px;
  background: #0d1218;
  box-shadow:
    0 24px 60px #0000006b,
    inset 0 1px 0 #ffffff14;
  color: #fff;
  font-size: 12px;
  line-height: 1.2;
  contain: layout paint;
}
.route-demo svg.rd-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.rd-car {
  animation: rd-drive var(--rd-t) infinite;
}
.rd-pulse {
  transform-box: fill-box;
  transform-origin: center;
  animation: rd-pulse 2.4s ease-out infinite;
}
.rd-hit {
  opacity: 0;
  animation: rd-hit var(--rd-t) infinite;
}
.rd-chip,
.rd-toast {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #ffffff21;
  background: #0a0e13d9;
  box-shadow: 0 8px 22px #0006;
  white-space: nowrap;
}
.rd-chip {
  top: 12px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  font-weight: 700;
}
.rd-ign {
  left: 12px;
}
.rd-ign i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px #22c55e33;
  animation: rd-blink 1.6s ease-in-out infinite;
}
.rd-speed {
  right: 12px;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}
.rd-speed small {
  color: #aab3bf;
  font-size: 11px;
  font-weight: 600;
}
.rd-digits {
  height: 1.2em;
  overflow: hidden;
  font-size: 15px;
  font-weight: 800;
}
.rd-digits span {
  display: flex;
  flex-direction: column;
  text-align: right;
  animation: rd-speed var(--rd-t) step-end infinite;
}
.rd-digits b {
  height: 1.2em;
  font-weight: inherit;
}
.rd-toast {
  left: 50%;
  bottom: 12px;
  padding: 8px 12px 8px 9px;
  border-radius: 12px;
  opacity: 0;
  transform: translate(-50%, 10px);
  animation: rd-toast var(--rd-t) infinite;
}
.rd-toast svg {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
}
.rd-toast span {
  display: grid;
  gap: 2px;
}
.rd-toast b {
  font-size: 12.5px;
}
.rd-toast small {
  color: #aab3bf;
  font-size: 11px;
}

/* Rota: (60,215) → (60,120) → (250,120) → (250,190) → (430,190).
   O tempo de cada trecho é proporcional ao comprimento; desacelera nas curvas. */
@keyframes rd-drive {
  0% {
    transform: translate(60px, 215px);
    opacity: 0;
    animation-timing-function: ease-out;
  }
  3% {
    transform: translate(60px, 215px);
    opacity: 1;
    animation-timing-function: ease-in-out;
  }
  14.9% {
    transform: translate(60px, 120px);
    animation-timing-function: ease-in-out;
  }
  38.7% {
    transform: translate(250px, 120px);
    animation-timing-function: ease-in-out;
  }
  47.5% {
    transform: translate(250px, 190px);
    animation-timing-function: ease-in-out;
  }
  70%,
  92% {
    transform: translate(430px, 190px);
    opacity: 1;
  }
  97%,
  100% {
    transform: translate(430px, 190px);
    opacity: 0;
  }
}
@keyframes rd-speed {
  0% {
    transform: translateY(0);
  }
  5% {
    transform: translateY(-1.2em);
  }
  18% {
    transform: translateY(-2.4em);
  }
  41% {
    transform: translateY(-3.6em);
  }
  50% {
    transform: translateY(-4.8em);
  }
  68% {
    transform: translateY(-6em);
  }
}
@keyframes rd-toast {
  0%,
  70% {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
  73%,
  92% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  97%,
  100% {
    opacity: 0;
    transform: translate(-50%, 0);
  }
}
@keyframes rd-hit {
  0%,
  66% {
    opacity: 0;
  }
  71%,
  92% {
    opacity: 1;
  }
  98%,
  100% {
    opacity: 0;
  }
}
@keyframes rd-pulse {
  0% {
    transform: scale(0.7);
    opacity: 0.85;
  }
  100% {
    transform: scale(1.55);
    opacity: 0;
  }
}
@keyframes rd-blink {
  50% {
    opacity: 0.35;
  }
}

/* Aba oculta ou ilustração fora da tela: nada se move. */
.rd-paused .route-demo *,
.rd-paused .route-demo {
  animation-play-state: paused !important;
}

@media (prefers-reduced-motion: reduce) {
  .route-demo *,
  .route-demo {
    animation: none !important;
  }
  .rd-car {
    transform: translate(430px, 190px);
  }
  .rd-hit {
    opacity: 1;
  }
  .rd-pulse {
    opacity: 0;
  }
  .rd-digits span {
    transform: translateY(-6em);
  }
  .rd-toast {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Desktop: o cartão fica abaixo do texto, na base do lado esquerdo. Em
   janelas baixas ele some para não apertar o título. */
@media (min-width: 901px) {
  .register-page .register-hero-copy {
    margin-bottom: 0;
  }
  .register-page .register-hero-copy > p {
    max-width: 400px;
  }
  .register-page .route-demo {
    margin-top: auto;
  }
}
@media (min-width: 901px) and (max-height: 660px) {
  .register-page .route-demo {
    display: none;
  }
  .register-page .register-hero-copy {
    margin-bottom: auto;
  }
}

/* Celular e tablet: a ilustração vira uma faixa baixa no topo. */
@media (max-width: 900px) {
  .register-page .register-hero {
    min-height: 0 !important;
    padding-bottom: 20px !important;
  }
  .register-page .register-hero-copy {
    margin-top: 22px !important;
  }
  .register-page .register-hero-copy > p {
    display: none;
  }
  .register-page .route-demo {
    width: 100%;
    max-width: 560px;
    aspect-ratio: 2.4 / 1;
    margin-top: 16px;
    border-radius: 14px;
  }
  .rd-chip {
    top: 8px;
    height: 24px;
    padding: 0 9px;
    font-size: 11px;
  }
  .rd-ign {
    left: 8px;
  }
  .rd-speed {
    right: 8px;
  }
  .rd-digits {
    font-size: 13px;
  }
  .rd-toast {
    bottom: 8px;
    padding: 6px 10px 6px 7px;
  }
  .rd-toast svg {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
  }
  .rd-toast b {
    font-size: 11.5px;
  }
  .rd-toast small {
    display: none;
  }
}

/* ---------- 2. Formulário ---------- */
.register-page .register-form .register-heading p {
  margin: 4px 0 0;
}

/* Escolha do painel: define para onde o login leva. */
.register-page .portal-choice {
  margin: 0 0 6px;
  padding: 0;
  border: 0;
  min-width: 0;
}
.register-page .portal-choice legend {
  padding: 0;
  margin-bottom: 7px;
  color: #59616c;
  font-size: 12px;
  font-weight: 700;
}
.register-page .portal-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid #dfe3e8;
  border-radius: 14px;
  background: #f1f3f6;
}
.register-page .register-form .portal-options label {
  position: relative;
  margin: 0;
  display: block;
  cursor: pointer;
}
.register-page .register-form .portal-options input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.register-page .portal-options span {
  min-height: 52px;
  padding: 8px 10px 8px 12px;
  display: grid;
  grid-template-columns: 22px 1fr;
  column-gap: 9px;
  align-items: center;
  border-radius: 10px;
  color: #3a424d;
  transition:
    background 0.18s,
    color 0.18s,
    box-shadow 0.18s;
}
.register-page .portal-options svg {
  grid-row: span 2;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.register-page .portal-options b {
  font-size: 14px;
  line-height: 1.15;
}
.register-page .portal-options small {
  color: #707985;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.2;
}
.register-page .portal-options input:checked + span {
  background: #fff;
  color: #e84900;
  box-shadow:
    0 1px 2px #0000000f,
    0 4px 12px #18202a14;
}
.register-page .portal-options input:focus-visible + span {
  outline: 2px solid #ff5a0a;
  outline-offset: 2px;
}
.register-page .portal-hint {
  margin: 6px 2px 0;
  color: #707985;
  font-size: 11.5px;
  line-height: 1.35;
}

/* Campos: mesmo ritmo vertical em todas as telas. */
.register-page .register-form > label,
.register-page .register-form .field {
  display: block;
  margin-top: 12px;
  color: #3a424d !important;
  font-size: 12.5px;
  font-weight: 700;
}
.register-page .register-form select {
  width: 100%;
  height: 46px;
  margin-top: 5px;
  padding: 0 12px;
  border: 1px solid #d6dbe0;
  border-radius: 12px;
  background: #fff;
  color: #111317;
  font: inherit;
  font-size: 14px;
}
.register-page .register-form select:disabled {
  color: #8a929c;
  background: #f4f5f7;
}
.register-page .register-form input:user-invalid {
  border-color: #d93b3b !important;
  box-shadow: 0 0 0 3px #d93b3b1a !important;
}
.register-page .forgot-password-link {
  display: flex;
  align-items: center;
  width: max-content;
  margin: 4px 0 0 auto;
}
.register-page .field-hint {
  margin: 6px 2px 0;
  color: #707985;
  font-size: 12px;
  line-height: 1.4;
}

/* Erro: faixa com ícone, legível e próxima do botão. */
.register-page .register-form .form-error {
  margin: 14px 0 0;
  padding: 10px 12px 10px 36px;
  position: relative;
  border: 1px solid #f1b8b8;
  border-radius: 12px;
  background: #fff3f3;
  color: #9f1d27;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
.register-page .register-form .form-error::before {
  content: '!';
  position: absolute;
  left: 11px;
  top: 10px;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d93b3b;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}
/* Conta bloqueada por tentativas: aviso âmbar com cadeado. */
.register-page .register-form .form-error.is-locked,
.register-page .register-form .form-error[data-code='ACCOUNT_LOCKED'] {
  border-color: #f3cf8a;
  background: #fff8e8;
  color: #7a4a00;
}
.register-page .register-form .form-error.is-locked::before,
.register-page .register-form .form-error[data-code='ACCOUNT_LOCKED']::before {
  content: '';
  background: #b7791f
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E")
    center / 11px no-repeat;
}
.register-page .register-form .form-error.success {
  border-color: #a7e3bd;
  background: #effbf3;
  color: #166534;
}
.register-page .register-form .form-error.success::before {
  content: '✓';
  background: #16a34a;
}
.register-page .register-form .form-success {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid #a7e3bd;
  border-radius: 12px;
  background: #effbf3;
  color: #166534;
  font-size: 13px;
  font-weight: 600;
}

.register-page .register-form .register-submit {
  margin-top: 18px;
}
.register-page .register-submit:focus-visible,
.register-page .register-form a:focus-visible,
.register-page .register-password-toggle:focus-visible {
  outline: 3px solid #ff5a0a;
  outline-offset: 2px;
}

/* Verificação em duas etapas (a lógica fica em auth.js). */
.register-page .two-factor-step[hidden] {
  display: none !important;
}
.register-page .two-factor-step .two-factor-code {
  height: 56px !important;
  text-align: center;
  font-size: 24px !important;
  font-weight: 800;
  letter-spacing: 0.45em;
  font-variant-numeric: tabular-nums;
}
.register-page .two-factor-back {
  display: block;
  width: max-content;
  margin: 14px auto 0;
  color: #59616c;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.register-page .two-factor-back:hover {
  color: #e84900;
}

/* Recuperação de senha no mesmo layout das outras telas. */
.register-page .recovery-back {
  display: inline-flex;
  margin-bottom: 14px;
  color: #59616c;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.register-page .recovery-back:hover {
  color: #e84900;
}
.register-page .recovery-form .register-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none !important;
}
.register-page .recovery-form #recoveryGoogleBlock p {
  margin: 14px 0 8px;
  color: #59616c;
  font-size: 13px;
}
.register-page .recovery-form + .recovery-form {
  margin-top: 0;
}
@media (min-width: 901px) {
  .register-page .register-form-panel .recovery-wrap {
    width: min(500px, 100%);
  }
  .register-page .recovery-wrap .register-form {
    width: 100%;
  }
  .register-page .recovery-wrap .recovery-back {
    color: #fff;
  }
}
