/* ============================================
   动画与过渡
   ============================================ */

/* === 淡入 === */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* === 闪烁光标 === */
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* === 脉冲发光 === */
@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(163, 113, 247, 0.2);
  }
  50% {
    box-shadow: 0 0 40px rgba(163, 113, 247, 0.4);
  }
}

/* === 进度环动画 === */
@keyframes drawCircle {
  from { stroke-dashoffset: 100; }
  to { stroke-dashoffset: var(--target-offset, 0); }
}

/* === 扫描线 === */
@keyframes scanline {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

/* === 打字机 === */
@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

/* === 渐变流动 === */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* === 应用动画类 === */
.animate-fade-in {
  animation: fadeIn var(--transition-slow) ease;
}

.animate-fade-in-up {
  animation: fadeInUp var(--transition-slow) ease;
}

.animate-fade-in-down {
  animation: fadeInDown var(--transition-slow) ease;
}

.animate-scale-in {
  animation: scaleIn var(--transition-base) ease;
}

/* === 延迟动画 === */
.animate-delay-1 { animation-delay: 0.1s; animation-fill-mode: both; }
.animate-delay-2 { animation-delay: 0.2s; animation-fill-mode: both; }
.animate-delay-3 { animation-delay: 0.3s; animation-fill-mode: both; }
.animate-delay-4 { animation-delay: 0.4s; animation-fill-mode: both; }
.animate-delay-5 { animation-delay: 0.5s; animation-fill-mode: both; }

/* === 终端光标 === */
.terminal-cursor {
  display: inline-block;
  width: 8px;
  height: 16px;
  background: var(--accent-green);
  animation: blink 1s step-end infinite;
  vertical-align: middle;
}

/* === 加载动画 === */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-default);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* === 骨架屏 === */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 25%,
    var(--bg-tertiary) 50%,
    var(--bg-secondary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

/* === 减少动画偏好 === */
@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;
  }
}
