/* ===================================
   CSS Animations
   =================================== */

/* ===================================
   Keyframe Animations
   =================================== */

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

@keyframes scroll {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  50% {
    transform: translateY(8px);
    opacity: 0.7;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

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

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

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255, 107, 107, 0.7);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 107, 107, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255, 107, 107, 0);
  }
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(255, 107, 107, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.8);
  }
}

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

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

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

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

/* Morphing animation for nav toggle */
@keyframes morph {
  0% {
    border-radius: 0% 0% 0% 0%;
  }
  25% {
    border-radius: 50% 0% 0% 0%;
  }
  50% {
    border-radius: 50% 50% 0% 0%;
  }
  75% {
    border-radius: 50% 50% 50% 0%;
  }
  100% {
    border-radius: 50% 50% 50% 50%;
  }
}

/* Animated gradient background */
@keyframes gradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Counter animation */
@keyframes countTo {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ===================================
   Reveal Animations (on scroll)
   =================================== */

.reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.6s ease;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.reveal--left {
  transform: translateX(-50px);
}

.reveal--right {
  transform: translateX(50px);
}

.reveal--scale {
  transform: scale(0.8);
}

.reveal--rotate {
  transform: rotate(180deg) scale(0.5);
}

/* ===================================
   Animation Classes
   =================================== */

.animate-fadeIn {
  animation: fadeIn 0.6s ease-out forwards;
}

.animate-fadeInUp {
  animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fadeInLeft {
  animation: fadeInLeft 0.6s ease-out forwards;
}

.animate-fadeInRight {
  animation: fadeInRight 0.6s ease-out forwards;
}

.animate-pulse {
  animation: pulse 2s infinite;
}

.animate-shake {
  animation: shake 0.5s ease-in-out;
}

.animate-pulse-glow {
  animation: pulse-glow 2s infinite;
}

.animate-slideIn {
  animation: slideIn 0.3s ease-out forwards;
}

.animate-slideOut {
  animation: slideOut 0.3s ease-out forwards;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-bounce {
  animation: bounce 1s ease-in-out infinite;
}

.animate-morph {
  animation: morph 2s ease-in-out infinite alternate;
}

.animate-gradient {
  background-size: 200% 200%;
  animation: gradient 3s ease infinite;
}

.animate-count {
  animation: countTo 0.5s ease-out;
}

.animate-float {
  animation: float 4s ease-in-out infinite;
}

/* ===================================
   Staggered Animations
   =================================== */

.stagger > * {
  opacity: 0;
  transform: translateY(20px);
  animation: staggerFadeIn 0.6s ease-out forwards;
}

.stagger > *:nth-child(1) { animation-delay: 0.1s; }
.stagger > *:nth-child(2) { animation-delay: 0.2s; }
.stagger > *:nth-child(3) { animation-delay: 0.3s; }
.stagger > *:nth-child(4) { animation-delay: 0.4s; }
.stagger > *:nth-child(5) { animation-delay: 0.5s; }
.stagger > *:nth-child(6) { animation-delay: 0.6s; }

@keyframes staggerFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===================================
   Loading Animations
   =================================== */

.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: loading 1.5s infinite;
}

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

/* ===================================
   Hover Animations
   =================================== */

.hover-lift {
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.hover-lift:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.hover-grow {
  transition: transform var(--transition-fast);
}

.hover-grow:hover {
  transform: scale(1.05);
}

.hover-shrink {
  transition: transform var(--transition-fast);
}

.hover-shrink:hover {
  transform: scale(0.95);
}

.hover-rotate {
  transition: transform var(--transition-fast);
}

.hover-rotate:hover {
  transform: rotate(5deg);
}

.hover-glow {
  transition: all var(--transition-fast);
}

.hover-glow:hover {
  box-shadow: var(--shadow-glow);
}

.hover-swipe {
  position: relative;
  overflow: hidden;
}

.hover-swipe::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  transition: left var(--transition-fast);
}

.hover-swipe:hover::before {
  left: 100%;
}

.hover-zoom {
  position: relative;
  overflow: hidden;
}

.hover-zoom img {
  transition: transform var(--transition-slow);
}

.hover-zoom:hover img {
  transform: scale(1.2);
}

/* ===================================
   Text Animations
   =================================== */

.text-split {
  overflow: hidden;
}

.text-split .char {
  display: inline-block;
  transform: translateY(100%);
  animation: textSplit 0.6s ease-out forwards;
}

@keyframes textSplit {
  to {
    transform: translateY(0);
  }
}

.text-glow {
  animation: textGlow 2s ease-in-out infinite alternate;
}

@keyframes textGlow {
  from {
    text-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
  }
  to {
    text-shadow: 0 0 20px rgba(255, 107, 107, 0.8);
  }
}

.text-typing {
  overflow: hidden;
  border-right: 2px solid var(--color-primary);
  white-space: nowrap;
  animation: typing 3s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink-caret {
  from,
  to {
    border-color: transparent;
  }
  50% {
    border-color: var(--color-primary);
  }
}

/* ===================================
   Parallax Effect
   =================================== */

.parallax {
  position: relative;
  overflow: hidden;
}

.parallax__layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
}

.parallax__layer--back {
  transform: translateZ(-1px) scale(2);
}

.parallax__layer--mid {
  transform: translateZ(-0.5px) scale(1.5);
}

.parallax__layer--fore {
  transform: translateZ(0);
}

/* ===================================
   Progress Animations
   =================================== */

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--color-surface-light);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: var(--gradient-primary);
  width: 0%;
  transition: width 2s ease;
}

.animate-progress .progress-bar__fill {
  width: var(--progress);
}

/* ===================================
   Overlay Animations
   =================================== */

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
}

.overlay--active {
  opacity: 1;
  visibility: visible;
}

/* ===================================
   Notification Animations
   =================================== */

.notification {
  position: fixed;
  top: 100px;
  right: -300px;
  width: 280px;
  padding: var(--spacing-md);
  background: var(--color-surface);
  border-radius: var(--border-radius);
  border-left: 4px solid var(--color-primary);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-tooltip);
  transition: right var(--transition-normal);
}

.notification--show {
  right: 20px;
}

.notification--success {
  border-left-color: var(--color-secondary);
}

.notification--error {
  border-left-color: var(--color-primary);
}

/* ===================================
   Mobile Menu Animation
   =================================== */

.mobile-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
}

.mobile-overlay--active {
  opacity: 1;
  visibility: visible;
}

/* ===================================
   Smooth Transitions
   =================================== */

.fade-transition {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.fade-transition.active {
  opacity: 1;
}

.slide-up {
  transform: translateY(100%);
  transition: transform 0.5s ease;
}

.slide-up.active {
  transform: translateY(0);
}

.scale-in {
  transform: scale(0);
  opacity: 0;
  transition: all 0.5s ease;
}

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

/* ===================================
   Animation Presets
   =================================== */

.animate-on-load {
  animation-play-state: paused;
}

.animate-on-load.loaded {
  animation-play-state: running;
}

.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===================================
   Responsive Animation Adjustments
   =================================== */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .animate-on-scroll,
  .reveal {
    transition: none;
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 768px) {
  .stagger > * {
    animation-delay: 0s !important;
  }

  .text-typing {
    animation: none;
    border-right: none;
  }
}
