/* ==========================================================================
   ENTRANCE & EXIT ANIMATIONS SYSTEM & FLASH SPLASH LOADER
   Scroll Reveal, Page Transitions, Micro-interactions, Logo Splash Loader
   ========================================================================== */

/* Global Splash Screen Loading Overlay */
.splash-loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #FFFFFF;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s ease;
  pointer-events: all;
}

.splash-loader-overlay.splash-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  display: none !important;
}

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

.splash-logo-pulse {
  width: 120px;
  height: 148px;
  object-fit: contain;
  animation: logoPulse 1.5s ease-in-out infinite alternate;
  filter: drop-shadow(0 8px 24px rgba(218, 40, 40, 0.25));
}

@keyframes logoPulse {
  0% {
    transform: scale(0.94);
    opacity: 0.85;
  }
  100% {
    transform: scale(1.06);
    opacity: 1;
  }
}

.splash-spinner-bar {
  width: 140px;
  height: 3.5px;
  background: #F3F4F6;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.splash-spinner-progress {
  position: absolute;
  left: -50%;
  height: 100%;
  width: 50%;
  background: var(--color-primary);
  border-radius: 4px;
  animation: splashProgress 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes splashProgress {
  0% {
    left: -50%;
    width: 30%;
  }
  50% {
    width: 60%;
  }
  100% {
    left: 100%;
    width: 30%;
  }
}

/* Ready State for IntersectionObserver */
.anim-fade-in,
.anim-slide-up,
.anim-scale-in {
  opacity: 0;
  will-change: opacity, transform;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), 
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.anim-fade-in {
  transform: translateY(30px);
}

.anim-slide-up {
  transform: translateY(50px);
}

.anim-scale-in {
  transform: scale(0.92);
}

/* Entrance Active State (Scrolling into View) */
.anim-fade-in.anim-fade-in-active,
.anim-slide-up.anim-fade-in-active {
  opacity: 1;
  transform: translateY(0);
}

.anim-scale-in.anim-fade-in-active {
  opacity: 1;
  transform: scale(1);
}

/* Exit Active State (Scrolling out of View) */
.anim-fade-in.anim-fade-out-active,
.anim-slide-up.anim-fade-out-active {
  opacity: 0;
  transform: translateY(-25px);
}

.anim-scale-in.anim-fade-out-active {
  opacity: 0;
  transform: scale(0.94);
}

/* Stagger Delays for Grouped Elements */
.anim-delay-1 { transition-delay: 0.1s; }
.anim-delay-2 { transition-delay: 0.2s; }
.anim-delay-3 { transition-delay: 0.3s; }
.anim-delay-4 { transition-delay: 0.4s; }

/* Page Level Main Content Transitions */
main.main-content-transition {
  animation: pageContentEnter 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

main.main-content-exit {
  animation: pageContentExit 0.35s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes pageContentEnter {
  0% {
    opacity: 0;
    transform: translateY(18px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pageContentExit {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-14px);
  }
}

/* Button & Card Micro-Interactions */
.btn-animate {
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-animate::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120%;
  height: 120%;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  transition: transform 0.5s ease-out, opacity 0.5s ease-out;
}

.btn-animate:active::after {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  transition: 0s;
}

/* Reduced Motion Preferences */
@media (prefers-reduced-motion: reduce) {
  .anim-fade-in,
  .anim-slide-up,
  .anim-scale-in,
  main.main-content-transition,
  main.main-content-exit,
  .splash-loader-overlay {
    transition: none !important;
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
