/* ========================================
   MICROINTERACTIONS & ANIMATIONS
   Smooth, delightful user feedback
   ======================================== */

/* ========================================
   1. BUTTON RIPPLE EFFECT
   ======================================== */

.btn, .mood-btn, .split-btn, .level-btn {
  position: relative;
  overflow: hidden;
}

.btn:active::after,
.mood-btn:active::after,
.split-btn:active::after,
.level-btn:active::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%);
  animation: ripple 0.6s ease-out;
}

@keyframes ripple {
  to {
    width: 300px;
    height: 300px;
    opacity: 0;
  }
}

/* ========================================
   2. LOADING SPINNER ON BUTTONS
   ======================================== */

.btn-loading {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
}

.btn-loading::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 8px;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
}

@keyframes spin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

/* ========================================
   3. CARD ENTRANCE ANIMATIONS
   ======================================== */

.card {
  animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:nth-child(1) { animation-delay: 0s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.2s; }
.card:nth-child(4) { animation-delay: 0.3s; }

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

/* ========================================
   4. EXERCISE CARD STAGGER
   ======================================== */

.exercise-card {
  animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.exercise-card:nth-child(1) { animation-delay: 0s; }
.exercise-card:nth-child(2) { animation-delay: 0.1s; }
.exercise-card:nth-child(3) { animation-delay: 0.2s; }
.exercise-card:nth-child(4) { animation-delay: 0.3s; }
.exercise-card:nth-child(5) { animation-delay: 0.4s; }

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

/* ========================================
   5. HOVER SCALE EFFECT
   ======================================== */

.recipe-card,
.exercise-card,
.stat-box {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.recipe-card:hover,
.stat-box:hover {
  transform: translateY(-2px) scale(1.01);
}

/* ========================================
   6. FOCUS GLOW EFFECT
   ======================================== */

input:focus,
select:focus,
textarea:focus {
  animation: focusGlow 0.3s ease-out;
}

@keyframes focusGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.4);
  }
  100% {
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
  }
}

/* ========================================
   7. SUCCESS MESSAGE SLIDE IN
   ======================================== */

.success-message {
  animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   8. PROGRESS BAR ANIMATION
   ======================================== */

.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-orange), var(--neon-blue));
  border-radius: 2px;
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 1.5s infinite;
}

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

/* ========================================
   9. TOOLTIP HOVER
   ======================================== */

[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  font-size: 0.85rem;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1000;
}

[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* ========================================
   10. SKELETON LOADING
   ======================================== */

.skeleton {
  background: linear-gradient(90deg, 
    rgba(255, 255, 255, 0.05) 25%, 
    rgba(255, 255, 255, 0.1) 50%, 
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s infinite;
  border-radius: 8px;
}

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

/* ========================================
   11. SMOOTH SCROLL BEHAVIOR
   ======================================== */

html {
  scroll-behavior: smooth;
}

/* ========================================
   12. BADGE PULSE
   ======================================== */

.shopping-badge {
  animation: badgePulse 2s ease-in-out infinite;
}

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