/* =============================================
   三娃工具 - 前台样式（黑白配色）
   ============================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f7f7f8;
  --card: #ffffff;
  --border: #e6e6e8;
  --text: #111111;
  --text-2: #666666;
  --text-3: #999999;
  --dark: #111111;
  --radius: 12px;
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--text); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ---------- 顶栏 ---------- */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner { display: flex; align-items: center; gap: 24px; height: 60px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; flex-shrink: 0; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--dark); color: #fff; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center;
}
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  padding: 6px 12px; border-radius: 8px; color: var(--text-2); font-size: 14px; white-space: nowrap;
}
.nav a:hover { background: #f0f0f1; text-decoration: none; }
.nav a.active { color: var(--text); font-weight: 600; background: #f0f0f1; }
.search-box { display: flex; flex-shrink: 0; }
.search-box input {
  border: 1px solid var(--border); border-right: none; border-radius: 8px 0 0 8px;
  padding: 7px 12px; font-size: 13px; width: 180px; outline: none; background: #fff; color: var(--text);
}
.search-box input:focus { border-color: #bbb; }
.search-box button {
  border: 1px solid var(--dark); background: var(--dark); color: #fff;
  border-radius: 0 8px 8px 0; padding: 0 12px; cursor: pointer; font-size: 16px;
}

/* ---------- 热门工具条 ---------- */
.hotbar-wrap { background: #fff; border-bottom: 1px solid var(--border); }
.hotbar { display: flex; align-items: center; gap: 16px; padding: 10px 20px; overflow-x: auto; }
.hotbar-label {
  flex-shrink: 0; font-size: 12px; font-weight: 600; color: #fff;
  background: var(--dark); padding: 3px 10px; border-radius: 20px;
}
.hotbar-list { display: flex; gap: 8px; align-items: center; }
.hotbar-item {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px;
  border: 1px solid var(--border); border-radius: 20px; font-size: 13px; color: var(--text-2); white-space: nowrap;
}
.hotbar-item:hover { border-color: #bbb; color: var(--text); text-decoration: none; }
.hotbar-icon { font-size: 14px; }

/* ---------- 三栏布局 ---------- */
.main-grid { display: grid; grid-template-columns: 92px 1fr 300px; gap: 16px; padding-top: 16px; padding-bottom: 32px; }
.tool-layout, .blog-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; padding: 16px 0 32px; }
.container { max-width: 1200px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }

/* 左侧竖导航（可折叠） */
.side-nav {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px; height: fit-content; position: sticky; top: 76px;
  transition: padding .18s;
}
.side-nav-toggle {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 28px; margin-top: 6px;
  border: none; background: none; cursor: pointer;
  color: var(--text-3); font-size: 14px; border-radius: 8px;
}
.side-nav-toggle::before {
  content: ''; position: absolute; top: 0; left: 8px; right: 8px;
  height: 1px; background: var(--border);
}
.side-nav-toggle:hover { background: #f0f0f1; color: var(--text); }
.side-nav-toggle svg { transition: transform .18s; }
.side-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px; border-radius: 10px; color: var(--text-2); font-size: 12px;
}
.side-nav-item:hover { background: #f0f0f1; text-decoration: none; color: var(--text); }
.side-nav-icon { font-size: 20px; line-height: 1; }
.side-nav-text { white-space: nowrap; }

/* 折叠状态：只留图标（状态由 html[data-nav] 控制，默认折叠） */
.main-grid { transition: grid-template-columns .18s; }
html[data-nav="collapsed"] #side-nav { padding: 8px 6px; }
html[data-nav="collapsed"] #side-nav .side-nav-text { display: none; }
html[data-nav="collapsed"] #side-nav .side-nav-item { padding: 10px 0; }
html[data-nav="collapsed"] .main-grid { grid-template-columns: 56px 1fr 300px; }
html[data-nav="collapsed"] #side-nav .side-nav-toggle svg { transform: rotate(180deg); }

/* 卡片 */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
}
.content .card:last-child { margin-bottom: 0; }

/* 分类区块 */
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-head h2 { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.section-icon { font-size: 18px; }
.more { font-size: 13px; color: var(--text-3); }
.more:hover { color: var(--text); }

/* 工具网格 */
.tool-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tool-grid-large { grid-template-columns: repeat(3, 1fr); }
.tool-item {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border: 1px solid var(--border); border-radius: 10px; transition: all .15s;
}
.tool-item:hover { border-color: #bbb; background: #fafafa; text-decoration: none; transform: translateY(-1px); }
.tool-item-icon {
  width: 36px; height: 36px; border-radius: 8px; background: #f0f0f1; color: var(--text);
  display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.tool-item-body { display: flex; flex-direction: column; min-width: 0; }
.tool-item-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-item-desc { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 右侧栏 ---------- */
.clock-card { text-align: center; }
.clock-date { font-size: 13px; color: var(--text-2); }
.clock-time { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.clock-week { font-size: 13px; color: var(--text-3); }
.side-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.side-list { list-style: none; }
.side-list li a {
  display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-radius: 8px;
}
.side-list li a:hover { background: #f5f5f5; text-decoration: none; }
.side-list-icon { font-size: 16px; width: 22px; text-align: center; }
.side-list-body { display: flex; flex-direction: column; min-width: 0; }
.side-list-name { font-size: 13px; font-weight: 500; }
.side-list-desc { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 页面标题区 ---------- */
.page-head { padding: 24px 0 12px; }
.page-head h1 { font-size: 24px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.breadcrumb { font-size: 13px; color: var(--text-3); margin-bottom: 10px; }
.breadcrumb a { color: var(--text-3); }
.breadcrumb a:hover { color: var(--text); }

/* 工具详情 */
.tool-title { font-size: 26px; }
.tool-title-icon { font-size: 28px; }
.tool-sub { color: var(--text-2); margin-top: 6px; }
.tool-panel { padding: 24px; }

/* 工具介绍 / 标签 / FAQ */
.tool-doc, .tool-tags-card, .tool-faq { padding: 24px; }
.doc-title {
  font-size: 17px; font-weight: 700; margin-bottom: 14px;
  padding-left: 12px; border-left: 3px solid var(--dark); line-height: 1.2;
}
.doc-body { color: #333; font-size: 15px; line-height: 1.9; }
.doc-body p { margin: 8px 0; }
.doc-body ul, .doc-body ol { padding-left: 22px; margin: 8px 0; }
.doc-body code { background: #f2f2f3; padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  padding: 4px 14px; background: #f0f0f1; border-radius: 20px;
  font-size: 13px; color: var(--text-2);
}
.faq-item { padding: 12px 0; border-bottom: 1px dashed var(--border); }
.faq-item:last-child { border-bottom: none; padding-bottom: 0; }
.faq-q { font-weight: 600; font-size: 14px; }
.faq-q::before { content: 'Q：'; color: var(--text-3); }
.faq-a { color: var(--text-2); font-size: 14px; margin-top: 6px; }
.faq-a::before { content: 'A：'; color: var(--text-3); }

/* 分类页子分类 chips */
.subcat-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.subcat-chip {
  padding: 6px 14px; border: 1px solid var(--border); border-radius: 20px;
  font-size: 13px; color: var(--text-2); background: #fff;
}
.subcat-chip:hover { border-color: #bbb; color: var(--text); text-decoration: none; }

/* ---------- 工具通用 UI ---------- */
.tool-ui { display: flex; flex-direction: column; gap: 16px; }
.tool-ui-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tool-col label, .tool-row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
.tool-col textarea { width: 100%; }
.tool-row { display: flex; flex-direction: column; }
.tool-inline { display: flex; gap: 8px; }
.tool-inline input { flex: 1; }
.tool-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tool-result { margin-top: 10px; padding: 10px 14px; background: #f5f5f5; border-radius: 8px; font-size: 14px; word-break: break-all; }
.tool-msg { font-size: 13px; }
.msg-ok { color: #166534; }
.msg-err { color: #991b1b; }
.tool-desc { color: var(--text-2); }
.tool-tip { color: var(--text-3); margin-top: 8px; }
.tool-default { padding: 20px 0; text-align: center; }
hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* 表单控件 */
input[type="text"], input[type="number"], input[type="datetime-local"], input[type="password"], select, textarea {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px;
  font-size: 14px; outline: none; background: #fff; color: var(--text); font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: #bbb; }
textarea { resize: vertical; }
.code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; font-size: 13px; line-height: 1.55; }

/* 按钮 */
.btn {
  display: inline-block; border: 1px solid transparent; border-radius: 8px;
  padding: 8px 18px; font-size: 14px; cursor: pointer; transition: all .15s; font-family: inherit;
}
.btn:hover { text-decoration: none; }
.btn-dark { background: var(--dark); color: #fff; }
.btn-dark:hover { background: #333; }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: #bbb; background: #f5f5f5; }

/* ---------- 博客 ---------- */
.post-item { padding: 20px; }
.post-item-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.post-item-title a:hover { text-decoration: underline; }
.post-item-meta { display: flex; gap: 14px; font-size: 12px; color: var(--text-3); margin: 6px 0 10px; }
.post-cat {
  background: #f0f0f1; color: var(--text-2); padding: 1px 10px; border-radius: 20px; font-size: 12px;
}
.post-item-summary { color: var(--text-2); font-size: 14px; }
.post-title { font-size: 24px; }
.post-content { font-size: 15px; line-height: 1.9; }
.post-content h1, .post-content h2, .post-content h3 { margin: 20px 0 10px; }
.post-content p { margin: 10px 0; }
.post-content img { max-width: 100%; border-radius: 8px; }
.post-content table { border-collapse: collapse; width: 100%; margin: 12px 0; }
.post-content table th, .post-content table td { border: 1px solid var(--border); padding: 8px 12px; }
.post-content table th { background: #f5f5f5; }
.post-content blockquote { border-left: 3px solid #bbb; padding-left: 14px; color: var(--text-2); margin: 12px 0; }
.post-content code { background: #f2f2f3; padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.post-content pre { background: #111; color: #f5f5f5; padding: 16px; border-radius: 8px; overflow-x: auto; margin: 12px 0; }
.post-content pre code { background: none; color: inherit; }
.post-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
.post-nav-link { flex: 1; padding: 12px 16px; background: #fff; border: 1px solid var(--border); border-radius: 10px; font-size: 13px; color: var(--text-2); }
.post-nav-link:hover { border-color: #bbb; color: var(--text); text-decoration: none; }
.post-nav-link:last-child { text-align: right; }

/* 搜索 */
.search-large { display: flex; gap: 8px; margin-top: 14px; max-width: 520px; }
.search-large input { flex: 1; padding: 10px 14px; font-size: 15px; }
.search-large button { padding: 10px 22px; }

/* 分页 */
.pagination { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pg-item {
  min-width: 34px; height: 34px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 8px; font-size: 13px; background: #fff; color: var(--text-2);
}
.pg-item:hover { border-color: #bbb; color: var(--text); text-decoration: none; }
.pg-active { background: var(--dark); color: #fff; border-color: var(--dark); }
.pg-active:hover { color: #fff; }

/* 空状态 / 404 */
.empty, .empty-mini { color: var(--text-3); text-align: center; padding: 30px 10px; }
.empty-mini { padding: 16px 10px; font-size: 13px; }
.err-404 { font-size: 72px; font-weight: 800; color: var(--text); }

/* ---------- 页脚 ---------- */
.site-footer { background: #fff; border-top: 1px solid var(--border); margin-top: 32px; }
.footer-inner { padding: 28px 20px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.footer-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; font-size: 13px; }
.footer-links a { color: var(--text-2); }
.footer-links a:hover { color: var(--text); }
.footer-copy { font-size: 12px; color: var(--text-3); text-align: center; }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .main-grid, html[data-nav="collapsed"] .main-grid { grid-template-columns: 1fr; }
  .tool-layout, .blog-layout { grid-template-columns: 1fr; }
  .side-nav { flex-direction: row; position: static; overflow-x: auto; }
  .side-nav-item { flex-direction: row; }
  .side-nav-text, html[data-nav="collapsed"] #side-nav .side-nav-text { display: inline; }
  html[data-nav="collapsed"] #side-nav .side-nav-item { padding: 10px 4px; }
  .side-nav-toggle { display: none; }
  .nav { overflow-x: auto; }
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .tool-grid-large { grid-template-columns: repeat(2, 1fr); }
  .tool-ui-row { grid-template-columns: 1fr; }
  .search-box { display: none; }
}
@media (max-width: 480px) {
  .tool-grid, .tool-grid-large { grid-template-columns: 1fr; }
}
