/* ==========================================
   NexTrade Global Page Loading Overlay
   ========================================== */

#page-global-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 999999;
  background: rgba(11, 15, 25, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.35s ease;
  user-select: none;
  -webkit-user-select: none;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#page-global-loader.pg-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Central Spinner Card */
.pg-loader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 3rem;
  border-radius: 24px;
  background: rgba(17, 24, 39, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 242, 254, 0.08);
  text-align: center;
  max-width: 90vw;
  transform: scale(1);
  transition: transform 0.3s ease;
}

#page-global-loader.pg-hidden .pg-loader-card {
  transform: scale(0.92);
}

/* Ring & Icon Wrapper */
.pg-spinner-wrapper {
  position: relative;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

/* Outer Glowing Ring */
.pg-spinner-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: #00f2fe;
  border-right-color: #00e676;
  animation: pg-spin 1.1s linear infinite;
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.3);
}

/* Inner Inverse Ring */
.pg-spinner-ring-inner {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-bottom-color: #3b82f6;
  border-left-color: #a855f7;
  animation: pg-spin-reverse 0.8s linear infinite;
}

/* Center Logo Icon */
.pg-spinner-logo {
  font-size: 2rem;
  color: #ffffff;
  z-index: 2;
  animation: pg-pulse 1.8s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.6));
}

/* Brand Name */
.pg-brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pg-brand-badge {
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Loading Message & Pulse Dots */
.pg-loader-msg {
  font-size: 0.875rem;
  font-weight: 500;
  color: #9ca3af;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.pg-dots span {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: #3b82f6;
  animation: pg-dot-blink 1.4s infinite ease-in-out both;
}

.pg-dots span:nth-child(1) { animation-delay: -0.32s; }
.pg-dots span:nth-child(2) { animation-delay: -0.16s; }
.pg-dots span:nth-child(3) { animation-delay: 0s; }

/* Keyframe Animations */
@keyframes pg-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pg-spin-reverse {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(-360deg); }
}

@keyframes pg-pulse {
  0%, 100% { opacity: 0.8; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1.06); }
}

@keyframes pg-dot-blink {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.2); background-color: #00f2fe; }
}

/* Prevent body scroll when loading */
body.pg-loading-active {
  overflow: hidden !important;
}
