/* ============================================================
   在线工具大全 - 参考 LDDGO.NET 布局风格
   深色导航条 / 深色搜索 Hero / 卡片网格 / 深色一行页脚
   ============================================================ */
:root {
  --nav-bg: #343a45;       /* 顶部导航深灰 */
  --nav-hover: #4a5363;
  --hero-bg1: #454d5a;     /* Hero 渐变起始（header/footer 色 #343a45 的淡化版） */
  --hero-bg2: #505967;     /* Hero 渐变结束（稍浅，过渡柔和） */
  --link: #2d6bc4;         /* 链接蓝 */
  --link-hover: #1f559e;
  --text: #333;
  --text-light: #666;
  --text-lighter: #999;
  --bg: #f4f5f7;
  --card-bg: #fff;
  --border: #e5e8ec;
  --footer-bg: #343a45;
  --footer-text: #c3c9d2;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  /* 兜底：防止任何元素溢出产生横向滚动条（clip 不创建滚动容器，不影响 sticky 导航） */
  overflow-x: clip;
}

main { flex: 1; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }

h1, h2, h3 { line-height: 1.4; font-weight: bold; }

/* ============ 顶部导航条（深色） ============ */
.site-header {
  background: var(--nav-bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  position: relative;  /* 移动端下拉菜单的定位参考 */
}

.logo { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 19px; font-weight: bold; }
.logo:hover { color: #fff; text-decoration: none; }
.logo-img { width: 24px; height: 24px; }
.logo-icon { font-size: 22px; line-height: 1; }

/* 汉堡按钮：桌面端隐藏，移动端显示（样式见响应式段） */
.nav-toggle {
  display: none;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.main-nav { display: flex; flex-wrap: wrap; align-items: center; }
.main-nav a {
  color: #cfd6e0;
  font-size: 14px;
  padding: 0 14px;
  line-height: 58px;
}
.main-nav a:hover { color: #fff; text-decoration: none; background: var(--nav-hover); }

/* ============ Hero（深色搜索区） ============ */
.hero {
  background: linear-gradient(135deg, var(--hero-bg1), var(--hero-bg2));
  text-align: center;
  padding: 64px 0 56px;
  color: #fff;
}

.hero-stat {
  font-size: 34px;
  font-weight: bold;
  margin-bottom: 10px;
  letter-spacing: 1px;
}
.hero-stat .more-text { font-size: 17px; font-weight: normal; opacity: 0.85; }

.hero .sub { opacity: 0.85; margin-bottom: 26px; font-size: 15px; }

.search-box {
  position: relative;
  max-width: 620px;
  margin: 0 auto;
  display: flex;
  height: 50px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.12);
}
.search-box input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: #fff;
  font-size: 15px;
  padding: 0 18px;
  caret-color: #fff;
}
.search-box input::placeholder { color: rgba(255, 255, 255, 0.75); }

.search-btn {
  width: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.search-btn svg { width: 20px; height: 20px; fill: #fff; opacity: 0.9; }
.search-btn:hover svg { opacity: 1; }

.search-suggest {
  position: absolute;
  top: 56px;
  left: -2px;
  right: -2px;
  background: #fff;
  border: 1px solid #d3d3d3;
  border-top: none;
  color: #333;
  text-align: left;
  display: none;
  z-index: 50;
}
.search-suggest.show { display: block; }
.search-suggest a {
  display: block;
  padding: 10px 14px;
  color: var(--text);
  border-bottom: 1px solid #f0f2f5;
}
.search-suggest a:last-child { border-bottom: none; }
.search-suggest a:hover { background: #f0f0f0; color: var(--link); text-decoration: none; }
.search-suggest a small { color: var(--text-lighter); margin-left: 8px; font-size: 12px; }
.search-empty { padding: 10px 14px; color: var(--text-lighter); font-size: 13px; }

/* ============ 区块标题（居中，无装饰） ============ */
.section { padding: 34px 0 10px; }
.section-head { text-align: center; margin-bottom: 18px; }
.section-head h2 {
  font-size: 20px;
  color: var(--text);
  display: inline-block;
}

/* ============ 工具卡片网格（固定尺寸，整卡可点击） ============ */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 252px);
  gap: 18px;
  justify-content: center;
}

.tool-card {
  display: flex;
  flex-direction: column;
  width: 252px;
  height: 248px;
  background: var(--card-bg);
  border-radius: 4px;
  padding: 22px 18px 12px;
  text-align: center;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.tool-card:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
  transform: translateY(-2px);
  color: var(--text);
  text-decoration: none;
}

.tool-icon { font-size: 42px; line-height: 1; margin-bottom: 12px; }
.tool-icon-img { width: 45px; height: 45px; margin: 0 auto 12px; display: block; }

.tool-title { font-size: 15px; color: var(--text); margin-bottom: 8px; }

.tool-desc {
  font-size: 13px;
  color: var(--text-light);
  text-align: left;
  min-height: 60px;
  margin-bottom: 12px;
  flex: 1;
}

.tool-use-count {
  border-top: 1px solid #f0f2f5;
  padding-top: 8px;
  color: var(--text-lighter);
  font-size: 13px;
}

.empty-tip {
  color: var(--text-lighter);
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: 4px;
  padding: 24px;
  text-align: center;
}

/* ============ 页内 SEO 文案区 ============ */
.article-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px 26px;
}
.article-box h2 { font-size: 18px; margin-bottom: 12px; }
.article-box h3 { font-size: 15px; margin: 16px 0 6px; }
.article-box p { color: var(--text-light); margin-bottom: 8px; }
.article-box ul { padding-left: 22px; color: var(--text-light); margin-bottom: 8px; }

/* ============ 面包屑 ============ */
.breadcrumb {
  font-size: 13px;
  color: var(--text-lighter);
  padding: 14px 0;
}
.breadcrumb a { color: var(--text-lighter); }
.breadcrumb a:hover { color: var(--link); }
.breadcrumb .sep { margin: 0 6px; color: #c9cdd3; }
.breadcrumb .current { color: var(--text-light); }

/* ============ 栏目页标题（居中，无背景） ============ */
.page-title {
  text-align: center;
  font-size: 26px;
  color: #222;
  padding: 26px 0 4px;
}

/* ============ 工具页：标题 / 标签行 / 分隔线 ============ */
.main-title { font-size: 24px; color: #222; margin: 6px 0 12px; }

.tool-hr { border: none; border-top: 1px solid var(--border); margin: 16px 0 20px; }

/* ============ 计算区：左表单 + 右结果 ============ */
.calc-layout {
  display: grid;
  /* minmax(0,1fr)：列最小宽度为 0，避免 select 最长 option 文本把 grid 列撑宽导致页面横向溢出 */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.calc-form, .calc-result {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 22px 24px;
}

.form-item {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}
.form-item > label:first-child {
  flex-shrink: 0;
  width: 92px;
  height: 38px;
  line-height: 38px;
  text-align: center;
  font-size: 14px;
  background: #f4f6f9;
  border: 1px solid var(--border);
  border-right: none;
}
.form-item input[type="number"], .form-item select {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: #fff;
  outline: none;
}
.form-item input[type="number"]:focus, .form-item select:focus { border-color: var(--link); }
.form-item .unit {
  flex-shrink: 0;
  width: 42px;            /* 固定宽度：作为行尾占位，保证各行右缘对齐 */
  height: 38px;
  line-height: 38px;
  padding: 0 10px;
  font-size: 13px;
  color: var(--text-lighter);
  text-align: center;     /* 单位文本居中 */
}
/* 下拉框、文件选择行没有单位后缀，右侧预留与 .unit 等宽的占位，保证与输入框右边缘对齐 */
.form-item select, .form-item input[type="file"] { margin-right: 42px; }

.radio-inline { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 0 12px; min-height: 38px; align-items: center; }
.radio-inline label { display: flex; align-items: center; gap: 5px; font-weight: normal; font-size: 14px; cursor: pointer; }
.radio-inline input { width: auto; height: auto; margin: 0; }

/* 结果区 */
.bmr-line { font-size: 15px; color: var(--text); margin-bottom: 14px; }
#bmrResult { font-size: 24px; color: #009688; font-weight: bold; }
#bmrResult small { font-size: 13px; font-weight: normal; color: var(--text-light); }

.table-wrap { overflow-x: auto; }
.result-hint { color: var(--text-lighter); text-align: center; padding: 18px 0; }
.result-tip { font-size: 12px; color: var(--text-lighter); margin-top: 10px; }

/* BMI 体型判定 */
.bmi-level { display: inline-block; margin-top: 8px; padding: 2px 12px; border-radius: 3px; font-size: 14px; }
.bmi-level.thin { background: #fde8e8; color: #c0392b; }
.bmi-level.normal { background: #e6f6ec; color: #1c8a4a; }
.bmi-level.over { background: #fff3d6; color: #b7791f; }
.bmi-level.obese { background: #fde8e8; color: #c0392b; }

/* 图片转 ICO */
.form-item input[type="file"] { flex: 1; min-width: 0; height: auto; padding: 7px 10px; }
.form-item select:disabled { background: #f2f4f7; color: var(--text-lighter); cursor: not-allowed; }

/* 选图后显示的原图信息 */
.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -2px 0 14px;
  padding: 10px 12px;
  background: #f7f9fb;
  border: 1px dashed var(--border);
  border-radius: 4px;
}
.file-info img {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  padding: 3px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
}
.file-meta { min-width: 0; font-size: 13px; color: var(--text-light); line-height: 1.7; }
.file-meta .file-name { color: var(--text); word-break: break-all; }

/* 多尺寸打包勾选行 */
.check-label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 10px;
  font-size: 13px;
  color: var(--text-light);
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--border);
}
.check-label input { width: auto; height: auto; margin: 0; flex-shrink: 0; }

/* 转换结果区 */
.ico-result-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  margin-bottom: 14px;
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: 4px;
}
.ico-result-preview img {
  display: none;
  max-width: 120px;
  max-height: 120px;
  padding: 10px;
  object-fit: contain;
}
.result-info { font-size: 13px; color: var(--text-light); text-align: center; margin: -6px 0 12px; }

/* ============ 相关工具 / 区块标题 ============ */
.related-tools { margin-top: 26px; }
.block-title { font-size: 20px; color: var(--text); margin-bottom: 16px; padding-left: 10px; border-left: 4px solid var(--link); }

/* ============ 工具简介 / 使用说明 / FAQ 标题（h2，顶部分隔线） ============ */
.tool-field-title {
  font-size: 18px;
  font-weight: bold;
  color: var(--text);
  border-top: 1px solid var(--border);
  margin-top: 28px;
  padding-top: 18px;
}
.tool-field-body { color: var(--text-light); margin-top: 10px; }

.use-note { padding-left: 24px; margin-top: 10px; color: var(--text-light); }
.use-note li { margin-bottom: 10px; }
.main-code {
  font-family: Consolas, Menlo, monospace;
  background: #f4f6f9;
  border: 1px solid var(--border);
  padding: 0 4px;
  font-size: 13px;
}

/* ============ 工具页布局 ============ */
.tool-page { padding: 24px 0 48px; }

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}

.tool-main, .tool-side {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px;
}

.tool-main h1 { font-size: 22px; color: var(--text); margin-bottom: 4px; }
.tool-main .tool-intro { color: var(--text-light); font-size: 13px; margin-bottom: 18px; }

/* ============ 表单 ============ */
.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px 16px;
}

.form-group label { display: block; font-size: 13px; margin-bottom: 4px; color: var(--text); }
.form-group input, .form-group select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fff;
  outline: none;
}
.form-group input:focus, .form-group select:focus { border-color: var(--link); }
.form-group.full { grid-column: 1 / -1; }

.radio-row { display: flex; gap: 18px; padding-top: 4px; }
.radio-row label { display: flex; align-items: center; gap: 5px; font-weight: normal; margin-bottom: 0; }
.radio-row input { width: auto; height: auto; }

.btn {
  display: inline-block;
  height: 38px;
  padding: 0 26px;
  font-size: 14px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  background: var(--link);
  color: #fff;
}
.btn:hover { background: var(--link-hover); }
.btn-secondary { background: #e8edf4; color: var(--link); }
.btn-secondary:hover { background: #dde5ef; color: var(--link-hover); }
.btn-row { display: flex; gap: 10px; margin-top: 18px; }

/* ============ 结果区 ============ */
.result-box { margin-top: 20px; display: none; }
.result-box.show { display: block; }

.result-card {
  border: 1px solid var(--border);
  background: #f6f9fe;
  border-radius: 4px;
  padding: 16px 20px;
  margin-bottom: 12px;
}
.result-card .num {
  font-size: 30px;
  font-weight: bold;
  color: var(--link);
  line-height: 1.3;
}
.result-card .num small { font-size: 14px; font-weight: normal; color: var(--text-light); }
.result-card .desc { color: var(--text-light); font-size: 13px; margin-top: 2px; }

.result-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 4px; }
.result-table th, .result-table td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.result-table th { background: #f0f3f7; font-weight: bold; }
.result-table .hl td { background: #e8f1fc; font-weight: bold; color: var(--link-hover); }

.form-error { color: #d33; font-size: 13px; margin-top: 8px; display: none; }

/* ============ FAQ ============ */
.faq-item { border-bottom: 1px solid var(--border); padding: 12px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-item h3 { font-size: 14px; margin-bottom: 4px; }
.faq-item p { font-size: 13px; color: var(--text-light); }

/* ============ 侧栏 ============ */
.tool-side h2 {
  font-size: 15px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 10px;
}
.side-list { list-style: none; }
.side-list li { padding: 5px 0; border-bottom: 1px dashed #eef0f3; font-size: 13px; }
.side-list li:last-child { border-bottom: none; }

/* ============ 页脚（深色一行） ============ */
.site-footer {
  background: var(--footer-bg);
  margin-top: 40px;
}
.footer-line {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 22px 0;
  font-size: 13px;
  color: var(--footer-text);
}
.footer-line .sep { color: #6b7280; }
.footer-line a { color: var(--footer-text); }
.footer-line a:hover { color: #fff; text-decoration: underline; }

/* ============ 博客列表与文章页 ============ */
.post-list { max-width: 860px; margin: 0 auto; }

.post-item {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px 24px;
  margin-bottom: 14px;
  color: var(--text);
}
.post-item:hover { border-color: var(--link); color: var(--text); text-decoration: none; }
.post-item-title { font-size: 18px; color: var(--link); margin-bottom: 8px; }
.post-item:hover .post-item-title { color: var(--link-hover); }
.post-item-summary { font-size: 14px; color: var(--text-light); margin-bottom: 10px; }
.post-item-meta { font-size: 13px; color: var(--text-lighter); display: flex; flex-wrap: wrap; gap: 8px 16px; }

.post-cat { color: var(--link); }

.post-title { font-size: 24px; color: #222; margin: 6px 0 10px; }
.post-meta {
  font-size: 13px;
  color: var(--text-lighter);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-bottom: 18px;
}

.post-content {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 28px 32px;
}
.post-content h2 { font-size: 19px; margin: 22px 0 10px; color: var(--text); }
.post-content h2:first-child { margin-top: 0; }
.post-content p { color: var(--text-light); margin-bottom: 12px; }
.post-content ul { padding-left: 24px; color: var(--text-light); margin-bottom: 12px; }
.post-content li { margin-bottom: 6px; }

.post-related { margin-top: 24px; }
.post-back { display: inline-block; margin-top: 20px; font-size: 14px; }

.post-refs { padding-left: 24px; margin-top: 10px; color: var(--text-light); font-size: 13px; }
.post-refs li { margin-bottom: 6px; word-break: break-all; }

.post-disclaimer {
  margin-top: 18px;
  padding: 12px 16px;
  background: #f6f8fb;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-lighter);
  line-height: 1.8;
}

/* ============ 响应式 ============ */
@media (max-width: 992px) {
  .tool-grid { grid-template-columns: repeat(auto-fill, 252px); }
}
@media (max-width: 768px) {
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .tool-card { width: 100%; height: auto; }
  .tool-layout { grid-template-columns: 1fr; }
  .calc-layout { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .hero { padding: 42px 0 36px; }
  .hero-stat { font-size: 26px; }
  .footer-line { gap: 10px; }

  /* ===== 移动端折叠导航 ===== */
  .nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 44px;
    height: 44px;
  }
  .nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: #cfd6e0;
    border-radius: 1px;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  .main-nav {
    display: none;
    position: absolute;
    top: 58px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--nav-bg);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.18);
  }
  .main-nav.open { display: flex; }
  .main-nav a {
    line-height: 46px;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .main-nav a:hover { background: var(--nav-hover); }
}
@media (max-width: 480px) {
  .tool-grid { grid-template-columns: 1fr; }
}
