/*
 * Cargador de Nexum: la N animada con nodos de circuito.
 * Es el único indicador de carga del sistema (pantalla completa o en línea).
 *  - Páginas internas: AppUI.showLoader('Texto…') / AppUI.hideLoader()
 *    (assets/js/app-ui.js). Los gif ajax-loader y los fa-spinner se
 *    convierten solos al cargador en línea.
 *  - Páginas sin app-ui (login y públicas): incluir este CSS y
 *    assets/js/nexum-loader.js → NexumLoader.show('Texto…') / hide().
 */

.app-loading-overlay {
  align-items: center;
  background: rgba(15, 23, 42, 0.66);
  backdrop-filter: blur(3px);
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  right: 0;
  top: 0;
  transition: opacity 160ms ease;
  z-index: 99980;
}

body.app-is-loading .app-loading-overlay {
  opacity: 1;
  pointer-events: auto;
}

.app-loading-card {
  align-items: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(20, 184, 166, 0.13), transparent 46%),
    #ffffff;
  border: 1px solid rgba(20, 184, 166, 0.2);
  border-radius: 24px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.36);
  color: #0f172a;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 244px;
  padding: 24px 30px 22px;
  text-align: center;
}

.app-loading-spinner {
  height: 86px;
  position: relative;
  width: 108px;
}

.nexum-loader {
  filter: drop-shadow(0 14px 22px rgba(20, 184, 166, 0.22));
}

.nexum-loader-svg {
  display: block;
  height: 100%;
  overflow: visible;
  width: 100%;
}

.nexum-loader-letter,
.nexum-loader-circuit {
  fill: none;
  stroke: url(#nexumLoaderStroke);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nexum-loader-letter {
  animation: nexumDrawLetter 1.8s ease-in-out infinite;
  filter: url(#nexumLoaderGlow);
  stroke-dasharray: 225;
  stroke-dashoffset: 225;
  stroke-width: 13;
}

.nexum-loader-circuit {
  animation: nexumDrawCircuit 1.8s ease-in-out infinite;
  opacity: 0.95;
  stroke-dasharray: 150;
  stroke-dashoffset: 150;
  stroke-width: 7;
}

.nexum-loader-circuit.circuit-right {
  animation-delay: 0.18s;
}

.nexum-loader-node {
  animation: nexumNodePulse 1.8s ease-in-out infinite;
  fill: #ffffff;
  opacity: 0;
  stroke: #22f2b3;
  stroke-width: 7;
}

.nexum-loader-node.node-left-top {
  animation-delay: 0.24s;
}

.nexum-loader-node.node-left-bottom {
  animation-delay: 0.36s;
}

.nexum-loader-node.node-right-top {
  animation-delay: 0.52s;
}

.nexum-loader-node.node-right-bottom {
  animation-delay: 0.66s;
}

.app-loading-text {
  color: #334155;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

@keyframes nexumDrawLetter {
  0% {
    opacity: 0.65;
    stroke-dashoffset: 225;
    transform: translateY(1px);
  }
  42%,
  72% {
    opacity: 1;
    stroke-dashoffset: 0;
    transform: translateY(0);
  }
  100% {
    opacity: 0.68;
    stroke-dashoffset: -225;
    transform: translateY(1px);
  }
}

@keyframes nexumDrawCircuit {
  0%,
  12% {
    opacity: 0;
    stroke-dashoffset: 150;
  }
  45%,
  74% {
    opacity: 1;
    stroke-dashoffset: 0;
  }
  100% {
    opacity: 0;
    stroke-dashoffset: -150;
  }
}

@keyframes nexumNodePulse {
  0%,
  22% {
    opacity: 0;
    transform: scale(0.75);
    transform-origin: center;
  }
  48%,
  76% {
    opacity: 1;
    transform: scale(1);
    transform-origin: center;
  }
  100% {
    opacity: 0;
    transform: scale(0.75);
    transform-origin: center;
  }
}

.nexum-inline-loader {
  color: #14b8a6;
  display: inline-block;
  height: 22px;
  margin-right: 6px;
  position: relative;
  top: 5px;
  vertical-align: baseline;
  width: 28px;
}

.nexum-inline-loader svg {
  display: block;
  height: 100%;
  overflow: visible;
  width: 100%;
}

.nexum-inline-letter,
.nexum-inline-circuit {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nexum-inline-letter {
  animation: nexumInlineDrawLetter 1.45s ease-in-out infinite;
  stroke-dasharray: 225;
  stroke-dashoffset: 225;
  stroke-width: 14;
}

.nexum-inline-circuit {
  animation: nexumInlineDrawCircuit 1.45s ease-in-out infinite;
  opacity: 0.95;
  stroke-dasharray: 150;
  stroke-dashoffset: 150;
  stroke-width: 8;
}

.nexum-inline-circuit.circuit-right {
  animation-delay: 0.15s;
}

.nexum-inline-node {
  animation: nexumInlineNodePulse 1.45s ease-in-out infinite;
  fill: #ffffff;
  opacity: 0;
  stroke: currentColor;
  stroke-width: 8;
}

.nexum-inline-node.node-left-top {
  animation-delay: 0.2s;
}

.nexum-inline-node.node-left-bottom {
  animation-delay: 0.28s;
}

.nexum-inline-node.node-right-top {
  animation-delay: 0.4s;
}

.nexum-inline-node.node-right-bottom {
  animation-delay: 0.5s;
}

@keyframes nexumInlineDrawLetter {
  0% {
    opacity: 0.6;
    stroke-dashoffset: 225;
  }
  45%,
  72% {
    opacity: 1;
    stroke-dashoffset: 0;
  }
  100% {
    opacity: 0.65;
    stroke-dashoffset: -225;
  }
}

@keyframes nexumInlineDrawCircuit {
  0%,
  12% {
    opacity: 0;
    stroke-dashoffset: 150;
  }
  45%,
  72% {
    opacity: 1;
    stroke-dashoffset: 0;
  }
  100% {
    opacity: 0;
    stroke-dashoffset: -150;
  }
}

@keyframes nexumInlineNodePulse {
  0%,
  22% {
    opacity: 0;
    transform: scale(0.75);
    transform-origin: center;
  }
  48%,
  76% {
    opacity: 1;
    transform: scale(1);
    transform-origin: center;
  }
  100% {
    opacity: 0;
    transform: scale(0.75);
    transform-origin: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nexum-loader-letter,
  .nexum-loader-circuit,
  .nexum-loader-node,
  .nexum-inline-letter,
  .nexum-inline-circuit,
  .nexum-inline-node {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    opacity: 1 !important;
    stroke-dashoffset: 0 !important;
  }
}

@media (max-width: 575px) {
  .app-loading-card {
    min-width: 190px;
    padding: 22px;
  }
}
