/* ===== Page Transitions ===== */
.page-transition {
  animation: page-fade-in 0.3s ease;
}

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

/* ===== Card Entrance ===== */
.post-card {
  animation: card-entrance 0.4s ease backwards;
}

.post-card:nth-child(1) { animation-delay: 0.05s; }
.post-card:nth-child(2) { animation-delay: 0.1s; }
.post-card:nth-child(3) { animation-delay: 0.15s; }
.post-card:nth-child(4) { animation-delay: 0.2s; }
.post-card:nth-child(5) { animation-delay: 0.25s; }
.post-card:nth-child(6) { animation-delay: 0.3s; }
.post-card:nth-child(7) { animation-delay: 0.35s; }
.post-card:nth-child(8) { animation-delay: 0.4s; }

@keyframes card-entrance {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ===== Snack Animation ===== */
.snack-btn {
  position: relative;
  overflow: visible;
}

.snack-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--snack-color);
  border-radius: 50%;
  pointer-events: none;
}

.snack-burst .snack-particle:nth-child(1) { animation: burst 0.5s ease-out forwards; --angle: 0deg; }
.snack-burst .snack-particle:nth-child(2) { animation: burst 0.5s ease-out forwards; --angle: 45deg; }
.snack-burst .snack-particle:nth-child(3) { animation: burst 0.5s ease-out forwards; --angle: 90deg; }
.snack-burst .snack-particle:nth-child(4) { animation: burst 0.5s ease-out forwards; --angle: 135deg; }
.snack-burst .snack-particle:nth-child(5) { animation: burst 0.5s ease-out forwards; --angle: 180deg; }
.snack-burst .snack-particle:nth-child(6) { animation: burst 0.5s ease-out forwards; --angle: 225deg; }
.snack-burst .snack-particle:nth-child(7) { animation: burst 0.5s ease-out forwards; --angle: 270deg; }
.snack-burst .snack-particle:nth-child(8) { animation: burst 0.5s ease-out forwards; --angle: 315deg; }

@keyframes burst {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--angle)) translateX(0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--angle)) translateX(40px);
  }
}

/* ===== Pulse Animation ===== */
.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* ===== Shake Animation ===== */
.shake {
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

/* ===== Bounce Animation ===== */
.bounce {
  animation: bounce 0.5s ease;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ===== Fade In Up ===== */
.fade-in-up {
  animation: fade-in-up 0.4s ease;
}

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

/* ===== Wiggle ===== */
.wiggle {
  animation: wiggle 0.3s ease;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-5deg); }
  75% { transform: rotate(5deg); }
}

/* ===== Glow ===== */
.glow {
  animation: glow 1.5s ease-in-out infinite alternate;
}

@keyframes glow {
  from {
    box-shadow: 0 0 5px var(--snack-color), 0 0 10px var(--snack-color);
  }
  to {
    box-shadow: 0 0 10px var(--snack-color), 0 0 20px var(--snack-color), 0 0 30px var(--snack-color);
  }
}

/* ===== HTMX Loading States ===== */
.htmx-request {
  opacity: 0.7;
  pointer-events: none;
}

.htmx-swapping {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.htmx-settling {
  opacity: 1;
  transition: opacity 0.2s ease;
}

/* ===== Cat Face Animation ===== */
.cat-face {
  display: inline-block;
}

.cat-face:hover {
  animation: cat-wiggle 0.5s ease;
}

@keyframes cat-wiggle {
  0%, 100% { transform: rotate(0) scale(1); }
  25% { transform: rotate(-10deg) scale(1.1); }
  75% { transform: rotate(10deg) scale(1.1); }
}

/* ===== Loading Dots ===== */
.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  animation: dot-bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes dot-bounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* ===== Success Checkmark ===== */
.success-checkmark {
  width: 80px;
  height: 80px;
  margin: 0 auto;
}

.success-checkmark .check-icon {
  width: 80px;
  height: 80px;
  position: relative;
  border-radius: 50%;
  box-sizing: content-box;
  border: 4px solid var(--success);
}

.success-checkmark .check-icon::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 25px;
  height: 50px;
  border: solid var(--success);
  border-width: 0 4px 4px 0;
  transform: translate(-50%, -60%) rotate(45deg);
  animation: checkmark 0.3s ease-in-out 0.2s forwards;
  opacity: 0;
}

@keyframes checkmark {
  from {
    opacity: 0;
    transform: translate(-50%, -60%) rotate(45deg) scale(0);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -60%) rotate(45deg) scale(1);
  }
}
