/**
 * Neumorphism 2.0 Animations & Micro-Interactions
 * Following UX Guideline: "Micro Interactions Everywhere"
 *
 * Every action must be confirmed by movement, light, or micro-vibration
 * Animation speed: 0.2-0.3s cubic-bezier(0.25, 0.1, 0.25, 1)
 */

/* ============================================================================
   MICRO INTERACTIONS
   ========================================================================== */

/* Gentle Hover Lift */
.hover-lift {
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
}

.hover-lift:hover {
  transform: translateY(-4px);
}

.hover-lift:active {
  transform: translateY(0);
}

/* Scale on Hover */
.hover-scale {
  transition: transform var(--transition-smooth);
}

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

.hover-scale:active {
  transform: scale(0.98);
}

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

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

/* Bounce Animation */
.bounce {
  animation: bounce 1s ease-in-out infinite;
}

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

/* ============================================================================
   BUTTON INTERACTIONS
   ========================================================================== */

/* Ripple Effect */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

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

.btn-ripple:active::after {
  width: 300px;
  height: 300px;
}

/* Press Down Effect */
.btn-press {
  transition: all var(--transition-quick);
}

.btn-press:active {
  transform: scale(0.95);
  box-shadow: var(--shadow-neumorphic-inset);
}

/* Glow on Hover */
.btn-glow:hover {
  box-shadow:
    0 0 20px color-mix(in srgb, var(--accent) 40%, transparent),
    var(--shadow-neumorphic-hover);
}

/* ============================================================================
   CARD INTERACTIONS
   ========================================================================== */

/* Card Tilt on Hover */
.card-tilt {
  transition: transform var(--transition-smooth);
}

.card-tilt:hover {
  transform: perspective(1000px) rotateX(2deg) rotateY(2deg);
}

/* Card Expand */
.card-expand {
  transition: all var(--transition-smooth);
}

.card-expand:hover {
  transform: scale(1.03);
  z-index: 10;
}

/* 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.2),
    transparent);
  animation: shimmer 2s infinite;
}

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

/* ============================================================================
   LOADING STATES
   ========================================================================== */

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg,
    var(--base) 25%,
    color-mix(in srgb, var(--base) 90%, white) 50%,
    var(--base) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

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

/* Fade In */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

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

/* Slide In from Bottom */
.slide-in-bottom {
  animation: slideInBottom 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

/* Slide In from Top */
.slide-in-top {
  animation: slideInTop 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

/* Slide In from Left */
.slide-in-left {
  animation: slideInLeft 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

/* Slide In from Right */
.slide-in-right {
  animation: slideInRight 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

/* ============================================================================
   INPUT INTERACTIONS
   ========================================================================== */

/* Focus Glow */
.input-glow:focus {
  animation: inputGlow 0.3s ease-out;
}

@keyframes inputGlow {
  0% {
    box-shadow: var(--shadow-neumorphic-inset);
  }
  50% {
    box-shadow:
      inset 4px 4px 8px rgba(0, 0, 0, 0.15),
      inset -4px -4px 8px rgba(255, 255, 255, 0.5),
      0 0 20px color-mix(in srgb, var(--accent) 50%, transparent);
  }
  100% {
    box-shadow:
      inset 4px 4px 8px rgba(0, 0, 0, 0.15),
      inset -4px -4px 8px rgba(255, 255, 255, 0.5),
      0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
  }
}

/* Shake on Error */
.shake {
  animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

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

/* ============================================================================
   NOTIFICATION & TOAST ANIMATIONS
   ========================================================================== */

/* Toast Slide In */
.toast-slide-in {
  animation: toastSlideIn 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

@keyframes toastSlideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Toast Slide Out */
.toast-slide-out {
  animation: toastSlideOut 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

@keyframes toastSlideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

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

/* Modal Zoom In */
.modal-zoom-in {
  animation: modalZoomIn 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

/* Modal Zoom Out */
.modal-zoom-out {
  animation: modalZoomOut 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

/* ============================================================================
   NEON THEME ANIMATIONS
   ========================================================================== */

/* Neon Glow Pulse */
.theme-neon .neon-pulse {
  animation: neonPulse 2s ease-in-out infinite;
}

@keyframes neonPulse {
  0%, 100% {
    text-shadow:
      0 0 6px var(--accent),
      0 0 16px var(--accent),
      0 0 30px color-mix(in srgb, var(--accent) 70%, white);
    box-shadow:
      0 0 10px color-mix(in srgb, var(--accent) 70%, black),
      0 0 25px color-mix(in srgb, var(--accent) 60%, black);
  }
  50% {
    text-shadow:
      0 0 10px var(--accent),
      0 0 25px var(--accent),
      0 0 45px color-mix(in srgb, var(--accent) 80%, white);
    box-shadow:
      0 0 15px color-mix(in srgb, var(--accent) 80%, black),
      0 0 35px color-mix(in srgb, var(--accent) 70%, black);
  }
}

/* Neon Flicker */
.theme-neon .neon-flicker {
  animation: neonFlicker 4s linear infinite;
}

@keyframes neonFlicker {
  0%, 19.999%, 22%, 62.999%, 64%, 64.999%, 70%, 100% {
    opacity: 1;
  }
  20%, 21.999%, 63%, 63.999%, 65%, 69.999% {
    opacity: 0.4;
  }
}

/* ============================================================================
   PAGE TRANSITION ANIMATIONS
   ========================================================================== */

/* Page Fade In */
.page-fade-in {
  animation: pageFadeIn 0.6s ease-out;
}

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

/* Stagger Animation (for lists) */
.stagger-item {
  opacity: 0;
  animation: staggerFadeIn 0.5s ease-out forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.1s; }
.stagger-item:nth-child(2) { animation-delay: 0.2s; }
.stagger-item:nth-child(3) { animation-delay: 0.3s; }
.stagger-item:nth-child(4) { animation-delay: 0.4s; }
.stagger-item:nth-child(5) { animation-delay: 0.5s; }
.stagger-item:nth-child(6) { animation-delay: 0.6s; }
.stagger-item:nth-child(7) { animation-delay: 0.7s; }
.stagger-item:nth-child(8) { animation-delay: 0.8s; }
.stagger-item:nth-child(9) { animation-delay: 0.9s; }
.stagger-item:nth-child(10) { animation-delay: 1s; }

@keyframes staggerFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================================
   UTILITY ANIMATIONS
   ========================================================================== */

/* Rotate */
.rotate-90 {
  transform: rotate(90deg);
  transition: transform var(--transition-smooth);
}

.rotate-180 {
  transform: rotate(180deg);
  transition: transform var(--transition-smooth);
}

/* Flip Horizontal */
.flip-h {
  transform: scaleX(-1);
  transition: transform var(--transition-smooth);
}

/* Flip Vertical */
.flip-v {
  transform: scaleY(-1);
  transition: transform var(--transition-smooth);
}

/* Infinite Spin */
.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Breathing Animation */
.breathe {
  animation: breathe 3s ease-in-out infinite;
}

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

/* ============================================================================
   REDUCED MOTION SUPPORT
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
