/* Animations and transitions */

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

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

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

@keyframes correctPulse {
  0% {
    transform: scale(1);
    background-color: #e8f5e8;
  }
  50% {
    transform: scale(1.02);
    background-color: #c8e6c9;
  }
  100% {
    transform: scale(1);
    background-color: #e8f5e8;
  }
}

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

@keyframes bounce {
  0%,
  20%,
  53%,
  80%,
  100% {
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
    transform: translate3d(0, 0, 0);
  }
  40%,
  43% {
    animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
    transform: translate3d(0, -30px, 0);
  }
  70% {
    animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
    transform: translate3d(0, -15px, 0);
  }
  90% {
    transform: translate3d(0, -4px, 0);
  }
}

/* FLIP animation classes */
.flip-item {
  transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1);
}

.flip-item.flip-animating {
  transform: none !important;
}

/* Drag animations */
.timeline-item.dragging {
  transition: none !important;
  pointer-events: none;
}

.timeline-item:not(.dragging) {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Loading animations */
.loading-dots {
  display: inline-block;
}

.loading-dots::after {
  content: '';
  animation: loadingDots 1.5s steps(4, end) infinite;
}

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

/* Button press animations */
.btn-primary:active,
.btn-secondary:active {
  transform: scale(0.98);
}

.btn-control:active {
  transform: scale(0.95);
}

/* Timeline item interactions */
.timeline-item.placeholder:hover {
  transform: translateY(-1px) scale(1.01);
}

/* Screen transitions */
.screen-transition-enter {
  animation: slideUp 0.4s cubic-bezier(0.2, 0, 0.2, 1);
}

.screen-transition-exit {
  animation: slideDown 0.4s cubic-bezier(0.2, 0, 0.2, 1);
}

/* Placement feedback animations */
.placement-correct {
  animation: correctPulse 0.6s ease-out;
}

.placement-wrong {
  animation: wrongShake 0.5s ease-in-out;
}

/* Progress animations */
.progress-bar {
  width: 100%;
  height: 4px;
  background: #f0f0f0;
  border-radius: 2px;
  overflow: hidden;
  margin: 1rem 0;
}

.progress-fill {
  height: 100%;
  background: #007aff;
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* Audio visualization (if needed) */
.audio-bars {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 20px;
}

.audio-bar {
  width: 3px;
  background: #007aff;
  border-radius: 1px;
  animation: audioWave 1s ease-in-out infinite;
}

.audio-bar:nth-child(2) {
  animation-delay: 0.1s;
}

.audio-bar:nth-child(3) {
  animation-delay: 0.2s;
}

.audio-bar:nth-child(4) {
  animation-delay: 0.3s;
}

@keyframes audioWave {
  0%,
  100% {
    height: 4px;
  }
  50% {
    height: 20px;
  }
}

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

  .timeline-item:hover {
    transform: none;
  }

  .btn-primary:active,
  .btn-secondary:active,
  .btn-control:active {
    transform: none;
  }
}
