.loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at 60% 40%, #174a8c 0%, #092c5c 80%);
  animation: overlayFadeIn 0.8s ease forwards;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.loader-overlay.fade-out {
  opacity: 0;
  animation: overlayFadeOut 0.8s ease forwards;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes overlayFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.logo-glow {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: bounce 2.5s infinite ease-in-out;
}

.loader-logo {
  width: 90px;
  height: 90px;
  margin-bottom: 18px;
  border-radius: 50%;
  box-shadow:
    0 0 38px 8px rgba(22, 70, 140, 0.85),
    0 0 16px 0px #fff8;
  animation:
    logoPulse 1.35s infinite alternate,
    logoShadowShift 4s ease-in-out infinite;
  position: relative;
  z-index: 2;
  background: #fff; /* Optional white background behind logo for crisp glow */
}

/* Rotating glow ring around the logo */
.logo-glow::before {
  content: "";
  position: absolute;
  top: -20px;
  left: -20px;
  width: 130px;
  height: 130px;
  border: 4px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  box-shadow: 0 0 20px 5px #092c5cAA;
  animation: rotateGlow 6s linear infinite;
  z-index: 1;
}

@keyframes rotateGlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes logoPulse {
  0% { transform: scale(1);}
  100% { transform: scale(1.09);}
}

@keyframes logoShadowShift {
  0% {
    box-shadow:
      0 0 38px 8px rgba(22, 70, 140, 0.85),
      0 0 16px 0px #fff8;
  }
  50% {
    box-shadow:
      0 0 48px 10px rgba(40, 90, 190, 1),
      0 0 30px 2px #e0f0ff;
  }
  100% {
    box-shadow:
      0 0 38px 8px rgba(22, 70, 140, 0.85),
      0 0 16px 0px #fff8;
  }
}

.spinner {
  border: 7px solid #174a8c;
  border-top: 7px solid #fff;
  border-radius: 50%;
  width: 72px;
  height: 72px;
  animation: spin 1.15s linear infinite;
  box-shadow: 0 0 14px 1px #ffffff30;
  margin-top: -110px; /* position spinner overlapping logo center */
  position: relative;
  z-index: 0;
}

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

.loader-text {
  color: #fff;
  font-size: 1.22rem;
  margin-top: 24px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 10px #174a8c75;
  animation: fadeInText 1.75s ease forwards;
  opacity: 0;
}

@keyframes fadeInText {
  from { opacity: 0; transform: translateY(20px);}
  to { opacity: 1; transform: translateY(0);}
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-12px);
  }
}
