/* ============================================
   ZAIMOON — LOADER SCREEN
   loader.css
   ============================================ */

#zaimoon-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #020b18;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#zaimoon-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ── Grid lines de fondo ── */
#zaimoon-loader::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 229, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: gridPulse 3s ease-in-out infinite;
}

@keyframes gridPulse {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1;   }
}

/* ── Partículas de código flotando ── */
.loader-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.loader-particle {
  position: absolute;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: rgba(0, 229, 255, 0.18);
  white-space: nowrap;
  animation: floatUp linear infinite;
  user-select: none;
}

@keyframes floatUp {
  0%   { transform: translateY(110vh) rotate(-5deg); opacity: 0;   }
  10%  { opacity: 1; }
  90%  { opacity: 0.6; }
  100% { transform: translateY(-10vh)  rotate(5deg);  opacity: 0;   }
}

/* ── Contenedor central ── */
.loader-center {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  z-index: 2;
}

/* ── Logo / Moon ── */
.loader-moon {
  font-size: 52px;
  line-height: 1;
  animation: moonGlow 2s ease-in-out infinite;
  filter: drop-shadow(0 0 18px #00e5ff);
}

@keyframes moonGlow {
  0%, 100% { filter: drop-shadow(0 0 12px #00e5ff); transform: scale(1);    }
  50%       { filter: drop-shadow(0 0 30px #00e5ff); transform: scale(1.08); }
}

/* ── Texto principal ── */
.loader-title {
  font-family: 'Space Mono', monospace;
  font-size: clamp(13px, 2.2vw, 17px);
  color: #00e5ff;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.6;
}

.loader-title .brand {
  display: block;
  font-size: clamp(22px, 4vw, 34px);
  font-family: 'Exo 2', sans-serif;
  font-weight: 900;
  letter-spacing: 0.3em;
  color: #ffffff;
  text-shadow: 0 0 24px rgba(0, 229, 255, 0.7);
  animation: titleFlicker 4s ease-in-out infinite;
}

@keyframes titleFlicker {
  0%, 97%, 100% { opacity: 1; }
  98%            { opacity: 0.6; }
  99%            { opacity: 1;   }
}

/* ── Typewriter line ── */
.loader-typewriter {
  font-family: 'Space Mono', monospace;
  font-size: clamp(11px, 1.5vw, 13px);
  color: rgba(0, 229, 255, 0.65);
  letter-spacing: 0.08em;
  min-height: 20px;
  text-align: center;
}

.loader-typewriter .tw-cursor {
  display: inline-block;
  width: 2px;
  height: 14px;
  background: #00e5ff;
  margin-left: 3px;
  vertical-align: middle;
  animation: blink 0.8s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Barra de progreso ── */
.loader-bar-wrap {
  width: clamp(260px, 40vw, 420px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.loader-bar-track {
  width: 100%;
  height: 3px;
  background: rgba(0, 229, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.loader-bar-track::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 229, 255, 0.08);
  border-radius: 999px;
}

.loader-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00e5ff, #00aaff, #00e5ff);
  background-size: 200% 100%;
  border-radius: 999px;
  transition: width 0.12s ease;
  animation: shimmer 1.5s linear infinite;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.8);
}

@keyframes shimmer {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}

.loader-bar-info {
  display: flex;
  justify-content: space-between;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: rgba(0, 229, 255, 0.45);
  letter-spacing: 0.1em;
}

.loader-pct {
  color: rgba(0, 229, 255, 0.75);
  font-weight: 700;
  transition: color 0.3s;
}

/* ── Línea de estado (log) ── */
.loader-status {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: rgba(0, 229, 255, 0.4);
  letter-spacing: 0.12em;
  text-align: center;
  min-height: 16px;
  transition: opacity 0.3s;
}

/* ── Esquinas decorativas ── */
.loader-corner {
  position: absolute;
  width: 22px;
  height: 22px;
  opacity: 0.4;
}
.loader-corner.tl { top: 36px; left: 36px;  border-top: 2px solid #00e5ff; border-left: 2px solid #00e5ff;  }
.loader-corner.tr { top: 36px; right: 36px; border-top: 2px solid #00e5ff; border-right: 2px solid #00e5ff; }
.loader-corner.bl { bottom: 36px; left: 36px;  border-bottom: 2px solid #00e5ff; border-left: 2px solid #00e5ff;  }
.loader-corner.br { bottom: 36px; right: 36px; border-bottom: 2px solid #00e5ff; border-right: 2px solid #00e5ff; }

/* ── Scanline ── */
.loader-scanline {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0,229,255,0.15), transparent);
  animation: scanDown 3s linear infinite;
  pointer-events: none;
}

@keyframes scanDown {
  0%   { top: -2px; }
  100% { top: 100%; }
}