/* Animations CSS - Transitions, Keyframes, and Interactive States */

/* Fade Animations */
.fade-in {
  animation: fadeIn var(--transition-normal) ease-out;
}

.fade-out {
  animation: fadeOut var(--transition-normal) ease-out;
}

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

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

/* Slide Animations */
.slide-in-right {
  animation: slideInRight var(--transition-normal) ease-out;
}

.slide-in-left {
  animation: slideInLeft var(--transition-normal) ease-out;
}

.slide-in-up {
  animation: slideInUp var(--transition-normal) ease-out;
}

.slide-in-down {
  animation: slideInDown var(--transition-normal) ease-out;
}

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

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

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

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

/* Scale Animations */
.scale-in {
  animation: scaleIn var(--transition-normal) ease-out;
}

.scale-out {
  animation: scaleOut var(--transition-normal) ease-out;
}

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

/* Loading Animations */
.loading-dots {
  animation: loadingDots 1.5s infinite ease-in-out;
}

.loading-dots::after {
  content: '';
  animation: loadingDotsAfter 1.5s infinite ease-in-out;
}

@keyframes loadingDots {
  0%, 20% {
    content: '.';
  }
  40% {
    content: '..';
  }
  60%, 100% {
    content: '...';
  }
}

/* Bounce Animation */
.bounce {
  animation: bounce 0.6s ease-in-out;
}

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

/* Shake Animation */
.shake {
  animation: shake 0.5s ease-in-out;
}

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

/* Typing Animation */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.typing-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--text-muted);
  animation: typingDot 1.5s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
  animation-delay: 0s;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingDot {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  30% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Progress Bar Animation */
.progress-bar {
  width: 100%;
  height: 4px;
  background-color: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--primary-color);
  border-radius: 2px;
  transition: width var(--transition-slow) ease-out;
}

.progress-bar-indeterminate {
  position: relative;
  background-color: var(--bg-tertiary);
  overflow: hidden;
}

.progress-bar-indeterminate::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background-color: var(--primary-color);
  animation: progressIndeterminate 2s infinite linear;
}

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

/* Hover Effects */
.hover-lift {
  transition: all var(--transition-fast);
}

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

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

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

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

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

/* Focus Effects */
.focus-ring {
  transition: all var(--transition-fast);
}

.focus-ring:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 122, 204, 0.1);
}

.focus-ring:focus-visible {
  box-shadow: 0 0 0 3px rgba(0, 122, 204, 0.3);
}

/* State Transitions */
.state-transition {
  transition: all var(--transition-normal);
}

/* Smooth scroll */
.smooth-scroll {
  scroll-behavior: smooth;
}

/* Text animations */
.text-shimmer {
  background: linear-gradient(
    90deg,
    var(--text-muted) 0%,
    var(--text-primary) 50%,
    var(--text-muted) 100%
  );
  background-size: 200% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 2s infinite ease-in-out;
}

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

/* Ripple Effect */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.ripple:active::before {
  width: 300px;
  height: 300px;
}

/* Breathing animation for active states */
.breathing {
  animation: breathing 3s infinite ease-in-out;
}

@keyframes breathing {
  0%, 100% {
    opacity: 0.8;
  }
  50% {
    opacity: 1;
  }
}

/* Slide animation for panels */
.slide-panel-enter {
  transform: translateX(100%);
  opacity: 0;
}

.slide-panel-enter-active {
  transform: translateX(0);
  opacity: 1;
  transition: all var(--transition-slow) ease-out;
}

.slide-panel-exit {
  transform: translateX(0);
  opacity: 1;
}

.slide-panel-exit-active {
  transform: translateX(100%);
  opacity: 0;
  transition: all var(--transition-slow) ease-in;
}

/* Stagger animation for list items */
.stagger-item {
  opacity: 0;
  transform: translateY(20px);
  animation: staggerIn var(--transition-normal) ease-out forwards;
}

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

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

/* Loading skeleton animation */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 25%,
    var(--bg-tertiary) 50%,
    var(--bg-secondary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton 1.5s infinite ease-in-out;
  border-radius: var(--radius-sm);
}

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

/* Micro-interactions */
.micro-bounce {
  transition: transform 0.1s ease-out;
}

.micro-bounce:active {
  transform: scale(0.98);
}

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

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

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .smooth-scroll {
    scroll-behavior: auto;
  }
}