/* ========================================
   Animations & Transitions
   ======================================== */

/* ===== 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(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

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

/* ===== SLIDE ANIMATIONS ===== */
@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

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

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

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

/* ===== SCALE ANIMATIONS ===== */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

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

/* ===== PULSE ANIMATIONS ===== */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* ===== SPIN ANIMATIONS ===== */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

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

/* ===== GLOW ANIMATIONS ===== */
@keyframes glow {
  0%, 100% {
    box-shadow: var(--shadow-glow);
  }
  50% {
    box-shadow: var(--shadow-glow), 0 0 40px rgba(99, 102, 241, 0.3);
  }
}

@keyframes glow-accent {
  0%, 100% {
    box-shadow: var(--shadow-glow-accent);
  }
  50% {
    box-shadow: var(--shadow-glow-accent), 0 0 30px rgba(6, 182, 212, 0.25);
  }
}

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

@keyframes blink {
  0%, 49%, 100% {
    opacity: 1;
  }
  50%, 99% {
    opacity: 0;
  }
}

/* ===== UTILITY ANIMATION CLASSES ===== */

.animate-fadeIn {
  animation: fadeIn var(--transition-smooth) ease-in-out forwards;
}

.animate-fadeInUp {
  animation: fadeInUp var(--transition-smooth) ease-out forwards;
}

.animate-fadeInDown {
  animation: fadeInDown var(--transition-smooth) ease-out forwards;
}

.animate-fadeInLeft {
  animation: fadeInLeft var(--transition-smooth) ease-out forwards;
}

.animate-fadeInRight {
  animation: fadeInRight var(--transition-smooth) ease-out forwards;
}

.animate-slideInLeft {
  animation: slideInLeft var(--transition-smooth) ease-out forwards;
}

.animate-slideInRight {
  animation: slideInRight var(--transition-smooth) ease-out forwards;
}

.animate-scaleIn {
  animation: scaleIn var(--transition-smooth) ease-out forwards;
}

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

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

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

.animate-glow {
  animation: glow 3s ease-in-out infinite;
}

.animate-shimmer {
  background: linear-gradient(
    90deg,
    var(--color-bg-secondary) 25%,
    var(--color-bg-tertiary) 50%,
    var(--color-bg-secondary) 75%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* Stagger animation for lists */
.animate-stagger > * {
  animation: fadeInUp var(--transition-smooth) ease-out forwards;
}

.animate-stagger > :nth-child(1) { animation-delay: 0ms; }
.animate-stagger > :nth-child(2) { animation-delay: 50ms; }
.animate-stagger > :nth-child(3) { animation-delay: 100ms; }
.animate-stagger > :nth-child(4) { animation-delay: 150ms; }
.animate-stagger > :nth-child(5) { animation-delay: 200ms; }
.animate-stagger > :nth-child(n+6) { animation-delay: 250ms; }

/* Delay utilities */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-500 { animation-delay: 500ms; }

/* ===== MICRO-INTERACTIONS ===== */

/* Button press effect */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.btn:active::after {
  animation: ripple 600ms ease-out;
}

@keyframes ripple {
  to {
    width: 300px;
    height: 300px;
    opacity: 0;
  }
}

/* ===== LOADING STATES ===== */

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-bg-tertiary);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-dots {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  background: var(--color-primary);
  border-radius: 50%;
  animation: pulse 1.4s infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

/* ===== EMPTY STATE ANIMATION ===== */

.empty-state-icon {
  width: 100px;
  height: 100px;
  margin: 0 auto var(--space-6);
  opacity: 0.5;
  animation: fadeInUp var(--transition-slow) ease-out forwards;
}

.empty-state-text {
  animation: fadeInUp var(--transition-slow) ease-out forwards;
  animation-delay: 100ms;
}

/* ===== HOVER EFFECTS ===== */

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

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

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

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

/* ===== FOCUS STATES ===== */

.focus-ring:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Smooth page transitions */
.page-enter {
  animation: fadeInUp var(--transition-smooth) ease-out forwards;
}

.page-exit {
  animation: fadeOut var(--transition-smooth) ease-in forwards;
}
