/* ==========================================================================
   custom.css  —  站点自定义样式（覆盖 vue.css 的移动端行为）
   2026-10-18  移动端侧边栏修复
   - 开关按钮：vue.css 里是「左下角、284px 宽、半透明白底 + 2px 细线」，白底页面上
     几乎不可见 → 改为左上角绿色圆钮
   - 侧边栏：手机端改为全屏抽屉，展开时内容不位移（避免右侧露出半截文字）
   ========================================================================== */

@media screen and (max-width: 768px) {
  /* ---------- 1) 侧边栏开关：左上角 44px 绿色圆钮 ---------- */
  .sidebar-toggle,
  body.close .sidebar-toggle,
  body.sticky .sidebar-toggle {
    position: fixed;
    top: 10px;
    left: 10px;
    bottom: auto;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: #0F6E56;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60;
    transition: none;
  }

  .sidebar-toggle-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .sidebar-toggle span,
  body.close .sidebar-toggle span {
    background-color: #ffffff;
    width: 18px;
    height: 2px;
    margin: 0 0 4px 0;
    border-radius: 1px;
  }

  .sidebar-toggle span:last-child {
    margin-bottom: 0;
  }

  /* ---------- 2) 侧边栏：全屏抽屉，展开时盖住内容 ---------- */
  /* 注意：search 插件运行时会注入 `.sidebar{padding-top:0}`，与本节同为单类特异性，
     且其插入时机晚于本文件，故这里统一用 `body .sidebar` 提高特异性，否则会被压掉 */
  body .sidebar {
    width: 100%;
    left: -100%;
    padding-top: 64px;
    box-shadow: 2px 0 14px rgba(0, 0, 0, 0.12);
  }

  /* 菜单项：手机上放大字号、拉开行距，方便点击 */
  body .sidebar ul li {
    margin: 10px 0;
  }

  body .sidebar ul li a {
    font-size: 16px;
  }

  body.close .sidebar {
    transform: translateX(100%);
  }

  /* 内容不跟着位移，避免窄屏上露出半截文字 */
  body.close .content {
    transform: none;
  }

  /* ---------- 3) 顶部给圆钮留出空间，避免压住标题 ---------- */
  .content {
    padding-top: 64px;
  }
}

/* ==========================================================================
   2026-10-18  表格移动端优化
   - vue.css 的 td/th 左右 padding 各 13px，手机上 4 列导航条内边距吃掉 104px，
     每格只剩 2 字宽 → 收紧内边距 + 缩小导航条字号
   - 导航条是页面内第一个表格，用 :first-of-type 定位，不影响清单表
   ========================================================================== */
@media screen and (max-width: 768px) {
  .markdown-section table td,
  .markdown-section table th {
    padding: 3px;
  }

  .markdown-section table:first-of-type td,
  .markdown-section table:first-of-type th {
    font-size: 13px;
    text-align: center;
    line-height: 1.4;
  }
}

/* ==========================================================================
   2026-10-18  清单表列宽（class="list-tbl"，电脑端140px / 移动端60px）
   - 宽度全部由本文件控制，页面上不再写内联宽度
   - 移动端恢复 display:table + width:100%，第二列自适应吃满剩余宽度
     （vue.css 把 table 设为 display:block，列宽按内容收缩）
   ========================================================================== */
.markdown-section table.list-tbl {
  table-layout: fixed;
  display: table;
  width: 100%;
}

.markdown-section table.list-tbl col:first-of-type {
  width: 140px;
}

@media screen and (max-width: 768px) {
  .markdown-section table.list-tbl col:first-of-type {
    width: 60px;
  }
}

/* ==========================================================================
   2026-10-18  导航条文字居中（桌面端+移动端统一）
   - 导航条是每个页面内第一个表格；移动端的字号规则已在上方 media 块内
   - 2026-10-20 导航条字号放大一档：桌面 15px(继承) → 16px，移动 11px → 12px → 13px
   ========================================================================== */
.markdown-section table:first-of-type td,
.markdown-section table:first-of-type th {
  text-align: center;
}

/* 桌面端导航条字号（用 min-width 包一层，避免覆盖下方/上方 media 块里移动端的 12px） */
@media screen and (min-width: 769px) {
  .markdown-section table:first-of-type td,
  .markdown-section table:first-of-type th {
    font-size: 16px;
  }
}

/* ==========================================================================
   2026-10-19  RAG问答页表单（4RAG问答/README.md）
   - 配色沿用站点主色 #0F6E56（辅 #5DCAA5 / #E1F5EE）
   - 全部用 .rag- 前缀，避免与既有规则冲突
   ========================================================================== */
.rag-panel {
  margin: 1rem 0 1.6rem;
  padding: 16px;
  background: #F7FCFA;
  border: 1px solid #E1F5EE;
  border-radius: 10px;
}

.rag-field {
  margin-bottom: 12px;
}

.rag-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #0F6E56;
}

.rag-field input,
.rag-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 11px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: #2c3e50;
  background: #ffffff;
  border: 1px solid #cfe6de;
  border-radius: 6px;
  resize: vertical;
}

.rag-field input:focus,
.rag-field textarea:focus {
  outline: none;
  border-color: #0F6E56;
  box-shadow: 0 0 0 3px rgba(15, 110, 86, 0.12);
}

.rag-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.rag-btn {
  padding: 9px 20px;
  font-family: inherit;
  font-size: 14px;
  color: #0F6E56;
  background: #ffffff;
  border: 1px solid #0F6E56;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.rag-btn:hover {
  background: #E1F5EE;
}

.rag-btn-primary {
  color: #ffffff;
  background: #0F6E56;
}

.rag-btn-primary:hover {
  background: #0c5b47;
}

.rag-msg {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.6;
}

.rag-msg-ok {
  color: #0F6E56;
}

.rag-msg-warn {
  color: #b26a00;
}

@media screen and (max-width: 768px) {
  .rag-panel {
    padding: 12px;
  }

  .rag-actions {
    flex-direction: column;
  }

  .rag-btn {
    width: 100%;
  }
}

/* ---------- 提问与答复列表 ---------- */
.rag-list {
  margin: 0.6rem 0 1.2rem;
}

.rag-empty {
  padding: 10px 0;
  font-size: 13px;
  color: #8a9a95;
}

.rag-item {
  margin-bottom: 12px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid #E1F5EE;
  border-left: 3px solid #5DCAA5;
  border-radius: 6px;
}

.rag-item-mine {
  background: #F7FCFA;
  border-left-color: #0F6E56;
}

.rag-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.rag-item-product {
  font-size: 14px;
  font-weight: 600;
  color: #0F6E56;
}

.rag-item-time {
  font-size: 12px;
  color: #8a9a95;
}

.rag-item-q {
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.6;
  color: #2c3e50;
}

.rag-item-a {
  padding-top: 8px;
  font-size: 14px;
  line-height: 1.7;
  color: #2c3e50;
  border-top: 1px dashed #E1F5EE;
  white-space: pre-wrap;
}

.rag-item-pending {
  padding-top: 8px;
  font-size: 13px;
  color: #b26a00;
  border-top: 1px dashed #E1F5EE;
}

/* ---------- 站内 PDF 内嵌（lib/pdfjs/pdfjs-viewer.js） ----------
   仅相对路径的 .pdf 会走到这里；外链 PDF 一律保持普通链接。
   用浏览器原生查看器，比 pdf.js 逐页 canvas 渲染省内存。 */
.pdf-embed {
  margin: 1rem 0;
  border: 1px solid #E1F5EE;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.pdf-embed iframe {
  display: block;
  width: 100%;
  height: 80vh;
  min-height: 520px;
  border: 0;
}

.pdf-embed-tip {
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.6;
  color: #8a9a95;
  background: #F7FCFA;
  border-top: 1px solid #E1F5EE;
}

.pdf-embed-tip a {
  color: #0F6E56;
  text-decoration: none;
}

@media (max-width: 768px) {
  .pdf-embed iframe {
    height: 60vh;
    min-height: 380px;
  }
}
