/**
 * ============================================
 * GLOBAL LOADING - ESTILO MINIMALISTA
 * ============================================
 * Usado em todas as páginas exceto RCS.
 * Cores alinhadas ao Sobre: verde #1dd1a1 e azul #54a0ff.
 */

/* Cores do loading (verde e azul — Sobre) */
.global-loading {
  --loading-green: #1dd1a1;
  --loading-blue: #54a0ff;
}

/* Container do loading */
.global-loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--rcs-bg-primary, #ffffff);
  display: flex;
  /* Mostra por padrão ao navegar */
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  will-change: opacity, visibility;
  /* Otimização de performance */
}

[data-theme="dark"] .global-loading {
  background: var(--rcs-bg-primary, #0f172a);
}

.global-loading.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Container do ícone */
.global-loading-container {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Círculos pulsantes - entre o ícone (verde e azul) */
.global-loading-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90px;
  height: 90px;
  border: 2px solid var(--loading-green, #1dd1a1);
  border-radius: 50%;
  opacity: 0.35;
  animation: global-circle-pulse 2s ease-in-out infinite;
}

.global-loading-circle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 110px;
  height: 110px;
  border: 2px solid var(--loading-blue, #54a0ff);
  border-radius: 50%;
  opacity: 0.25;
  animation: global-circle-pulse 2s ease-in-out infinite 0.3s;
}

.global-loading-circle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 130px;
  height: 130px;
  border: 1px solid var(--loading-green, #1dd1a1);
  border-radius: 50%;
  opacity: 0.15;
  animation: global-circle-pulse 2s ease-in-out infinite 0.6s;
}

/* Ícone SVG - no centro */
.global-loading-icon {
  width: 70px;
  height: 70px;
  position: relative;
  z-index: 2;
  animation: global-icon-pulse 2s ease-in-out infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}

.global-loading-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(29, 209, 161, 0.35)) drop-shadow(0 2px 8px rgba(84, 160, 255, 0.25));
}

[data-theme="dark"] .global-loading-icon img {
  filter: drop-shadow(0 4px 12px rgba(29, 209, 161, 0.5)) drop-shadow(0 2px 8px rgba(84, 160, 255, 0.35));
}

/* Pontos orbitais - ao redor */
.global-loading-dots {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 160px;
  height: 160px;
}

.global-loading-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--loading-green, #1dd1a1);
  border-radius: 50%;
  opacity: 0.8;
  animation: global-dot-orbit 3s linear infinite;
}

.global-loading-dot:nth-child(2),
.global-loading-dot:nth-child(4) {
  background: var(--loading-blue, #54a0ff);
}

.global-loading-dot:nth-child(1) {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  animation-delay: 0s;
}

.global-loading-dot:nth-child(2) {
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  animation-delay: 0.75s;
}

.global-loading-dot:nth-child(3) {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  animation-delay: 1.5s;
}

.global-loading-dot:nth-child(4) {
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  animation-delay: 2.25s;
}

/* Animações */
@keyframes global-icon-pulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.1);
    opacity: 0.9;
  }
}

@keyframes global-circle-pulse {

  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.3;
  }

  50% {
    transform: translate(-50%, -50%) scale(1.15);
    opacity: 0.1;
  }
}

@keyframes global-dot-orbit {
  0% {
    transform: translate(-50%, -50%) rotate(0deg) translateX(77px) rotate(0deg);
    opacity: 0.7;
  }

  50% {
    opacity: 1;
  }

  100% {
    transform: translate(-50%, -50%) rotate(360deg) translateX(77px) rotate(-360deg);
    opacity: 0.7;
  }
}

/* Responsivo */
@media (max-width: 767px) {
  .global-loading-container {
    width: 120px;
    height: 120px;
  }

  .global-loading-icon {
    width: 60px;
    height: 60px;
  }

  .global-loading-circle {
    width: 80px;
    height: 80px;
  }

  .global-loading-circle::before {
    width: 100px;
    height: 100px;
  }

  .global-loading-circle::after {
    width: 120px;
    height: 120px;
  }

  .global-loading-dots {
    width: 140px;
    height: 140px;
  }
}