/**
 * DevPulse v3.0 - Animations
 * Smooth, performant animations and micro-interactions
 */

/* ================================
   ANIMATION VARIABLES
   ================================ */

:root {
  /* Animation durations */
  --duration-instant: 100ms;
  --duration-fast: 200ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
  --duration-slower: 700ms;
  --duration-slowest: 1000ms;

  /* Easing functions */
  --ease-linear: linear;
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-back: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-elastic: cubic-bezier(0.68, -0.6, 0.32, 1.6);
}

/* ================================
   RESPECT USER PREFERENCES
   ================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .animate-on-scroll,
  .animate-fade-in,
  .animate-slide-up,
  .animate-slide-down,
  .animate-slide-left,
  .animate-slide-right,
  .animate-scale-in,
  .animate-bounce-in,
  .animate-rotate-in {
    animation: none !important;
  }
}

/* ================================
   CORE ANIMATIONS
   ================================ */

/* Loading Animations */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

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

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

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

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

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

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

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

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

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

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

/* Scale animations */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

/* Bounce animations */
@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3) translateY(-50px);
  }
  50% {
    opacity: 1;
    transform: scale(1.05) translateY(0);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    transform: translateY(0);
  }
  40%, 43% {
    transform: translateY(-20px);
  }
  70% {
    transform: translateY(-10px);
  }
  90% {
    transform: translateY(-4px);
  }
}

/* Rotation animations */
@keyframes rotateIn {
  from {
    opacity: 0;
    transform: rotate(-180deg) scale(0.8);
  }
  to {
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
}

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

/* Pulse animations */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

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

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

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

/* Shimmer/Loading animations */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes loadingDots {
  0%, 20% {
    opacity: 0;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}

/* Progress animations */
@keyframes progressSlide {
  0% {
    transform: translateX(-100%);
  }
  50% {
    transform: translateX(0%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes progressGrow {
  from {
    width: 0%;
  }
  to {
    width: 100%;
  }
}

/* Number counter animation */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Floating animation */
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* Glow effect */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(102, 126, 234, 0.2);
  }
  50% {
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.6), 0 0 30px rgba(102, 126, 234, 0.4);
  }
}

/* Typewriter effect */
@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blinkCursor {
  from, to {
    border-right: 2px solid transparent;
  }
  50% {
    border-right: 2px solid var(--color-primary);
  }
}

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

/* Fade animations */
.animate-fade-in {
  animation: fadeIn var(--duration-normal) var(--ease-out);
}

.animate-fade-out {
  animation: fadeOut var(--duration-normal) var(--ease-in);
}

.animate-fade-in-up {
  animation: fadeInUp var(--duration-normal) var(--ease-out);
}

.animate-fade-in-down {
  animation: fadeInDown var(--duration-normal) var(--ease-out);
}

.animate-fade-in-left {
  animation: fadeInLeft var(--duration-normal) var(--ease-out);
}

.animate-fade-in-right {
  animation: fadeInRight var(--duration-normal) var(--ease-out);
}

/* Scale animations */
.animate-scale-in {
  animation: scaleIn var(--duration-normal) var(--ease-back);
}

.animate-scale-out {
  animation: scaleOut var(--duration-normal) var(--ease-in);
}

/* Bounce animations */
.animate-bounce-in {
  animation: bounceIn var(--duration-slow) var(--ease-out);
}

.animate-bounce {
  animation: bounce var(--duration-slowest) infinite;
}

/* Rotation animations */
.animate-rotate-in {
  animation: rotateIn var(--duration-slow) var(--ease-back);
}

.animate-spin {
  animation: spin var(--duration-slowest) linear infinite;
}

/* Pulse animations */
.animate-pulse {
  animation: pulse var(--duration-slowest) var(--ease-in-out) infinite;
}

.animate-heartbeat {
  animation: heartbeat 1.2s ease-in-out infinite;
}

/* Shake animations */
.animate-shake {
  animation: shake var(--duration-normal) var(--ease-in-out);
}

.animate-shake-y {
  animation: shakeY var(--duration-normal) var(--ease-in-out);
}

/* Utility animations */
.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-glow {
  animation: glow 2s ease-in-out infinite;
}

.animate-count-up {
  animation: countUp var(--duration-slow) var(--ease-back);
}

/* Loading animations */
.animate-shimmer {
  animation: shimmer 2s ease-in-out infinite;
}

.animate-loading-dots {
  animation: loadingDots 1.5s ease-in-out infinite;
}

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

.stagger-children > * {
  animation-delay: calc(var(--stagger-delay, 100ms) * var(--index, 0));
}

.stagger-children > *:nth-child(1) { --index: 0; }
.stagger-children > *:nth-child(2) { --index: 1; }
.stagger-children > *:nth-child(3) { --index: 2; }
.stagger-children > *:nth-child(4) { --index: 3; }
.stagger-children > *:nth-child(5) { --index: 4; }
.stagger-children > *:nth-child(6) { --index: 5; }
.stagger-children > *:nth-child(7) { --index: 6; }
.stagger-children > *:nth-child(8) { --index: 7; }
.stagger-children > *:nth-child(9) { --index: 8; }
.stagger-children > *:nth-child(10) { --index: 9; }

/* ================================
   HOVER EFFECTS
   ================================ */

.hover-lift {
  transition: transform var(--duration-fast) var(--ease-out);
}

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

.hover-grow {
  transition: transform var(--duration-fast) var(--ease-out);
}

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

.hover-shrink {
  transition: transform var(--duration-fast) var(--ease-out);
}

.hover-shrink:hover {
  transform: scale(0.95);
}

.hover-rotate {
  transition: transform var(--duration-fast) var(--ease-out);
}

.hover-rotate:hover {
  transform: rotate(5deg);
}

.hover-glow {
  transition: box-shadow var(--duration-fast) var(--ease-out);
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
}

/* ================================
   FOCUS EFFECTS
   ================================ */

.focus-ring {
  transition: box-shadow var(--duration-fast) var(--ease-out);
}

.focus-ring:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.focus-lift {
  transition: transform var(--duration-fast) var(--ease-out);
}

.focus-lift:focus {
  transform: translateY(-2px);
}

/* ================================
   SCROLL ANIMATIONS
   ================================ */

.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.animate-on-scroll.in-view {
  opacity: 1;
  transform: translateY(0);
}

.animate-on-scroll-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.animate-on-scroll-left.in-view {
  opacity: 1;
  transform: translateX(0);
}

.animate-on-scroll-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.animate-on-scroll-right.in-view {
  opacity: 1;
  transform: translateX(0);
}

.animate-on-scroll-scale {
  opacity: 0;
  transform: scale(0.8);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-back);
}

.animate-on-scroll-scale.in-view {
  opacity: 1;
  transform: scale(1);
}

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

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity var(--duration-slow) ease-out, visibility var(--duration-slow) ease-out;
  overflow: hidden;
}

.loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

/* Animated Background */
.loading-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.particle-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.particle {
  position: absolute;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  pointer-events: none;
  animation: particleFloat 3s infinite ease-in-out;
}

.geometric-shapes {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.shape {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  animation: shapeFloat 8s infinite ease-in-out;
}

.shape-1 {
  width: 100px;
  height: 100px;
  top: 20%;
  left: 10%;
  animation-delay: 0s;
}

.shape-2 {
  width: 60px;
  height: 60px;
  top: 60%;
  right: 15%;
  animation-delay: 2s;
  border-radius: 20%;
}

.shape-3 {
  width: 80px;
  height: 80px;
  bottom: 30%;
  left: 20%;
  animation-delay: 4s;
  transform: rotate(45deg);
  border-radius: 10px;
}

.shape-4 {
  width: 120px;
  height: 120px;
  top: 15%;
  right: 20%;
  animation-delay: 6s;
  background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
}

/* Loading Container */
.loading-container {
  text-align: center;
  color: white;
  max-width: 500px;
  padding: 2rem;
  z-index: 10;
  position: relative;
}

/* Logo Animation */
.loading-logo-container {
  position: relative;
  margin-bottom: 3rem;
  display: inline-block;
}

.logo-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
  border-radius: 50%;
  animation: logoGlow 2s ease-in-out infinite alternate;
}

.loading-logo {
  position: relative;
  z-index: 2;
  animation: logoFloat 3s ease-in-out infinite;
}

.loading-logo .logo-icon {
  width: 5rem;
  height: 5rem;
  color: rgba(255, 255, 255, 0.95);
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3));
  animation: logoRotate 4s linear infinite;
}

.logo-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100px;
  height: 100px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  animation: ringRotate 2s linear infinite;
}

/* Text Animation */
.brand-title {
  font-size: 3rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
  background: linear-gradient(45deg, #ffffff, #e0e7ff, #ffffff);
  background-size: 200% 200%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: textShimmer 3s ease-in-out infinite;
}

.brand-title .letter {
  display: inline-block;
  animation: letterBounce 1.5s ease-in-out infinite;
}

.brand-title .letter:nth-child(1) { animation-delay: 0.1s; }
.brand-title .letter:nth-child(2) { animation-delay: 0.2s; }
.brand-title .letter:nth-child(3) { animation-delay: 0.3s; }
.brand-title .letter:nth-child(4) { animation-delay: 0.4s; }
.brand-title .letter:nth-child(5) { animation-delay: 0.5s; }
.brand-title .letter:nth-child(6) { animation-delay: 0.6s; }
.brand-title .letter:nth-child(7) { animation-delay: 0.7s; }
.brand-title .letter:nth-child(8) { animation-delay: 0.8s; }

.loading-message {
  font-size: 1.2rem;
  margin: 0 0 2.5rem 0;
  opacity: 0.9;
  animation: messageGlow 2s ease-in-out infinite alternate;
}

/* Progress Bar */
.loading-progress-container {
  margin-bottom: 2rem;
}

.loading-progress {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, 
    rgba(255, 255, 255, 0.8) 0%, 
    rgba(255, 255, 255, 1) 50%, 
    rgba(255, 255, 255, 0.8) 100%);
  border-radius: 3px;
  width: 0%;
  transition: width var(--duration-normal) ease-out;
  position: relative;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.progress-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: progressGlow 2s ease-in-out infinite;
}

.progress-percentage {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

/* Loading Dots */
.loading-dots {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  margin-top: 2rem;
}

.loading-dot {
  width: 12px;
  height: 12px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  animation: dotPulse 1.5s ease-in-out infinite both;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.loading-dot:nth-child(1) { animation-delay: -0.3s; }
.loading-dot:nth-child(2) { animation-delay: -0.15s; }
.loading-dot:nth-child(3) { animation-delay: 0s; }

/* ================================
   LOADING ANIMATIONS KEYFRAMES
   ================================ */

@keyframes particleFloat {
  0%, 100% {
    transform: translateY(0px) translateX(0px);
    opacity: 0.6;
  }
  50% {
    transform: translateY(-20px) translateX(10px);
    opacity: 1;
  }
}

@keyframes shapeFloat {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
    opacity: 0.1;
  }
  50% {
    transform: translateY(-30px) rotate(180deg);
    opacity: 0.3;
  }
}

@keyframes logoGlow {
  0% {
    opacity: 0.3;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(1.1);
  }
}

@keyframes logoFloat {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-15px) rotate(5deg);
  }
}

@keyframes logoRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes ringRotate {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes textShimmer {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

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

@keyframes messageGlow {
  0% {
    opacity: 0.7;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
  }
  100% {
    opacity: 1;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
  }
}

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

@keyframes dotPulse {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1.3);
    opacity: 1;
  }
}

.loading-skeleton {
  background: linear-gradient(
    90deg,
    var(--color-surface) 25%,
    var(--color-border-light) 50%,
    var(--color-surface) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

/* ================================
   TOAST ANIMATIONS
   ================================ */

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

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

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

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

.toast-slide-in {
  animation: toastSlideIn var(--duration-normal) var(--ease-out);
}

.toast-slide-out {
  animation: toastSlideOut var(--duration-normal) var(--ease-in);
}

.toast-fade-in {
  animation: toastFadeIn var(--duration-normal) var(--ease-back);
}

.toast-fade-out {
  animation: toastFadeOut var(--duration-normal) var(--ease-in);
}

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

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

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

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

.modal-backdrop-enter {
  animation: modalBackdropFadeIn var(--duration-normal) var(--ease-out);
}

.modal-enter {
  animation: modalSlideIn var(--duration-normal) var(--ease-back);
}

.modal-exit {
  animation: modalSlideOut var(--duration-normal) var(--ease-in);
}

/* ================================
   RIPPLE EFFECT
   ================================ */

.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width var(--duration-normal) var(--ease-out),
              height var(--duration-normal) var(--ease-out);
}

.ripple:active::before {
  width: 300px;
  height: 300px;
}

/* ================================
   PERFORMANCE OPTIMIZATIONS
   ================================ */

/* Force hardware acceleration for smooth animations */
.gpu-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Optimize repaints for frequently animated elements */
.animate-optimized {
  will-change: transform, opacity;
}

.animate-optimized.animate-complete {
  will-change: auto;
}

/* ================================
   THEME-SPECIFIC ANIMATIONS
   ================================ */

[data-theme="dark"] .animate-glow {
  animation: glow 2s ease-in-out infinite;
}

[data-theme="dark"] .hover-glow:hover {
  box-shadow: 0 0 20px rgba(102, 126, 234, 0.6);
}

/* ================================
   ACCESSIBILITY ANIMATIONS
   ================================ */

/* Focus animations for keyboard navigation */
.a11y-focus {
  transition: outline var(--duration-fast) var(--ease-out);
}

.a11y-focus:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  animation: pulse 0.6s ease-in-out;
}

/* Screen reader animations */
.sr-only-animate {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  transition: all var(--duration-fast) var(--ease-out);
}

.sr-only-animate:focus {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

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

/* Page Load Animations */
.animate-on-load {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-on-load.animate-in {
  opacity: 1;
  transform: translateY(0);
}

.animate-delay-1 {
  animation-delay: 0.1s;
}

.animate-delay-2 {
  animation-delay: 0.2s;
}

.animate-delay-3 {
  animation-delay: 0.3s;
}

/* Staggered animations for lists */
.animate-stagger > * {
  opacity: 0;
  animation: slideInUp 0.6s ease-out forwards;
}

.animate-stagger > *:nth-child(1) { animation-delay: 0.1s; }
.animate-stagger > *:nth-child(2) { animation-delay: 0.2s; }
.animate-stagger > *:nth-child(3) { animation-delay: 0.3s; }
.animate-stagger > *:nth-child(4) { animation-delay: 0.4s; }
.animate-stagger > *:nth-child(5) { animation-delay: 0.5s; }
.animate-stagger > *:nth-child(6) { animation-delay: 0.6s; }

/* Hover animations */
.hover-lift {
  transition: transform 0.3s ease;
}

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

.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

/* Profile Section Animations */
@keyframes profileGlow {
  0%, 100% {
    transform: rotate(0deg) scale(1);
    opacity: 0.3;
  }
  50% {
    transform: rotate(180deg) scale(1.1);
    opacity: 0.1;
  }
}

@keyframes avatarGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
  }
}
