/* Tela de login (index.html): layout, fundo animado, campos de senha e modais. */

/* SPRINTER BG - FIX PARA IMPEDIR QUEBRA DE LAYOUT */
#sprinter-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
:root {
  color-scheme: dark;
  --red: #dc2626;
  --red-d: #b91c1c;
  --red-l: rgba(220, 38, 38, 0.1);
  --green: #16a34a;
  --green-l: rgba(22, 163, 74, 0.1);
  --amber: #d97706;
  --amber-l: rgba(217, 119, 6, 0.1);
  --blue: #1d4ed8;
  --blue-l: rgba(29, 78, 216, 0.1);
  --bg: #0f172a;
  --dark: #0f172a;
  --mid: #1e293b;
  --card: #1e293b;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --white: #fff;
  --accent: #dc2626;
  --accent-rgb: 220, 38, 38;
}
/* Modal Daisy — tema escuro consistente */
.modal-box {
  background-color: #0f172a !important;
  color: #e2e8f0 !important;
  border: 1px solid rgba(96, 165, 250, 0.2) !important;
}
#alertModal .iaph-alert-modal-box {
  display: flex;
  width: min(calc(100vw - 2rem), 24rem);
  min-height: 0;
  max-width: 24rem;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1rem;
  text-align: center;
}
#alertModal .iaph-alert-modal-icon {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0 auto 0.15rem;
  place-items: center;
  border: 1px solid rgba(250, 204, 21, 0.3);
  border-radius: 999px;
  background: rgba(250, 204, 21, 0.1);
  font-size: 1.25rem;
}
#alertModal .iaph-alert-modal-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 900;
  line-height: 1.2;
}
#alertModal .iaph-alert-modal-message {
  margin: 0;
  padding: 0;
  opacity: 0.82;
  font-size: 0.875rem;
  line-height: 1.4;
}
#alertModal .iaph-alert-modal-actions {
  width: 100%;
  margin: 0.35rem 0 0;
}
#alertModal .iaph-alert-modal-actions .btn {
  width: 100%;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: "DM Sans", sans-serif;
  background: var(--dark);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
#welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
  padding: 24px;
  position: relative;
}
#welcome::before {
  content: "✚";
  position: fixed;
  font-size: 400px;
  color: rgba(220, 38, 38, 0.03);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  line-height: 1;
}
.welcome-card {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 32px;
  padding: 48px 40px;
  max-width: 480px;
  width: 92%;
  text-align: center;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
  position: relative;
  z-index: 10;
}
.welcome-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  margin-bottom: 24px;
  transition: transform 0.3s ease;
  position: relative;
  background: transparent !important;
  box-shadow: none !important;
}
.welcome-logo:hover {
  transform: scale(1.05) rotate(2deg);
}

/* ════════ LOGO ANIMATIONS CORE ════════ */
.iaph-logo-base {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 1.5rem;
  background: linear-gradient(135deg, #dc2626, #9333ea, #2563eb);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.iaph-logo-cross-h {
  position: absolute;
  width: 60%;
  height: 12%;
  background: white;
  border-radius: 2px;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
  z-index: 2;
}
.iaph-logo-cross-v {
  position: absolute;
  width: 12%;
  height: 60%;
  background: white;
  border-radius: 2px;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
  z-index: 2;
}

@keyframes scan-ultra {
  0% {
    transform: translate(-50%, -250%) rotate(0deg);
    opacity: 0;
  }
  5% {
    opacity: 1;
  }
  45% {
    transform: translate(-50%, 250%) rotate(0deg);
    opacity: 1;
  }
  48% {
    opacity: 0;
  }
  52% {
    transform: translate(-50%, -50%) rotate(90deg) translateY(250%);
    opacity: 0;
  }
  55% {
    opacity: 1;
  }
  95% {
    transform: translate(-50%, -50%) rotate(90deg) translateY(-250%);
    opacity: 1;
  }
  98% {
    opacity: 0;
  }
  100% {
    transform: translate(-50%, -250%) rotate(0deg);
    opacity: 0;
  }
}
.scan-bar {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 20%;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: none;
  display: none;
  z-index: 3;
}
.anim-scan .scan-bar {
  animation: scan-ultra 6s ease-in-out infinite;
  display: block;
}

@keyframes energy-pulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}
.energy-ring {
  position: absolute;
  inset: 0;
  border-radius: 1.5rem;
  background: inherit;
  animation: none;
  display: none;
}
.anim-energy .energy-ring {
  animation: energy-pulse 2s infinite;
  display: block;
}

@keyframes neon-cycle {
  0% {
    filter: hue-rotate(0deg);
  }
  100% {
    filter: hue-rotate(360deg);
  }
}
.anim-neon {
  animation: neon-cycle 5s linear infinite;
}

.welcome-card h1 {
  font-family: "Bebas Neue", sans-serif;
  font-size: 48px;
  letter-spacing: 4px;
  color: var(--text);
  line-height: 0.9;
  margin-bottom: 4px;
}
.welcome-card h1 span {
  color: var(--red);
  text-shadow: 0 0 20px rgba(220, 38, 38, 0.3);
}
.welcome-card p {
  color: var(--muted);
  font-size: 14px;
  margin: 8px 0 32px;
  letter-spacing: 0.5px;
  font-weight: 500;
}
.welcome-tabs {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 14px;
  padding: 5px;
  margin-bottom: 28px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.wtab {
  border: 0;
  background: transparent;
  font-family: inherit;
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.wtab.active {
  background: var(--red);
  color: white;
  box-shadow: 0 4px 15px rgba(220, 38, 38, 0.4);
}
.wtab:not(.active):hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}
.wtab:focus-visible {
  outline: 3px solid #facc15;
  outline-offset: 2px;
}
.form-group {
  margin-bottom: 20px;
  text-align: left;
}
.form-group label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #e2e8f0;
  text-transform: uppercase;
  display: block;
  margin-bottom: 8px;
  padding-left: 4px;
}
.form-group input {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #e2e8f0;
  padding: 14px 16px;
  font-size: 15px;
  transition: all 0.2s ease;
}
.form-group input:-webkit-autofill,
.form-group input:-webkit-autofill:hover,
.form-group input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0px 1000px #0f172a inset !important;
  -webkit-text-fill-color: #e2e8f0 !important;
  caret-color: #e2e8f0;
  transition: background-color 5000s ease-in-out 0s;
}
.form-group input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.15);
  background: rgba(15, 23, 42, 0.8);
}
.btn-primary:not(.btn) {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--red), var(--red-d));
  color: white;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 24px rgba(220, 38, 38, 0.3);
}
.btn-primary:not(.btn):hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(220, 38, 38, 0.4);
  filter: brightness(1.1);
}
.btn-primary:not(.btn):active {
  transform: translateY(0);
}
.btn-sec {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
  margin-top: 12px;
}
.btn-sec:hover,
.btn-sec:focus {
  color: #e2e8f0 !important;
}
.modal-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 8px;
  padding: 12px;
  color: #fca5a5;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.modal-error.show {
  display: block;
}

#modalMenorIdade .modal-box,
#modalDobRequired .modal-box,
#modalPendente .modal-box,
#modalVoucherWelcome .modal-box,
#modalBloqueado .modal-box,
#modalEsqueciSenha .modal-box,
#instrEsqueciSenhaModal .modal-box,
#idxModalTrocarSenha .modal-box,
#instrChangePassModal .modal-box {
  width: min(92vw, 28rem);
  max-width: 28rem;
  margin-inline: auto;
  padding: 1.25rem;
}

#modalMenorIdade .modal-action,
#modalDobRequired .modal-action,
#modalPendente .modal-action,
#modalVoucherWelcome .modal-action,
#modalBloqueado .modal-action,
#modalEsqueciSenha .modal-action,
#instrEsqueciSenhaModal .modal-action,
#idxModalTrocarSenha .modal-action,
#instrChangePassModal .modal-action {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 0.75rem;
}

@media (max-width: 480px) {
  #modalMenorIdade .modal-box,
  #modalDobRequired .modal-box,
  #modalPendente .modal-box,
  #modalVoucherWelcome .modal-box,
  #modalBloqueado .modal-box,
  #modalEsqueciSenha .modal-box,
  #instrEsqueciSenhaModal .modal-box,
  #idxModalTrocarSenha .modal-box,
  #instrChangePassModal .modal-box {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    padding: 1rem;
  }
  #modalMenorIdade .modal-action,
  #modalDobRequired .modal-action,
  #modalPendente .modal-action,
  #modalVoucherWelcome .modal-action,
  #modalBloqueado .modal-action,
  #modalEsqueciSenha .modal-action,
  #instrEsqueciSenhaModal .modal-action,
  #idxModalTrocarSenha .modal-action,
  #instrChangePassModal .modal-action {
    flex-direction: column;
  }
  #modalMenorIdade .modal-action .btn,
  #modalDobRequired .modal-action .btn,
  #modalPendente .modal-action .btn,
  #modalVoucherWelcome .modal-action .btn,
  #modalBloqueado .modal-action .btn,
  #modalEsqueciSenha .modal-action .btn,
  #instrEsqueciSenhaModal .modal-action .btn,
  #idxModalTrocarSenha .modal-action .btn,
  #instrChangePassModal .modal-action .btn {
    width: 100%;
    min-height: 48px;
    white-space: normal;
  }
}

/* ══ ONBOARDING ══ */
#obOverlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: obFadeIn 0.3s ease;
}
#obOverlay.ob-hidden {
  display: none;
}
@keyframes obFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
#obBox {
  background: linear-gradient(145deg, #1a1d23, #151720);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  width: min(480px, 92vw);
  padding: 36px 32px 28px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.7);
  position: relative;
  overflow: hidden;
}
#obBox::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -60px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.12), transparent 70%);
  pointer-events: none;
}
.ob-slide {
  display: none;
  animation: obSlideIn 0.3s ease;
}
.ob-slide.active {
  display: block;
}
@keyframes obSlideIn {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.ob-icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
  text-align: center;
}
.ob-title {
  font-size: 20px;
  font-weight: 800;
  color: #f8fafc;
  text-align: center;
  margin-bottom: 10px;
  line-height: 1.3;
}
.ob-text {
  font-size: 14px;
  color: #94a3b8;
  line-height: 1.7;
  text-align: center;
}
.ob-text strong {
  color: #e2e8f0;
}
.ob-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0 0;
}
.ob-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 12px 14px;
}
.ob-step-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}
.ob-step-text {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.5;
}
.ob-step-text strong {
  color: #f1f5f9;
  display: block;
  font-size: 13px;
  margin-bottom: 1px;
}
.ob-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 24px 0 20px;
}
.ob-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  transition: 0.25s;
  cursor: pointer;
  border: none;
}
.ob-dot.active {
  background: #ef4444;
  width: 22px;
  border-radius: 4px;
}
.ob-btns {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#obBtnSkip {
  background: none;
  border: none;
  color: #64748b;
  font-size: 13px;
  cursor: pointer;
  padding: 8px 4px;
  transition: 0.2s;
  font-family: inherit;
}
#obBtnSkip:hover {
  color: #94a3b8;
}
#obBtnNext {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 11px 28px;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.2s;
  font-family: inherit;
  flex: 1;
  max-width: 200px;
}
#obBtnNext:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

/* ── Mobile & Small Height Optimizations ── */
@media (max-width: 480px) {
  .welcome-card {
    padding: 32px 24px;
    border-radius: 24px;
  }
  .welcome-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
  }
  .welcome-card h1 {
    font-size: 38px;
  }
  .welcome-card p {
    margin-bottom: 24px;
    font-size: 13px;
  }
  .wtab {
    padding: 10px;
    font-size: 11px;
  }
  .btn-primary:not(.btn) {
    padding: 14px;
    font-size: 15px;
  }

  #obBox {
    padding: 28px 20px;
    width: 94vw;
  }
  .ob-icon {
    font-size: 40px;
  }
  .ob-title {
    font-size: 18px;
  }
  .ob-text {
    font-size: 13px;
  }
  .ob-step {
    padding: 10px;
    gap: 8px;
  }
  .ob-step-icon {
    font-size: 18px;
  }
  .ob-step-text {
    font-size: 12px;
  }
}

/* Fix para alturas pequenas (ex: modo paisagem em mobile) */
@media (max-height: 720px) {
  #welcome {
    padding: 16px;
  }
  .welcome-card {
    padding: 24px 24px;
  }
  .welcome-logo {
    display: none;
  } /* Esconde logo para economizar espaço vertical */
  .welcome-card p {
    margin-bottom: 16px;
  }
  .welcome-tabs {
    margin-bottom: 16px;
  }
  .form-group {
    margin-bottom: 12px;
  }
}

.pass-field {
  position: relative;
}
.pass-field input {
  width: 100%;
  padding-right: 44px;
  box-sizing: border-box;
}
.pass-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.pass-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}
.pass-toggle svg {
  width: 20px;
  height: 20px;
}

/* ── Fundo animado do login ─────────────────────────────
   O canvas é desenhado por src/entry/fundo-login/ (empacotado num script clássico com defer).
   Enquanto ele não pinta o primeiro quadro, fica o céu da madrugada. */
#sprinter-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(180deg, #0a1230 0%, #151f42 62%, #2b2f3a 100%);
}
/* No celular, a altura "grande" da tela: esconder a barra do navegador não redesenha a cena. */
@supports (height: 100lvh) {
  #sprinter-bg {
    height: 100lvh;
  }
}
#sprinter-cena {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.6s ease;
}
#sprinter-cena[data-fundo="pronto"] {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  #sprinter-cena {
    transition: none;
  }
}

/* Compatibilidade: Garante que o .show do seu JS funcione com o Tailwind */
.modal-error.show {
  display: block !important;
}
/* Mantém a tipografia original do Bebas Neue nos novos modais */
.modal-box h2 {
  font-family: "Bebas Neue", sans-serif !important;
}
