/**
 * Lightweight Animation Styles
 * Performance-friendly CSS animations
 */

/* ====== Base Animation States ====== */
[data-animate] {
  opacity: 0;
  will-change: opacity, transform;
}

[data-animate].animated {
  opacity: 1;
}

/* ====== Fade Animations ====== */
.animate-fadeIn {
  animation: fadeIn 0.6s ease-out forwards;
}

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

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

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

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

/* ====== Scale Animations ====== */
.animate-scaleIn {
  animation: scaleIn 0.5s ease-out forwards;
}

.animate-scaleUp {
  animation: scaleUp 0.5s ease-out forwards;
}

/* ====== Slide Animations ====== */
.animate-slideInUp {
  animation: slideInUp 0.6s ease-out forwards;
}

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

/* ====== Keyframe Definitions ====== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  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 scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scaleUp {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ====== Hover Animations ====== */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.hover-scale {
  transition: transform 0.3s ease;
}

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

.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(20, 157, 221, 0.3);
}

/* ====== Continuous Animations ====== */
.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

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

.animate-bounce {
  animation: bounce 2s ease infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

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

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* ====== Loading States ====== */
.skeleton-loading {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
}

@keyframes skeleton {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ====== Stagger Animation Delays ====== */
[data-animate-stagger] > *:nth-child(1) { animation-delay: 0ms; }
[data-animate-stagger] > *:nth-child(2) { animation-delay: 100ms; }
[data-animate-stagger] > *:nth-child(3) { animation-delay: 200ms; }
[data-animate-stagger] > *:nth-child(4) { animation-delay: 300ms; }
[data-animate-stagger] > *:nth-child(5) { animation-delay: 400ms; }
[data-animate-stagger] > *:nth-child(6) { animation-delay: 500ms; }
[data-animate-stagger] > *:nth-child(7) { animation-delay: 600ms; }
[data-animate-stagger] > *:nth-child(8) { animation-delay: 700ms; }

/* ====== Button Animations ====== */
.btn-animated {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

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

.btn-animated:hover::after {
  width: 300px;
  height: 300px;
}

/* ====== Link Underline Animation ====== */
.link-animated {
  position: relative;
  text-decoration: none;
}

.link-animated::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -2px;
  left: 0;
  background: currentColor;
  transition: width 0.3s ease;
}

.link-animated:hover::after {
  width: 100%;
}

/* ====== Card Tilt Effect ====== */
[data-tilt] {
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
}

/* ====== Reduced Motion ====== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  [data-animate] {
    opacity: 1 !important;
    transform: none !important;
  }
  
  .animate-pulse,
  .animate-float,
  .animate-bounce {
    animation: none !important;
  }
}

/* ====== Dark Mode Adjustments ====== */
[data-theme="dark"] .skeleton-loading {
  background: linear-gradient(90deg, #3a3b3c 25%, #4a4b4c 50%, #3a3b3c 75%);
  background-size: 200% 100%;
}

[data-theme="dark"] .hover-glow:hover {
  box-shadow: 0 0 20px rgba(100, 255, 218, 0.3);
}
