/*
 * Onboarding Animations
 * Polished micro-interactions for delightful onboarding experience
 * Inspired by ChatGPT Atlas and Microsoft Mico
 */

/* Fade-in animation for journey items */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.onboarding-fade-in {
  animation: fadeInUp 0.4s ease-out forwards;
}

/* Staggered animation delay for list items */
.onboarding-fade-in:nth-child(1) { animation-delay: 0.05s; }
.onboarding-fade-in:nth-child(2) { animation-delay: 0.1s; }
.onboarding-fade-in:nth-child(3) { animation-delay: 0.15s; }
.onboarding-fade-in:nth-child(4) { animation-delay: 0.2s; }
.onboarding-fade-in:nth-child(5) { animation-delay: 0.25s; }
.onboarding-fade-in:nth-child(6) { animation-delay: 0.3s; }
.onboarding-fade-in:nth-child(7) { animation-delay: 0.35s; }
.onboarding-fade-in:nth-child(8) { animation-delay: 0.4s; }

/* Scale-in animation for suggested actions */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.onboarding-scale-in {
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Checkbox check animation */
@keyframes checkboxCheck {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.onboarding-checkbox-check {
  animation: checkboxCheck 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Progress bar fill animation */
@keyframes progressFill {
  from {
    transform: scaleX(0);
    transform-origin: left;
  }
  to {
    transform: scaleX(1);
    transform-origin: left;
  }
}

.onboarding-progress-fill {
  animation: progressFill 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Pulse animation for unread indicator */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.onboarding-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Slide-in from right for chat helper */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.onboarding-slide-in-right {
  animation: slideInRight 0.4s ease-out forwards;
}

/* Bounce animation for milestones */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.onboarding-bounce {
  animation: bounce 0.6s ease-in-out;
}

/* Shimmer effect for loading states */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.onboarding-shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.4) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* Glow effect for active items */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.8), 0 0 30px rgba(147, 51, 234, 0.4);
  }
}

.onboarding-glow {
  animation: glow 2s ease-in-out infinite;
}

/* Shake animation for errors */
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

.onboarding-shake {
  animation: shake 0.5s ease-in-out;
}

/* Smooth color transition for status changes */
.onboarding-color-transition {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Hover lift effect */
.onboarding-hover-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.onboarding-hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Icon rotation for collapsible sections */
@keyframes rotateIcon {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(180deg);
  }
}

.onboarding-icon-rotate {
  transition: transform 0.3s ease;
}

.onboarding-icon-rotate.rotated {
  transform: rotate(180deg);
}

/* Gradient animation for buttons */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.onboarding-gradient-animate {
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
}

/* Typing indicator */
@keyframes typing {
  0%, 60%, 100% {
    opacity: 0.3;
  }
  30% {
    opacity: 1;
  }
}

.onboarding-typing-dot {
  animation: typing 1.4s infinite;
}

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

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

/* Count-up animation for progress percentage */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.onboarding-count-up {
  animation: countUp 0.5s ease-out forwards;
}

/* Badge appearance */
@keyframes badgePop {
  0% {
    opacity: 0;
    transform: scale(0) rotate(-12deg);
  }
  50% {
    transform: scale(1.1) rotate(3deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.onboarding-badge-pop {
  animation: badgePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Confetti effect for milestones (CSS only) */
@keyframes confetti {
  0% {
    transform: translateY(0) rotateZ(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotateZ(720deg);
    opacity: 0;
  }
}

.onboarding-confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  animation: confetti 3s ease-out forwards;
  pointer-events: none;
}

/* Smooth opacity transitions */
.onboarding-fade-transition {
  transition: opacity 0.3s ease;
}

/* Button press effect */
.onboarding-button-press:active {
  transform: scale(0.97);
  transition: transform 0.1s ease;
}

/* Loading spinner */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

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

/* Celebration sparkle */
@keyframes sparkle {
  0%, 100% {
    opacity: 0;
    transform: scale(0);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.onboarding-sparkle {
  animation: sparkle 0.6s ease-in-out;
}

/* Smooth height transitions for collapsible content */
.onboarding-height-transition {
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease;
  overflow: hidden;
}

/* Focus ring animation */
@keyframes focusRing {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
  }
  100% {
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0);
  }
}

.onboarding-focus-ring:focus-visible {
  animation: focusRing 0.6s ease-out;
  outline: none;
}
