/**
 * ANIMATIONS & MICRO-INTERACTIONS
 * Smooth, delightful animations inspired by macOS
 */

/* ============================================
   ENTRANCE 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 scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

/* Animation Classes */
.fade-in {
  animation: fadeIn var(--transition-base) ease-out;
}

.fade-in-up {
  animation: fadeInUp var(--transition-base) ease-out;
}

.fade-in-down {
  animation: fadeInDown var(--transition-base) ease-out;
}

.scale-in {
  animation: scaleIn var(--transition-base) ease-out;
}

.slide-in-right {
  animation: slideInRight var(--transition-base) ease-out;
}

/* Staggered Animations (for lists) */
.stagger-item {
  animation: fadeInUp var(--transition-base) ease-out;
}

.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; }

/* ============================================
   LOADING ANIMATIONS
   ============================================ */

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

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

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

.bounce {
  animation: bounce 1s ease-in-out infinite;
}

/* Shimmer Loading */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.shimmer {
  background: linear-gradient(
    90deg,
    var(--color-background) 0%,
    var(--color-surface) 50%,
    var(--color-background) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* ============================================
   HOVER EFFECTS
   ============================================ */

.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.hover-scale {
  transition: transform var(--transition-base);
}

.hover-scale:hover {
  transform: scale(1.02);
}

.hover-glow {
  position: relative;
  transition: all var(--transition-base);
}

.hover-glow::after {
  content: '';
  position: absolute;
  inset: -2px;
  background: var(--gradient-primary);
  border-radius: inherit;
  opacity: 0;
  z-index: -1;
  filter: blur(20px);
  transition: opacity var(--transition-base);
}

.hover-glow:hover::after {
  opacity: 0.5;
}

/* ============================================
   INTERACTIVE STATES
   ============================================ */

.interactive {
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
}

.interactive:active {
  transform: scale(0.98);
}

/* 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%);
  opacity: 0;
  pointer-events: none;
}

.ripple:active::after {
  width: 200px;
  height: 200px;
  opacity: 1;
  transition: width var(--transition-base), height var(--transition-base), opacity var(--transition-fast);
}

/* ============================================
   PROGRESS & LOADING
   ============================================ */

@keyframes progressIndeterminate {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(400%);
  }
}

.progress-bar {
  position: relative;
  width: 100%;
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width var(--transition-base);
}

.progress-indeterminate {
  position: relative;
  width: 100%;
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-indeterminate::after {
  content: '';
  position: absolute;
  width: 25%;
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  animation: progressIndeterminate 1.5s ease-in-out infinite;
}

/* ============================================
   NOTIFICATIONS & TOASTS
   ============================================ */

@keyframes slideInFromTop {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideOutToTop {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(-100%);
    opacity: 0;
  }
}

.toast {
  animation: slideInFromTop var(--transition-base) ease-out;
}

.toast.closing {
  animation: slideOutToTop var(--transition-base) ease-in;
}

/* ============================================
   FLOATING ACTION BUTTON
   ============================================ */

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

.floating {
  animation: float 3s ease-in-out infinite;
}

/* ============================================
   MODAL ANIMATIONS
   ============================================ */

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

@keyframes modalContentIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-backdrop {
  animation: modalBackdropIn var(--transition-base) ease-out;
}

.modal-content {
  animation: modalContentIn var(--transition-base) var(--transition-spring);
}

/* ============================================
   GLASSMORPHISM HOVER EFFECTS
   ============================================ */

.glass-interactive {
  position: relative;
  overflow: hidden;
}

.glass-interactive::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: translateX(-100%) rotate(45deg);
  transition: transform var(--transition-slow);
  pointer-events: none;
}

.glass-interactive:hover::before {
  transform: translateX(100%) rotate(45deg);
}

/* ============================================
   REVEAL ANIMATION (On Scroll)
   ============================================ */

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--transition-base), transform var(--transition-base);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   TYPING INDICATOR
   ============================================ */

@keyframes typingDot {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

.typing-indicator {
  display: flex;
  gap: 4px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-tertiary);
  animation: typingDot 1.4s ease-in-out infinite;
}

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

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

/* ============================================
   GRADIENT ANIMATION
   ============================================ */

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

.animated-gradient {
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
}

/* ============================================
   CONFETTI EFFECT (Success States)
   ============================================ */

@keyframes confetti {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  background: var(--color-primary-start);
  animation: confetti 3s ease-out forwards;
}

/* ============================================
   GIFT BUTTON ANIMATIONS
   ============================================ */

/* Shimmer effect for golden ribbon */
@keyframes ribbon-shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

/* Pulsing glow effect */
@keyframes gift-glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.3),
                0 4px 12px rgba(73, 158, 241, 0.2);
  }
  50% {
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.5),
                0 4px 16px rgba(73, 158, 241, 0.3);
  }
}

/* Ribbon tightening effect */
@keyframes ribbon-tighten {
  0%, 100% {
    transform: scaleX(1);
  }
  50% {
    transform: scaleX(0.98);
  }
}

/* Subtle rotation for the ribbon cross - avec centrage maintenu */
@keyframes ribbon-wobble {
  0%, 100% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  25% {
    transform: translate(-50%, -50%) rotate(-2deg);
  }
  75% {
    transform: translate(-50%, -50%) rotate(2deg);
  }
}

/* Float animation for gift effect */
@keyframes gift-float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

.will-change-transform {
  will-change: transform;
}

.will-change-opacity {
  will-change: opacity;
}

.gpu-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}
