/* ============================================================
   layout.css · 全站 UI 重构新增布局样式
   仅补充新布局（顶部分类切换条 / 相关工具 / 首页网格 / 移动适配 / X5 兼容）
   复用 common.css 变量与品牌色，不修改 common.css 任何已有规则
   加载顺序：必须在 common.css 之后 <link>
   ============================================================ */

/* ---------- 去旧左侧边栏（零侵入：仅 CSS 隐藏，HTML 不改） ---------- */
.tool-page-layout { display: block !important; }
.sidebar,
.sidebar-toggle { display: none !important; }

/* ---------- 顶部分类切换条 ---------- */
.cat-bar {
  position: sticky;
  top: var(--header-height, 60px);
  z-index: 40;
  background: var(--bg-header);
  background: color-mix(in srgb, var(--bg-header) 78%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--primary) 24%, var(--border-color));
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  backdrop-filter: blur(12px) saturate(160%);
  box-shadow: 0 4px 18px rgba(255, 107, 0, 0.06);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cat-bar::-webkit-scrollbar { display: none; }
.cat-bar-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 20px;
  max-width: var(--container-width);
  margin: 0 auto;
}
.cat-chip {
  flex: 0 0 auto;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--bg-body);
  color: var(--text-secondary);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--border-color);
  transition: all .15s;
  text-decoration: none;
}
.cat-chip:hover { border-color: var(--primary); color: var(--primary); }
.cat-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 3px 10px rgba(255, 107, 0, 0.35);
}

/* ---------- 相关工具推荐 ---------- */
.related-tools { margin: 36px 0 12px; }
.related-title {
  font-size: 16px; font-weight: 600; margin-bottom: 14px;
  color: var(--text-primary); display: flex; align-items: center; gap: 8px;
}
.related-title::before {
  content: ''; width: 4px; height: 16px;
  background: var(--primary); border-radius: 2px;
}
.related-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.related-card {
  display: block; padding: 14px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); text-decoration: none; color: var(--text-primary);
  transition: all .15s;
}
.related-card:hover {
  border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px);
}
.related-card .rc-name { font-size: 14px; font-weight: 600; }
.related-card .rc-desc {
  font-size: 12px; color: var(--text-secondary); margin-top: 4px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.related-tip {
  margin-top: 16px; padding: 10px 14px;
  background: rgba(255, 107, 0, .06); border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 13px; color: var(--text-secondary);
}

/* ---------- 首页工具网格（统一视觉） ---------- */
.tools-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px;
}
.tool-card {
  display: block; padding: 16px; position: relative;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); text-decoration: none; color: var(--text-primary);
  transition: all .15s;
}
.tool-card:hover {
  border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px);
}
.tool-card-number {
  position: absolute; top: 10px; right: 12px; font-size: 11px; color: var(--text-muted);
}
.tool-card-title {
  font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px;
  padding-right: 42px;
}
.tool-card-desc {
  font-size: 13px; color: var(--text-secondary); margin-top: 6px; line-height: 1.5;
}
.category-section { margin-bottom: 36px; }
.category-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.category-number {
  font-size: 12px; font-weight: 700; color: var(--primary);
  background: rgba(255, 107, 0, .1); padding: 2px 8px; border-radius: 6px;
}
.category-title { font-size: 18px; font-weight: 700; color: var(--text-primary); margin: 0; }
.category-count { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.tag {
  font-size: 10px; padding: 1px 6px; border-radius: 4px; color: #fff; font-weight: 600;
  flex: 0 0 auto;
}
.tag.new { background: var(--tag-new, #10b981); }
.tag.hot { background: var(--tag-hot, #ef4444); }

/* 首页首屏（品牌光晕带） */
.hero-section {
  position: relative;
  text-align: center;
  padding: 46px 24px 28px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(75% 140% at 50% -25%, rgba(255, 107, 0, 0.13), transparent 62%),
    radial-gradient(45% 110% at 50% 125%, rgba(255, 107, 0, 0.06), transparent 60%);
  overflow: hidden;
}
.hero-label { font-size: 12px; color: var(--primary); font-weight: 600; letter-spacing: 2px; margin-bottom: 8px; }
.hero-title { font-size: 28px; margin: 0 0 6px; color: var(--text-primary); }
.hero-title span { color: var(--primary); }
.hero-desc { color: var(--text-secondary); margin: 0 0 4px; font-size: 14px; }

/* 热门工具区 */
.hot-tools { margin: 10px 0 18px; }
.hot-title {
    font-size: 14px; font-weight: 700; color: var(--text-primary);
    margin-bottom: 10px; display: flex; align-items: center; gap: 6px;
}
.hot-scroll {
    display: flex; gap: 10px; overflow-x: auto;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    padding-bottom: 4px;
}
.hot-scroll::-webkit-scrollbar { display: none; }
.hot-card {
    flex: 0 0 auto; width: 160px; padding: 12px 14px;
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); text-decoration: none; color: var(--text-primary);
    transition: all .15s;
}
.hot-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.hot-card-name { font-size: 14px; font-weight: 600; }
.hot-card-desc {
    font-size: 12px; color: var(--text-secondary); margin-top: 4px; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* 面包屑分类链接 */
.breadcrumb-cat-link { color: var(--primary); text-decoration: none; }
.breadcrumb-cat-link:hover { text-decoration: underline; }

/* 首页搜索框（重构版） */
.home-search {
  display: flex; gap: 10px; max-width: 560px; margin: 18px 0 8px;
}
.home-search input {
  flex: 1; padding: 13px 16px; font-size: 15px;
  border: 1px solid var(--border-color); border-radius: var(--radius-md);
  background: var(--bg-card); color: var(--text-primary); outline: none;
}
.home-search input:focus { border-color: var(--primary); }
.home-search button {
  padding: 0 22px; border: none; border-radius: var(--radius-md);
  background: var(--primary); color: #fff; font-size: 15px; cursor: pointer;
}
.category-filter {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 28px;
}
.category-filter-item {
  padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: 13px;
  background: var(--bg-card); border: 1px solid var(--border-color); color: var(--text-secondary);
  transition: all .15s;
}
.category-filter-item:hover { border-color: var(--primary); color: var(--primary); }
.category-filter-item.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- 移动端 / 微信 X5 适配 ---------- */
html { -webkit-text-size-adjust: 100%; }
* { -webkit-tap-highlight-color: transparent; }
img { -webkit-touch-callout: none; }

@media (max-width: 768px) {
  .related-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-bar-inner { padding: 8px 12px; }
  .tool-main { padding-left: 12px; padding-right: 12px; }
  .container { padding-left: 12px; padding-right: 12px; }
  .tools-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tool-card { padding: 13px; }
  .tool-card-desc { font-size: 12px; }
  .home-search { flex-direction: column; }
  .home-search button { padding: 12px; }
  .category-title { font-size: 16px; }
  .hero-section { padding: 30px 16px 18px; }
  .hero-title { font-size: 22px; }
  .hero-desc { font-size: 13px; }
  .hot-card { width: 140px; padding: 10px 12px; }
}
@supports (height: 100dvh) {
  .tool-page-layout { min-height: 100dvh; }
}
