/* ============================================================
   views.css —— 二级页面补充样式
   适用于：错题本 / 题库 / 学习统计 / 我的
   约定：只补充 app.css 里没有的布局件，一律 v- 前缀，避免污染。
   ============================================================ */

/* ---------- 0. 通用小件 ---------- */
.v-muted { color: var(--ink-2); }
.v-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-3); display: inline-block; flex: none; }
.v-dot-sep { color: var(--ink-3); margin: 0 4px; }
.v-footer { padding: 10px 0 6px; display: flex; justify-content: center; }
.v-loadmore { padding: 14px 0 4px; }

/* ---------- 1. 工具行：搜索 + 排序 / 章节筛选 ---------- */
.v-toolbar { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.v-search { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; }
.v-search svg {
  position: absolute; left: 13px; width: 16px; height: 16px;
  color: var(--ink-3); pointer-events: none;
}
.v-search .input { height: 42px; padding: 0 14px 0 36px; font-size: 14px; }
.v-toolbar-select {
  flex: none; width: 142px; height: 42px;
  padding: 0 24px 0 10px; font-size: 13px; border-radius: 12px;
  white-space: nowrap;
}
.v-tools-line { display: flex; align-items: center; gap: 10px; margin: 10px 2px 0; }
.v-tools-line .tiny { margin-left: auto; }

/* ---------- 2. 列表行补充 ---------- */
.v-icon-btn {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink-3);
  background: transparent; transition: background .16s, color .16s;
}
.v-icon-btn:active { background: var(--paper-2); color: var(--ink-1); }
.v-icon-btn svg { width: 18px; height: 18px; }
.v-wrong-item { align-items: flex-start; }
.v-wrong-item .level-ring { margin-top: 1px; }
.v-wrong-item .li-main { padding-top: 1px; }
.v-wrong-item .li-title { font-size: 14px; line-height: 1.55; }

/* ---------- 3. 弹层操作行（错题操作 / 题目详情 / 数据管理） ---------- */
.v-sheet-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.v-sheet-label {
  font-size: 12px; color: var(--ink-2); letter-spacing: .4px;
  margin: 16px 0 8px; display: flex; align-items: center; gap: 6px;
}
.v-sheet-actions {
  display: flex; flex-direction: column;
  margin-top: 18px; border-top: 1px solid var(--line-2);
}
.v-sheet-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 48px; padding: 13px 2px;
  text-align: left; font-size: 14.5px; color: var(--ink);
  border-bottom: 1px solid var(--line-2);
  background: none; transition: opacity .14s;
}
.v-sheet-row:last-child { border-bottom: 0; }
.v-sheet-row:active { opacity: .6; }
.v-sheet-row svg { width: 18px; height: 18px; color: var(--ink-2); flex: none; }
.v-sheet-row.danger { color: var(--red); }
.v-sheet-row.danger svg { color: var(--red); }
.v-sheet-row-sub { margin-left: auto; font-size: 12px; color: var(--ink-3); flex: none; padding-left: 8px; }
.v-sheet-row > span:first-of-type { flex: 1; min-width: 0; }

/* 调整遗忘等级的分段选择器 */
.v-level-seg { margin-bottom: 4px; }
.v-level-seg > button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }

/* 手动加入错题的候选题 */
.v-pick-list { max-height: 52dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; margin-top: 2px; }
.v-pick-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  text-align: left; padding: 12px 2px; border-bottom: 1px solid var(--line-2);
}
.v-pick-item:last-child { border-bottom: 0; }
.v-pick-item[disabled] { opacity: .5; }
.v-pick-stem { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.5; }
.v-pick-state { flex: none; font-size: 12px; color: var(--brand); }

/* ---------- 4. 题库页 ---------- */
.v-bank { margin-bottom: 10px; }
.v-bank-name { font-family: var(--serif); font-size: 16px; font-weight: 700; line-height: 1.4; }
.v-bank-desc { font-size: 12.5px; line-height: 1.55; margin-top: 3px; }
.v-bank-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-2); margin-top: 10px;
}
.v-bank-actions { display: flex; gap: 8px; margin-top: 12px; }
.v-bank-actions .btn { flex: none; }

.v-ops .v-btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.v-ops .v-btn-grid .btn {
  width: 100%; height: auto; min-height: 46px; padding: 9px 10px;
  font-size: 13px; font-weight: 600; line-height: 1.35; white-space: normal;
  text-align: center; gap: 7px; border-radius: 14px;
}
.v-ops .v-btn-grid .btn svg { width: 17px; height: 17px; flex: none; }

.v-q-item { align-items: flex-start; }
.v-q-item .li-title { font-size: 13.5px; line-height: 1.55; }
.v-q-no { flex: none; width: 30px; padding-top: 2px; font-size: 11.5px; color: var(--ink-3); text-align: center; }
.v-mini-chip { height: 20px; padding: 0 7px; font-size: 11px; }
.v-meta-text { font-size: 12px; color: var(--ink-2); }

/* 新增 / 编辑题目表单 */
.v-opt-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.v-opt-key {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--paper-2); color: var(--ink-2);
  font-size: 12px; font-weight: 700;
}
.v-ans-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.v-ans-chip {
  min-width: 44px; height: 38px; padding: 0 12px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--card);
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  transition: all .16s;
}
.v-ans-chip.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }

/* 题库格式说明 */
.v-format-lead { font-size: 13px; color: var(--ink-2); line-height: 1.7; margin: 0 0 8px; }
.v-format-list { margin: 0 0 14px; padding-left: 18px; font-size: 12.5px; line-height: 1.75; color: var(--ink-1); }
.v-format-list li { margin-bottom: 2px; }
.v-code {
  background: var(--paper-2); border-radius: 12px;
  padding: 12px 14px; margin: 0;
  font-size: 11px; line-height: 1.6;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  white-space: pre; tab-size: 2;
}

/* ---------- 5. 学习统计 ---------- */
.v-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 2px; }
.v-stat {
  background: var(--card); border: 1px solid rgba(236, 231, 223, .8);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px 15px;
}
.v-stat-k { font-size: 12px; color: var(--ink-2); letter-spacing: .3px; }
.v-stat b {
  display: block; font-family: var(--serif); font-size: 27px;
  font-weight: 700; line-height: 1.2; margin-top: 3px;
}
.v-stat-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

.v-lv-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 13px; }
.v-lv-name { flex: none; display: inline-flex; align-items: center; gap: 6px; width: 90px; color: var(--ink-1); }
.v-lv-track { flex: 1; min-width: 0; display: block; height: 10px; border-radius: 999px; background: var(--paper-2); overflow: hidden; }
.v-lv-track > i { display: block; height: 100%; border-radius: 999px; transition: width .4s ease; }
.v-lv-track > i.green { background: var(--green); }
.v-lv-track > i.yellow { background: var(--yellow); }
.v-lv-track > i.red { background: var(--red); }
.v-lv-num {
  flex: none; width: 96px; text-align: right;
  font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.v-chart-note { font-size: 11.5px; color: var(--ink-3); line-height: 1.65; margin: 10px 0 0; }

.v-bar14 { gap: 4px; }
.v-bar14 .bar > i { max-width: 16px; }
.v-bar14 .bar > span { font-size: 9px; white-space: nowrap; }

.v-ch-row { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.v-ch-row:last-child { border-bottom: 0; }
.v-ch-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.v-ch-name { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-1); }
.v-ch-count { flex: none; font-size: 12px; color: var(--ink-2); }
.v-ch-tri {
  display: flex; gap: 2px; height: 8px; margin-top: 8px;
  border-radius: 999px; overflow: hidden; background: var(--paper-2);
}
.v-ch-tri > i { display: block; height: 100%; }
.v-ch-tri > i.green { background: var(--green); }
.v-ch-tri > i.yellow { background: var(--yellow); }
.v-ch-tri > i.red { background: var(--red); }
.v-ch-legend { display: flex; gap: 14px; margin-top: 6px; font-size: 11px; color: var(--ink-3); }
.v-ch-legend > span { display: inline-flex; align-items: center; gap: 4px; }
.v-empty-sm { padding: 26px 12px; }
.v-empty-sm .emoji { font-size: 30px; }
.head-action { white-space: nowrap; }

/* ---------- 6. 我的（设置） ---------- */
.v-me-hero { margin-top: 2px; }
.v-me-top { display: flex; align-items: center; gap: 12px; }
.v-me-logo {
  flex: none; width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.v-me-logo svg { width: 24px; height: 24px; }
.v-me-info { flex: 1; min-width: 0; }
.v-me-name { font-family: var(--serif); font-size: 19px; font-weight: 700; line-height: 1.3; }
.v-me-slogan { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.v-me-ver { flex: none; font-size: 11px; color: var(--ink-3); letter-spacing: .3px; }
.v-me-today {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--line-2);
  font-size: 12.5px; color: var(--ink-2);
}
.v-me-today b { font-family: var(--serif); font-size: 14px; color: var(--ink); font-weight: 700; }

.v-select { flex: none; width: auto; min-width: 92px; height: 36px; padding: 0 26px 0 10px; font-size: 13px; border-radius: 10px; }

.v-set-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 13px 0; text-align: left;
  border-bottom: 1px solid var(--line-2); background: none;
}
.v-set-row:last-child { border-bottom: 0; }
.v-set-row:active { opacity: .65; }
.v-set-ic {
  flex: none; width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--paper-2); color: var(--ink-2);
}
.v-set-ic svg { width: 17px; height: 17px; }
.v-set-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.v-set-title { font-size: 14px; color: var(--ink); line-height: 1.45; }
.v-set-sub { font-size: 11.5px; color: var(--ink-3); line-height: 1.45; }
.v-set-arrow { flex: none; color: var(--ink-3); display: grid; place-items: center; }
.v-set-arrow svg { width: 16px; height: 16px; }
.v-set-row.danger .v-set-title { color: var(--red); }
.v-set-row.danger .v-set-ic { background: var(--red-soft); color: var(--red); }

.v-about { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.v-about p { margin: 0 0 6px; font-size: 12px; line-height: 1.7; color: var(--ink-2); }
.v-about .v-version { margin: 0; color: var(--ink-3); letter-spacing: .4px; }

/* 记忆曲线 / 题库格式说明弹层 */
.v-lv-table { margin: 8px 0 10px; }
.v-lv-line { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.v-lv-line:last-child { border-bottom: 0; }
.v-lv-head { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 600; color: var(--ink-1); }
.v-lv-factor { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--ink-3); }
.v-lv-days { margin-top: 4px; font-size: 12px; line-height: 1.6; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.v-tips { margin: 8px 0 14px; padding-left: 18px; font-size: 12.5px; line-height: 1.75; color: var(--ink-1); }
.v-tips li { margin-bottom: 2px; }
.v-tips code, .v-muted code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11.5px; background: var(--paper-2);
  padding: 1px 5px; border-radius: 5px;
}

/* ---------- 7. 窄屏兜底（360px 不横向滚动） ---------- */
@media (max-width: 380px) {
  .v-toolbar-select { width: 134px; }
  .v-lv-name { width: 78px; font-size: 12.5px; }
  .v-lv-num { width: 84px; font-size: 11.5px; }
  .v-me-slogan { font-size: 12px; }
  .v-stat b { font-size: 24px; }
  .v-ops .v-btn-grid .btn { font-size: 12.5px; padding: 9px 8px; }
  .v-bar14 .bar > span { font-size: 8px; }
  .v-ch-legend { gap: 10px; }
}

/* ---------- 页面内补充修正 ---------- */
.v-more-right { margin-left: auto; }
.v-ops-title svg { width: 18px; height: 18px; color: var(--ink-2); flex: none; }
.v-bar14 .bar span { font-size: 9px; white-space: nowrap; }
.v-bar14 .bar { min-width: 0; }
.bar-chart .bar.is-zero > i { background: transparent; min-height: 0; }

/* ============================================================
   8. 按钮对齐 / 视觉与交互精修
   ============================================================ */
/* 题库卡片：标题、标签、操作区分别对齐；操作区固定在同一底部基线 */
.v-bank { display: flex; flex-direction: column; min-height: 154px; }
.v-bank > .row-between { align-items: flex-start; }
.v-bank > .row-between > .chip { margin-top: 2px; }
.v-bank-name { padding-right: 8px; }
.v-bank-meta { margin-top: 9px; }
.v-bank-actions {
  margin-top: auto; padding-top: 16px;
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
}
.v-bank-actions .btn { min-width: 88px; }

/* 四个题库操作：同高、同宽、同图标基线，导入作为主操作 */
.v-ops { padding: 16px; }
.v-ops .card-title { margin-bottom: 14px; }
.v-ops .v-btn-grid { gap: 12px; }
.v-ops .v-btn-grid .btn {
  min-height: 48px; height: 48px; padding: 0 12px;
  background: var(--card-2); border-color: var(--line);
}
.v-ops .v-btn-grid .btn.btn-soft { background: var(--brand-soft); border-color: transparent; }
.v-ops .v-btn-grid .btn svg { color: var(--brand); }

/* 工具条与列表：输入框/下拉框等高，双栏卡片行内等高 */
.v-toolbar { gap: 12px; }
.v-search .input, .v-toolbar-select { height: 44px; }
.v-toolbar-select { width: 150px; padding-left: 13px; }
.v-tools-line { min-height: 36px; margin-top: 12px; }
.v-q-item { min-height: 92px; }
.v-q-item .li-chevron { align-self: center; }
.v-q-item .li-sub { margin-top: 7px; }
.v-q-no { width: 32px; }
.v-wrong-item { min-height: 96px; }
.v-wrong-item .v-icon-btn { margin-top: -2px; }

/* 图标按钮和分段筛选统一反馈 */
.v-icon-btn { width: 36px; height: 36px; background: var(--card-2); border: 1px solid var(--line-2); }
.v-filter-seg { margin: 16px 0 14px; }
.v-filter-seg > button { height: 36px; display: inline-flex; align-items: center; justify-content: center; }
.v-level-seg > button { min-width: 0; white-space: nowrap; }

/* 弹层操作行：图标、标题、辅助文字使用同一中心线 */
.v-sheet-row { padding-left: 8px; padding-right: 8px; border-radius: 10px; }
.v-sheet-row-sub { display: inline-flex; align-items: center; }
.v-pick-item { min-height: 54px; }
.v-pick-item .chip { flex: none; }
.v-pick-state { min-width: 28px; text-align: right; }

/* 章节选择：可搜索的纵向列表，替代一长排难点的横向 chips */
.v-chapter-search { margin: 0 0 10px; }
.v-chapter-list { max-height: min(52dvh, 460px); overflow-y: auto; display: flex; flex-direction: column; gap: 7px; }
.v-chapter-option {
  width: 100%; min-height: 52px; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; text-align: left; border-radius: 12px;
  background: var(--card-2); border: 1px solid var(--line-2);
  transition: background .16s ease, border-color .16s ease, transform .12s ease;
}
.v-chapter-option:active { transform: scale(.99); }
.v-chapter-option .v-chapter-name { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-1); }
.v-chapter-option .v-chapter-count { flex: none; font-size: 12px; color: var(--ink-2); }
.v-chapter-option svg { width: 15px; height: 15px; color: var(--ink-3); }
.v-chapter-empty { padding: 24px 0; text-align: center; color: var(--ink-2); font-size: 13px; }

/* 章节弹层采用单一滚动区：标题、搜索固定，目录自身承接全部触摸滑动。 */
.chapter-sheet-card {
  display: flex; flex-direction: column;
  height: 78vh; max-height: calc(100vh - 24px);
  height: 78dvh; max-height: calc(100dvh - 24px);
  overflow: hidden;
}
.chapter-sheet-card .sheet-handle,
.chapter-sheet-card .modal-head,
.chapter-sheet-card .v-chapter-search { flex: none; }
.chapter-sheet-card .v-chapter-list {
  flex: 1 1 auto; min-height: 0; max-height: none;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; touch-action: pan-y;
  padding-bottom: 4px;
}

@media (hover: hover) {
  .v-ops .v-btn-grid .btn:hover { background: var(--brand-soft); border-color: #D5E4DB; }
  .v-icon-btn:hover { background: var(--brand-soft); color: var(--brand); border-color: #D5E4DB; }
  .v-sheet-row:hover { background: var(--card-2); }
  .v-set-row:hover { background: linear-gradient(var(--card-2), var(--card-2)); }
  .v-chapter-option:hover { background: var(--brand-soft); border-color: #D5E4DB; }
}

@media (max-width: 520px) {
  .v-bank { min-height: 0; }
  .v-bank-actions { justify-content: flex-start; }
  .v-toolbar { gap: 8px; }
  .v-toolbar-select { width: 132px; }
  .v-level-seg > button { font-size: 11.5px; }
  .v-sheet-row-sub { max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
