/* ========================================
   增强动画效果 - 移动端和平板端优化
   Enhanced Animations for Mobile & Tablet
======================================== */

/* ========================================
   基础动画关键帧
======================================== */

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

/* 从上滑入 */
@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 从下滑入 */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 从左滑入 */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

/* 弹跳动画 */
@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    transform: translateY(0);
  }
  40%, 43% {
    transform: translateY(-15px);
  }
  70% {
    transform: translateY(-7px);
  }
  90% {
    transform: translateY(-3px);
  }
}

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

/* 摇摆动画 */
@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%);
  }
}

/* 翻转动画 */
@keyframes flipInX {
  from {
    transform: perspective(400px) rotateX(90deg);
    opacity: 0;
  }
  40% {
    transform: perspective(400px) rotateX(-20deg);
  }
  60% {
    transform: perspective(400px) rotateX(10deg);
    opacity: 1;
  }
  80% {
    transform: perspective(400px) rotateX(-5deg);
  }
  to {
    transform: perspective(400px) rotateX(0deg);
    opacity: 1;
  }
}

/* 光晕效果 */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(0, 80, 216, 0.3);
  }
  50% {
    box-shadow: 0 0 20px rgba(0, 80, 216, 0.6), 0 0 30px rgba(0, 80, 216, 0.4);
  }
}

/* 打字机效果 */
@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

/* 渐变背景动画 */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ========================================
   动画类定义
======================================== */

/* 基础动画类 */
.animate-fadeIn {
  animation: fadeIn 0.8s ease-out both;
}

.animate-slideInDown {
  animation: slideInDown 0.8s ease-out both;
}

.animate-slideInUp {
  animation: slideInUp 0.8s ease-out both;
}

.animate-slideInLeft {
  animation: slideInLeft 0.8s ease-out both;
}

.animate-slideInRight {
  animation: slideInRight 0.8s ease-out both;
}

.animate-zoomIn {
  animation: zoomIn 0.8s ease-out both;
}

.animate-bounce {
  animation: bounce 1s ease-in-out both;
}

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

.animate-wobble {
  animation: wobble 1s ease-in-out both;
}

.animate-flipInX {
  animation: flipInX 0.8s ease-out both;
}

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

/* 延迟动画类 */
.animate-delay-1 {
  animation-delay: 0.1s;
}

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

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

.animate-delay-4 {
  animation-delay: 0.4s;
}

.animate-delay-5 {
  animation-delay: 0.5s;
}

.animate-delay-6 {
  animation-delay: 0.6s;
}

/* 动画持续时间类 */
.animate-fast {
  animation-duration: 0.5s;
}

.animate-slow {
  animation-duration: 1.5s;
}

.animate-slower {
  animation-duration: 2s;
}

/* 初始隐藏状态 */
.animate-hidden {
  opacity: 0;
}

/* ========================================
   移动端动画优化
======================================== */
@media (max-width: 767px) {
  /* 减少动画复杂度以提高性能 */
  .animate-fadeIn,
  .animate-slideInDown,
  .animate-slideInUp,
  .animate-slideInLeft,
  .animate-slideInRight,
  .animate-zoomIn {
    animation-duration: 0.6s;
  }
  
  .animate-bounce {
    animation-duration: 0.8s;
  }
  
  .animate-pulse {
    animation-duration: 1.5s;
  }
  
  /* 简化复杂动画 */
  .animate-wobble {
    animation: slideInUp 0.6s ease-out both;
  }
  
  .animate-flipInX {
    animation: fadeIn 0.6s ease-out both;
  }
  
  /* 减少延迟时间 */
  .animate-delay-1 { animation-delay: 0.05s; }
  .animate-delay-2 { animation-delay: 0.1s; }
  .animate-delay-3 { animation-delay: 0.15s; }
  .animate-delay-4 { animation-delay: 0.2s; }
  .animate-delay-5 { animation-delay: 0.25s; }
  .animate-delay-6 { animation-delay: 0.3s; }
}

/* ========================================
   平板端动画优化
======================================== */
@media (min-width: 768px) and (max-width: 1024px) {
  .animate-fadeIn,
  .animate-slideInDown,
  .animate-slideInUp,
  .animate-slideInLeft,
  .animate-slideInRight,
  .animate-zoomIn {
    animation-duration: 0.7s;
  }
  
  .animate-delay-1 { animation-delay: 0.08s; }
  .animate-delay-2 { animation-delay: 0.16s; }
  .animate-delay-3 { animation-delay: 0.24s; }
  .animate-delay-4 { animation-delay: 0.32s; }
  .animate-delay-5 { animation-delay: 0.4s; }
  .animate-delay-6 { animation-delay: 0.48s; }
}

/* ========================================
   悬停和交互动画
======================================== */

/* 悬停缩放 */
.hover-scale {
  transition: transform 0.3s ease;
}

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

/* 悬停上浮 */
.hover-lift {
  transition: all 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* 悬停发光 */
.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(0, 80, 216, 0.3);
}

/* 悬停旋转 */
.hover-rotate {
  transition: transform 0.3s ease;
}

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

/* 悬停倾斜 */
.hover-skew {
  transition: transform 0.3s ease;
}

.hover-skew:hover {
  transform: skew(-5deg, 0);
}

/* ========================================
   按钮动画增强
======================================== */

/* 按钮基础动画 */
.m-btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.m-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.m-btn:hover::before {
  width: 300px;
  height: 300px;
}

/* 按钮点击动画 */
.m-btn:active {
  transform: scale(0.98);
}

/* 按钮加载动画 */
.m-btn.loading {
  pointer-events: none;
}

.m-btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ========================================
   卡片动画增强
======================================== */

.card {
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.card-hover {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card-hover::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;
}

.card-hover:hover::before {
  left: 100%;
}

/* ========================================
   导航动画增强
======================================== */

.nav-link {
  position: relative;
  transition: all 0.3s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  width: 0;
  height: 2px;
  background: #0050d8;
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.nav-link:hover::after {
  width: 100%;
}

/* 移动端导航动画 */
@media (max-width: 991px) {
  .navbar-collapse {
    animation: slideDown 0.3s ease-out;
  }
  
  .navbar-nav .nav-item {
    opacity: 0;
    animation: slideInLeft 0.3s ease-out forwards;
  }
  
  .navbar-nav .nav-item:nth-child(1) { animation-delay: 0.1s; }
  .navbar-nav .nav-item:nth-child(2) { animation-delay: 0.15s; }
  .navbar-nav .nav-item:nth-child(3) { animation-delay: 0.2s; }
  .navbar-nav .nav-item:nth-child(4) { animation-delay: 0.25s; }
  .navbar-nav .nav-item:nth-child(5) { animation-delay: 0.3s; }
}

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

/* ========================================
   图片动画增强
======================================== */

img {
  transition: all 0.3s ease;
}

.hover-zoom img:hover {
  transform: scale(1.1);
}

.image-reveal {
  overflow: hidden;
}

.image-reveal img {
  transition: transform 0.5s ease;
}

.image-reveal:hover img {
  transform: scale(1.1);
}

/* ========================================
   文字动画效果
======================================== */

.typewriter {
  overflow: hidden;
  border-right: 2px solid #0050d8;
  white-space: nowrap;
  animation: typewriter 3s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes blink-caret {
  from, to {
    border-color: transparent;
  }
  50% {
    border-color: #0050d8;
  }
}

.gradient-text {
  background: linear-gradient(45deg, #0050d8, #53d267);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease infinite;
}

/* ========================================
   滚动触发动画
======================================== */

/* 仅隐藏视口外的滚动动画元素：通过 .will-animate 控制 */
.will-animate.scroll-animate {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease;
}

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

/* ========================================
   性能优化
======================================== */

/* 减少动画在低性能设备上的复杂度 */
@media (max-width: 767px) {
  .reduced-motion * {
    animation-duration: 0.3s !important;
    transition-duration: 0.2s !important;
  }
  
  .reduced-motion .animate-pulse,
  .reduced-motion .animate-glow {
    animation: none;
  }
}

/* 尊重用户的减少动画偏好 */
@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;
  }
}

/* ========================================
   特殊效果
======================================== */

/* 粒子效果背景 */
.particles-bg {
  position: relative;
  overflow: hidden;
}

.particles-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 20% 80%, rgba(0, 80, 216, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(83, 210, 103, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(0, 80, 216, 0.05) 0%, transparent 50%);
  animation: float 6s ease-in-out infinite;
  pointer-events: none;
}

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

/* 霓虹灯效果 */
.neon-glow {
  text-shadow: 
    0 0 5px currentColor,
    0 0 10px currentColor,
    0 0 15px currentColor,
    0 0 20px #0050d8,
    0 0 35px #0050d8,
    0 0 40px #0050d8;
  animation: neon-flicker 2s infinite alternate;
}

@keyframes neon-flicker {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

/* 波浪效果 */
.wave-effect {
  position: relative;
  overflow: hidden;
}

.wave-effect::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 200%;
  height: 20px;
  background: linear-gradient(90deg, transparent, rgba(0, 80, 216, 0.3), transparent);
  animation: wave 3s linear infinite;
}

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