/* ==========================================================================
   AI工具页面样式
   卡片风格参考悟空AI首页设计语言
   ========================================================================== */

.ai-tools-page {
  --ait-primary: #0044ff;
  --ait-primary-soft: #e9f4ff;
  --ait-ink: #0f2033;
  --ait-muted: #757575;
  --ait-line: #e6ecf6;
  --ait-radius: 1.125rem;
  --ait-shadow: 0 1.125rem 2.875rem rgba(37, 99, 235, 0.12);
  --ait-shadow-sm: 0 0.5rem 1.375rem rgba(15, 32, 51, 0.06);
  font-family: "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  color: var(--ait-ink);
  line-height: 1.6;
  width: min(100vw, 120rem);
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  margin-top: -1.5rem;
  background-color: #ffffff;
  overflow-x: hidden;
  padding-bottom: 4rem;
}

/* ── Hero 区域 ── */
.ai-tools-hero {
  padding: 4.5rem 16rem 3rem;
  background:
    radial-gradient(circle at 12% 14%, rgba(125, 211, 252, 0.24), transparent 22rem),
    radial-gradient(circle at 84% 20%, rgba(167, 139, 250, 0.22), transparent 24rem),
    linear-gradient(135deg, #f7fbff 0%, #eef6ff 52%, #f7faff 100%);
  border-bottom: 1px solid #d9e8ff;
  text-align: center;
}

.ai-tools-hero-inner {
  max-width: 680px;
  margin: 0 auto;
}

.ai-tools-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid #c7d2fe;
  color: #1e40af;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 1.4rem;
}

.ai-tools-hero h1 {
  font-size: clamp(2.2rem, 4.5vw, 3.2rem);
  font-weight: 800;
  margin: 0 0 1rem;
  letter-spacing: 0.02em;
}

.ai-tools-hl {
  color: #0576ff;
}

.ai-tools-lead {
  color: #475569;
  font-size: 1.02rem;
  line-height: 1.85;
  margin: 0;
}

/* ── 工具卡片网格 ── */
.ai-tools-grid-section {
  padding: 3rem 16rem 2rem;
}

/* ── 类目 Tab 栏（仅在配置了自定义类目时出现）── */
/* ── 工具角标：新款 / 爆款（无角标不渲染；过期由服务端 badgeActive 关闭）── */
.ai-tool-card-badge {
  position: absolute;
  top: .6rem;
  right: .6rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .04em;
  color: #fff;
  text-transform: uppercase;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .28);
  pointer-events: none;
  animation: ai-tool-badge-pop .45s cubic-bezier(.2, 1.4, .4, 1) both;
}
.ai-tool-card-badge.is-new {
  background: linear-gradient(120deg, #22d3ee 0%, #3b82f6 55%, #6366f1 100%);
  background-size: 200% 100%;
  animation: ai-tool-badge-pop .45s cubic-bezier(.2, 1.4, .4, 1) both, ai-tool-badge-flow 3.2s linear infinite .45s;
}
.ai-tool-card-badge.is-hot {
  background: linear-gradient(120deg, #fbbf24 0%, #f97316 45%, #ef4444 100%);
  background-size: 200% 100%;
  animation: ai-tool-badge-pop .45s cubic-bezier(.2, 1.4, .4, 1) both, ai-tool-badge-flow 2.6s linear infinite .45s;
}
.ai-tool-card-badge.is-hot::after,
.ai-tool-card-badge.is-new::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .75) 50%, transparent 65%);
  transform: translateX(-120%);
  animation: ai-tool-badge-shine 2.8s ease-in-out infinite;
}
@keyframes ai-tool-badge-pop {
  from { opacity: 0; transform: scale(.6) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes ai-tool-badge-flow {
  from { background-position: 0% 50%; }
  to { background-position: 200% 50%; }
}
@keyframes ai-tool-badge-shine {
  0%, 55% { transform: translateX(-120%); }
  85%, 100% { transform: translateX(120%); }
}
@media (prefers-reduced-motion: reduce) {
  .ai-tool-card-badge,
  .ai-tool-card-badge.is-new,
  .ai-tool-card-badge.is-hot,
  .ai-tool-card-badge.is-hot::after,
  .ai-tool-card-badge.is-new::after { animation: none; }
}

.ai-tools-cat-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid #e8eef8;
}

.ai-tools-cat-tabs::-webkit-scrollbar {
  display: none;
}

.ai-tools-cat-tab {
  flex: 0 0 auto;
  border: 0;
  border-right: 1px solid #e8eef8;
  background: none;
  padding: .6rem 1.1rem;
  color: #5b6b80;
  font-size: .95rem;
  cursor: pointer;
  transition: color .2s ease, background-color .2s ease;
}

.ai-tools-cat-tab:first-child {
  border-left: 1px solid #e8eef8;
}

.ai-tools-cat-tab:hover {
  color: #1d4ed8;
  background: #f4f8ff;
}

.ai-tools-cat-tab.is-active {
  color: #1d4ed8;
  font-weight: 700;
  background: #eff6ff;
}

.ai-tools-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
}

/* ── 单个工具卡片 ── */
.ai-tool-card {
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid #e8eef8;
  box-shadow: 0 8px 24px rgba(15, 32, 51, 0.06);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.ai-tool-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 42px rgba(37, 99, 235, 0.16);
  border-color: #bfdbfe;
}

/* 卡片预览图区域（固定 5:3 比例，参考云端图片 480×288） */
.ai-tool-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 480 / 288;
  overflow: hidden;
  background: #f0f6ff;
}

.ai-tool-card-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.ai-tool-card:hover .ai-tool-card-cover {
  transform: scale(1.05);
}

/* 卡片内容区 */
.ai-tool-card-body {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
}

.ai-tool-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 1.2rem;
}

.ai-tool-card-text {
  flex: 1;
  min-width: 0;
}

.ai-tool-card-title {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.15rem;
}

.ai-tool-card-desc {
  margin: 0;
  font-size: 0.8rem;
  color: #757575;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-tool-card-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #94a3b8;
  transition: background 0.2s ease, color 0.2s ease;
}

.ai-tool-card:hover .ai-tool-card-arrow {
  background: #dbeafe;
  color: #1d4ed8;
}

/* 编排目录与固定工具融合为同一列表，仅保留分页尾部与安全图片图标样式。 */
.ai-tools-page .flow-catalog-footer { text-align: center; padding-top: 1.5rem; }
.ai-tools-page .flow-catalog-footer:has(p:empty):has(button[hidden]) { display: none; }
.ai-tools-page .flow-catalog-footer p { color: var(--ait-muted); font-size: .8rem; }
.ai-tools-page .flow-catalog-more { border: 1px solid var(--ait-line); border-radius: 999px; background: #fff; color: #2563eb; padding: .65rem 1.8rem; font-size: .88rem; }
.ai-tools-page .flow-catalog-more:hover { background: #eff6ff; }
.ai-tools-page .flow-catalog-more:disabled { opacity: .6; cursor: wait; }
.ai-tools-page .flow-catalog-more:focus-visible { outline: 3px solid #93c5fd; outline-offset: 3px; }
.ai-tools-page .flow-catalog-section .ai-tool-card-icon img { width: 70%; height: 70%; object-fit: contain; }
.ai-tools-page .flow-catalog-section .ai-tool-card-body { min-width: 0; }
.ai-tools-page .flow-catalog-section .ai-tool-card-title { overflow-wrap: anywhere; }
.ai-tools-page .flow-catalog-cover-placeholder { height: 100%; display: flex; align-items: center; justify-content: center; color: #64748b; font-size: .9rem; background: linear-gradient(135deg, #eff6ff, #eef2ff); }

/* ── 底部提示 ── */
.ai-tools-cta {
  text-align: center;
  padding: 1.5rem 2rem 0;
}

.ai-tools-cta p {
  color: #94a3b8;
  font-size: 0.88rem;
  margin: 0;
}

/* ── 响应式 ── */
@media (max-width: 1400px) {
  .ai-tools-hero {
    padding: 3.5rem 8rem 2.5rem;
  }
  .ai-tools-grid-section {
    padding: 2.5rem 8rem 1.5rem;
  }
}

@media (max-width: 1200px) {
  .ai-tools-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 992px) {
  .ai-tools-hero {
    padding: 3rem 4rem 2.2rem;
  }
  .ai-tools-grid-section {
    padding: 2rem 4rem 1.5rem;
  }
  .ai-tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.2rem;
  }
}

@media (max-width: 768px) {
  .ai-tools-page {
    margin-top: -0.75rem;
  }
  .ai-tools-hero {
    padding: 1.35rem 1.2rem;
    background: transparent;
    border-bottom: 0;
    /* 手机排版：标题与简述整体左右、上下居中 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  .ai-tools-hero-inner {
    width: 100%;
  }
  .ai-tools-eyebrow {
    display: none;
  }
  .ai-tools-hero h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }
  .ai-tools-lead {
    font-size: 0.88rem;
    line-height: 1.6;
    color: #64748b;
  }
  .ai-tools-grid-section {
    padding: 1.5rem 1rem 1rem;
  }
  .ai-tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
  }
  .ai-tool-card-body {
    padding: 0.8rem 0.85rem;
    gap: 0.55rem;
  }
  .ai-tool-card-icon {
    width: 34px;
    height: 34px;
    min-width: 34px;
    font-size: 1rem;
    border-radius: 10px;
  }
  .ai-tool-card-title {
    font-size: 0.88rem;
  }
  .ai-tool-card-desc {
    font-size: 0.74rem;
  }
  .ai-tool-card-arrow {
    display: none;
  }
}

@media (max-width: 480px) {
  .ai-tools-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .ai-tool-card {
    flex-direction: row;
    align-items: center;
  }
  .ai-tool-card-media {
    width: 110px;
    min-width: 110px;
    aspect-ratio: auto;
    height: 80px;
  }
  .ai-tool-card-body {
    flex: 1;
  }
}
