/* =========================================
   Trip Frogger — Animation System
   ========================================= */

/* ----- Keyframes ----- */
@keyframes tf-fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes tf-fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tf-slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes tf-slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

/* ----- Utility Classes ----- */
.tf-animate-fade {
  animation: tf-fadeIn 0.3s ease both;
}

.tf-animate-up {
  animation: tf-fadeInUp 0.4s ease both;
}

.tf-animate-slide-right {
  animation: tf-slideInRight 0.3s ease both;
}

.tf-animate-slide-down {
  animation: tf-slideDown 0.3s ease both;
}

/* Staggered children — apply to parent container */
.tf-stagger-children > * {
  animation: tf-fadeInUp 0.4s ease both;
}
.tf-stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.tf-stagger-children > *:nth-child(2) { animation-delay: 50ms; }
.tf-stagger-children > *:nth-child(3) { animation-delay: 100ms; }
.tf-stagger-children > *:nth-child(4) { animation-delay: 150ms; }
.tf-stagger-children > *:nth-child(5) { animation-delay: 200ms; }
.tf-stagger-children > *:nth-child(6) { animation-delay: 250ms; }
.tf-stagger-children > *:nth-child(7) { animation-delay: 300ms; }
.tf-stagger-children > *:nth-child(8) { animation-delay: 350ms; }

/* ----- Card Hover Lift ----- */
.tf-card-hover {
  transition: transform var(--tf-transition-fast), box-shadow var(--tf-transition-fast);
}

.tf-card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--tf-shadow-lg);
}

/* ----- Skeleton loading pulse ----- */
.tf-skeleton {
  background: linear-gradient(90deg, var(--tf-border) 25%, var(--tf-bg, #f1f5f9) 50%, var(--tf-border) 75%);
  background-size: 200% 100%;
  animation: tf-pulse 1.5s ease-in-out infinite;
  border-radius: var(--tf-radius-sm);
}

/* ---- Kawaii theme animations ---- */

/* Icon wiggle on hover (nav links, action buttons) */
[data-theme="kawaii"] .tf-icon-wiggle:hover svg,
[data-theme="kawaii"] .tf-icon-wiggle:hover .icon {
  animation: tf-iconWiggle 0.3s ease;
}

/* Card hover lift with tinted shadow */
[data-theme="kawaii"] .tf-card-lift {
  transition: transform var(--tf-transition-base, 0.2s ease),
              box-shadow var(--tf-transition-base, 0.2s ease);
}
[data-theme="kawaii"] .tf-card-lift:hover {
  transform: var(--tf-hover-transform, translateY(-2px));
  box-shadow: var(--tf-shadow-md);
}

/* Button press tactile feedback */
[data-theme="kawaii"] .tf-btn-press:active {
  transform: var(--tf-btn-active-transform, scale(0.97));
  transition: transform 0.1s ease;
}

/* Success pulse (apply temporarily after save) */
.tf-success-pulse {
  animation: tf-successPulse 0.6s ease;
}

/* Shake (apply to delete confirm dialogs) */
.tf-shake {
  animation: tf-shake 0.3s ease;
}

/* Entrance stagger for tab content */
[data-theme="kawaii"] .tf-entrance > * {
  opacity: 0;
  animation: tf-fadeInUp 0.3s ease forwards;
}
[data-theme="kawaii"] .tf-entrance > *:nth-child(1) { animation-delay: 0s; }
[data-theme="kawaii"] .tf-entrance > *:nth-child(2) { animation-delay: 0.05s; }
[data-theme="kawaii"] .tf-entrance > *:nth-child(3) { animation-delay: 0.1s; }
[data-theme="kawaii"] .tf-entrance > *:nth-child(4) { animation-delay: 0.15s; }
[data-theme="kawaii"] .tf-entrance > *:nth-child(5) { animation-delay: 0.2s; }

/* ----- Reduced motion ----- */
@media (prefers-reduced-motion: reduce) {
  .tf-animate-fade,
  .tf-animate-up,
  .tf-animate-slide-right,
  .tf-animate-slide-down,
  .tf-stagger-children > *,
  .tf-card-hover {
    animation: none !important;
    transition: none !important;
  }
}
