/**
 * Micro-interactions CSS
 * Premium animation styles for tactile feedback
 * 2026 UX standards
 */

/* ========================================
   RIPPLE EFFECT
   ======================================== */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0) 70%);
  transform: scale(0);
  animation: ripple-animation 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 1000;
}

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

/* ========================================
   BUTTON ANIMATIONS
   ======================================== */
.btn {
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, box-shadow;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: scale(0.95);
}

/* Glow effect on primary buttons */
.btn-primary {
  box-shadow: 0 4px 14px 0 rgba(139, 92, 246, 0.39);
}

.btn-primary:hover {
  box-shadow: 
    0 6px 20px rgba(139, 92, 246, 0.4),
    0 0 30px rgba(139, 92, 246, 0.3);
}

/* Pulse animation for CTAs */
@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 
      0 4px 14px 0 rgba(139, 92, 246, 0.39),
      0 0 0 0 rgba(139, 92, 246, 0.4);
  }
  50% {
    box-shadow: 
      0 4px 14px 0 rgba(139, 92, 246, 0.39),
      0 0 20px 8px rgba(139, 92, 246, 0.2);
  }
}

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

/* ========================================
   FORM FIELD ANIMATIONS
   ======================================== */
input, textarea, select {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: box-shadow, border-color;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--color-primary, #8b5cf6);
  box-shadow: 
    0 0 0 4px rgba(139, 92, 246, 0.1),
    0 0 20px rgba(139, 92, 246, 0.2);
}

/* Floating label animation */
label {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: left top;
}

/* Valid input state */
input:valid:not(:placeholder-shown) {
  border-color: #10b981;
}

input:invalid:not(:placeholder-shown):not(:focus) {
  border-color: #ef4444;
  animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

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

/* Valid checkmark */
.valid-check {
  animation: check-pop 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes check-pop {
  0% {
    transform: translateY(-50%) scale(0) rotate(-180deg);
    opacity: 0;
  }
  50% {
    transform: translateY(-50%) scale(1.2) rotate(0deg);
  }
  100% {
    transform: translateY(-50%) scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* ========================================
   CARD ANIMATIONS
   ======================================== */
.pricing-card, .feature-card, .testimonial-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, box-shadow;
}

.pricing-card:hover, .feature-card:hover, .testimonial-card:hover {
  transform: translateY(-8px);
}

/* Card content reveal on hover */
@keyframes slide-up-fade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pricing-card:hover .card-content > *,
.feature-card:hover .card-content > * {
  animation: slide-up-fade 0.3s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.pricing-card:hover .card-content > *:nth-child(1) { animation-delay: 0.05s; }
.pricing-card:hover .card-content > *:nth-child(2) { animation-delay: 0.1s; }
.pricing-card:hover .card-content > *:nth-child(3) { animation-delay: 0.15s; }
.pricing-card:hover .card-content > *:nth-child(4) { animation-delay: 0.2s; }

/* ========================================
   LOADING STATES
   ======================================== */
.loading-state {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: rgba(255, 255, 255, 1);
  border-radius: 50%;
  margin-right: 8px;
}

.loading-text {
  opacity: 0;
  animation: fade-pulse 1.5s ease-in-out infinite;
}

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

/* Skeleton loading screens */
.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: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 8px;
}

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

/* ========================================
   SUCCESS ANIMATIONS
   ======================================== */
.success-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  padding: 40px;
  border-radius: 24px;
  text-align: center;
  z-index: 10000;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.success-check {
  margin: 0 auto 20px;
  width: 80px;
  height: 80px;
}

.success-message {
  font-size: 20px;
  font-weight: 600;
  color: #10b981;
  margin-top: 16px;
}

/* ========================================
   ICON ANIMATIONS
   ======================================== */
.icon-bounce {
  animation: icon-bounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes icon-bounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.icon-spin {
  animation: icon-spin 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ========================================
   HOVER GLOW EFFECTS
   ======================================== */
.hover-glow {
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-glow::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(45deg, #8b5cf6, #ec4899, #8b5cf6);
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: -1;
  filter: blur(20px);
}

.hover-glow:hover::before {
  opacity: 0.6;
  animation: glow-rotate 3s linear infinite;
}

@keyframes glow-rotate {
  from { filter: blur(20px) hue-rotate(0deg); }
  to { filter: blur(20px) hue-rotate(360deg); }
}

/* ========================================
   SCROLL PROGRESS INDICATOR
   ======================================== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, #8b5cf6, #ec4899);
  transform-origin: left;
  z-index: 9999;
  transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  animation: toast-slide-in 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes toast-slide-in {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.toast-exit {
  animation: toast-slide-out 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes toast-slide-out {
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* Toast variants */
.toast-success { border-left: 4px solid #10b981; }
.toast-error { border-left: 4px solid #ef4444; }
.toast-warning { border-left: 4px solid #f59e0b; }
.toast-info { border-left: 4px solid #3b82f6; }

/* ========================================
   ACCESSIBILITY
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .ripple,
  .loading-spinner,
  .skeleton {
    animation: none !important;
  }
}

/* ========================================
   FOCUS VISIBLE (Keyboard Navigation)
   ======================================== */
*:focus-visible {
  outline: 2px solid #8b5cf6;
  outline-offset: 4px;
  border-radius: 4px;
}

button:focus-visible,
a:focus-visible {
  outline-offset: 2px;
}
