/* Global Loading Animation System */

/* Loading Overlay Container */
#comfy-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #fdd219;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Show overlay */
#comfy-loading-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* Animation Container */
.loading-animation-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 90vh;
}

/* Lottie Animation Wrapper */
#comfy-lottie-animation {
  width: 393px;
  height: 852px;
  max-width: 80vw;
  max-height: 70vh;
  object-fit: contain;
}

/* Loading Text - Hidden */
.loading-text {
  display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
  #comfy-lottie-animation {
    width: 295px;
    height: 639px;
    max-width: 75vw;
    max-height: 60vh;
  }
}

@media (max-width: 480px) {
  #comfy-lottie-animation {
    width: 236px;
    height: 511px;
    max-width: 70vw;
    max-height: 50vh;
  }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 600px) {
  #comfy-lottie-animation {
    max-height: 80vh;
    width: auto;
    height: auto;
  }
  
  .loading-animation-container {
    max-height: 95vh;
  }
}

/* Accessibility - Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
  #comfy-loading-overlay {
    transition: none;
  }
  
  #comfy-lottie-animation {
    animation: none;
  }
}

/* Fallback for browsers without Lottie support */
.loading-fallback {
  display: none;
  width: 60px;
  height: 60px;
  border: 4px solid #FED20A;
  border-top: 4px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Show fallback when Lottie fails */
.lottie-error .loading-fallback {
  display: block;
}

.lottie-error #comfy-lottie-animation {
  display: none;
}