/* ===== 全局重置 ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #4A90D9;
  --primary-dark: #357ABD;
  --primary-gradient: linear-gradient(135deg, #4A90D9, #7B68EE);
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --text: #2c3e50;
  --text-secondary: #7f8c9b;
  --border: #e8ecf1;
  --shadow: 0 2px 12px rgba(74, 144, 217, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== 导航栏 ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.nav-right a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 6px 14px;
  border-radius: 20px;
  transition: var(--transition);
}

.nav-right a:hover {
  background: var(--bg);
  color: var(--primary);
}

/* ===== Hero ===== */
.hero {
  background: var(--primary-gradient);
  padding: 60px 20px 50px;
  text-align: center;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 50%, rgba(255,255,255,0.06) 0%, transparent 60%);
  pointer-events: none;
}

.hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 10px;
  position: relative;
}

.hero p {
  font-size: 1.05rem;
  opacity: 0.9;
  margin-bottom: 6px;
  position: relative;
}

.hero-tags {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 16px 0 24px;
  font-size: 0.85rem;
  position: relative;
}

.hero-tags span {
  background: rgba(255,255,255,0.15);
  padding: 4px 14px;
  border-radius: 20px;
}

.search-box {
  max-width: 520px;
  margin: 0 auto;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  font-size: 1rem;
  border: none;
  border-radius: 50px;
  outline: none;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  transition: var(--transition);
}

.search-box input:focus {
  background: #fff;
  box-shadow: 0 6px 24px rgba(0,0,0,0.15);
}

.search-box::before {
  content: '🔍';
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  z-index: 1;
}

/* ===== 分类标签 ===== */
.category-bar {
  max-width: 1200px;
  margin: 24px auto 0;
  padding: 0 20px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.cat-btn {
  padding: 8px 20px;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: 24px;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.cat-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(74,144,217,0.06);
}

.cat-btn.active {
  background: var(--primary-gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(74,144,217,0.3);
}

/* ===== 工具网格 ===== */
.tools-section {
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 20px;
}

.category-group {
  margin-bottom: 36px;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

.category-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.category-header .count {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 2px 10px;
  border-radius: 12px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.tool-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(74,144,217,0.12);
  border-color: rgba(74,144,217,0.2);
}

.tool-card .icon {
  font-size: 2rem;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eef4ff, #f0eaff);
  border-radius: 12px;
}

.tool-card .info {
  flex: 1;
  min-width: 0;
}

.tool-card .info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.3;
}

.tool-card .info p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.tool-card .arrow {
  flex-shrink: 0;
  color: var(--border);
  font-size: 0.9rem;
  transition: var(--transition);
  margin-top: 10px;
}

.tool-card:hover .arrow {
  color: var(--primary);
  transform: translateX(3px);
}

/* ===== "未找到" 状态 ===== */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  display: none;
}

.no-results .big-emoji {
  font-size: 3rem;
  margin-bottom: 12px;
}

/* ===== About ===== */
.about {
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 20px;
}

.about-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 40px;
  border: 1px solid var(--border);
  text-align: center;
}

.about h2 {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.about > p {
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 30px;
  font-size: 0.95rem;
}

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.feature-item {
  padding: 20px;
}

.feature-item .fi-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.feature-item h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.feature-item p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ===== 页脚 ===== */
.footer {
  background: #1a2332;
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: 30px 20px;
  margin-top: 40px;
  font-size: 0.85rem;
}

.footer a {
  color: rgba(255,255,255,0.5);
  text-decoration: none;
}

.footer a:hover {
  color: #fff;
}

.footer .sep {
  margin: 0 10px;
  opacity: 0.3;
}

/* ===== 回到顶部 ===== */
.back-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  box-shadow: 0 4px 16px rgba(74,144,217,0.3);
  transition: var(--transition);
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  z-index: 99;
}

.back-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(74,144,217,0.4);
}

/* ===== 淡入动画 ===== */
/* AI 按钮工具提示 */
.ai-btn-tooltip {
  position: absolute;
  bottom: 50%;
  right: 62px;
  background: #fff;
  color: var(--primary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  white-space: nowrap;
  animation: tooltip-bounce 2s ease-in-out infinite;
  z-index: 1;
  border: 1px solid var(--border);
  pointer-events: none;
}

.ai-btn-tooltip::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-left: 6px solid #fff;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

@keyframes tooltip-bounce {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-4px); }
}

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

.tool-card {
  animation: fadeUp 0.4s ease both;
}

.tool-card:nth-child(1) { animation-delay: 0.02s; }
.tool-card:nth-child(2) { animation-delay: 0.04s; }
.tool-card:nth-child(3) { animation-delay: 0.06s; }
.tool-card:nth-child(4) { animation-delay: 0.08s; }
.tool-card:nth-child(5) { animation-delay: 0.10s; }
.tool-card:nth-child(6) { animation-delay: 0.12s; }
.tool-card:nth-child(7) { animation-delay: 0.14s; }
.tool-card:nth-child(8) { animation-delay: 0.16s; }
.tool-card:nth-child(9) { animation-delay: 0.18s; }
.tool-card:nth-child(10) { animation-delay: 0.20s; }

/* ===== 响应式 ===== */
/* ===== 热门推荐卡片（Hero内） ===== */
.featured-tools {
  max-width: 800px;
  margin: 28px auto 0;
  position: relative;
}

.featured-label {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-bottom: 12px;
  text-align: left;
  padding-left: 4px;
  letter-spacing: 1px;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.featured-card {
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  padding: 16px 14px;
  text-decoration: none;
  color: #fff;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}

.featured-card:hover {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.35);
  transform: translateY(-3px);
}

.featured-card .fc-icon {
  font-size: 2rem;
}

.featured-card .fc-info h3 {
  font-size: 0.9rem;
  font-weight: 600;
}

.featured-card .fc-info p {
  font-size: 0.75rem;
  opacity: 0.8;
  margin-top: 2px;
}

.featured-card .fc-action {
  font-size: 0.75rem;
  background: rgba(255,255,255,0.2);
  padding: 3px 14px;
  border-radius: 12px;
  margin-top: 4px;
  font-weight: 500;
}

.featured-card:hover .fc-action {
  background: rgba(255,255,255,0.35);
}

/* ===== AI 聊天助手小部件 ===== */
#ai-chat-widget {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.ai-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4A90D9, #7B68EE);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.6rem;
  box-shadow: 0 4px 20px rgba(74,144,217,0.35);
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  line-height: 1;
}

.ai-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(74,144,217,0.45);
}

.ai-btn::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(74,144,217,0.3);
  animation: ai-pulse 2.5s ease-in-out infinite;
}

@keyframes ai-pulse {
  0% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.12); opacity: 0.2; }
  100% { transform: scale(1); opacity: 0.6; }
}

.ai-btn::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  background: #4cd964;
  border-radius: 50%;
  bottom: 2px;
  right: 2px;
  border: 2px solid #fff;
}

.ai-panel {
  position: absolute;
  bottom: 66px;
  right: 0;
  width: 360px;
  max-height: 520px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.95);
  transform-origin: bottom right;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}

.ai-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* AI Header */
.ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, #4A90D9, #7B68EE);
  color: #fff;
  flex-shrink: 0;
}

.ai-header-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-header-icon {
  font-size: 1.4rem;
}

.ai-status {
  font-size: 0.7rem;
  background: rgba(255,255,255,0.2);
  padding: 1px 8px;
  border-radius: 8px;
  margin-left: 6px;
}

.ai-close-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.ai-close-btn:hover {
  background: rgba(255,255,255,0.3);
}

/* Messages area */
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  background: #f8f9fc;
  min-height: 260px;
  max-height: 320px;
}

.ai-messages::-webkit-scrollbar {
  width: 4px;
}

.ai-messages::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 4px;
}

.ai-welcome {
  text-align: center;
  color: #aaa;
  font-size: 0.82rem;
  padding: 20px 10px;
}

/* Message bubbles */
.ai-msg {
  margin-bottom: 12px;
  display: flex;
  animation: fadeUp 0.3s ease;
}

.user-msg {
  justify-content: flex-end;
}

.ai-msg-bot {
  justify-content: flex-start;
  align-items: flex-start;
  gap: 8px;
}

.ai-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4A90D9, #7B68EE);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.user-msg .msg-bubble {
  background: linear-gradient(135deg, #4A90D9, #6A5ACD);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bot-bubble {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

/* Tool list in chat */
.ai-tool-list {
  margin: 10px 0 6px;
}

.ai-tool-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: #f0f4ff;
  border-radius: 10px;
  margin-bottom: 6px;
  text-decoration: none;
  color: var(--text);
  transition: var(--transition);
  gap: 8px;
}

.ai-tool-item:hover {
  background: #e0eaff;
  transform: translateX(3px);
}

.ai-tool-icon {
  font-size: 1.2rem;
}

.ai-tool-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.88rem;
}

.ai-tool-arrow {
  color: var(--primary);
  font-weight: bold;
}

.ai-tip {
  font-size: 0.75rem;
  color: #aaa;
  margin-top: 2px;
}

/* Input bar */
.ai-input-bar {
  display: flex;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
  gap: 8px;
}

.ai-input-bar input {
  flex: 1;
  border: 2px solid var(--border);
  border-radius: 24px;
  padding: 8px 14px;
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition);
}

.ai-input-bar input:focus {
  border-color: var(--primary);
}

.ai-send-btn {
  background: var(--primary-gradient);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 24px;
  font-size: 0.82rem;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}

.ai-send-btn:hover {
  opacity: 0.9;
  transform: scale(1.03);
}

/* Quick tips */
.ai-quick-tips {
  display: flex;
  gap: 6px;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--border);
  background: #fafbfc;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.ai-quick-btn {
  font-size: 0.75rem;
  padding: 4px 12px;
  background: #f0f2f5;
  border: 1px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  white-space: nowrap;
}

.ai-quick-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Typing animation */
.typing::after {
  content: '▌';
  animation: blink 0.8s infinite;
  margin-left: 2px;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ===== 响应式 ===== */

/* 平板 */
@media (max-width: 768px) {
  .hero { padding: 36px 14px 32px; }
  .hero h1 { font-size: 1.5rem; }
  .hero p { font-size: 0.9rem; }
  .hero-tags { flex-wrap: wrap; gap: 6px; }
  .hero-tags span { font-size: 0.78rem; padding: 3px 10px; }
  .search-box input { font-size: 0.9rem; padding: 12px 16px 12px 42px; }
  .search-box::before { font-size: 1rem; left: 14px; }
  .tools-grid { grid-template-columns: 1fr; gap: 10px; }
  .tool-card { padding: 14px; gap: 10px; }
  .tool-card .icon { width: 40px; height: 40px; font-size: 1.4rem; }
  .tool-card .info h3 { font-size: 0.9rem; }
  .cat-btn { font-size: 0.8rem; padding: 5px 12px; }
  .category-bar { gap: 6px; padding: 0 12px; margin-top: 16px; }
  .category-header h2 { font-size: 1rem; }
  .features { grid-template-columns: 1fr; gap: 12px; }
  .about-card { padding: 24px 16px; }
  .about h2 { font-size: 1.2rem; }
  .back-top { bottom: 20px; right: 20px; width: 40px; height: 40px; font-size: 1rem; }
  .featured-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .featured-card { padding: 12px 8px; }
  .featured-card .fc-icon { font-size: 1.5rem; }
  .featured-card .fc-info h3 { font-size: 0.8rem; }
  .featured-card .fc-info p { display: none; }
  .featured-card .fc-action { font-size: 0.7rem; padding: 2px 10px; }
  #ai-chat-widget { bottom: 70px; right: 12px; }
  .ai-btn { width: 50px; height: 50px; font-size: 1.4rem; }
  .ai-panel { width: 330px; right: -10px; }
  .footer { font-size: 0.78rem; padding: 24px 16px; }
}

/* 手机 */
@media (max-width: 480px) {
  .header-inner { padding: 0 12px; height: 50px; }
  .logo { font-size: 1rem; }
  .nav-right a { font-size: 0.8rem; padding: 4px 10px; }
  .hero { padding: 28px 12px 24px; }
  .hero h1 { font-size: 1.25rem; }
  .hero p { font-size: 0.82rem; }
  .hero-tags { gap: 4px; }
  .hero-tags span { font-size: 0.72rem; padding: 2px 8px; }
  .search-box input { font-size: 0.85rem; padding: 10px 14px 10px 36px; }
  .featured-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .featured-card { padding: 10px 6px; border-radius: 10px; gap: 3px; }
  .featured-card .fc-icon { font-size: 1.3rem; }
  .featured-card .fc-info h3 { font-size: 0.75rem; }
  .featured-card .fc-action { font-size: 0.65rem; padding: 2px 8px; }
  .tools-section { padding: 0 12px; }
  .tool-card { padding: 12px; gap: 10px; border-radius: 12px; }
  .tool-card .icon { width: 36px; height: 36px; font-size: 1.2rem; border-radius: 10px; }
  .tool-card .info h3 { font-size: 0.85rem; }
  .tool-card .info p { font-size: 0.75rem; }
  .cat-btn { font-size: 0.75rem; padding: 4px 10px; }
  .category-header h2 { font-size: 0.95rem; }
  .about-card { padding: 20px 12px; border-radius: 12px; }
  .feature-item { padding: 12px; }
  .footer { padding: 20px 12px; }

  /* AI 全屏 */
  #ai-chat-widget { bottom: 60px; right: 8px; }
  .ai-btn { width: 48px; height: 48px; font-size: 1.3rem; }
  .ai-btn::after { width: 8px; height: 8px; bottom: 1px; right: 1px; }
  .ai-panel {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    top: 0;
    width: 100% !important;
    max-height: none !important;
    border-radius: 0;
    transform: translateY(20px) scale(0.98);
  }
  .ai-panel.open { transform: translateY(0) scale(1); }
  .ai-messages { min-height: 0; max-height: none; flex: 1; }
  .ai-header { padding: 16px 14px; }
  .ai-header-info { font-size: 1rem; }
  .ai-input-bar { padding: 10px 10px 14px; }
  .ai-input-bar input { font-size: 0.9rem; padding: 10px 14px; }
  .ai-quick-tips { padding: 8px 10px 10px; }
  .back-top { bottom: 16px; right: 16px; width: 36px; height: 36px; font-size: 0.9rem; }
}
