/**
 * animations.css - Animation classes and keyframes
 * Reusable animations for scroll effects and interactions
 */

/* ===========================
   Fade Animations
   =========================== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@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);
  }
}

/* ===========================
   Scale Animations
   =========================== */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scaleOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.8);
  }
}

/* ===========================
   Slide Animations
   =========================== */
@keyframes slideInUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

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

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

/* ===========================
   Rotation Animations
   =========================== */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes rotateIn {
  from {
    opacity: 0;
    transform: rotate(-180deg) scale(0.5);
  }
  to {
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
}

/* ===========================
   Bounce Animations
   =========================== */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-20px);
  }
  60% {
    transform: translateY(-10px);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

/* ===========================
   Shake Animation
   =========================== */
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-10px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(10px);
  }
}

/* ===========================
   Pulse Animations
   =========================== */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(0, 160, 178, 0.7);
  }
  50% {
    box-shadow: 0 0 0 15px rgba(0, 160, 178, 0);
  }
}

/* ===========================
   Ripple Effect
   =========================== */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  animation: ripple 0.6s ease-out;
  pointer-events: none;
}

/* ===========================
   Typing Animation
   =========================== */
@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink {
  0%, 100% {
    border-color: transparent;
  }
  50% {
    border-color: currentColor;
  }
}

/* ===========================
   Loading Animations
   =========================== */
@keyframes spinner {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes dotPulse {
  0%, 100% {
    opacity: 0.4;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ===========================
   Wave Animation
   =========================== */
@keyframes wave {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* ===========================
   Gradient Animation
   =========================== */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ===========================
   Utility Animation Classes
   =========================== */
.animated {
  animation-duration: 0.6s;
  animation-fill-mode: both;
}

.animated.fast {
  animation-duration: 0.3s;
}

.animated.slow {
  animation-duration: 1s;
}

.animated.delay-1 {
  animation-delay: 0.1s;
}

.animated.delay-2 {
  animation-delay: 0.2s;
}

.animated.delay-3 {
  animation-delay: 0.3s;
}

.animated.delay-4 {
  animation-delay: 0.4s;
}

.animated.delay-5 {
  animation-delay: 0.5s;
}

/* Animation class names */
.fadeIn { animation-name: fadeIn; }
.fadeOut { animation-name: fadeOut; }
.fadeInUp { animation-name: fadeInUp; }
.fadeInDown { animation-name: fadeInDown; }
.fadeInLeft { animation-name: fadeInLeft; }
.fadeInRight { animation-name: fadeInRight; }
.scaleIn { animation-name: scaleIn; }
.scaleOut { animation-name: scaleOut; }
.slideInUp { animation-name: slideInUp; }
.slideInDown { animation-name: slideInDown; }
.slideInLeft { animation-name: slideInLeft; }
.slideInRight { animation-name: slideInRight; }
.rotate { animation-name: rotate; animation-duration: 2s; animation-iteration-count: infinite; }
.rotateIn { animation-name: rotateIn; }
.bounce { animation-name: bounce; animation-duration: 1s; }
.bounceIn { animation-name: bounceIn; }
.shake { animation-name: shake; animation-duration: 0.5s; }
.pulse { animation-name: pulse; animation-duration: 1s; animation-iteration-count: infinite; }
.pulseGlow { animation-name: pulseGlow; animation-duration: 2s; animation-iteration-count: infinite; }

/* ===========================
   Hover Effects
   =========================== */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

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

.hover-scale {
  transition: transform var(--transition-base);
}

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

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

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(0, 160, 178, 0.5);
}

.hover-brighten {
  transition: filter var(--transition-base);
}

.hover-brighten:hover {
  filter: brightness(1.1);
}

/* ===========================
   Loading States
   =========================== */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-light) 0%,
    #e0e0e0 50%,
    var(--bg-light) 100%
  );
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
  border-radius: var(--border-radius-md);
}

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

/* ===========================
   Scroll-triggered Animations
   =========================== */
[data-animate] {
  opacity: 0;
}

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

/* ===========================
   Parallax Effect
   =========================== */
[data-parallax] {
  transition: transform 0.1s ease-out;
  will-change: transform;
}

/* ===========================
   Stagger Animation
   =========================== */
.stagger-container > * {
  opacity: 0;
  transform: translateY(20px);
}

.stagger-container.animate > *:nth-child(1) {
  animation: fadeInUp 0.6s ease forwards;
  animation-delay: 0.1s;
}

.stagger-container.animate > *:nth-child(2) {
  animation: fadeInUp 0.6s ease forwards;
  animation-delay: 0.2s;
}

.stagger-container.animate > *:nth-child(3) {
  animation: fadeInUp 0.6s ease forwards;
  animation-delay: 0.3s;
}

.stagger-container.animate > *:nth-child(4) {
  animation: fadeInUp 0.6s ease forwards;
  animation-delay: 0.4s;
}

.stagger-container.animate > *:nth-child(5) {
  animation: fadeInUp 0.6s ease forwards;
  animation-delay: 0.5s;
}

.stagger-container.animate > *:nth-child(6) {
  animation: fadeInUp 0.6s ease forwards;
  animation-delay: 0.6s;
}

/* ===========================
   Image Reveal Animation
   =========================== */
.image-reveal {
  position: relative;
  overflow: hidden;
}

.image-reveal::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--primary-color);
  transform: translateX(-100%);
}

.image-reveal.animate::after {
  animation: imageReveal 1.2s ease-in-out forwards;
}

@keyframes imageReveal {
  0% {
    transform: translateX(-100%);
  }
  50% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(100%);
  }
}

/* ===========================
   Counter Animation
   =========================== */
[data-counter] {
  font-variant-numeric: tabular-nums;
}

/* ===========================
   Button Effects
   =========================== */
.btn-shimmer {
  position: relative;
  overflow: hidden;
}

.btn-shimmer::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.5s;
}

.btn-shimmer:hover::before {
  left: 100%;
}

/* ===========================
   Text Effects
   =========================== */
.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-animated {
  background: linear-gradient(
    45deg,
    var(--primary-color),
    var(--accent-color),
    var(--primary-color)
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease infinite;
}

/* ===========================
   Card Flip Animation
   =========================== */
.flip-card {
  perspective: 1000px;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
}

.flip-card-back {
  transform: rotateY(180deg);
}

