/* ==========================================================================
   components-card.css — 资源卡片（字段表 / 链接 / 口令 / 复制按钮 / 备用网盘）
   适用范围：resources.html 查询成功的卡片
   加载顺序：components-status.css 之后
   依赖：base.css 的设计令牌；所有关键属性均带 var() 回退值
   ========================================================================== */

/* --------------------------------------------------------------------------
   资源卡片
   -------------------------------------------------------------------------- */
.card {
  border: 1px solid #e2e6eb;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  border-radius: var(--radius-lg);
  background: #ffffff;
  background: var(--color-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.08);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e6eb;
  border-bottom: 1px solid var(--color-border);
  background: #f8fafc;
  background: var(--color-surface-2);
}
.card__title {
  margin: 0;
  font-size: 1.125rem;
  font-size: var(--text-lg);
  overflow-wrap: anywhere;
}
.card__body {
  padding: 12px 20px 18px;
}

/* 卡片分组：组标题小字弱化；组间用细线分隔（整组为空时不渲染） */
.card__section + .card__section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #e2e6eb;
  border-top: 1px solid var(--color-border);
}
.card__section-title {
  margin: 0 0 6px;
  color: #5b6675;
  color: var(--color-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

/* 哈希为空时的自助校验指引：浅底 + 左侧细线，降为次要信息块 */
.card__value--fallback {
  padding: 10px 12px;
  border-left: 3px solid #c9d1dc;
  border-left: 3px solid var(--color-border-strong);
  border-radius: 0 6px 6px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: #f8fafc;
  background: var(--color-surface-2);
  color: #5b6675;
  color: var(--color-muted);
  font-size: 0.8125rem;
  font-size: var(--text-xs);
  line-height: 1.75;
}

/* 字段表：使用 dl/dt/dd 语义；桌面两列、手机单列 */
.card__dl {
  margin: 0;
}
.card__row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #e2e6eb;
  border-bottom: 1px solid var(--color-border);
}
.card__row:last-child {
  border-bottom: 0;
}
.card__label {
  margin: 0;
  color: #5b6675;
  color: var(--color-muted);
  font-size: 0.875rem;
  font-size: var(--text-sm);
}
.card__value {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}
/* Key / 哈希 / 口令等使用等宽字体，方便核对 */
.card__value--mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-family: var(--font-mono);
  word-break: break-all;
}
.card__value--empty {
  color: #5b6675;
  color: var(--color-muted);
}
.card__footer {
  padding: 12px 20px;
  border-top: 1px solid #e2e6eb;
  border-top: 1px solid var(--color-border);
  background: #f8fafc;
  background: var(--color-surface-2);
  color: #5b6675;
  color: var(--color-muted);
  font-size: 0.8125rem;
  font-size: var(--text-xs);
}

/* 链接列表：地址 + 复制按钮；长链接自动换行 */
.link-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.link-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.link-item__url {
  flex: 1 1 200px;
  min-width: 0;
  overflow-wrap: anywhere;
  text-decoration: none; /* 列表内以颜色区分，悬停再出现下划线 */
}
.link-item__url:hover {
  text-decoration: underline;
}
/* 非白名单协议（如 magnet:）以纯文本 + 标签呈现 */
.link-item__blocked {
  color: #5b6675;
  color: var(--color-muted);
}

/* 口令标签 */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 4px 6px 4px 10px;
  border: 1px solid #e2e6eb;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  background: var(--color-surface-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-family: var(--font-mono);
  font-size: 0.875rem;
}
.chip__text {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* 复制按钮：成功时变绿并显示对勾（对勾用纯 CSS 绘制） */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #c9d1dc;
  border: 1px solid var(--color-border-strong);
  border-radius: 6px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  background: var(--color-surface);
  color: #1f2937;
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.8125rem;
  font-size: var(--text-xs);
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease,
    color 160ms ease;
}
.copy-btn:hover {
  background: #f8fafc;
  background: var(--color-surface-2);
}
.copy-btn__check {
  display: none;
  width: 9px;
  height: 5px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg) translateY(-1px);
}
.copy-btn.is-copied {
  border-color: #15803d;
  border-color: var(--color-success);
  color: #15803d;
  color: var(--color-success);
}
.copy-btn.is-copied .copy-btn__check {
  display: inline-block;
}

/* 备用网盘：自定义折叠面板（按钮 + aria-expanded）。
   展开/收起通过 CSS grid-template-rows 0fr→1fr 实现高度过渡；
   不支持 grid 动画的旧浏览器会保持展开显示，功能不受影响。 */
.backup-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.backup-item {
  border: 1px solid #e2e6eb;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  border-radius: var(--radius-md);
  background: #f8fafc;
  background: var(--color-surface-2);
  overflow: hidden;
}
.backup-item__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: #1f2937;
  color: var(--color-text);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
/* 折叠箭头（纯 CSS 旋转） */
.backup-item__toggle::after {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease;
}
.backup-item.is-open .backup-item__toggle::after {
  transform: rotate(-135deg) translateY(-2px);
}
/* 展开容器：0fr → 1fr 的高度过渡；overflow:hidden 使折叠时自动最小高度为 0 */
.backup-item__body-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 280ms ease;
  transition: grid-template-rows var(--motion-base) var(--easing-standard);
}
.backup-item.is-open .backup-item__body-wrap {
  grid-template-rows: 1fr;
}
.backup-item__body {
  overflow: hidden;
  padding: 0 14px 12px;
}
.backup-item__meta {
  margin: 0 0 6px;
  color: #5b6675;
  color: var(--color-muted);
  font-size: 0.875rem;
}
.backup-item__meta:last-child {
  margin-bottom: 0;
}

