/* LifePilot Animations — Motion & Transitions */

/* === KEYFRAMES === */

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in-scale {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slide-in-left {
  from { opacity: 0; transform: translateX(-40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes logo-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

@keyframes fab-pulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(74, 155, 142, 0.3); }
  50% { box-shadow: 0 4px 24px rgba(74, 155, 142, 0.5); }
}

[data-theme="dark"] .fab {
  animation-name: fab-pulse-dark;
}

@keyframes fab-pulse-dark {
  0%, 100% { box-shadow: 0 4px 16px rgba(91, 184, 168, 0.25); }
  50% { box-shadow: 0 4px 24px rgba(91, 184, 168, 0.45); }
}

@keyframes draw-check {
  from { stroke-dashoffset: 24; }
  to { stroke-dashoffset: 0; }
}

@keyframes breathe-in {
  from { transform: scale(0.5); }
  to { transform: scale(1); }
}

@keyframes breathe-out {
  from { transform: scale(1); }
  to { transform: scale(0.5); }
}

@keyframes breathe-hold {
  from { transform: scale(1); }
  to { transform: scale(1); }
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.6); opacity: 0; }
}

@keyframes water-drop {
  0% { transform: translateY(-20px) scale(1); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateY(30px) scale(0.5); opacity: 0; }
}

@keyframes plant-bounce {
  0%, 100% { transform: scaleY(1); }
  30% { transform: scaleY(1.06); }
  60% { transform: scaleY(0.97); }
}

@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translateY(400px) rotate(720deg) scale(0); opacity: 0; }
}

@keyframes confetti-burst {
  0% { transform: translate(0,0) scale(0); opacity: 0; }
  20% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; }
}

@keyframes wave-pulse {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes compass-draw {
  from { stroke-dashoffset: 300; }
  to { stroke-dashoffset: 0; }
}

@keyframes needle-appear {
  from { transform: rotate(-90deg) scale(0); opacity: 0; }
  to { transform: rotate(0deg) scale(1); opacity: 1; }
}

@keyframes progress-ring {
  from { stroke-dashoffset: var(--ring-circumference); }
  to { stroke-dashoffset: var(--ring-offset); }
}

@keyframes number-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

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

/* === ANIMATION CLASSES === */

.animate-fade-in {
  animation: fade-in 0.4s ease forwards;
}

.animate-fade-in-up {
  animation: fade-in-up 0.5s ease forwards;
}

.animate-fade-in-scale {
  animation: fade-in-scale 0.4s ease forwards;
}

.animate-slide-right {
  animation: slide-in-right 0.35s ease forwards;
}

.animate-slide-left {
  animation: slide-in-left 0.35s ease forwards;
}

.animate-logo-breathe {
  animation: logo-breathe 4s ease-in-out infinite;
}

/* Staggered list items */
.stagger-item {
  animation: fade-in-up 0.4s ease both;
}

.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(6) { animation-delay: 250ms; }
.stagger-item:nth-child(7) { animation-delay: 300ms; }
.stagger-item:nth-child(8) { animation-delay: 350ms; }
.stagger-item:nth-child(9) { animation-delay: 400ms; }
.stagger-item:nth-child(10) { animation-delay: 450ms; }
.stagger-item:nth-child(11) { animation-delay: 500ms; }
.stagger-item:nth-child(12) { animation-delay: 550ms; }

/* Breathing exercise circle */
.breathing-circle {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.5s ease;
}

.breathing-circle.inhale {
  animation: breathe-in 4s ease forwards;
}

.breathing-circle.hold {
  animation: breathe-hold 7s linear forwards;
}

.breathing-circle.exhale {
  animation: breathe-out 8s ease forwards;
}

/* Pulse ring (for KOPFFREI button) */
.pulse-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--accent);
  animation: pulse-ring 2s ease-out infinite;
}

/* Confetti container */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confetti-fall 2s ease-in forwards;
}

/* Water animation */
.water-drops {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.water-drop {
  position: absolute;
  font-size: 16px;
  animation: water-drop 0.8s ease-in forwards;
}

.plant-bounce {
  animation: plant-bounce 0.5s ease forwards;
  transform-origin: bottom center;
}

/* Wave bars (voice recording) */
.voice-waves {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 40px;
}

.voice-wave-bar {
  width: 4px;
  height: 100%;
  border-radius: 2px;
  background: var(--primary);
  transform-origin: center;
}

.voice-waves.active .voice-wave-bar {
  animation: wave-pulse 0.8s ease-in-out infinite;
}

.voice-wave-bar:nth-child(1) { animation-delay: 0s; height: 60%; }
.voice-wave-bar:nth-child(2) { animation-delay: 0.1s; height: 80%; }
.voice-wave-bar:nth-child(3) { animation-delay: 0.2s; height: 100%; }
.voice-wave-bar:nth-child(4) { animation-delay: 0.3s; height: 70%; }
.voice-wave-bar:nth-child(5) { animation-delay: 0.15s; height: 90%; }
.voice-wave-bar:nth-child(6) { animation-delay: 0.25s; height: 60%; }
.voice-wave-bar:nth-child(7) { animation-delay: 0.05s; height: 80%; }

/* Screen transitions */
.screen-enter-right {
  animation: slide-in-right 0.3s ease forwards;
}

.screen-enter-left {
  animation: slide-in-left 0.3s ease 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;
  }
}
