/* Loading skeleton styles - shown before React loads */
#root-loading {
  /* Use dvh (dynamic viewport height) for better mobile support, fallback to vh */
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(135deg, #450693 0%, #6B0FB8 50%, #450693 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  overflow: hidden;
  /* Prevent scrolling on mobile */
  touch-action: none;
  /* Optimize for mobile rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Animated background gradients */
#root-loading::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(140, 0, 255, 0.3), rgba(255, 63, 127, 0.2), transparent);
  top: -300px;
  left: -300px;
  animation: float 4s ease-in-out infinite;
}

#root-loading::after {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 196, 0, 0.3), rgba(255, 63, 127, 0.2), transparent);
  bottom: -300px;
  right: -300px;
  animation: float 5s ease-in-out infinite reverse;
}

.skeleton-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  position: relative;
  z-index: 1;
}

/* Logo container with glow effect */
.logo-container {
  position: relative;
  margin-bottom: 1rem;
}

.logo-glow {
  position: absolute;
  /* Fallback for older browsers that don't support inset */
  top: -20px;
  right: -20px;
  bottom: -20px;
  left: -20px;
  /* Modern browsers */
  inset: -20px;
  background: radial-gradient(circle, rgba(255, 196, 0, 0.5), rgba(255, 63, 127, 0.3), transparent);
  border-radius: 50%;
  animation: pulse-glow 2s ease-in-out infinite;
  filter: blur(20px);
  /* Optimize animation performance on mobile */
  will-change: transform, opacity;
  /* Use GPU acceleration */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.logo-image {
  position: relative;
  width: 96px;
  height: 96px;
  max-width: 25vw;
  max-height: 25vw;
  animation: logo-float 3s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(255, 196, 0, 0.6));
  /* Optimize for mobile */
  will-change: transform;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  /* Ensure image loads properly on mobile */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* Loyalty card animation */
.loyalty-card {
  width: 200px;
  height: 120px;
  /* Responsive sizing for mobile */
  max-width: 80vw;
  max-height: 48vw;
  min-width: 180px;
  min-height: 108px;
  background: linear-gradient(135deg, rgba(140, 0, 255, 0.9), rgba(69, 6, 147, 0.9));
  border-radius: 12px;
  border: 2px solid rgba(255, 196, 0, 0.5);
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  margin: 1rem 0;
  /* Optimize for mobile */
  will-change: transform;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.loyalty-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 196, 0, 0.3), transparent);
  animation: shimmer 2s infinite;
}

/* Stamps appearing on card */
.stamp {
  position: absolute;
  width: 24px;
  height: 24px;
  background: #FFC400;
  border-radius: 50%;
  border: 2px solid #FF3F7F;
  animation: stamp-appear 0.5s ease-out forwards;
  opacity: 0;
}

.stamp:nth-child(1) {
  top: 20px;
  left: 20px;
  animation-delay: 0.3s;
}

.stamp:nth-child(2) {
  top: 20px;
  left: 60px;
  animation-delay: 0.6s;
}

.stamp:nth-child(3) {
  top: 20px;
  left: 100px;
  animation-delay: 0.9s;
}

.stamp:nth-child(4) {
  top: 20px;
  left: 140px;
  animation-delay: 1.2s;
}

.stamp:nth-child(5) {
  top: 60px;
  left: 40px;
  animation-delay: 1.5s;
}

.stamp:nth-child(6) {
  top: 60px;
  left: 80px;
  animation-delay: 1.8s;
}

/* Floating stars */
.floating-star {
  position: absolute;
  color: #FFC400;
  font-size: 20px;
  /* Responsive font size for mobile */
  font-size: clamp(16px, 5vw, 20px);
  animation: float-star 3s ease-in-out infinite;
  opacity: 0.7;
  /* Optimize animation performance */
  will-change: transform, opacity;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  /* Ensure emojis render properly on all devices */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.floating-star:nth-child(1) {
  top: 10%;
  left: 10%;
  animation-delay: 0s;
}

.floating-star:nth-child(2) {
  top: 20%;
  right: 15%;
  animation-delay: 0.5s;
}

.floating-star:nth-child(3) {
  bottom: 15%;
  left: 20%;
  animation-delay: 1s;
}

.floating-star:nth-child(4) {
  bottom: 25%;
  right: 10%;
  animation-delay: 1.5s;
}

/* Loading text */
.skeleton-text {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.25rem;
  /* Responsive font size for mobile */
  font-size: clamp(1rem, 4vw, 1.25rem);
  font-weight: 600;
  text-align: center;
  background: linear-gradient(135deg, #FFC400, #FF3F7F, #8C00FF);
  /* iOS Safari support */
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  /* Standard support */
  background-clip: text;
  animation: text-pulse 2s ease-in-out infinite;
  /* Fallback color for browsers that don't support background-clip */
  color: #FFC400;
}

/* Loading dots */
.loading-dots {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: dot-bounce 1.4s ease-in-out infinite;
}

.dot:nth-child(1) {
  background: #FFC400;
  animation-delay: 0s;
}

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

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

/* Progress bar */
.progress-bar {
  width: 200px;
  /* Responsive width for mobile */
  max-width: 80vw;
  min-width: 180px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 1rem;
  /* Optimize for mobile */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #FFC400, #FF3F7F, #8C00FF);
  border-radius: 2px;
  animation: progress 2s ease-in-out infinite;
  /* Optimize animation performance */
  will-change: transform, width;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

/* Animations */
@keyframes float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(20px, 20px) scale(1.1);
  }
}

@keyframes pulse-glow {
  0%,
  100% {
    opacity: 0.5;
    transform: scale(1);
  }

  50% {
    opacity: 0.8;
    transform: scale(1.1);
  }
}

@keyframes logo-float {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }

  50% {
    transform: translateY(-10px) rotate(5deg);
  }
}

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

  100% {
    left: 100%;
  }
}

@keyframes stamp-appear {
  0% {
    opacity: 0;
    transform: scale(0) rotate(-180deg);
  }

  50% {
    transform: scale(1.2) rotate(10deg);
  }

  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes float-star {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
    opacity: 0.7;
  }

  50% {
    transform: translateY(-20px) rotate(180deg);
    opacity: 1;
  }
}

@keyframes text-pulse {
  0%,
  100% {
    opacity: 0.8;
  }

  50% {
    opacity: 1;
  }
}

@keyframes dot-bounce {
  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }

  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

@keyframes progress {
  0% {
    transform: translateX(-100%);
    width: 30%;
  }

  50% {
    transform: translateX(0%);
    width: 70%;
  }

  100% {
    transform: translateX(100%);
    width: 30%;
  }
}

/* Hide skeleton when React mounts */
#root:not(:empty) ~ #root-loading {
  display: none;
}

/* Mobile-specific optimizations */
@media (max-width: 768px) {
  .skeleton-loader {
    gap: 1.5rem;
    padding: 1rem;
  }

  .logo-image {
    width: 80px;
    height: 80px;
  }

  .loyalty-card {
    width: 180px;
    height: 108px;
  }

  .stamp {
    width: 20px;
    height: 20px;
  }

  /* Reduce animation complexity on low-end devices */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
  #root-loading {
    /* Fix for iOS Safari viewport height issues */
    min-height: -webkit-fill-available;
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  #root-loading *,
  #root-loading *::before,
  #root-loading *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

