/**
 * LexiCore™ - Animation & Transition System
 * Professional, subtle animations for enterprise legal platform
 */

/* ============================================
   ANIMATION KEYFRAMES
   ============================================ */

/* Fade in from opacity 0 to 1 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Fade in with upward motion */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade in with downward motion */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide in from right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide in from left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale in from center */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Gentle pulse for attention */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Shimmer effect for loading states */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

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

/* Slide down for toasts */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide up to dismiss */
@keyframes slideUp {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-100%);
  }
}


/* ============================================
   ANIMATION CLASSES
   ============================================ */

/* Fade in animation */
.animate-fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

/* Fade in with upward motion */
.animate-fade-in-up {
  animation: fadeInUp 0.4s ease-out forwards;
}

/* Fade in with downward motion */
.animate-fade-in-down {
  animation: fadeInDown 0.4s ease-out forwards;
}

/* Slide in from right */
.animate-slide-in-right {
  animation: slideInRight 0.4s ease-out forwards;
}

/* Slide in from left */
.animate-slide-in-left {
  animation: slideInLeft 0.4s ease-out forwards;
}

/* Scale in from center */
.animate-scale-in {
  animation: scaleIn 0.3s ease-out forwards;
}

/* Pulse animation */
.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* Shimmer loading effect */
.animate-shimmer {
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* Spinner animation */
.animate-spin {
  animation: spin 1s linear infinite;
}

/* Toast slide down */
.animate-toast-in {
  animation: slideDown 0.3s ease-out forwards;
}

/* Toast slide up (dismiss) */
.animate-toast-out {
  animation: slideUp 0.3s ease-in forwards;
}


/* ============================================
   TRANSITION UTILITIES
   ============================================ */

/* Smooth transitions for interactive elements */
.transition-all {
  transition: all 0.2s ease;
}

.transition-colors {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.transition-transform {
  transition: transform 0.2s ease;
}

.transition-opacity {
  transition: opacity 0.2s ease;
}

/* Slower transitions for larger elements */
.transition-slow {
  transition: all 0.4s ease;
}

/* Fast transitions for immediate feedback */
.transition-fast {
  transition: all 0.1s ease;
}


/* ============================================
   HOVER & INTERACTION STATES
   ============================================ */

/* Lift effect on hover */
.hover-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Subtle scale on hover */
.hover-scale {
  transition: transform 0.2s ease;
}

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

/* Button press effect */
.active-press:active {
  transform: scale(0.98);
}

/* Focus ring for accessibility */
.focus-ring:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Focus visible (keyboard only) */
.focus-ring:focus:not(:focus-visible) {
  outline: none;
}

.focus-ring:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}


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

/* Skeleton loader for text */
.skeleton-text {
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
  border-radius: 4px;
  height: 16px;
  width: 100%;
}

/* Skeleton loader for boxes */
.skeleton-box {
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
  border-radius: 8px;
  width: 100%;
  height: 100%;
}

/* Spinner icon */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #e5e7eb;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-large {
  width: 40px;
  height: 40px;
  border-width: 3px;
}


/* ============================================
   STAGGERED ANIMATIONS
   ============================================ */

/* Stagger children animations */
.stagger-children > * {
  animation: fadeInUp 0.4s ease-out forwards;
  opacity: 0;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.10s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.20s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.30s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.40s; }


/* ============================================
   REDUCED MOTION (Accessibility)
   ============================================ */

/* Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .animate-shimmer,
  .skeleton-text,
  .skeleton-box {
    animation: none;
    background: #f0f0f0;
  }

  .spinner {
    animation: none;
    border-top-color: var(--color-primary);
  }
}
