/* -------------------------------------------------------------------
 * Purposeful, Subtle CSS Animations & Keyframes
 * ------------------------------------------------------------------- */

/* View Transitions */
@keyframes fadeInSlide {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-section.active-view {
  animation: fadeInSlide 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Chat Message Entrance */
@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chat-bubble {
  animation: messageIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Modal Dialog Fade & Scale */
@keyframes modalBackdropFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.modal-backdrop {
  animation: modalBackdropFade 0.18s ease-out forwards;
}

.modal-dialog {
  animation: modalDialogPop 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Toast Notification Slide-In */
@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast {
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Skeleton Wave Loading */
@keyframes skeleton-wave {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Subtle Spinner for Real Processing */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(85, 124, 101, 0.25);
  border-top-color: var(--primary-accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  display: inline-block;
}

/* Insight Highlight Pulse (Runs once on newly created analysis) */
@keyframes insightHighlight {
  0% {
    background-color: rgba(85, 124, 101, 0.18);
  }
  100% {
    background-color: transparent;
  }
}

.newly-generated {
  animation: insightHighlight 1.5s ease-out forwards;
}

/* Expandable Accordion Transition */
.accordion-content {
  transition: max-height 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  overflow: hidden;
}

/* Button Press Tactile Feel */
.btn:active:not(:disabled) {
  transform: scale(0.98);
}

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