/* animations.css - 为BytePilot添加流畅的动画效果 */

/* 全局动画变量 */
:root {
  --animation-duration-slow: 1s;
  --animation-duration-medium: 0.5s;
  --animation-duration-fast: 0.3s;
  --animation-duration-flash: 0.1s;
  --animation-easing-default: cubic-bezier(0.25, 0.1, 0.25, 1);
  --animation-easing-bouncy: cubic-bezier(0.2, 0.9, 0.3, 1.3);
  --animation-easing-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

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

.fade-in {
  animation: fadeIn var(--animation-duration-medium) var(--animation-easing-default) forwards;
}

/* 向上淡入 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp var(--animation-duration-medium) var(--animation-easing-default) forwards;
}

/* 向下淡入 */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-down {
  animation: fadeInDown var(--animation-duration-medium) var(--animation-easing-default) forwards;
}

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

.pulse {
  animation: pulse var(--animation-duration-slow) var(--animation-easing-smooth) infinite;
}

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

.rotate {
  animation: rotate var(--animation-duration-slow) linear infinite;
}

/* 闪烁动画 */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.blink {
  animation: blink var(--animation-duration-medium) ease-in-out infinite;
}

/* 加载动画 */
@keyframes loading {
  0% { 
    stroke-dasharray: 1, 150;
    stroke-dashoffset: 0;
  }
  50% {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: -35;
  }
  100% {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: -124;
  }
}

.loading-icon .loading-arc {
  animation: loading 1.5s ease-in-out infinite;
  stroke-linecap: round;
}

/* 卡片悬停效果增强 */
.tool-card {
  transition: transform 0.4s var(--animation-easing-smooth), 
              box-shadow 0.4s var(--animation-easing-smooth),
              background-color 0.3s var(--animation-easing-default);
}

.tool-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 
              0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* 标签特效 */
.tag {
  transition: transform 0.2s var(--animation-easing-bouncy), 
              background-color 0.3s var(--animation-easing-default);
}

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

/* 搜索栏动画 */
.search-bar {
  transition: width 0.3s var(--animation-easing-smooth), 
              background-color 0.3s var(--animation-easing-default);
}

.search-bar:focus-within {
  background-color: rgba(142, 142, 147, 0.2);
}

/* 导航链接动画 */
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 0;
  height: 2px;
  background-color: var(--color-primary);
  transition: width 0.3s var(--animation-easing-smooth), 
              left 0.3s var(--animation-easing-smooth);
  border-radius: 1px;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
  left: 0;
}

/* 分类按钮动画 */
.category-tabs button {
  transition: background-color 0.3s var(--animation-easing-default),
              color 0.3s var(--animation-easing-default),
              border-color 0.3s var(--animation-easing-default),
              transform 0.2s var(--animation-easing-bouncy);
}

.category-tabs button:hover,
.category-tabs button.active {
  transform: scale(1.05);
}

.category-tabs button.active {
  transition: transform 0.3s var(--animation-easing-bouncy);
  transform: scale(1.1);
}

/* 连续出现动画 */
.stagger-item {
  opacity: 0;
}

.stagger-appear {
  animation: fadeInUp var(--animation-duration-medium) var(--animation-easing-default) forwards;
}

/* 首屏加载动画 */
.hero h2 {
  animation: fadeInDown 0.8s var(--animation-easing-smooth) 0.2s forwards;
  opacity: 0;
}

.hero p {
  animation: fadeInDown 0.8s var(--animation-easing-smooth) 0.4s forwards;
  opacity: 0;
}

.category-tabs {
  animation: fadeIn 0.8s var(--animation-easing-smooth) 0.6s forwards;
  opacity: 0;
}

/* 卡片特效 */
.tool-card {
  opacity: 0;
}

.tool-card.appear {
  animation: fadeInUp 0.6s var(--animation-easing-smooth) forwards;
}

/* 页面加载时的全局动画 */
body {
  animation: fadeIn 0.5s var(--animation-easing-default) forwards;
}

/* 工具链接悬停动画 */
.tool-link {
  overflow: hidden;
  position: relative;
}

.tool-link::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.7s var(--animation-easing-default);
}

.tool-link:hover::before {
  left: 100%;
} 