/* ==========================================================================
   components/splash.css — Pantalla de carga/splash antes del login.
   --------------------------------------------------------------------------
   Animacion de carga con logo MB de texto y efectos fluidos en terracota.
   La pantalla de splash se muestra primero y luego transiciona al login.

   Paleta: la misma del login (tokens.css + login.css), para que la transicion
   splash -> login no produzca un salto de color. El acento usa --brand-500
   (#AC6A44 terracota), que es el unico token de marca que no cambia entre
   temas: por eso el logo y el spinner se leen igual en claro y en oscuro.
   ========================================================================== */

/* Acento y superficies del splash — se redefinen por tema */
.splash-screen {
  --splash-bg-1: #F8F4E9;
  --splash-bg-2: #EFE0C8;
  --splash-halo: rgba(232, 200, 160, 0.55);
  --splash-glow: rgba(172, 106, 68, 0.22);
}
html[data-theme="dark"] .splash-screen {
  --splash-bg-1: #141A1E;
  --splash-bg-2: #1A2226;
  --splash-halo: rgba(44, 58, 68, 0.55);
  --splash-glow: rgba(172, 106, 68, 0.28);
}

/* Contenedor del splash - cubre toda la pantalla */
.splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(900px 600px at 85% -10%, var(--splash-glow) 0%, transparent 60%),
    radial-gradient(800px 520px at 0% 110%, var(--splash-halo) 0%, transparent 60%),
    linear-gradient(160deg, var(--splash-bg-1) 0%, var(--splash-bg-2) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 1s ease-out, transform 1s ease-out;
}

/* Overlay sutil */
.splash-screen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, var(--splash-glow) 0%, transparent 70%);
  z-index: 1;
}

/* Efecto de pulso sutil en el fondo */
.splash-screen::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--splash-glow) 0%, transparent 70%);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  animation: splashPulse 3s ease-in-out infinite;
}

@keyframes splashPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
  50% { transform: translate(-50%, -50%) scale(1.4); opacity: 0.8; }
}

.splash-screen.fade-out {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}

/* Contenido centrado */
.splash-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Logo MB de texto.
   --brand-700 cambia con el tema: petroleo oscuro sobre crema en claro,
   terracota claro sobre petroleo en oscuro. Asi el logo contrasta en ambos
   sin necesitar una regla data-theme por separado. */
.splash-logo-text {
  font-size: 96px;
  font-weight: 800;
  color: var(--brand-700);
  letter-spacing: 0.1em;
  margin-bottom: 2rem;
  opacity: 0;
  transform: translateY(30px) scale(0.8);
  animation: splashLogoIn 1.2s cubic-bezier(0.23, 1, 0.32, 1) forwards;
  text-shadow:
    0 0 60px var(--splash-glow),
    0 20px 60px rgba(0, 0, 0, 0.25);
  animation: splashLogoIn 1.2s cubic-bezier(0.23, 1, 0.32, 1) forwards,
             splashLogoGlow 2s ease-in-out 1.2s infinite alternate;
}

@keyframes splashLogoIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes splashLogoGlow {
  0% { text-shadow: 0 0 60px var(--splash-glow), 0 20px 60px rgba(0, 0, 0, 0.25); }
  100% { text-shadow: 0 0 80px var(--splash-glow), 0 20px 80px rgba(0, 0, 0, 0.35); }
}

/* Linea decorativa animada */
.splash-line {
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand-500), transparent);
  margin-bottom: 1.5rem;
  animation: splashLine 1.5s ease-out 0.8s forwards;
}

@keyframes splashLine {
  to { width: 180px; }
}

/* Texto del sistema */
.splash-title {
  color: var(--brand-700);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  opacity: 0;
  animation: splashFadeIn 0.8s ease-out 1s forwards;
}

.splash-subtitle {
  color: var(--ink-500);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 2rem;
  opacity: 0;
  animation: splashFadeIn 0.8s ease-out 1.2s forwards;
}

@keyframes splashFadeIn {
  to { opacity: 1; }
}

/* Spinner elegante */
.splash-spinner {
  position: relative;
  width: 40px;
  height: 40px;
  opacity: 0;
  animation: splashFadeIn 0.8s ease-out 1.4s forwards;
}

.splash-spinner-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 2px solid var(--slate-300);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: splashSpin 1s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.splash-spinner-ring:nth-child(2) {
  width: 70%;
  height: 70%;
  top: 15%;
  left: 15%;
  border-top-color: var(--brand-400);
  animation-duration: 0.8s;
  animation-direction: reverse;
}

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

/* Barra de progreso inferior */
.splash-progress {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 2px;
  background: var(--slate-300);
  border-radius: 1px;
  overflow: hidden;
  opacity: 0;
  animation: splashFadeIn 0.8s ease-out 1.6s forwards;
}

.splash-progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--brand-300), var(--brand-500));
  border-radius: 1px;
  animation: splashProgress 2.5s ease-in-out 1.8s forwards;
}

@keyframes splashProgress {
  0% { width: 0%; }
  30% { width: 40%; }
  60% { width: 70%; }
  100% { width: 100%; }
}

/* Texto de carga */
.splash-loading {
  position: absolute;
  bottom: 35px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--ink-500);
  font-family: var(--font-sans);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0;
  animation: splashFadeIn 0.8s ease-out 1.8s forwards;
}

/* Ocultar el splash cuando se completa */
.splash-screen.hidden {
  display: none;
}

/* Login oculto hasta que termine el splash */
.login-content-hidden {
  opacity: 0;
  pointer-events: none;
}

.login-content-visible {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.5s ease-in;
}
