/* ── AstroPlanets Loading Screen — matches the login page's cosmic theme ── */
#ap-loading-screen {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #ffffff;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  opacity: 1;
  visibility: visible;
}

#ap-loading-screen.ap-loading-hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Same white → orange cosmic gradient used behind the login card */
#ap-loading-screen .ap-loading-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(135deg, #ffffff 0%, #fff3e0 40%, #ffb74d 75%, #fd7e14 100%);
}

#ap-loading-screen .ap-loading-star-field {
  position: absolute;
  inset: 0;
}

#ap-loading-screen .ap-loading-star {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
  animation: ap-loading-twinkle var(--dur, 3s) ease-in-out infinite alternate;
}

@keyframes ap-loading-twinkle {
  from { opacity: 0.3; }
  to   { opacity: var(--op, 0.9); }
}

#ap-loading-screen .ap-loading-planet {
  position: absolute;
  border-radius: 50%;
  animation: ap-loading-float 18s ease-in-out infinite;
}

#ap-loading-screen .ap-loading-planet-1 {
  width: 46px; height: 46px;
  left: 10%; top: 20%;
  background: radial-gradient(circle at 35% 35%, #d4af37, #6f42c1);
  box-shadow: 0 10px 20px rgba(0,0,0,0.15), inset -8px -8px 16px rgba(0,0,0,0.4);
  animation-delay: 0s;
}

#ap-loading-screen .ap-loading-planet-2 {
  width: 28px; height: 28px;
  left: 82%; top: 22%;
  background: radial-gradient(circle at 30% 30%, #a78bfa, #1e1a4a);
  box-shadow: 0 8px 15px rgba(124,58,237,0.3), inset -6px -6px 12px rgba(0,0,0,0.5);
  animation-delay: 3s;
}

#ap-loading-screen .ap-loading-planet-3 {
  width: 34px; height: 34px;
  left: 78%; top: 68%;
  background: radial-gradient(circle at 40% 35%, #34d399, #28a745);
  box-shadow: 0 8px 18px rgba(0,0,0,0.12), inset -6px -6px 14px rgba(0,0,0,0.4);
  animation-delay: 6s;
}

@keyframes ap-loading-float {
  0%   { transform: translateY(0) rotate(0deg); opacity: 0.55; }
  50%  { transform: translateY(-18px) rotate(180deg); opacity: 0.8; }
  100% { transform: translateY(0) rotate(360deg); opacity: 0.55; }
}

#ap-loading-screen .ap-loading-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 32px 40px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(6px);
  border-top: 4px solid #6f42c1;
  box-shadow: 0 20px 50px rgba(253, 126, 20, 0.2), 0 10px 30px rgba(0, 0, 0, 0.08);
}

#ap-loading-screen .ap-loading-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  animation: ap-loading-pulse 1.8s ease-in-out infinite;
}

#ap-loading-screen .ap-loading-spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid rgba(111, 66, 193, 0.15);
  border-top-color: #d4af37;
  border-right-color: #fd7e14;
  animation: ap-loading-spin 0.9s linear infinite;
}

#ap-loading-screen .ap-loading-text {
  color: #2d293d;
  font: 600 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0.02em;
  opacity: 0.85;
}

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

@keyframes ap-loading-pulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  #ap-loading-screen .ap-loading-spinner { animation-duration: 1.8s; }
  #ap-loading-screen .ap-loading-logo { animation: none; }
  #ap-loading-screen .ap-loading-planet,
  #ap-loading-screen .ap-loading-star { animation: none; }
}
