/* ==========================================================================
   Spotling Universal Page Loader & Progress Wheel
   ========================================================================== */

/* Top slim progress bar */
#spotling-top-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #f59e0b, #14b8a6, #38bdf8, #f59e0b);
  background-size: 300% 100%;
  z-index: 999999;
  pointer-events: none;
  opacity: 0;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.6), 0 0 5px rgba(20, 184, 166, 0.8);
  animation: spotling-shimmer 2s linear infinite;
}

#spotling-top-progress.active {
  opacity: 1;
}

/* Fullscreen Progress Wheel Backdrop & Modal */
#spotling-page-loader {
  position: fixed;
  inset: 0;
  background-color: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-in-out;
}

#spotling-page-loader.visible {
  opacity: 1;
  pointer-events: auto;
}

.spotling-loader-card {
  background: rgba(24, 24, 27, 0.98);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 1.25rem;
  padding: 1.25rem 1rem;
  max-width: 22rem;
  width: 100%;
  max-height: calc(100vh - 1.5rem);
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 25px rgba(245, 158, 11, 0.15);
  position: relative;
  overflow-x: hidden;
  color: #f4f4f5;
  transform: scale(0.96);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (min-width: 640px) {
  #spotling-page-loader {
    padding: 1rem;
  }
  .spotling-loader-card {
    border-radius: 1.5rem;
    padding: 1.75rem 2rem;
    max-width: 24rem;
    max-height: calc(100vh - 2rem);
  }
}

#spotling-page-loader.visible .spotling-loader-card {
  transform: scale(1);
}

/* Top accent rainbow gradient line on card */
.spotling-loader-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #f59e0b, #14b8a6, #38bdf8, #f59e0b);
  background-size: 200% 100%;
  animation: spotling-shimmer 2s linear infinite;
}

/* Progress Wheel Visual Container */
.spotling-wheel-wrap {
  position: relative;
  width: 4rem;
  height: 4rem;
  margin: 0 auto 0.85rem auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 640px) {
  .spotling-wheel-wrap {
    width: 5rem;
    height: 5rem;
    margin-bottom: 1.25rem;
  }
}

/* Dual outer spinner rings */
.spotling-wheel-ring-outer {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  border: 3px solid rgba(245, 158, 11, 0.15);
  border-top-color: #f59e0b;
  border-right-color: #14b8a6;
  animation: spotling-spin 1.1s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.25);
}

.spotling-wheel-ring-inner {
  position: absolute;
  inset: 5px;
  border-radius: 9999px;
  border: 2px dashed rgba(20, 184, 166, 0.35);
  border-bottom-color: #38bdf8;
  animation: spotling-spin-reverse 2s linear infinite;
}

/* Glowing center disc */
.spotling-wheel-center {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 9999px;
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.6), 0 0 10px rgba(245, 158, 11, 0.2);
  animation: spotling-pulse-glow 2s ease-in-out infinite;
}

@media (min-width: 640px) {
  .spotling-wheel-center {
    width: 3rem;
    height: 3rem;
    font-size: 1.5rem;
  }
}

/* Typography in Loader */
.spotling-loader-title {
  font-size: 0.95rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.015em;
  margin-bottom: 0.2rem;
  line-height: 1.25;
}

@media (min-width: 640px) {
  .spotling-loader-title {
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
  }
}

.spotling-loader-subtitle {
  font-size: 0.68rem;
  font-weight: 700;
  color: #fbbf24;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

@media (min-width: 640px) {
  .spotling-loader-subtitle {
    font-size: 0.72rem;
    margin-bottom: 0.75rem;
  }
}

/* Animated Shimmer Bar */
.spotling-loader-bar-wrap {
  width: 100%;
  height: 5px;
  background-color: #27272a;
  border-radius: 9999px;
  overflow: hidden;
  margin: 0.5rem 0;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

@media (min-width: 640px) {
  .spotling-loader-bar-wrap {
    height: 6px;
    margin: 0.75rem 0;
  }
}

.spotling-loader-bar-inner {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #f59e0b 0%, #14b8a6 50%, #f59e0b 100%);
  background-size: 200% 100%;
  animation: spotling-shimmer 1.5s ease-in-out infinite;
  border-radius: 9999px;
}

/* Live Rotating Status Message */
.spotling-loader-msg {
  font-size: 0.74rem;
  font-weight: 600;
  color: #d4d4d8;
  min-height: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  padding: 0 0.25rem;
  transition: opacity 0.2s ease;
}

@media (min-width: 640px) {
  .spotling-loader-msg {
    font-size: 0.78rem;
    min-height: 2.2rem;
    line-height: 1.25;
    padding: 0 0.5rem;
  }
}

.spotling-loader-hint {
  font-size: 0.65rem;
  color: #71717a;
  margin-top: 0.35rem;
}

@media (min-width: 640px) {
  .spotling-loader-hint {
    font-size: 0.68rem;
    margin-top: 0.5rem;
  }
}

/* Keyframes */
@keyframes spotling-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

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

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

@keyframes spotling-pulse-glow {
  0%, 100% {
    transform: scale(0.96);
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.6), 0 0 8px rgba(245, 158, 11, 0.2);
  }
  50% {
    transform: scale(1.04);
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.6), 0 0 18px rgba(245, 158, 11, 0.45);
  }
}
