/* ============ 用户提问目录 / 快速跳转(照 DeepSeek) ============ */
/* 折叠态：右边缘几条裸横杠(无背板/边框/阴影，零侵入)。悬停 → 同一容器长出背板、
   向左变宽、文字显现成列表，横杠贴右不动。固定定位、不占布局；DOM 由 questionNav.js 建。 */

.question-nav {
  position: fixed;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  /* 当前项用系统主题色(绿)，和应用整体配色一致 */
  --qnav-active: var(--ink);
}
/* class 选择器特异性高于 UA 的 [hidden]，必须显式补这条才能藏住空目录 */
.question-nav[hidden] { display: none; }

/* 报告面板打开时隐藏(兄弟选择器，故 #questionNav 在 DOM 里排在 #reportCanvas 之后) */
#reportCanvas:not([hidden]) ~ #questionNav { display: none; }

/* 只在对话视图露出；欢迎页 / 项目主页不显示(body[data-view] 由 state.setCurrentView 写) */
body:not([data-view="chat"]):not([data-view="chat-in-project"]) #questionNav {
  display: none !important;
}

/* 窄屏 / 小窗隐藏 */
@media (max-width: 980px) {
  #questionNav { display: none !important; }
}

/* ---- 单容器：折叠透明无背板 → 悬停长出背板并变宽 ---- */
.qnav-rail {
  display: flex;
  flex-direction: column;
  width: 40px;                       /* 折叠宽：只容横杠 */
  max-height: 64vh;
  overflow: hidden;
  background: transparent;           /* 折叠态零背板，无侵入 */
  border: 1px solid transparent;
  border-radius: 14px;
  box-shadow: none;
  transition: width .26s ease, background .2s ease,
              border-color .2s ease, box-shadow .2s ease;
}
.question-nav:hover .qnav-rail {
  width: 272px;                      /* 向左展开(右边缘锚定，横杠不动) */
  background: var(--card-bg);
  border-color: var(--border-soft);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
}

.qnav-list {
  /* 一次最多展示 --rows 条，超出在小窗里自己滚动。改 5/7 只动 --rows 一个数。
     精确卡条数：max-height = 条数 × 单行高 + 上下 padding；行高固定(见 .qnav-item)。 */
  --rows: 7;
  --row-h: 34px;
  max-height: calc(var(--rows) * var(--row-h) + 12px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px;
  display: flex;
  flex-direction: column;
}
.qnav-list::-webkit-scrollbar { width: 8px; }
.qnav-list::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 4px;
}

/* 每行：文字(左) + 横杠(右)。折叠态文字裁没、只见横杠贴右。行高一致(不跳)。 */
.qnav-item {
  display: flex;
  align-items: center;
  justify-content: center;           /* 折叠态横杠居中(不同宽度的横杠中线对齐) */
  gap: 0;
  width: 100%;
  /* 固定行高 = padding(7×2) + line-height(20) = 34px，与 .qnav-list 的 --row-h 对齐，
     这样"一次 N 条"才能精确卡住。 */
  padding: 7px 6px;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-3);
  font-size: 13px;
  line-height: 20px;
  font-family: inherit;
  text-align: left;
}
.question-nav:hover .qnav-item { gap: 12px; }   /* 展开态文字与横杠间距 */

.qnav-label {
  flex: 1;
  min-width: 0;
  max-width: 0;                      /* 折叠态裁没 */
  opacity: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: max-width .26s ease, opacity .2s ease;
}
.question-nav:hover .qnav-label {
  max-width: 210px;
  opacity: 1;
}

.qnav-dash {
  flex-shrink: 0;
  width: 6.5px;                      /* 未激活：激活的一半 */
  height: 2px;
  border-radius: 2px;
  background: var(--text-3);
  opacity: 0.3;                      /* 折叠态存在感弱 */
  transition: background .15s, opacity .15s, width .15s;
}

/* 当前项：横杠 + 文字用系统主题色；激活横杠 = 未激活的两倍宽，居中对齐 */
.qnav-item.active { color: var(--qnav-active); }
.qnav-item.active .qnav-dash {
  background: var(--qnav-active);
  opacity: 0.95;
  width: 13px;
}

/* 悬停某行的浅底反馈(仅展开态) */
.question-nav:hover .qnav-item:hover { background: var(--ink-softer); }

/* ---- 跳转后目标行短暂高亮 ---- */
.msg-jump-flash { animation: msgJumpFlash 1.6s ease; }
@keyframes msgJumpFlash {
  0%, 28% { background: var(--ink-soft); }
  100% { background: transparent; }
}
