/* =========================================================================
   Splash de boas-vindas do login + botão de tema da tela de acesso.
   ========================================================================= */

/* ----------------------------- Botão de tema ----------------------------- */
.login-theme-toggle-wrap {
  position: fixed;
  top: max(14px, env(safe-area-inset-top, 0px));
  right: max(14px, env(safe-area-inset-right, 0px));
  z-index: 10060;
  display: flex;
}

.login-theme-toggle {
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border-radius: 14px;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: rgba(17, 13, 26, .78);
  color: #e9e3ff;
  border: 1px solid rgba(167, 139, 250, .26);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}

.login-theme-toggle:hover {
  background: rgba(30, 23, 45, .9);
  border-color: rgba(167, 139, 250, .55);
  transform: translateY(-1px);
}

.login-theme-toggle:active { transform: none; }

.login-theme-toggle .theme-toggle-icon {
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

html[data-theme="dark"] .login-theme-toggle .theme-toggle-sun { display: inline-flex; }
html[data-theme="dark"] .login-theme-toggle .theme-toggle-moon { display: none; }
html[data-theme="light"] .login-theme-toggle .theme-toggle-sun { display: none; }
html[data-theme="light"] .login-theme-toggle .theme-toggle-moon { display: inline-flex; }

.login-theme-toggle .theme-toggle-svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.9;
}

html[data-theme="light"] .login-theme-toggle {
  background: rgba(255, 255, 255, .92);
  color: #475467;
  border-color: #e4e7ec;
  box-shadow: 0 12px 30px rgba(24, 39, 75, .12);
}

html[data-theme="light"] .login-theme-toggle:hover {
  background: #ffffff;
  color: #6d28d9;
  border-color: #d9c8ff;
}

/* ------------------------------- Splash --------------------------------- */
.login-splash {
  position: fixed;
  inset: 0;
  z-index: 10040;
  display: grid;
  place-items: center;
  padding: clamp(20px, 4vw, 48px);
  overflow: hidden;
  color: #f4f8ff;
  background:
    radial-gradient(900px 640px at 50% 4%, rgba(124, 58, 237, .30), transparent 62%),
    radial-gradient(720px 520px at 10% 92%, rgba(217, 70, 239, .16), transparent 62%),
    radial-gradient(720px 520px at 92% 84%, rgba(59, 130, 246, .13), transparent 62%),
    #06050a;
  animation: splashSafetyHide .4s ease 4.8s forwards;
}

body.has-splash { overflow: hidden; }

.login-splash.is-leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .45s ease, visibility .45s ease;
}

.login-splash.is-leaving .login-splash-inner {
  opacity: 0;
  transform: scale(1.035);
  transition: transform .5s cubic-bezier(.2, .8, .2, 1), opacity .38s ease;
}

.login-splash.is-leaving .splash-skip { opacity: 0; transition: opacity .25s ease; }

/* Aurora / brilhos de fundo */
.splash-aurora {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.splash-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(12px);
  opacity: .8;
}

.splash-orb-a {
  width: min(520px, 70vw);
  height: min(520px, 70vw);
  top: -18%;
  left: 12%;
  background: radial-gradient(circle, rgba(139, 92, 246, .33), transparent 68%);
  animation: splashDrift 13s ease-in-out infinite alternate;
}

.splash-orb-b {
  width: min(420px, 60vw);
  height: min(420px, 60vw);
  right: -8%;
  bottom: -14%;
  background: radial-gradient(circle, rgba(217, 70, 239, .22), transparent 68%);
  animation: splashDrift 16s ease-in-out infinite alternate-reverse;
}

.splash-orb-c {
  width: min(360px, 52vw);
  height: min(360px, 52vw);
  left: -10%;
  bottom: 6%;
  background: radial-gradient(circle, rgba(59, 130, 246, .18), transparent 68%);
  animation: splashDrift 19s ease-in-out infinite alternate;
}

.splash-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(circle at 50% 42%, #000 10%, transparent 72%);
  mask-image: radial-gradient(circle at 50% 42%, #000 10%, transparent 72%);
  opacity: .6;
}

/* Conteúdo */
.login-splash-inner {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform .5s cubic-bezier(.2, .8, .2, 1), opacity .38s ease;
}

.splash-logo-stage {
  position: relative;
  width: clamp(168px, 24vw, 214px);
  height: clamp(168px, 24vw, 214px);
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  animation: splashPop .85s cubic-bezier(.2, .9, .25, 1.15) both;
}

.splash-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(167, 139, 250, .18);
  pointer-events: none;
}

.splash-ring-a {
  inset: 0;
  border-top-color: rgba(196, 181, 253, .85);
  border-right-color: rgba(196, 181, 253, .08);
  animation: splashSpin 13s linear infinite;
}

.splash-ring-b {
  inset: 21px;
  border-bottom-color: rgba(240, 171, 252, .8);
  border-left-color: rgba(240, 171, 252, .06);
  animation: splashSpin 9.5s linear infinite reverse;
}

.splash-logo {
  width: 108px;
  height: 108px;
  padding: 15px;
  border-radius: 32px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .04));
  border: 1px solid rgba(255, 255, 255, .18);
  box-shadow:
    0 28px 70px rgba(124, 58, 237, .42),
    0 0 0 8px rgba(139, 92, 246, .06),
    inset 0 1px 0 rgba(255, 255, 255, .22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: splashLogoGlow 3.2s ease-in-out infinite;
}

.splash-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 18px;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .25));
}

.splash-icon-chip {
  position: absolute;
  z-index: 2;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #c4b5fd;
  background: rgba(17, 13, 26, .72);
  border: 1px solid rgba(167, 139, 250, .26);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .32);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: splashFloat 4.6s ease-in-out infinite;
}

.splash-icon-chip .splash-icon {
  width: 20px;
  height: 20px;
  color: currentColor;
}

.chip-1 { top: -6px; left: -12px; animation-delay: -.2s; }
.chip-2 { top: 10%; right: -24px; animation-delay: -1.1s; color: #f0abfc; }
.chip-3 { bottom: 8%; right: -20px; animation-delay: -2.2s; color: #86efac; }
.chip-4 { bottom: -8px; left: 10%; animation-delay: -3s; color: #93c5fd; }
.chip-5 { top: 40%; left: -30px; animation-delay: -1.7s; }
.chip-6 { top: -18px; right: 20%; animation-delay: -.7s; color: #fda4af; }

/* Textos */
.splash-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 16px 0 0;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(139, 92, 246, .12);
  border: 1px solid rgba(167, 139, 250, .24);
  color: #d8ccff;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  animation: splashFadeUp .6s cubic-bezier(.2, .8, .2, 1) .18s both;
}

.splash-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, .14), 0 0 14px rgba(74, 222, 128, .8);
  animation: splashPulse 1.8s ease-in-out infinite;
}

.splash-title {
  margin: 14px 0 0;
  font-size: clamp(32px, 5.6vw, 58px);
  line-height: 1.04;
  letter-spacing: -.045em;
  font-weight: 800;
  color: #f8faff;
}

.splash-title-line {
  display: block;
  animation: splashFadeUp .72s cubic-bezier(.2, .8, .2, 1) both;
}

.splash-title-line:nth-child(1) { animation-delay: .3s; }

.splash-title-accent {
  background: linear-gradient(100deg, #ffffff 6%, #c4b5fd 36%, #f0abfc 62%, #ffffff 94%);
  background-size: 210% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: splashFadeUp .72s cubic-bezier(.2, .8, .2, 1) .42s both,
    splashShimmer 4.2s linear .8s infinite;
}

.splash-subtitle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 15px 0 0;
  color: #a8bad0;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: .01em;
  animation: splashFadeUp .6s cubic-bezier(.2, .8, .2, 1) .56s both;
}

.splash-dots {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 12px;
}

.splash-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #c4b5fd;
  animation: splashDot 1.25s ease-in-out infinite;
}

.splash-dots i:nth-child(2) { animation-delay: .16s; }
.splash-dots i:nth-child(3) { animation-delay: .32s; }

/* Progresso */
.splash-progress {
  position: relative;
  width: min(270px, 62vw);
  height: 4px;
  margin-top: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  overflow: hidden;
  animation: splashFadeUp .5s ease .66s both;
}

.splash-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8b5cf6, #c084fc, #f0abfc);
  box-shadow: 0 0 18px rgba(139, 92, 246, .7);
  animation: splashProgress 2.55s cubic-bezier(.35, 0, .2, 1) .25s forwards;
}

.splash-trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 10px;
  margin-top: 22px;
  animation: splashFadeUp .6s ease .78s both;
}

.splash-trust span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(255, 255, 255, .075);
  color: #9aa9c0;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.splash-trust-icon {
  width: 14px;
  height: 14px;
  color: #a78bfa;
}

/* Botão pular */
.splash-skip {
  position: fixed;
  right: clamp(14px, 3vw, 28px);
  bottom: max(clamp(16px, 3vw, 28px), env(safe-area-inset-bottom, 0px));
  z-index: 10042;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(167, 139, 250, .26);
  background: rgba(17, 13, 26, .74);
  color: #e9e3ff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .3);
  transition: background .18s ease, border-color .18s ease, color .18s ease, opacity .25s ease;
  animation: splashFadeUp .5s ease 1s both;
}

.splash-skip:hover {
  background: rgba(35, 26, 54, .92);
  border-color: rgba(167, 139, 250, .6);
  color: #ffffff;
}

.splash-skip-icon {
  width: 15px;
  height: 15px;
}

/* Flash suave na transição para o login */
.splash-flash {
  position: fixed;
  inset: 0;
  z-index: 10050;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 45%, rgba(196, 181, 253, .22), transparent 52%);
}

body.splash-done .splash-flash { animation: splashFlash .65s ease forwards; }

/* Card do login entrando em cena */
body.splash-done .lx-card {
  animation: loginCardIn .62s cubic-bezier(.2, .85, .25, 1) both;
}

body.splash-done .lx-card .field:nth-of-type(1) { animation: loginFieldIn .55s cubic-bezier(.2, .85, .25, 1) .12s both; }
body.splash-done .lx-card .field:nth-of-type(2) { animation: loginFieldIn .55s cubic-bezier(.2, .85, .25, 1) .2s both; }
body.splash-done .lx-card .login-button { animation: loginFieldIn .55s cubic-bezier(.2, .85, .25, 1) .28s both; }
body.splash-done .lx-card .login-whatsapp { animation: loginFieldIn .55s cubic-bezier(.2, .85, .25, 1) .36s both; }

/* ------------------------------ Temas claro ------------------------------ */
html[data-theme="light"] .login-splash {
  color: #1a1f2b;
  background:
    radial-gradient(900px 640px at 50% 4%, rgba(124, 58, 237, .14), transparent 62%),
    radial-gradient(720px 520px at 10% 92%, rgba(217, 70, 239, .08), transparent 62%),
    radial-gradient(720px 520px at 92% 84%, rgba(59, 130, 246, .07), transparent 62%),
    #f4f5f8;
}

html[data-theme="light"] .splash-orb-a { background: radial-gradient(circle, rgba(139, 92, 246, .18), transparent 68%); }
html[data-theme="light"] .splash-orb-b { background: radial-gradient(circle, rgba(217, 70, 239, .11), transparent 68%); }
html[data-theme="light"] .splash-orb-c { background: radial-gradient(circle, rgba(59, 130, 246, .09), transparent 68%); }

html[data-theme="light"] .splash-grid {
  background-image:
    linear-gradient(rgba(15, 23, 42, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, .055) 1px, transparent 1px);
}

html[data-theme="light"] .splash-ring { border-color: rgba(124, 58, 237, .14); }
html[data-theme="light"] .splash-ring-a { border-top-color: rgba(124, 58, 237, .65); }
html[data-theme="light"] .splash-ring-b { border-bottom-color: rgba(192, 38, 211, .55); }

html[data-theme="light"] .splash-logo {
  background: linear-gradient(145deg, #ffffff, #f8f5ff);
  border-color: #ebe4ff;
  box-shadow:
    0 28px 60px rgba(124, 58, 237, .18),
    0 0 0 8px rgba(139, 92, 246, .05),
    inset 0 1px 0 #ffffff;
}

html[data-theme="light"] .splash-logo img { filter: drop-shadow(0 6px 12px rgba(24, 39, 75, .12)); }

html[data-theme="light"] .splash-icon-chip {
  background: rgba(255, 255, 255, .92);
  border-color: #e9e3f6;
  color: #7c3aed;
  box-shadow: 0 12px 28px rgba(24, 39, 75, .12);
}

html[data-theme="light"] .splash-kicker {
  background: #f1ebff;
  border-color: #e6dcff;
  color: #5b21b6;
}

html[data-theme="light"] .splash-title { color: #1a1f2b; }

html[data-theme="light"] .splash-title-accent {
  background-image: linear-gradient(100deg, #4c1d95 6%, #7c3aed 38%, #c026d3 64%, #4c1d95 94%);
}

html[data-theme="light"] .splash-subtitle { color: #667085; }
html[data-theme="light"] .splash-dots i { background: #8b5cf6; }
html[data-theme="light"] .splash-progress { background: rgba(15, 23, 42, .09); }
html[data-theme="light"] .splash-trust span {
  background: #ffffff;
  border-color: #e9ecf1;
  color: #667085;
  box-shadow: 0 4px 12px rgba(24, 39, 75, .04);
}
html[data-theme="light"] .splash-trust-icon { color: #7c3aed; }

html[data-theme="light"] .splash-skip {
  background: rgba(255, 255, 255, .94);
  border-color: #e4e7ec;
  color: #475467;
  box-shadow: 0 12px 30px rgba(24, 39, 75, .12);
}

html[data-theme="light"] .splash-skip:hover {
  background: #ffffff;
  border-color: #d9c8ff;
  color: #6d28d9;
}

html[data-theme="light"] .splash-flash {
  background: radial-gradient(circle at 50% 45%, rgba(124, 58, 237, .12), transparent 52%);
}

/* ------------------------------- Animações ------------------------------- */
@keyframes splashSpin { to { transform: rotate(360deg); } }

@keyframes splashDrift {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to { transform: translate3d(3%, 2%, 0) scale(1.07); }
}

@keyframes splashPop {
  from { opacity: 0; transform: scale(.72) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes splashLogoGlow {
  0%, 100% { box-shadow: 0 28px 70px rgba(124, 58, 237, .38), 0 0 0 8px rgba(139, 92, 246, .06), inset 0 1px 0 rgba(255, 255, 255, .22); }
  50% { box-shadow: 0 30px 82px rgba(139, 92, 246, .58), 0 0 0 12px rgba(139, 92, 246, .08), inset 0 1px 0 rgba(255, 255, 255, .22); }
}

@keyframes splashFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-9px) rotate(2deg); }
}

@keyframes splashPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(74, 222, 128, .14), 0 0 14px rgba(74, 222, 128, .75); }
  50% { box-shadow: 0 0 0 7px rgba(74, 222, 128, .08), 0 0 22px rgba(74, 222, 128, .9); }
}

@keyframes splashFadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes splashShimmer {
  from { background-position: 0% center; }
  to { background-position: 210% center; }
}

@keyframes splashDot {
  0%, 100% { opacity: .25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

@keyframes splashProgress {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes splashSafetyHide {
  to { opacity: 0; visibility: hidden; pointer-events: none; }
}

@keyframes splashFlash {
  0% { opacity: 0; }
  35% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(22px) scale(.982); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes loginFieldIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------- Responsivo / a11y --------------------------- */
@media (max-width: 640px) {
  .splash-logo-stage { width: 158px; height: 158px; }
  .splash-logo { width: 92px; height: 92px; padding: 13px; border-radius: 28px; }
  .splash-icon-chip { width: 36px; height: 36px; border-radius: 12px; }
  .splash-icon-chip .splash-icon { width: 17px; height: 17px; }
  .chip-5 { left: -18px; }
  .chip-2 { right: -14px; }
  .chip-3 { right: -12px; }
  .login-splash-inner { padding: 0 4px; }
  .splash-title { font-size: clamp(29px, 8.4vw, 42px); }
  .splash-trust span:nth-child(3) { display: none; }
  .splash-skip { height: 38px; padding: 0 13px; font-size: 11px; }
}

@media (max-width: 380px) {
  .splash-logo-stage { width: 140px; height: 140px; }
  .splash-logo { width: 84px; height: 84px; }
  .splash-icon-chip { width: 32px; height: 32px; }
  .splash-icon-chip .splash-icon { width: 15px; height: 15px; }
  .splash-progress { width: 200px; }
}

@media (prefers-reduced-motion: reduce) {
  .login-splash,
  .login-splash-inner,
  .splash-logo-stage,
  .splash-logo,
  .splash-ring,
  .splash-icon-chip,
  .splash-orb,
  .splash-kicker,
  .splash-title-line,
  .splash-title-accent,
  .splash-subtitle,
  .splash-dots i,
  .splash-progress,
  .splash-progress span,
  .splash-trust,
  .splash-skip,
  .splash-dot,
  .splash-flash,
  body.splash-done .lx-card,
  body.splash-done .lx-card .field,
  body.splash-done .lx-card .login-button,
  body.splash-done .lx-card .login-whatsapp {
    animation: none !important;
  }
  .login-splash { transition: opacity .25s ease, visibility .25s ease; }
  .splash-progress span { width: 100%; }
}
