.loader-container {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 200px;
}

/* Sky background with gradient */
.loader::before {
  content: '';
  position: absolute;
  top: -50px;
  left: -50px;
  right: -50px;
  bottom: -50px;
  border-radius: 20px;
  z-index: -1;
}

/* Floating clouds */
.loader-cloud {
  position: absolute;
  width: 60px;
  height: 40px;
  background-image: url('/assets/images/intro/cloud1.png');
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.8;
  animation: float-cloud 4s ease-in-out infinite;
}

.loader-cloud:nth-child(1) {
  top: 20px;
  left: 20px;
  animation-delay: 0s;
  animation-duration: 3s;
}

.loader-cloud:nth-child(2) {
  top: 60px;
  right: 30px;
  animation-delay: 1s;
  animation-duration: 4s;
}

.loader-cloud:nth-child(3) {
  bottom: 40px;
  left: 40px;
  animation-delay: 2s;
  animation-duration: 3.5s;
}

/* Rocket animation */
.loader-rocket {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  background-image: url('/assets/images/intro/rocket.png');
  background-size: contain;
  background-repeat: no-repeat;
  animation: rocket-flight 3s ease-in-out infinite;
  z-index: 10;
}

/* Rocket trail effect */
.loader-rocket::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 20px;
  background: linear-gradient(to bottom, 
    rgba(255, 165, 0, 0.8) 0%,
    rgba(255, 69, 0, 0.6) 50%,
    transparent 100%);
  border-radius: 50%;
  animation: rocket-trail 3s ease-in-out infinite;
}

/* Loading text */
.loader-text {
  position: absolute;
  bottom: -70px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  text-align: center;
  white-space: nowrap;
}

.loader-text::after {
  content: '';
  animation: loading-dots 2s ease-in-out infinite;
}

/* React가 렌더링된 후 텍스트가 있을 때는 CSS content를 숨김 */
.loader-text:not(:empty)::after {
  content: '';
}

/* React가 렌더링되지 않았을 때 기본 텍스트 표시 */
.loader-text:empty::before {
  content: 'Powered by CEMWARE';
}

/* Progress bar */
.loader-progress {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  overflow: hidden;
}

.loader-progress::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent 0%,
    #3498db 50%,
    transparent 100%);
  animation: progress-sweep 2s ease-in-out infinite;
}

/* Animations */
@keyframes rocket-flight {
  0% {
    transform: translate(-50%, -50%) rotate(-10deg);
  }
  25% {
    transform: translate(-30%, -60%) rotate(5deg);
  }
  50% {
    transform: translate(-70%, -40%) rotate(-5deg);
  }
  75% {
    transform: translate(-30%, -30%) rotate(10deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(-10deg);
  }
}

@keyframes rocket-trail {
  0%, 100% {
    opacity: 0.8;
    height: 20px;
  }
  50% {
    opacity: 1;
    height: 30px;
  }
}

@keyframes float-cloud {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes loading-dots {
  0% {
    content: '';
  }
  25% {
    content: '.';
  }
  50% {
    content: '..';
  }
  75% {
    content: '...';
  }
  100% {
    content: '';
  }
}

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

/* Responsive design */
@media (max-width: 768px) {
  .loader {
    width: 250px;
    height: 150px;
  }
  
  .loader-cloud {
    width: 40px;
    height: 25px;
  }
  
  .loader-rocket {
    width: 35px;
    height: 35px;
  }
  
  .loader-text {
    font-size: 14px;
  }
  
  .loader-progress {
    width: 150px;
  }
}
