/**
 * WhisperServer - Premium Animations
 * Smooth transitions and effects
 */

/* ============================================================================
   FADE ANIMATIONS
   ============================================================================ */
.fade-in {
  animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.fade-in-up {
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

.fade-in-down {
  animation: fadeInDown 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================================
   SLIDE ANIMATIONS
   ============================================================================ */
.slide-in-left {
  animation: slideInLeft 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

.slide-in-right {
  animation: slideInRight 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

/* ============================================================================
   SCALE ANIMATIONS
   ============================================================================ */
.scale-in {
  animation: scaleIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

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

/* ============================================================================
   BOUNCE ANIMATION
   ============================================================================ */
.bounce {
  animation: bounce 1s infinite;
}

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

/* ============================================================================
   SHAKE ANIMATION
   ============================================================================ */
.shake {
  animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
  10%, 90% {
    transform: translateX(-2px);
  }
  20%, 80% {
    transform: translateX(2px);
  }
  30%, 50%, 70% {
    transform: translateX(-4px);
  }
  40%, 60% {
    transform: translateX(4px);
  }
}

/* ============================================================================
   GLOW ANIMATIONS
   ============================================================================ */
.glow {
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
  from {
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4),
                0 0 20px rgba(99, 102, 241, 0.3),
                0 0 30px rgba(99, 102, 241, 0.2);
  }
  to {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.6),
                0 0 30px rgba(99, 102, 241, 0.5),
                0 0 40px rgba(99, 102, 241, 0.4);
  }
}

.glow-success {
  animation: glowSuccess 2s ease-in-out infinite alternate;
}

@keyframes glowSuccess {
  from {
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
  }
  to {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.8);
  }
}

/* ============================================================================
   TYPING ANIMATION
   ============================================================================ */
.typing::after {
  content: '|';
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* ============================================================================
   GRADIENT ANIMATION
   ============================================================================ */
.gradient-animate {
  background-size: 200% 200%;
  animation: gradientMove 3s ease infinite;
}

@keyframes gradientMove {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ============================================================================
   FLIP ANIMATION
   ============================================================================ */
.flip {
  animation: flip 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes flip {
  0% {
    transform: perspective(400px) rotateY(0);
  }
  100% {
    transform: perspective(400px) rotateY(360deg);
  }
}

/* ============================================================================
   FLOAT ANIMATION
   ============================================================================ */
.float {
  animation: float 3s ease-in-out infinite;
}

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

/* ============================================================================
   ATTENTION SEEKERS
   ============================================================================ */
.wiggle {
  animation: wiggle 0.8s ease-in-out;
}

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

.heartbeat {
  animation: heartbeat 1.3s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.1); }
  28% { transform: scale(1); }
  42% { transform: scale(1.1); }
  70% { transform: scale(1); }
}

/* ============================================================================
   DELAY UTILITIES
   ============================================================================ */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }

/* ============================================================================
   DURATION UTILITIES
   ============================================================================ */
.duration-fast { animation-duration: 300ms; }
.duration-normal { animation-duration: 500ms; }
.duration-slow { animation-duration: 800ms; }

/* ============================================================================
   HOVER EFFECTS
   ============================================================================ */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.hover-grow {
  transition: transform 0.3s ease;
}

.hover-grow:hover {
  transform: scale(1.05);
}

.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.6),
              0 0 40px rgba(99, 102, 241, 0.4);
}

/* ============================================================================
   PULSE RING - Live Indicators
   ============================================================================ */
.pulse-ring {
  position: relative;
}

.pulse-ring::before,
.pulse-ring::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
  transform: translate(-50%, -50%);
  animation: pulseRing 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.pulse-ring::after {
  animation-delay: 1s;
}

@keyframes pulseRing {
  0% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(0.8);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.5);
  }
}

/* ============================================================================
   SKELETON LOADERS
   ============================================================================ */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--gray-800) 0%,
    var(--gray-700) 50%,
    var(--gray-800) 100%
  );
  background-size: 200% 100%;
  animation: skeletonWave 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
  opacity: 0.7;
}

body.light-mode .skeleton {
  background: linear-gradient(
    90deg,
    var(--gray-200) 0%,
    var(--gray-100) 50%,
    var(--gray-200) 100%
  );
  background-size: 200% 100%;
}

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

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-title {
  height: 1.5rem;
  width: 60%;
  margin-bottom: 1rem;
}

.skeleton-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
}

/* ============================================================================
   STAGGER FADE-IN - For Lists
   ============================================================================ */
.stagger-fade-in {
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.stagger-fade-in:nth-child(1) { animation-delay: 0.05s; }
.stagger-fade-in:nth-child(2) { animation-delay: 0.1s; }
.stagger-fade-in:nth-child(3) { animation-delay: 0.15s; }
.stagger-fade-in:nth-child(4) { animation-delay: 0.2s; }
.stagger-fade-in:nth-child(5) { animation-delay: 0.25s; }
.stagger-fade-in:nth-child(6) { animation-delay: 0.3s; }
.stagger-fade-in:nth-child(7) { animation-delay: 0.35s; }
.stagger-fade-in:nth-child(8) { animation-delay: 0.4s; }
.stagger-fade-in:nth-child(9) { animation-delay: 0.45s; }
.stagger-fade-in:nth-child(10) { animation-delay: 0.5s; }

/* ============================================================================
   SLIDE UP - Toast Notifications
   ============================================================================ */
.slide-up {
  animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================================
   SHIMMER EFFECT
   ============================================================================ */
.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* ============================================================================
   TYPING INDICATOR
   ============================================================================ */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: currentColor;
  border-radius: 50%;
  opacity: 0.4;
  animation: typingDot 1.4s infinite;
}

.typing-indicator span:nth-child(1) {
  animation-delay: 0s;
}

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

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

@keyframes typingDot {
  0%, 60%, 100% {
    opacity: 0.4;
    transform: scale(1);
  }
  30% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* ============================================================================
   NUMBER COUNTER ANIMATION
   ============================================================================ */
.counter-animate {
  display: inline-block;
  transition: transform 0.3s ease;
}

.counter-animate.updated {
  animation: counterPop 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes counterPop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
    color: var(--primary);
  }
  100% {
    transform: scale(1);
  }
}

/* ============================================================================
   RIPPLE EFFECT
   ============================================================================ */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
  width: 300px;
  height: 300px;
  opacity: 0;
}


