/* ============================================================
   Clash Verge下载 · components.css
   跨页面共享组件:tab / toc / FAQ / 术语卡 / 下载卡 / 文章卡 /
   callout / 表格 / 步骤 / dl-fab
   ============================================================ */

/* ---------- 徽章 / 标签 ---------- */
.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  min-height:28px;
  padding:0 12px;
  border-radius:var(--r-pill);
  font-size:12px;
  font-weight:600;
  white-space:nowrap;
  max-width:100%;
  overflow:hidden;
}
.badge-rec{background:var(--accent);color:var(--bg)}
.badge-alt{background:var(--bg-panel);border:1px solid var(--border);color:var(--text)}
.badge-legacy{background:var(--bg-panel2);color:var(--text-muted)}
.badge-warn{background:var(--warn-soft);color:var(--warn-deep)}
.badge-success{background:var(--success-soft);color:var(--success-deep)}
.tag{
  display:inline-flex;
  align-items:center;
  min-height:26px;
  padding:0 12px;
  border-radius:var(--r-pill);
  background:var(--bg-panel);
  border:1px solid var(--border);
  font-size:12px;
  font-weight:600;
  color:var(--text-muted);
  white-space:nowrap;
  max-width:100%;
  overflow:hidden;
}

/* ---------- Tab 切换 ---------- */
.tablist{display:flex;flex-wrap:wrap;gap:8px}
.tab{
  appearance:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:44px;
  padding:0 18px;
  border:1px solid var(--border);
  border-radius:var(--r-pill);
  background:var(--bg);
  color:var(--text-muted);
  font-size:14.5px;
  font-weight:600;
  cursor:pointer;
  transition:background .18s,color .18s,border-color .18s;
}
.tab svg{width:16px;height:16px;flex-shrink:0}
.tab:hover{border-color:var(--accent);color:var(--accent)}
.tab[aria-selected="true"]{background:var(--accent);border-color:var(--accent);color:var(--bg)}
.tab:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.tabpanel{padding:28px 2px 2px;min-width:0}
.tabpanel[hidden]{display:none}

/* ---------- 长页分类跳转(toc) ---------- */
.toc{display:flex;flex-wrap:wrap;gap:8px}
.toc a{
  display:inline-flex;
  align-items:center;
  min-height:40px;
  padding:0 16px;
  border:1px solid var(--border);
  border-radius:var(--r-pill);
  background:var(--bg);
  font-size:13.5px;
  font-weight:500;
  color:var(--text-muted);
  transition:border-color .18s,color .18s;
}
.toc a:hover{border-color:var(--accent);color:var(--accent)}

/* ---------- FAQ 折叠项 ---------- */
.faq-list{display:grid;gap:12px}
.faq-item{
  border:1px solid var(--border);
  border-radius:var(--r-panel);
  background:var(--bg);
  overflow:hidden;
  min-width:0;
}
.faq-q{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:18px 22px;
  min-height:56px;
  font-size:15.5px;
  font-weight:600;
  color:var(--text);
  text-align:left;
  cursor:pointer;
}
.faq-q:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
.faq-ico{
  flex-shrink:0;
  width:24px;height:24px;
  border-radius:50%;
  border:1px solid var(--border);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color:var(--text-muted);
  transition:transform .2s,background .2s,border-color .2s,color .2s;
}
.faq-ico svg{width:12px;height:12px}
.faq-item.open .faq-ico{
  transform:rotate(45deg);
  background:var(--accent);
  border-color:var(--accent);
  color:var(--bg);
}
.faq-a{
  display:none;
  padding:0 22px 20px;
  color:var(--text-muted);
  font-size:14.5px;
  line-height:1.8;
}
.faq-a p{margin:0 0 .8em}
.faq-a p:last-child{margin-bottom:0}
.faq-item.open .faq-a{display:block}

/* ---------- 术语卡 ---------- */
.term-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:16px}
.term-card{
  background:var(--bg);
  border:1px solid var(--border);
  border-radius:var(--r-card);
  padding:24px;
  box-shadow:var(--shadow-sm);
  min-width:0;
}
.term-card h3{font-size:17px;margin-bottom:8px;letter-spacing:-.01em}
.term-card .term-cat{display:inline-flex;margin-bottom:12px}
.term-card p{margin:0;font-size:14px;color:var(--text-muted);line-height:1.75}

/* ---------- 下载客户端卡 ---------- */
.dl-card{
  background:var(--bg);
  border:1px solid var(--border);
  border-radius:var(--r-card);
  padding:28px;
  box-shadow:var(--shadow-sm);
  display:flex;
  flex-direction:column;
  gap:20px;
  min-width:0;
}
.dl-card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  min-width:0;
}
.dl-card-title{min-width:0}
.dl-card-title h3{font-size:20px;letter-spacing:-.01em}
.dl-card-sub{font-size:13.5px;color:var(--text-muted);margin-top:4px;line-height:1.6}
.dl-card-badges{display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end}
.dl-card-body{min-width:0}
.dl-card-actions{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:10px;
  margin-top:auto;
  padding-top:8px;
}
.app-icon{width:56px;height:56px;flex-shrink:0;object-fit:contain}
.ver-slot{font-family:var(--font-mono);font-size:12.5px;color:var(--text-muted)}
.ver-slot[hidden]{display:none}

/* 事实网格:标签与值严格对齐,禁止单行堆叠 */
.fact-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:16px 28px;
  border-top:1px solid var(--border);
  padding-top:18px;
}
.fact{min-width:0}
.fact dt{font-size:12px;color:var(--text-muted);margin-bottom:4px;letter-spacing:.02em}
.fact dd{
  margin:0;
  font-size:14.5px;
  font-weight:600;
  color:var(--text);
  line-height:1.45;
  overflow-wrap:anywhere;
}

/* ---------- 博客文章卡 ---------- */
.post-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:16px}
.post-card{
  background:var(--bg);
  border:1px solid var(--border);
  border-radius:var(--r-card);
  padding:24px;
  display:flex;
  flex-direction:column;
  gap:12px;
  box-shadow:var(--shadow-sm);
  transition:box-shadow .2s,transform .2s,border-color .2s;
  min-width:0;
}
.post-card:hover{box-shadow:var(--shadow-md);transform:translateY(-2px);border-color:var(--border-strong)}
.post-card h3{font-size:17px;line-height:1.45;letter-spacing:-.01em}
.post-card p{margin:0;font-size:14px;color:var(--text-muted);line-height:1.7}
.post-meta{display:flex;flex-wrap:wrap;align-items:center;gap:10px;font-size:12.5px;color:var(--text-muted)}
.post-card .post-link{
  margin-top:auto;
  padding-top:6px;
  font-size:14px;
  font-weight:600;
  color:var(--accent);
}
.post-card .post-link:hover{color:var(--accent-dark)}

/* ---------- callout 引用块 ---------- */
.callout{
  display:flex;
  align-items:flex-start;
  gap:14px;
  padding:18px 20px;
  background:var(--bg-panel);
  border:1px solid var(--border);
  border-left:3px solid var(--accent);
  border-radius:var(--r-panel);
  font-size:14.5px;
  line-height:1.75;
  color:var(--text);
  min-width:0;
}
.callout svg{flex-shrink:0;width:18px;height:18px;margin-top:3px;color:var(--accent)}
.callout p{margin:0}
.callout.tip{border-left-color:var(--success)}
.callout.tip svg{color:var(--success)}
.callout.warn{border-left-color:var(--warn)}
.callout.warn svg{color:var(--warn-deep)}
.callout code{font-size:13px}

/* ---------- 表格 ---------- */
.table-wrap{
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  max-width:100%;
  border:1px solid var(--border);
  border-radius:var(--r-panel);
  background:var(--bg);
}
.data-table{
  width:100%;
  border-collapse:collapse;
  font-size:14px;
  min-width:640px;
}
.data-table th,.data-table td{
  padding:12px 16px;
  border-bottom:1px solid var(--border);
  text-align:left;
  vertical-align:top;
}
.data-table thead th{background:var(--bg-panel);font-weight:600;color:var(--text);white-space:nowrap}
.data-table tbody tr:last-child td{border-bottom:0}
.data-table tbody tr:hover{background:var(--bg-panel)}
/* 文章页裸表格防御:不带 .table-wrap 的 .data-table 也要能横滑 */
.prose > .data-table{
  display:block;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  max-width:100%;
  min-width:0;
  border:0;
}

/* ---------- 编号步骤 ---------- */
.steps{display:grid;gap:16px;counter-reset:step}
.step{
  position:relative;
  padding:22px 24px 22px 74px;
  background:var(--bg-panel);
  border:1px solid var(--border);
  border-radius:var(--r-panel);
  min-width:0;
}
.step::before{
  counter-increment:step;
  content:counter(step);
  position:absolute;
  left:22px;top:22px;
  width:32px;height:32px;
  border-radius:50%;
  background:var(--accent);
  color:var(--bg);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:14px;
  font-weight:700;
}
.step h3{font-size:16px;margin-bottom:6px}
.step p{margin:0;font-size:14px;color:var(--text-muted);line-height:1.75}

/* ---------- 右下角常驻下载浮层(仅博客文章页使用) ---------- */
.dl-fab{
  position:fixed;
  right:22px;bottom:22px;
  z-index:80;
  display:inline-flex;
  align-items:center;
  gap:10px;
  min-height:52px;
  padding:0 22px;
  background:var(--accent);
  color:var(--bg);
  border-radius:var(--r-pill);
  box-shadow:var(--shadow-accent);
  font-size:14.5px;
  font-weight:600;
  transition:background .18s,transform .18s;
}
.dl-fab:hover{background:var(--accent-dark);transform:translateY(-2px)}
.dl-fab svg{width:18px;height:18px;flex-shrink:0}
.dl-fab.demo{position:static;box-shadow:var(--shadow-sm)}

.note{font-size:13px;color:var(--text-muted);line-height:1.7}

/* ---------- 响应式 ---------- */
@media (max-width:768px){
  .fact-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .dl-card{padding:22px}
  .dl-card-badges{justify-content:flex-start}
  .tabpanel{padding-top:20px}
}
@media (max-width:480px){
  .fact-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 16px}
  .dl-fab{right:14px;bottom:14px}
  .dl-card-actions .btn{flex:1 1 auto;justify-content:center;white-space:normal;line-height:1.35}
}