/**
 * 🎬 Animations & Micro-Interactions
 * Time Tracker v2 - Fancy UI
 */

/* ========================================
   Fade Animations
   ======================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ========================================
   Slide Animations
   ======================================== */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ========================================
   Bounce & Spring Animations
   ======================================== */
@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-5px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(5px);
  }
}

/* ========================================
   Glow & Shimmer
   ======================================== */
@keyframes glow {
  0%,
  100% {
    box-shadow: 0 0 5px rgba(var(--color-primary-rgb), 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(var(--color-primary-rgb), 0.8);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ========================================
   Utility Classes
   ======================================== */
.animate-fadeIn {
  animation: fadeIn 0.3s ease-out;
}

.animate-fadeInUp {
  animation: fadeInUp 0.4s ease-out;
}

.animate-fadeInDown {
  animation: fadeInDown 0.4s ease-out;
}

.animate-fadeInScale {
  animation: fadeInScale 0.3s ease-out;
}

.animate-slideInRight {
  animation: slideInRight 0.4s ease-out;
}

.animate-slideInLeft {
  animation: slideInLeft 0.4s ease-out;
}

.animate-bounceIn {
  animation: bounceIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-shake {
  animation: shake 0.5s ease-in-out;
}

.animate-glow {
  animation: glow 2s ease-in-out infinite;
}

/* ========================================
   Staggered List Animation
   ======================================== */
.stagger-list > * {
  opacity: 0;
  animation: fadeInUp 0.4s ease-out forwards;
}

.stagger-list > *:nth-child(1) {
  animation-delay: 0.05s;
}
.stagger-list > *:nth-child(2) {
  animation-delay: 0.1s;
}
.stagger-list > *:nth-child(3) {
  animation-delay: 0.15s;
}
.stagger-list > *:nth-child(4) {
  animation-delay: 0.2s;
}
.stagger-list > *:nth-child(5) {
  animation-delay: 0.25s;
}
.stagger-list > *:nth-child(6) {
  animation-delay: 0.3s;
}
.stagger-list > *:nth-child(7) {
  animation-delay: 0.35s;
}
.stagger-list > *:nth-child(8) {
  animation-delay: 0.4s;
}
.stagger-list > *:nth-child(9) {
  animation-delay: 0.45s;
}
.stagger-list > *:nth-child(10) {
  animation-delay: 0.5s;
}

/* ========================================
   Skeleton Loading
   ======================================== */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-elevated) 25%,
    var(--surface-hover) 50%,
    var(--surface-elevated) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
}

.skeleton-text:last-child {
  width: 70%;
}

.skeleton-circle {
  border-radius: 50%;
}

.skeleton-button {
  height: 40px;
  width: 120px;
}

/* ========================================
   Hover Lift Effect
   ======================================== */
.hover-lift {
  transition: transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* ========================================
   Click Ripple Effect (CSS only)
   ======================================== */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
}

.ripple:active::after {
  width: 200px;
  height: 200px;
  opacity: 0;
  transition: width 0.3s ease-out, height 0.3s ease-out, opacity 0.3s ease-out;
}

/* ========================================
   Number Counter Animation
   ======================================== */
.counter-animate {
  display: inline-block;
  transition: transform 0.2s ease-out;
}

.counter-animate.updating {
  transform: scale(1.1);
  color: var(--color-primary);
}

/* ========================================
   Success/Error Feedback
   ======================================== */
.feedback-success {
  animation: bounceIn 0.5s ease-out;
  color: var(--color-success);
}

.feedback-error {
  animation: shake 0.5s ease-out;
  color: var(--color-danger);
}

/* ========================================
   Card Entrance Animation
   ======================================== */
.card-enter {
  animation: fadeInScale 0.3s ease-out;
}

/* ========================================
   Button Press Effect
   ======================================== */
.btn-press:active {
  transform: scale(0.97);
}

/* ========================================
   Focus Ring Animation
   ======================================== */
@keyframes focus-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(var(--color-primary-rgb), 0.4);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(var(--color-primary-rgb), 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(var(--color-primary-rgb), 0);
  }
}

.focus-animate:focus {
  animation: focus-ring 0.4s ease-out;
}

/* ========================================
   Page Transition
   ======================================== */
.page-enter {
  animation: fadeInUp 0.3s ease-out;
}

.page-exit {
  animation: fadeIn 0.2s ease-out reverse;
}

/* ========================================
   Reduced Motion
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
