/**
 * Micro-Interactions & Haptic-Like Visual Feedback
 * Apple-style subtle interactions and feedback
 */

/* Ripple Effect */
.elastic-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0);
  animation: ripple-animation 600ms cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

@keyframes ripple-animation {
  to {
    transform: scale(2);
    opacity: 0;
  }
}

/* Pulse Feedback (for notifications, alerts) */
.pulse-feedback {
  animation: pulse-feedback 400ms cubic-bezier(0.4, 0, 0.6, 1);
}

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

/* Success Bounce */
.success-bounce {
  animation: success-bounce 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes success-bounce {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.15);
  }
  50% {
    transform: scale(0.95);
  }
  70% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* Shake (for errors) */
.shake-feedback {
  animation: shake-feedback 400ms cubic-bezier(0.4, 0, 0.6, 1);
}

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

/* Wiggle (for attention) */
.wiggle-feedback {
  animation: wiggle-feedback 500ms ease-in-out;
}

@keyframes wiggle-feedback {
  0%, 100% {
    transform: rotate(0deg);
  }
  20%, 60% {
    transform: rotate(-3deg);
  }
  40%, 80% {
    transform: rotate(3deg);
  }
}

/* Glow Pulse (for focus states) */
.glow-pulse {
  position: relative;
}

.glow-pulse::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(235, 195, 120, 0.5), rgba(255, 215, 145, 0.5));
  opacity: 0;
  filter: blur(8px);
  transition: opacity 300ms ease;
}

.glow-pulse:focus::before,
.glow-pulse.active::before {
  opacity: 1;
  animation: glow-pulse-animation 2s ease-in-out infinite;
}

@keyframes glow-pulse-animation {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 0.8;
  }
}

/* Magnetic Hover (elements attract cursor) */
.magnetic-hover {
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.magnetic-hover:hover {
  transform: scale(1.03);
}

/* Button Press States */
.btn-press {
  transition: transform 100ms cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-press:active {
  transform: scale(0.96);
}

/* Lift on Hover */
.lift-hover {
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.lift-hover:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
}

/* Shimmer on Hover */
.shimmer-hover {
  position: relative;
  overflow: hidden;
}

.shimmer-hover::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transition: left 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.shimmer-hover:hover::after {
  left: 100%;
}

/* Scale Tap Feedback */
.tap-scale {
  transition: transform 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.tap-scale:active {
  transform: scale(0.95);
}

/* Rotate on Hover */
.rotate-hover {
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Slide In Underline */
.slide-underline {
  position: relative;
}

.slide-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: rgba(235, 195, 120, 0.8);
  transition: width 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-underline:hover::after {
  width: 100%;
}

/* Focus Ring (Apple-style) */
.focus-ring {
  outline: none;
  position: relative;
}

.focus-ring::before {
  content: '';
  position: absolute;
  inset: -4px;
  border: 2px solid rgba(235, 195, 120, 0.6);
  border-radius: inherit;
  opacity: 0;
  transition: opacity 200ms ease;
}

.focus-ring:focus::before,
.focus-ring:focus-visible::before {
  opacity: 1;
}

/* Loading Pulse */
.loading-pulse {
  animation: loading-pulse 1.5s ease-in-out infinite;
}

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

/* Heartbeat (for notifications) */
.heartbeat {
  animation: heartbeat 1.2s ease-in-out infinite;
}

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

/* Bounce In Entrance */
.bounce-in {
  animation: bounce-in 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes bounce-in {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

/* Slide Up Fade In */
.slide-up-fade {
  animation: slide-up-fade 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Float Animation (subtle continuous motion) */
.float {
  animation: float 3s ease-in-out infinite;
}

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

/* Magnetic Button (follows cursor slightly) */
.magnetic-button {
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

/* Gentle Scale on Focus */
.focus-scale:focus {
  transform: scale(1.02);
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Subtle Glow */
.subtle-glow {
  box-shadow: 0 0 20px rgba(235, 195, 120, 0.1);
  transition: box-shadow 300ms ease;
}

.subtle-glow:hover {
  box-shadow: 0 0 30px rgba(235, 195, 120, 0.2);
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .elastic-ripple,
  .pulse-feedback,
  .success-bounce,
  .shake-feedback,
  .wiggle-feedback,
  .glow-pulse,
  .shimmer-hover::after,
  .loading-pulse,
  .heartbeat,
  .bounce-in,
  .float {
    animation: none;
  }

  .lift-hover:hover,
  .magnetic-hover:hover,
  .rotate-hover:hover,
  .focus-scale:focus {
    transform: none;
  }

  .slide-underline::after {
    transition: none;
  }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Increase tap targets */
  .tap-scale,
  .btn-press {
    min-height: 44px;
    min-width: 44px;
  }

  /* Remove hover effects */
  .lift-hover:hover,
  .shimmer-hover:hover::after,
  .rotate-hover:hover,
  .subtle-glow:hover {
    transform: none;
    box-shadow: inherit;
  }

  /* Enhance active states */
  .tap-scale:active {
    transform: scale(0.93);
  }
}
