#loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

#loader.fade-out {
  opacity: 0;
  transform: scale(1.1);
  pointer-events: none;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.spinner {
  position: relative;
  width: 80px;
  height: 80px;
}

/* Animated circles */
.circle {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

.circle:nth-child(2) {
  width: 60px;
  height: 60px;
  top: 10px;
  left: 10px;
  border-top-color: #ffd700;
  animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite reverse;
}

.circle:nth-child(3) {
  width: 40px;
  height: 40px;
  top: 20px;
  left: 20px;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

/* Pulsing dots */
.dots {
  display: flex;
  gap: 12px;
  align-items: center;
}

.dot {
  width: 12px;
  height: 12px;
  background: #ffffff;
  border-radius: 50%;
  animation: bounce 1.4s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.dot:nth-child(2) {
  animation-delay: 0.2s;
  background: #ffd700;
}

.dot:nth-child(3) {
  animation-delay: 0.4s;
}

/* Loading text */
.loading-text {
  color: #ffffff;
  font-size: 24px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 2px;
  animation: pulse 2s ease-in-out infinite;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.loading-subtext {
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin-top: -20px;
  animation: fadeInOut 2s ease-in-out infinite;
}

/* Progress bar */
.progress-container {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #ffffff, #ffd700, #ffffff);
  background-size: 200% 100%;
  border-radius: 10px;
  animation: progress 2s ease-in-out infinite, shimmer 1.5s linear infinite;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

/* Floating particles */
.particles {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
  top: 0;
  left: 0;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  animation: float 4s ease-in-out infinite;
}

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

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-20px) scale(1.1);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

@keyframes fadeInOut {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

@keyframes progress {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}

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

@keyframes float {
  0%,
  100% {
    transform: translateY(100vh) translateX(0) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
    transform: translateY(90vh) translateX(20px) scale(1);
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-10vh) translateX(40px) scale(0);
    opacity: 0;
  }
}
