/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  color: #ffffff;
}

/* Running-themed animations */
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes pendulum {
  0% {
    transform: rotate(-15deg);
  }
  50% {
    transform: rotate(15deg);
  }
  100% {
    transform: rotate(-15deg);
  }
}

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

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

@keyframes sparkle {
  0% { transform: translateY(0px); }
  100% { transform: translateY(-100px); }
}

/* Loading Screen Styles */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  z-index: 9999;
  overflow: hidden;
}

/* Animated background particles */
.loading-screen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(2px 2px at 20px 30px, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(2px 2px at 40px 70px, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1px 1px at 90px 40px, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 130px 80px, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(2px 2px at 160px 30px, rgba(255, 255, 255, 0.3), transparent);
  background-repeat: repeat;
  background-size: 200px 100px;
  animation: sparkle 20s linear infinite;
  opacity: 0.6;
}

/* Main Content */
.loading-content {
  text-align: center;
  z-index: 10;
  animation: fadeInUp 1s ease-out;
  position: relative;
  padding-top: 220px; /* More space for the long pendulum rope */
}

/* Pendulum Container */
.pendulum-container {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 200px;
  z-index: 5;
  transform-origin: top center;
  animation: pendulum 3s ease-in-out infinite;
}

/* Pendulum Rope */
.pendulum-rope {
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 180px;
  background: linear-gradient(to bottom, 
    rgba(255, 255, 255, 0.9) 0%,
    rgba(255, 255, 255, 0.6) 30%,
    rgba(255, 255, 255, 0.3) 70%,
    rgba(255, 255, 255, 0.1) 100%);
  border-radius: 1px;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

/* Pendulum Bob (Logo) */
.loading-logo {
  width: 80px;
  height: 80px;
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  animation: pulse 2s ease-in-out infinite;
  box-shadow: 
    0 0 0 0 rgba(255, 255, 255, 0.4),
    0 0 0 0 rgba(255, 255, 255, 0.4),
    0 4px 20px rgba(255, 255, 255, 0.3),
    0 10px 30px rgba(0, 0, 0, 0.4);
}

/* Rotating ring around the logo */
.loading-logo::after {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  border-radius: 50%;
  z-index: -1;
  animation: rotate 4s linear infinite;
  opacity: 0.6;
}

.loading-logo img {
  width: 50px;
  height: 50px;
  filter: brightness(0) invert(0.2);
  animation: rotate 3s linear infinite;
}

.loading-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #ffffff;
  animation: fadeInUp 1s ease-out 0.3s both;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

/* Progress indicator */
.loading-progress {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin: 2rem auto;
  overflow: hidden;
  position: relative;
}

.loading-progress::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, #ffffff, rgba(255, 255, 255, 0.8), transparent);
  animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Loading dots */
.loading-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 1rem;
}

.loading-dot {
  width: 8px;
  height: 8px;
  background: #ffffff;
  border-radius: 50%;
  animation: dotPulse 1.4s ease-in-out infinite both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }
.loading-dot:nth-child(3) { animation-delay: 0s; }

@keyframes dotPulse {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .loading-content {
    padding-top: 180px;
  }

  .pendulum-container {
    height: 160px;
  }

  .pendulum-rope {
    height: 140px;
  }

  .loading-logo {
    width: 60px;
    height: 60px;
  }

  .loading-logo img {
    width: 35px;
    height: 35px;
  }

  .loading-title {
    font-size: 2rem;
  }

  .loading-progress {
    width: 150px;
  }
}