﻿/**
 * Universal AURORA navigation loader
 */

#auroraLoader {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(15, 18, 32, 0.4);
  backdrop-filter: blur(8px) saturate(150%);
  -webkit-backdrop-filter: blur(8px) saturate(150%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

#auroraLoader.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

#auroraLoader .loader-spinner {
  width: 100px;
  height: 100px;
  font-size: 5px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#auroraLoader .loader-spinner .comet {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border-style: solid;
}

#auroraLoader .loader-spinner .comet:nth-child(1) {
  color: #5edfff;
  border-color: currentColor transparent transparent currentColor;
  border-width: 0.4em 0.4em 0 0;
  --deg: -45deg;
  animation: cometSpin 2.5s linear infinite normal;
}

#auroraLoader .loader-spinner .comet:nth-child(2) {
  width: 70%;
  height: 70%;
  color: #ff9f43;
  border-color: currentColor currentColor transparent transparent;
  border-width: 0.4em 0 0 0.4em;
  --deg: -135deg;
  animation: cometSpin 2.5s linear infinite reverse;
}

#auroraLoader .loader-spinner .comet .circle {
  position: absolute;
  width: 50%;
  height: 0.2em;
  top: 50%;
  left: 50%;
  background-color: transparent;
  transform: rotate(var(--deg));
  transform-origin: left;
}

#auroraLoader .loader-spinner .comet .circle::before {
  content: '';
  position: absolute;
  top: -0.9em;
  right: -0.9em;
  width: 1.8em;
  height: 1.8em;
  background-color: currentColor;
  border-radius: 50%;
  box-shadow:
    0 0 2em currentColor,
    0 0 4em currentColor,
    0 0 6em currentColor,
    0 0 8em currentColor;
  z-index: 2;
  filter: drop-shadow(0 0.3em 0.6em rgba(0, 0, 0, 0.4));
}

#auroraLoader .loader-spinner .comet::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border-style: solid;
  opacity: 0.35;
  filter: blur(0.8em);
  transform: translateY(0.4em) scale(1.05);
  pointer-events: none;
  z-index: -1;
}

#auroraLoader .loader-spinner .comet:nth-child(1)::after {
  color: #5edfff;
  border-color: currentColor transparent transparent currentColor;
  border-width: 0.4em 0.4em 0 0;
  animation: cometSpin 2.5s linear infinite normal;
}

#auroraLoader .loader-spinner .comet:nth-child(2)::after {
  width: 70%;
  height: 70%;
  color: #ff9f43;
  border-color: currentColor currentColor transparent transparent;
  border-width: 0.4em 0 0 0.4em;
  animation: cometSpin 2.5s linear infinite reverse;
}

#auroraLoader .loader-spinner .comet .circle::after {
  content: '';
  position: absolute;
  top: -0.9em;
  right: -0.9em;
  width: 1.8em;
  height: 1.8em;
  background-color: transparent;
  border-radius: 50%;
  box-shadow:
    0 0 2em currentColor,
    0 0 4em currentColor,
    0 0 6em currentColor,
    0 0 8em currentColor;
  opacity: 0.5;
  z-index: 1;
  transform: rotate(var(--deg));
  transform-origin: left;
}

#auroraLoader .loader-spinner .comet:nth-child(1) .circle::after {
  animation: cometSpin 2.5s linear infinite normal;
  animation-delay: -0.4s;
}

#auroraLoader .loader-spinner .comet:nth-child(2) .circle::after {
  animation: cometSpin 2.5s linear infinite reverse;
  animation-delay: -0.4s;
}

@keyframes cometSpin {
  to { transform: rotate(1turn); }
}

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

#auroraProgress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  z-index: 999998;
  background: linear-gradient(90deg, #6c6cff, #2fd3c7, #6c6cff);
  background-size: 200% 100%;
  width: 0%;
  opacity: 0;
  transition: width 0.3s ease, opacity 0.2s ease;
  box-shadow: 0 0 10px #6c6cff, 0 0 20px rgba(47, 211, 199, 0.5);
  animation: auroraProgressShimmer 1.5s ease infinite;
}

#auroraProgress.active {
  opacity: 1;
}

@keyframes auroraProgressShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

body.in-iframe #auroraLoader {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

body.in-iframe #auroraLoader .loader-spinner .comet:nth-child(1) {
  color: #6c6cff;
}

body.in-iframe #auroraLoader .loader-spinner .comet:nth-child(2) {
  color: #2fd3c7;
}

body.aurora-loading > *:not(#auroraLoader):not(#auroraProgress):not(script):not(style):not(link) {
  opacity: 0;
  transition: opacity 0.3s ease;
}

body.aurora-loaded > * {
  opacity: 1;
}

html[data-theme='dark'] #auroraLoader {
  background: rgba(11, 15, 24, 0.6);
}

@media (max-width: 720px) {
  #auroraLoader .loader-spinner {
    width: 70px;
    height: 70px;
    font-size: 3.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #auroraLoader .loader-spinner {
    animation-duration: 1.5s;
  }

  #auroraProgress {
    animation: none;
  }
}
