/* ============================================================
   frontend-intro-v5 共享样式 common.css
   明亮主题 · 桌面 + 移动端适配 · 供 html/*/ 下全部页面引用
   配套交互脚本：../js/common.js（渐进增强，无脚本亦可完整阅读）
   约定：主色 #1a73e8；背景 #f5f7fb；正文 #2c3e50
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #f5f7fb;
  color: #2c3e50;
  line-height: 1.75;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- 顶部导航 / 页头 ---------------- */
.page-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 52px;
  padding: 0 20px;
  background: #ffffff;
  border-bottom: 1px solid #e4e9f0;
  box-shadow: 0 1px 4px rgba(16, 42, 67, 0.06);
}

.page-topbar .brand {
  font-weight: 700;
  font-size: 15px;
  color: #1a73e8;
  white-space: nowrap;
  text-decoration: none;
}
.page-topbar .brand small { color: #8896a7; font-weight: 400; }

.topbar-spacer { flex: 1; }

.topbar-nav { display: flex; align-items: center; gap: 6px; }
.topbar-nav a {
  color: #44596f;
  text-decoration: none;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 6px;
  transition: background .18s, color .18s;
  white-space: nowrap;
}
.topbar-nav a:hover { background: #eef4ff; color: #1a73e8; }

/* 移动端目录抽屉开关 */
.toc-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  border: 1px solid #d5ddea;
  background: #fff;
  color: #2c3e50;
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
}

/* ---------------- 页面主体布局 ---------------- */
.page-wrap {
  display: flex;
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 20px 60px;
  gap: 28px;
}

/* 侧边目录 */
.toc {
  flex: 0 0 240px;
  position: sticky;
  top: 76px;
  align-self: flex-start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding: 14px 6px;
  background: #ffffff;
  border: 1px solid #e4e9f0;
  border-radius: 10px;
}
.toc-title {
  font-size: 12px;
  color: #8896a7;
  letter-spacing: .08em;
  padding: 0 10px 8px;
  font-weight: 600;
}
.toc a {
  display: block;
  color: #44596f;
  text-decoration: none;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.toc a:hover { background: #f0f5ff; color: #1a73e8; }
.toc a.lv2 { font-weight: 600; }
.toc a.lv3 { padding-left: 22px; font-size: 12.5px; color: #5b6d82; }
.toc a.active { background: #e8f1ff; color: #1a73e8; border-left-color: #1a73e8; font-weight: 600; }

/* 内容区 */
.content { flex: 1; min-width: 0; }

/* ---------------- 页头（面包屑 + 标题 + 元信息） ---------------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #8896a7;
  margin-bottom: 10px;
}
.breadcrumb a { color: #1a73e8; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: #b7c2d0; }

.page-header h1 {
  font-size: 26px;
  line-height: 1.35;
  color: #17324d;
  margin-bottom: 10px;
}
.page-header .subtitle { color: #5b6d82; font-size: 14px; margin-bottom: 14px; }

.meta-table {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0;
  background: #ffffff;
  border: 1px solid #e4e9f0;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 22px;
}
.meta-item {
  display: flex;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid #f0f3f8;
  font-size: 13px;
}
.meta-item:nth-child(odd) { background: #fafbfe; }
.meta-item .k { color: #8896a7; flex: 0 0 68px; }
.meta-item .v { color: #2c3e50; word-break: break-all; }
.meta-item .v code { background: #eef2f8; }

/* ---------------- 章节与文本 ---------------- */
.content h2 {
  font-size: 21px;
  color: #17324d;
  margin: 34px 0 14px;
  padding: 0 0 8px 12px;
  border-left: 4px solid #1a73e8;
  border-bottom: 1px solid #e8edf5;
}
.content h3 {
  font-size: 17px;
  color: #1a73e8;
  margin: 24px 0 10px;
}
.content h4 { font-size: 15px; color: #34506e; margin: 18px 0 8px; }
.content p { margin: 8px 0; }
.content ul, .content ol { margin: 8px 0 8px 26px; }
.content li { margin: 4px 0; }
.content strong { color: #17324d; }
.content em { color: #44596f; }

a { color: #1a73e8; }

code {
  background: #eef2f8;
  color: #1c4a8a;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px;
}
pre {
  background: #1f2937;
  color: #e5e7eb;
  padding: 14px 18px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  margin: 12px 0;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}
pre code { background: none; color: inherit; padding: 0; }

/* ---------------- 卡片 / 表格 / 告警 / 标签 ---------------- */
.card {
  background: #ffffff;
  border: 1px solid #e4e9f0;
  border-radius: 10px;
  padding: 18px 22px;
  margin: 14px 0;
  box-shadow: 0 1px 3px rgba(16, 42, 67, .04);
}
.card h3:first-child { margin-top: 0; }

.table-wrap {
  overflow-x: auto;
  margin: 12px 0;
  border: 1px solid #e4e9f0;
  border-radius: 10px;
  background: #fff;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 640px;
}
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid #eef1f6; vertical-align: top; }
th {
  background: #f0f4fa;
  font-weight: 600;
  color: #44596f;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
tbody tr:hover td { background: #f7faff; }
tr:last-child td { border-bottom: none; }

.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin: 12px 0; border-left: 4px solid; }
.alert-info    { background: #ebf5ff; border-color: #1a73e8; color: #17468c; }
.alert-warn    { background: #fff8e8; border-color: #e0a800; color: #7a5b00; }
.alert-ok      { background: #eefaf2; border-color: #21a354; color: #166c3a; }
.alert-danger  { background: #fef0ef; border-color: #d64545; color: #8c2323; }

.tag { display: inline-block; padding: 1px 9px; border-radius: 20px; font-size: 12px; margin: 0 4px 4px 0; }
.tag-ok    { background: #eefaf2; color: #166c3a; border: 1px solid #bfe6cc; }
.tag-part  { background: #fff8e8; color: #7a5b00; border: 1px solid #f0d68a; }
.tag-no    { background: #fef0ef; color: #8c2323; border: 1px solid #f3c0bf; }
.tag-info  { background: #ebf5ff; color: #17468c; border: 1px solid #b9d8fb; }

/* ---------------- 按钮 / 折叠 / Tab ---------------- */
.btn {
  display: inline-block;
  padding: 6px 16px;
  border: 1px solid #cfd8e4;
  border-radius: 6px;
  background: #fff;
  color: #2c3e50;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: all .18s;
}
.btn:hover { border-color: #1a73e8; color: #1a73e8; }
.btn-primary { background: #1a73e8; border-color: #1a73e8; color: #fff; }
.btn-primary:hover { background: #1662c4; color: #fff; }
.btn-danger { background: #d64545; border-color: #d64545; color: #fff; }
.btn-danger:hover { background: #b83a3a; color: #fff; }
.btn-sm { padding: 3px 10px; font-size: 12px; }

details.fold {
  background: #fff;
  border: 1px solid #e4e9f0;
  border-radius: 10px;
  margin: 12px 0;
  overflow: hidden;
}
details.fold summary {
  cursor: pointer;
  padding: 12px 18px;
  font-weight: 600;
  font-size: 14px;
  color: #17324d;
  background: #f8fafd;
  list-style: none;
  position: relative;
  transition: background .18s;
}
details.fold summary:hover { background: #f0f5ff; }
details.fold summary::after {
  content: '▸';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #1a73e8;
  transition: transform .2s;
}
details.fold[open] summary::after { transform: translateY(-50%) rotate(90deg); }
details.fold .fold-body { padding: 8px 18px 16px; border-top: 1px solid #eef1f6; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 2px solid #e4e9f0; margin: 16px 0 0; }
.tab-btn {
  padding: 8px 18px;
  border: none;
  background: none;
  color: #5b6d82;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: #1a73e8; }
.tab-btn.active { color: #1a73e8; border-bottom-color: #1a73e8; font-weight: 600; }
.tab-panel { display: none; padding: 14px 2px 6px; }
.tab-panel.active { display: block; }

/* ---------------- 索引页 ---------------- */
.landing { max-width: 1080px; margin: 0 auto; padding: 20px; }
.landing h1 { font-size: 28px; color: #17324d; margin-bottom: 6px; }
.landing .intro { color: #5b6d82; margin-bottom: 18px; }
.landing-search { margin-bottom: 20px; }
.landing-search input {
  width: 100%;
  max-width: 560px;
  padding: 11px 16px;
  border: 1px solid #cfd8e4;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.landing-search input:focus { border-color: #1a73e8; box-shadow: 0 0 0 3px rgba(26, 115, 232, .12); }

.prod-block { margin-bottom: 26px; }
.prod-block h2 {
  font-size: 20px;
  color: #17324d;
  padding: 10px 16px;
  background: #fff;
  border: 1px solid #e4e9f0;
  border-left: 4px solid #1a73e8;
  border-radius: 8px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.prod-block h2 .port { font-size: 12px; color: #8896a7; font-weight: 400; }
.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
}
.page-link {
  display: block;
  padding: 11px 16px;
  background: #fff;
  border: 1px solid #e4e9f0;
  border-radius: 8px;
  color: #2c3e50;
  text-decoration: none;
  font-size: 14px;
  transition: all .18s;
}
.page-link:hover { border-color: #1a73e8; box-shadow: 0 2px 8px rgba(26, 115, 232, .12); transform: translateY(-1px); }
.page-link .desc { color: #8896a7; font-size: 12.5px; margin-top: 2px; }

/* 结果空态 */
.search-empty { color: #8896a7; padding: 14px 0; font-size: 14px; }
.hidden-item { display: none !important; }

/* ---------------- 页脚 ---------------- */
.page-footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 20px 40px;
  color: #8896a7;
  font-size: 12.5px;
  border-top: 1px solid #e8edf5;
}

/* ---------------- 移动端适配 ---------------- */
@media (max-width: 900px) {
  .toc { flex-basis: 210px; }
}

@media (max-width: 768px) {
  body { font-size: 14.5px; }
  .page-topbar { padding: 0 12px; gap: 8px; }
  .topbar-nav a { display: none; }
  .topbar-nav a.toc-toggle { display: flex; }

  .page-wrap { display: block; padding: 12px 12px 40px; }
  .toc {
    display: none;
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: none;
    z-index: 99;
    border-radius: 0;
    border-top: none;
    padding: 16px;
    overflow-y: auto;
  }
  .toc.open { display: block; }
  .toc-toggle { display: inline-flex !important; }

  .page-header h1 { font-size: 21px; }
  .content h2 { font-size: 18px; }
  .content h3 { font-size: 15.5px; }
  .meta-table { grid-template-columns: 1fr; }
  .page-grid { grid-template-columns: 1fr; }
  .landing { padding: 14px; }
  .landing h1 { font-size: 23px; }
}
