/* 实用工具箱菜单增强交互效果 */

/* 1. 整个卡片区域可点击，鼠标悬停显示手型 */
.tool-card {
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible !important; /* 允许大图预览溢出 */
}

/* 确保卡片内所有元素都显示手型光标 */
.tool-card,
.tool-card *,
.tool-card .tool-icon,
.tool-card .tool-icon img,
.tool-card .tool-info,
.tool-card .tool-info h4,
.tool-card .tool-info p {
}

/* 2. 鼠标悬停到卡片上的效果 */
.tool-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-color) !important;
  box-shadow: 
    0 8px 24px rgba(59, 130, 246, 0.25),
    0 0 0 1px rgba(59, 130, 246, 0.15);
  background-color: var(--bg-light);
}

/* 防止悬停时出现滚动条 */
.tools-grid,
.tool-card {
  will-change: transform;
}

body {
  overflow-x: hidden !important;
}

.tools-grid {
  overflow: visible !important;
  padding: 20px;
  margin-bottom: 40px; /* 给悬停上浮留出空间 */
}

/* 3. 图标容器样式 */
.tool-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: visible;
  z-index: 1;
}

/* 图标默认状态：80% 尺寸，10px 圆角 */
.tool-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(0.8);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 10px;
}

/* 4. 鼠标悬停到图标上的放大动画效果 */
/* 图标放大到 1.1 倍，保持 10px 圆角，不挡住标题 */
.tool-card:hover .tool-icon {
  transform: rotate(-5deg);
  z-index: 10;
}

.tool-card:hover .tool-icon img {
  transform: scale(1.1);
  border-radius: 10px;
  filter: brightness(1.1) drop-shadow(0 4px 12px rgba(59, 130, 246, 0.4));
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

/* 5. 点击时的反馈效果 */
.tool-card:active {
  transform: translateY(-2px) scale(0.98);
  transition: all 0.1s ease;
}

.tool-card:active .tool-icon {
  transform: rotate(-3deg);
}

.tool-card:active .tool-icon img {
  transform: scale(0.95);
  border-radius: 8px;
}

/* 6. 文字信息区域样式优化 */
.tool-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  transition: all 0.3s ease;
}

.tool-card:hover .tool-info h4 {
  color: var(--accent-color);
  transition: color 0.3s ease;
}

.tool-card:hover .tool-info p {
  opacity: 1;
  color: var(--text-primary);
  transition: all 0.3s ease;
}

/* 7. 权限锁定状态下禁用交互效果 */
.tool-card.permission-locked {
  opacity: 0.6;
}

.tool-card.permission-locked,
.tool-card.permission-locked * {
}

.tool-card.permission-locked:hover {
  transform: none !important;
  border-color: var(--border-color) !important;
  box-shadow: none !important;
  background-color: var(--bg-surface) !important;
}

.tool-card.permission-locked:hover .tool-icon {
  transform: none !important;
}

.tool-card.permission-locked:hover .tool-icon img {
  transform: scale(0.8) !important;
  filter: none !important;
}

/* 8. 拖拽状态下的样式 */
.tool-card.dragging {
  opacity: 0.6;
  transform: scale(0.95) !important;
}

.tool-card.dragging .tool-icon {
  transform: none !important;
}

.tool-card.dragging .tool-icon img {
  transform: scale(0.8) !important;
}

.tool-card[draggable="true"]:not(.dragging) {
}

/* 9. 响应式优化 - 移动端 */
@media (max-width: 768px) {
  .tool-card:hover {
    transform: translateY(-2px);
  }
  
  .tool-card:hover .tool-icon {
    transform: rotate(-3deg);
  }
  
  .tool-card:hover .tool-icon img {
    transform: scale(0.95);
  }
}

/* 10. 主题适配 - 个性化主题 */
[data-theme="personal"] .tool-card:hover {
  background-color: var(--bg-light) !important;
  box-shadow: 
    0 8px 24px var(--accent-glow),
    0 0 0 1px var(--accent-color);
}

/* 11. 主题适配 - 浪漫主题 */
[data-theme="romantic"] .tool-card:hover {
  background: rgba(var(--accent-color-rgb, 59, 130, 246), 0.05) !important;
  border-color: var(--accent-color) !important;
}

/* 12. 主题适配 - 浅色主题 */
[data-theme="light"] .tool-card:hover {
  background-color: #f8fafc !important;
  box-shadow: 
    0 8px 24px rgba(59, 130, 246, 0.15),
    0 0 0 1px rgba(59, 130, 246, 0.1);
}

/* 13. 焦点状态（键盘导航支持） */
.tool-card:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* 14. 加载状态动画 */
@keyframes tool-card-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.tool-card.loading {
  background: linear-gradient(
    90deg,
    var(--bg-surface) 0%,
    var(--bg-light) 50%,
    var(--bg-surface) 100%
  );
  background-size: 200% 100%;
  animation: tool-card-shimmer 1.5s infinite;
  pointer-events: none;
}

/* 15. 图标悬停时的额外光晕效果 */
.tool-card:hover .tool-icon::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 140%;
  height: 140%;
  background: radial-gradient(
    circle,
    rgba(59, 130, 246, 0.2) 0%,
    transparent 70%
  );
  border-radius: 50%;
  opacity: 0;
  animation: icon-glow 0.4s ease-out forwards;
  pointer-events: none;
  z-index: -1;
}

@keyframes icon-glow {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* 16. 确保游戏卡片也有相同的交互效果 */
.game-card {
}

.game-card,
.game-card *,
.game-card .game-icon,
.game-card .game-icon img,
.game-card .game-info {
}

/* 游戏图标容器样式 */
.game-icon {
  overflow: visible;
  z-index: 1;
  position: relative;
}

/* 游戏图标默认状态：缩小到 80%，无圆角 */
.game-icon img {
  transform: scale(0.8);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 0;
}

/* 游戏图标悬停：恢复到原始尺寸，添加 10px 圆角 */
.game-card:hover .game-icon {
  transform: rotate(-5deg);
  z-index: 10;
}

.game-card:hover .game-icon img {
  transform: scale(1);
  border-radius: 10px;
  filter: brightness(1.1) drop-shadow(0 4px 12px rgba(59, 130, 246, 0.3));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
