/* 自定义动画类 */

/* 淡入动画 */
.animate-fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 动画延迟 */
.animation-delay-2000 {
  animation-delay: 2s;
}

.animation-delay-4000 {
  animation-delay: 4s;
}

/* 渐变文字效果 */
.text-gradient {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 玻璃态效果 */
.glass-effect {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.dark .glass-effect {
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 悬浮动画 */
.hover-float {
  transition: transform 0.3s ease;
}

.hover-float:hover {
  transform: translateY(-5px);
}

/* 脉冲边框效果 */
.pulse-border {
  position: relative;
}

.pulse-border::before {
  content: "";
  position: absolute;
  inset: -2px;
  background: linear-gradient(45deg, #667eea, #764ba2, #667eea);
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.pulse-border:hover::before {
  opacity: 1;
  animation: pulse-border 2s infinite;
}

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

  50% {
    background-position: 100% 50%;
  }
}

/* 渐变背景动画 */
.gradient-bg-animated {
  background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
  background-size: 400% 400%;
  animation: gradient-shift 15s ease infinite;
}

@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

/* 打字机效果 */
.typewriter {
  overflow: hidden;
  border-right: 2px solid;
  white-space: nowrap;
  animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
  from {
    width: 0;
  }

  to {
    width: 100%;
  }
}

@keyframes blink-caret {
  from,
  to {
    border-color: transparent;
  }

  50% {
    border-color: currentColor;
  }
}

/* 卡片悬浮效果 */
.card-hover {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* 按钮波纹效果 */
.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 0.6s, height 0.6s;
}

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

/* 现代化动画系统 */

/* 页面过渡动画 */
.page-transition-enter {
  animation: pageEnter 0.5s ease-out forwards;
}

.page-transition-exit {
  animation: pageExit 0.3s ease-in forwards;
}

/* 组件进入动画 */
.component-enter {
  animation: slideUp 0.4s ease-out forwards;
}

.component-enter-delayed {
  animation: slideUp 0.4s ease-out forwards;
  animation-delay: 0.1s;
  opacity: 0;
}

/* 悬停动画组合 */
.hover-lift {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

.hover-glow:hover {
  box-shadow:
    0 0 20px rgba(59, 130, 246, 0.3),
    0 0 40px rgba(59, 130, 246, 0.1);
  transform: scale(1.02);
}

/* 按钮动画增强 */
.btn-animate {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn-animate::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.btn-animate:hover::before {
  left: 100%;
}

.btn-animate:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.btn-animate:active {
  transform: translateY(0);
  transition: transform 0.1s ease;
}

/* 卡片动画 */
.card-animate {
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-animate:hover {
  transform: translateY(-8px) rotateX(5deg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* 输入框聚焦动画 */
.input-animate {
  position: relative;
  transition: all 0.3s ease;
}

.input-animate::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.input-animate:focus::after {
  width: 100%;
}

/* 导航链接动画 */
.nav-animate {
  position: relative;
  transition: all 0.3s ease;
}

.nav-animate::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  transition: width 0.3s ease;
}

.nav-animate:hover::after,
.nav-animate.active::after {
  width: 100%;
}

/* 图标动画 */
.icon-spin-hover {
  transition: transform 0.3s ease;
}

.icon-spin-hover:hover {
  transform: rotate(360deg);
}

.icon-bounce-hover {
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.icon-bounce-hover:hover {
  transform: scale(1.2) rotate(10deg);
}

.icon-pulse-hover {
  transition: all 0.3s ease;
}

.icon-pulse-hover:hover {
  animation: pulse 1s infinite;
}

/* 文字动画 */
.text-reveal {
  overflow: hidden;
}

.text-reveal .char {
  display: inline-block;
  transform: translateY(100%);
  animation: textReveal 0.8s ease forwards;
}

.text-reveal .char:nth-child(2) {
  animation-delay: 0.1s;
}

.text-reveal .char:nth-child(3) {
  animation-delay: 0.2s;
}

.text-reveal .char:nth-child(4) {
  animation-delay: 0.3s;
}

.text-reveal .char:nth-child(5) {
  animation-delay: 0.4s;
}

@keyframes textReveal {
  to {
    transform: translateY(0);
  }
}

/* 数字计数动画 */
.counter-animate {
  font-feature-settings: "tnum";
  transition: all 0.3s ease;
}

/* 进度条动画 */
.progress-animate {
  position: relative;
  overflow: hidden;
  background: #e5e7eb;
  border-radius: 9999px;
}

.progress-animate::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  border-radius: 9999px;
  transition: width 1s ease;
}

/* 加载动画 */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e5e7eb;
  border-top: 4px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-dots {
  display: flex;
  gap: 4px;
}

.loading-dots .dot {
  width: 8px;
  height: 8px;
  background: #3b82f6;
  border-radius: 50%;
  animation: loadingDots 1.4s ease-in-out infinite;
}

.loading-dots .dot:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots .dot:nth-child(3) {
  animation-delay: 0.4s;
}

.loading-bars {
  display: flex;
  gap: 2px;
  align-items: end;
  height: 20px;
}

.loading-bars .bar {
  width: 4px;
  background: #3b82f6;
  animation: loadingBars 1.2s ease-in-out infinite;
}

.loading-bars .bar:nth-child(2) {
  animation-delay: 0.1s;
}

.loading-bars .bar:nth-child(3) {
  animation-delay: 0.2s;
}

.loading-bars .bar:nth-child(4) {
  animation-delay: 0.3s;
}

/* 骨架屏动画 */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton 2s ease-in-out infinite;
}

.dark .skeleton {
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
}

/* 滚动触发动画 */
.scroll-animate {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease;
}

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

.scroll-animate-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: all 0.6s ease;
}

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

.scroll-animate-right {
  opacity: 0;
  transform: translateX(30px);
  transition: all 0.6s ease;
}

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

.scroll-animate-scale {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.6s ease;
}

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

/* 视差滚动 */
.parallax {
  transform: translateZ(0);
  transition: transform 0.1s ease-out;
}

/* 磁性效果 */
.magnetic {
  transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

/* 鼠标跟随效果 */
.cursor-follow {
  position: relative;
}

.cursor-follow::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid #3b82f6;
  border-radius: 50%;
  pointer-events: none;
  transition: all 0.1s ease;
  opacity: 0;
}

.cursor-follow:hover::after {
  opacity: 1;
  transform: scale(1.5);
}

/* 波纹效果 */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

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

/* 弹性动画 */
.elastic {
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.elastic:hover {
  transform: scale(1.05);
}

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

/* 摇摆动画 */
.wobble:hover {
  animation: wobble 0.8s ease-in-out;
}

@keyframes wobble {
  0% {
    transform: translateX(0%);
  }

  15% {
    transform: translateX(-25px) rotate(-5deg);
  }

  30% {
    transform: translateX(20px) rotate(3deg);
  }

  45% {
    transform: translateX(-15px) rotate(-3deg);
  }

  60% {
    transform: translateX(10px) rotate(2deg);
  }

  75% {
    transform: translateX(-5px) rotate(-1deg);
  }

  100% {
    transform: translateX(0%);
  }
}

/* 3D 翻转效果 */
.flip-card {
  perspective: 1000px;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
}

.flip-card-back {
  transform: rotateY(180deg);
}

/* 粒子动画背景 */
.particle-bg {
  position: relative;
  overflow: hidden;
}

.particle-bg::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(
      circle at 20% 80%,
      rgba(120, 119, 198, 0.3) 0%,
      transparent 50%
    ),
    radial-gradient(
    circle at 80% 20%,
    rgba(255, 119, 198, 0.3) 0%,
    transparent 50%
  ),
    radial-gradient(
    circle at 40% 40%,
    rgba(120, 219, 255, 0.3) 0%,
    transparent 50%
  );
  animation: particleFloat 20s ease-in-out infinite;
  pointer-events: none;
}

@keyframes particleFloat {
  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
  }

  33% {
    transform: translate(30px, -30px) rotate(120deg);
  }

  66% {
    transform: translate(-20px, 20px) rotate(240deg);
  }
}

/* 响应式动画调整 */
@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;
  }
}

/* 移动端优化 */
@media (max-width: 768px) {
  .hover-lift:hover {
    transform: none;
  }

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

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