/* ===== 自定义滚动条 ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.5);
}

/* ===== 隐藏横向滚动条 ===== */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* ===== 骨架屏动画 ===== */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton-item {
  background: linear-gradient(
    90deg,
    rgba(30, 41, 59, 0.6) 25%,
    rgba(51, 65, 85, 0.4) 37%,
    rgba(30, 41, 59, 0.6) 63%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 0.5rem;
}

/* ===== 卡片入场动画 ===== */
@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-enter {
  animation: cardFadeIn 0.35s ease-out forwards;
  opacity: 0;
}

/* ===== 卡片悬停效果 ===== */
.project-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.project-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
}

/* ===== 分类标签样式 ===== */
.category-tag {
  transition: all 0.2s ease;
  white-space: nowrap;
  user-select: none;
}
.category-tag:hover {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}
.category-tag.active {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}

/* ===== 搜索框聚焦效果 ===== */
#searchInput:focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 0 20px rgba(59, 130, 246, 0.05);
}

/* ===== 回到顶部按钮 ===== */
#backToTop.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ===== 空状态 ===== */
#emptyState.visible {
  display: flex;
}

/* ===== 标签样式 ===== */
.tag-pill {
  transition: background 0.15s ease, color 0.15s ease;
}
.tag-pill:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

/* ===== 图标容器 ===== */
.icon-container {
  transition: background 0.2s ease;
}
.project-card:hover .icon-container {
  background: rgba(59, 130, 246, 0.15);
}

/* ===== 加载更多按钮 ===== */
#loadMoreBtn:active {
  transform: scale(0.97);
}

/* ===== 响应式微调 ===== */
@media (max-width: 640px) {
  .project-card {
    padding: 0.875rem;
  }
}

/* ===== 懒加载图片淡入 ===== */
.lazy-img {
  opacity: 0;
  transition: opacity 0.3s ease;
}
.lazy-img.loaded {
  opacity: 1;
}

/* ===== 减少动画偏好 ===== */
@media (prefers-reduced-motion: reduce) {
  .skeleton-item {
    animation: none;
  }
  .card-enter {
    animation: none;
    opacity: 1;
  }
  .project-card {
    transition: none;
  }
  .category-tag {
    transition: none;
  }
}

/* ===== 亮色模式 ===== */
html:not(.dark) body {
  background-color: #f8fafc;
  color: #1e293b;
}
html:not(.dark) header,
html:not(.dark) nav[class*="sticky"] {
  background-color: rgba(255, 255, 255, 0.85);
  border-color: rgba(226, 232, 240, 0.6);
}
html:not(.dark) .project-card {
  background-color: #ffffff;
  border-color: rgba(226, 232, 240, 0.8);
  color: #1e293b;
}
html:not(.dark) .project-card:hover {
  box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
}
html:not(.dark) .project-card .text-dark-400,
html:not(.dark) .project-card .text-dark-500 {
  color: #64748b;
}
html:not(.dark) .project-card .text-dark-100,
html:not(.dark) .project-card .text-dark-200 {
  color: #1e293b;
}
html:not(.dark) .project-card .text-dark-300 {
  color: #475569;
}
html:not(.dark) #searchInput {
  background-color: #f1f5f9;
  border-color: rgba(203, 213, 225, 0.6);
  color: #1e293b;
}
html:not(.dark) #searchInput::placeholder {
  color: #94a3b8;
}
html:not(.dark) #searchInput:focus {
  border-color: rgba(59, 130, 246, 0.5);
}
html:not(.dark) .category-tag {
  color: #475569;
  background: rgba(241, 245, 249, 0.8);
  border-color: rgba(226, 232, 240, 0.6);
}
html:not(.dark) .category-tag:hover {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}
html:not(.dark) .category-tag.active {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
  border-color: rgba(59, 130, 246, 0.4);
}
html:not(.dark) .skeleton-item {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 37%, #f1f5f9 63%);
  background-size: 200% 100%;
}
html:not(.dark) #backToTop {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(226, 232, 240, 0.6);
  color: #64748b;
}
html:not(.dark) #backToTop:hover {
  background: #f1f5f9;
  color: #1e293b;
}
html:not(.dark) .tag-pill {
  color: #475569;
  background: rgba(241, 245, 249, 0.8);
}
html:not(.dark) .tag-pill:hover {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}
html:not(.dark) .icon-container {
  background: rgba(241, 245, 249, 0.8);
}
html:not(.dark) .project-card:hover .icon-container {
  background: rgba(59, 130, 246, 0.1);
}
html:not(.dark) #loadMoreBtn {
  background: #f1f5f9;
  border-color: rgba(226, 232, 240, 0.6);
  color: #475569;
}
html:not(.dark) #loadMoreBtn:hover {
  background: #e2e8f0;
  color: #1e293b;
}
html:not(.dark) #emptyState svg,
html:not(.dark) #emptyState p {
  color: #94a3b8;
}
html:not(.dark) .text-dark-400 {
  color: #64748b;
}
html:not(.dark) .bg-dark-800 {
  background-color: #f1f5f9;
}
html:not(.dark) .border-dark-600\/50 {
  border-color: rgba(203, 213, 225, 0.5);
}
html:not(.dark) .hover\:bg-dark-800:hover {
  background-color: #e2e8f0;
}
html:not(.dark) .hover\:text-dark-200:hover {
  color: #334155;
}
html:not(.dark) .text-dark-100 {
  color: #1e293b;
}

/* ===== Toast样式 ===== */
#appToastContent.toast-info {
  background: #3b82f6;
  color: white;
}
#appToastContent.toast-warning {
  background: #f59e0b;
  color: white;
}
#appToastContent.toast-error {
  background: #ef4444;
  color: white;
}
#appToastContent.toast-success {
  background: #22c55e;
  color: white;
}
