/* 自定义基础样式 */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* 页面加载淡入动画 */
  animation: pageLoad 0.8s ease-out;
}

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

/* 卡片样式和增强的悬停效果 */
.tool-card {
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-style: preserve-3d;
  perspective: 1000px;
}

.tool-card:hover {
  transform: translateY(-12px) scale(1.03) rotateX(2deg);
  box-shadow:
    0 30px 60px rgba(59, 130, 246, 0.15),
    0 10px 20px rgba(59, 130, 246, 0.1),
    0 0 0 1px rgba(59, 130, 246, 0.05);
}

.tool-card::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200%;
  padding-bottom: 200%;
  border-radius: 50%;
  background: radial-gradient(
    circle at center,
    rgba(59, 130, 246, 0.15) 0%,
    rgba(59, 130, 246, 0.1) 20%,
    rgba(59, 130, 246, 0.05) 40%,
    rgba(59, 130, 246, 0) 70%
  );
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
  z-index: 0;
  pointer-events: none;
}

.tool-card:hover::before {
  transform: translate(-50%, -50%) scale(1.2);
}

/* 添加光泽扫描效果 */
.tool-card::after {
  content: "";
  position: absolute;
  top: -100%;
  left: -100%;
  width: 300%;
  height: 300%;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 70%
  );
  transform: rotate(45deg);
  transition: all 0.6s;
  z-index: 1;
  pointer-events: none;
}

.tool-card:hover::after {
  animation: shimmer 0.6s ease-out;
}

@keyframes shimmer {
  0% {
    top: -100%;
    left: -100%;
  }
  100% {
    top: 100%;
    left: 100%;
  }
}

.tool-card a {
  position: relative;
  z-index: 2;
  transition: all 0.3s ease;
}

.tool-card:hover a {
  transform: translateZ(10px);
}

/* 标签筛选按钮增强动画 */
.tag-filter {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.tag-filter::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(59, 130, 246, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.5s ease, height 0.5s ease;
}

.tag-filter:hover::before {
  width: 100%;
  height: 100%;
}

.tag-filter.active {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
  box-shadow:
    0 4px 15px rgba(59, 130, 246, 0.4),
    0 2px 4px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px) scale(1.05);
}

.tag-filter:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 卡片内容动画 */
.tool-card .fa-star,
.tool-card .fa-tools,
.tool-card [class^="fa-"] {
  transition: all 0.3s ease;
}

.tool-card:hover [class^="fa-"] {
  transform: scale(1.2) rotateZ(5deg);
  color: #3b82f6;
}

.tool-card h3 {
  transition: all 0.3s ease;
}

.tool-card:hover h3 {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tool-card .tags-container {
  transition: all 0.3s ease;
}

.tool-card:hover .tags-container span {
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
  transform: scale(1.05);
}

.tool-card .arrow-icon {
  transition: all 0.3s ease;
  display: inline-block;
}

.tool-card:hover .arrow-icon {
  transform: translateX(5px);
}

/* 搜索框增强动画 */
#search-box {
  transition: all 0.3s ease;
  position: relative;
}

#search-box:focus {
  transform: scale(1.02);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#search-box:focus + #kbd-shortcut {
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
}

#kbd-shortcut {
  transition: all 0.2s ease;
}

/* 搜索图标动画 */
.search-container .fa-search {
  transition: all 0.3s ease;
}

.search-container .fa-search.focused {
  color: #3b82f6;
  transform: scale(1.1);
}

/* 页面滚动动画 */
@keyframes fadeInUp {
  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);
  }
}

/* 滚动时显示的动画 */
.scroll-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s ease-out;
}

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

/* Header 动画 */
header {
  animation: slideInDown 0.6s ease-out;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Footer 动画 */
footer {
  animation: slideInUp 0.6s ease-out 0.3s both;
}

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

/* 加载状态动画 */
.loading {
  position: relative;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #3b82f6;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* 无结果状态动画 */
#no-results {
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* 导航链接动画 */
header a {
  position: relative;
  transition: all 0.3s ease;
}

header a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

header a:hover::after {
  width: 100%;
}

/* 移动端菜单按钮动画 */
.md:hidden button {
  transition: all 0.3s ease;
}

.md:hidden button:hover i {
  transform: rotate(90deg);
  transition: transform 0.3s ease;
}

/* 卡片网格进入动画 */
#card-grid {
  animation: gridFadeIn 0.6s ease-out 0.2s both;
}

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

/* 标签筛选容器动画 */
#tag-filters {
  animation: slideInLeft 0.5s ease-out 0.3s both;
}

/* 搜索框容器动画 */
.search-container {
  animation: slideInRight 0.5s ease-out 0.2s both;
}

/* 卡片点击波纹效果 */
.tool-card a {
  position: relative;
  overflow: hidden;
}

.tool-card a::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(59, 130, 246, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.tool-card a:active::after {
  width: 300px;
  height: 300px;
}

/* 脉冲动画（用于新工具或特殊标记） */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.pulse {
  animation: pulse 2s infinite;
}

/* 响应式动画优化 */
@media (max-width: 768px) {
  .tool-card:hover {
    transform: translateY(-8px) scale(1.01);
  }

  .tool-card:hover::before {
    transform: translate(-50%, -50%) scale(1);
  }
}

/* 暗色模式适配 */
@media (prefers-color-scheme: dark) {
  .tool-card::after {
    background: linear-gradient(
      105deg,
      transparent 30%,
      rgba(255, 255, 255, 0.05) 50%,
      transparent 70%
    );
  }
}

/* 减少动画（用户偏好） */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

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

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* 悬停时的发光效果 */
.glow-on-hover:hover {
  box-shadow:
    0 0 20px rgba(59, 130, 246, 0.3),
    0 0 40px rgba(59, 130, 246, 0.2),
    0 0 60px rgba(59, 130, 246, 0.1);
}

/* 文字渐变动画效果 */
@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.text-gradient {
  background: linear-gradient(
    135deg,
    #3b82f6,
    #2563eb,
    #1d4ed8,
    #2563eb,
    #3b82f6
  );
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease infinite;
}
