﻿/* ============================================
   动画与过渡效果
   ============================================ */

/* --- 脉冲动画 --- */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(102, 126, 234, 0); }
}

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

@keyframes bounceOut {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.3); opacity: 0; }
}

/* --- 浮动 --- */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* --- 旋转 --- */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

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

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

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

/* --- 弹入 --- */
@keyframes slideInRight {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

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

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

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

/* --- 缩放淡入 --- */
@keyframes zoomIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* --- 打字机光标 --- */
@keyframes blink {
  0%, 50% { border-color: transparent; }
  51%, 100% { border-color: #667eea; }
}

/* --- 涟漪效果 --- */
@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* --- 习惯打卡勾选动画 --- */
@keyframes checkPop {
  0% { transform: scale(0); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* --- 数字滚动 --- */
@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- 骨架屏加载 --- */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* --- 应用类 --- */
.animate-bounce-in {
  animation: bounceIn 0.5s ease forwards;
}

.animate-slide-right {
  animation: slideInRight 0.4s ease forwards;
}

.animate-slide-left {
  animation: slideInLeft 0.4s ease forwards;
}

.animate-slide-up {
  animation: slideInUp 0.4s ease forwards;
}

.animate-zoom-in {
  animation: zoomIn 0.3s ease forwards;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

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

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

.animate-gradient {
  background-size: 200% 200%;
  animation: gradientFlow 3s ease infinite;
}

.animate-check-pop {
  animation: checkPop 0.3s ease forwards;
}

/* --- 交错动画延迟 --- */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }
.stagger-7 { animation-delay: 0.35s; }
.stagger-8 { animation-delay: 0.4s; }

/* --- 悬停动画增强 --- */
.hover-lift {
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px var(--color-shadow);
}

.hover-scale {
  transition: transform var(--transition-fast);
}

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

/* --- 颜色渐变背景装饰 --- */
.bg-gradient-animated {
  background: linear-gradient(-45deg, #FF6B6B, #4ECDC4, #45B7D1, #96CEB4, #FFEAA7, #667eea);
  background-size: 400% 400%;
  animation: gradientFlow 15s ease infinite;
}

/* --- 成就徽章发光 --- */
.badge-glow {
  position: relative;
}

.badge-glow::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--gradient-primary);
  opacity: 0;
  z-index: -1;
  filter: blur(8px);
  transition: opacity var(--transition-normal);
}

.badge-glow:hover::after {
  opacity: 0.6;
}
