/* Page load animations */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

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

/* Staggered entrance */
.header {
  animation: fadeUp 0.5s ease-out;
}

.dropzone-wrapper {
  animation: fadeUp 0.5s ease-out 0.1s both;
}

.options-panel {
  animation: fadeUp 0.5s ease-out 0.2s both;
}

/* File items animate in */
.file-item {
  animation: slideIn 0.3s ease-out both;
}

.file-item:nth-child(1) { animation-delay: 0s; }
.file-item:nth-child(2) { animation-delay: 0.05s; }
.file-item:nth-child(3) { animation-delay: 0.1s; }
.file-item:nth-child(4) { animation-delay: 0.15s; }
.file-item:nth-child(5) { animation-delay: 0.2s; }

/* Result items */
.result-item {
  animation: fadeUp 0.4s ease-out both;
}

.result-item:nth-child(1) { animation-delay: 0s; }
.result-item:nth-child(2) { animation-delay: 0.08s; }
.result-item:nth-child(3) { animation-delay: 0.16s; }
.result-item:nth-child(4) { animation-delay: 0.24s; }

/* Progress section */
.progress-section:not(.hidden) {
  animation: fadeIn 0.3s ease-out;
}

/* Processing indicator */
.progress-section.processing #progressText::after {
  content: '';
  animation: pulse 1.5s ease-in-out infinite;
}

/* Preview image */
.preview-container img {
  animation: fadeUp 0.4s ease-out;
}

/* Dropzone drag state */
.dropzone.dragover .dropzone-icon {
  animation: bounce 0.4s ease;
}

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

/* Button loading state */
.btn-convert.loading {
  pointer-events: none;
  position: relative;
}

.btn-convert.loading span {
  opacity: 0;
}

.btn-convert.loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--paper);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Section reveal */
.file-list:not(.hidden),
.results-section:not(.hidden),
.viewer-section:not(.hidden) {
  animation: fadeUp 0.4s ease-out;
}

/* Focus ring animation */
@keyframes focusRing {
  0% { outline-offset: 0; }
  50% { outline-offset: 3px; }
  100% { outline-offset: 1px; }
}

.dropzone:focus-visible {
  animation: focusRing 0.3s ease-out forwards;
}

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