/* ============================================================================
   AIChainWatch · 组件层（Components）
   ----------------------------------------------------------------------------
   作用：可复用的 UI 原子 / 分子组件。页面只能“拼装”组件，不重复造样式。
   命名：BEM 风格 —— .block、.block__element、.block--modifier
   ========================================================================== */

/* ============================================================
   1. 按钮 Button
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: 14.5px;
  font-weight: 550;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease),
    border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    color var(--dur) var(--ease);
}

.btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* 主按钮：品牌渐变，页面唯一的“最强动作” */
.btn--primary {
  background: var(--gradient-accent);
  color: #fff;
  box-shadow: 0 10px 26px -12px rgba(124, 92, 255, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn--primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 14px 32px -12px rgba(124, 92, 255, 1);
}

/* 次按钮：描边 */
.btn--ghost {
  border-color: var(--border-strong);
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}

.btn--ghost:hover {
  border-color: var(--accent-line);
  background: rgba(124, 92, 255, 0.09);
}

/* 柔和按钮：淡紫底，用于次级强调（保存结果等） */
.btn--soft {
  background: var(--accent-soft);
  color: #cbbdff;
  border-color: rgba(124, 92, 255, 0.24);
}

.btn--soft:hover {
  background: rgba(124, 92, 255, 0.2);
  color: #ded5ff;
}

/* 静默按钮：纯文字 */
.btn--quiet {
  color: var(--text-2);
  padding-inline: 10px;
}

.btn--quiet:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

/* 危险操作 */
.btn--danger {
  color: var(--danger);
  border-color: rgba(255, 107, 129, 0.3);
  background: var(--danger-soft);
}

.btn--danger:hover {
  background: rgba(255, 107, 129, 0.18);
}

/* 尺寸 */
.btn--sm {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 10px;
  gap: 6px;
}

.btn--sm svg {
  width: 14px;
  height: 14px;
}

.btn--lg {
  height: 50px;
  padding: 0 26px;
  font-size: 15.5px;
  border-radius: 14px;
}

/* 图标按钮（正方形，仅图标） */
.btn--icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
}

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

/* ============================================================
   2. 徽章 Badge（信任要素：链上已验证 / 更新时间）
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}

.badge svg {
  width: 13px;
  height: 13px;
}

/* 已验证：绿色系，是页面上唯一允许的“成功色” */
.badge--ok {
  color: #8ff0c4;
  background: var(--ok-soft);
  border-color: rgba(61, 220, 151, 0.26);
}

/* 强调徽章（如 Pro、AI 回答） */
.badge--accent {
  color: #d3c7ff;
  background: var(--accent-soft);
  border-color: rgba(124, 92, 255, 0.28);
}

.badge--warn {
  color: #ffd3a3;
  background: var(--warn-soft);
  border-color: rgba(255, 184, 107, 0.26);
}

/* 小圆点：表示“实时 / 在线” */
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.16);
  flex: none;
}

/* ============================================================
   3. 卡片 Card
   ============================================================ */
.card {
  position: relative;
  padding: var(--s-6);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  /* 极轻的顶部高光渐变，避免大面积纯色显得“死板” */
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0) 42%),
    var(--surface);
  box-shadow: var(--shadow-md);
}

.card--flat {
  box-shadow: none;
  background: rgba(255, 255, 255, 0.02);
}

.card--pad-sm {
  padding: var(--s-5);
}

/* 互动卡片：可点击时给出悬停反馈 */
.card--interactive {
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.card--interactive:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}

.card__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.card__sub {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--text-3);
}

/* ============================================================
   4. 搜索框 Searchbar（产品核心交互）
   ============================================================ */
.searchbar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  padding: 9px 9px 9px 20px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.035);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

/* 聚焦态：紫色描边 + 外发光，是全站最强的焦点提示 */
.searchbar:focus-within {
  border-color: var(--accent-line);
  box-shadow: var(--focus-ring), 0 22px 54px -26px rgba(124, 92, 255, 0.75);
}

.searchbar__icon {
  width: 19px;
  height: 19px;
  color: var(--text-3);
  flex: none;
}

.searchbar__input {
  flex: 1;
  min-width: 0;
  height: 38px;
  border: 0;
  background: none;
  outline: none;
  font-size: 16px; /* 移动端 16px 可避免 iOS 自动缩放 */
  color: var(--text);
}

.searchbar__input::placeholder {
  color: var(--text-3);
}

/* 搜索框内的提交按钮 */
.searchbar__submit {
  height: 40px;
  padding: 0 20px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--gradient-accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
  flex: none;
  transition: filter var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.searchbar__submit:hover {
  filter: brightness(1.09);
}

.searchbar__submit:active {
  transform: scale(0.98);
}

/* 结果页的紧凑版：高度更小、圆角更方，避免与回答卡片抢视线 */
.searchbar--compact {
  padding: 5px 6px 5px 16px;
  border-radius: var(--r-md);
  box-shadow: none;
  background: var(--surface-2);
}

.searchbar--compact .searchbar__input {
  height: 34px;
  font-size: 14.5px;
}

.searchbar--compact .searchbar__submit {
  height: 34px;
  padding: 0 16px;
  font-size: 13px;
  border-radius: var(--r-xs);
}

/* 搜索建议 chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  font-size: 13px;
  color: var(--text-2);
  transition: all var(--dur) var(--ease);
  text-align: left;
}

.chip:hover {
  color: var(--text);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.chip svg {
  width: 13px;
  height: 13px;
  color: var(--accent);
  flex: none;
}

/* ============================================================
   5. 数据组件：统计块 / 表格
   ============================================================ */
/* 关键数据 2×2 网格 */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--s-3);
}

.stat {
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.022);
}

.stat__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0.02em;
}

.stat__value {
  margin-top: 6px;
  font-size: clamp(1.35rem, 2.4vw, 1.65rem);
  font-weight: 620;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
}

.stat__value small {
  font-size: 0.62em;
  font-weight: 500;
  color: var(--text-3);
  margin-left: 3px;
  letter-spacing: 0;
}

/* 涨跌色 */
.stat__delta {
  margin-top: 4px;
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.is-up {
  color: var(--ok);
}

.is-down {
  color: var(--danger);
}

/* 数据表格：结果页的“关键数据”支撑 */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.015);
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 520px;
  font-size: 13.5px;
}

.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: rgba(124, 92, 255, 0.05);
}

.data-table .cell-strong {
  color: var(--text);
  font-weight: 550;
}

/* 表格里的数字列右对齐 + 等宽，方便竖向比较 */
.data-table .cell-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* 地址单元格：等宽 + 省略号 */
.addr {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text);
}

.addr__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.85;
  flex: none;
}

.addr__tail {
  color: var(--text-3);
}

/* ============================================================
   6. 表单 Form
   ============================================================ */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.input::placeholder {
  color: var(--text-3);
}

.input:focus {
  border-color: var(--accent-line);
  box-shadow: var(--focus-ring);
}

.input--mono {
  font-family: var(--font-mono);
  font-size: 13.5px;
}

.field__hint {
  font-size: 12px;
  color: var(--text-3);
}

/* 复选框 */
.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  line-height: 1.5;
}

.checkbox input {
  appearance: none;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface-2);
  flex: none;
  position: relative;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}

.checkbox input:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox input:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(42deg);
}

/* 开关（监控提醒渠道） */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-3);
}

.switch input {
  appearance: none;
  width: 34px;
  height: 19px;
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.12);
  position: relative;
  flex: none;
  transition: background var(--dur) var(--ease);
  cursor: pointer;
}

.switch input::after {
  content: "";
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--dur) var(--ease);
}

.switch input:checked {
  background: var(--accent);
}

.switch input:checked::after {
  transform: translateX(15px);
}

/* 分段控件（计费周期切换） */
.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.03);
}

.segmented__btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--r-full);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  transition: all var(--dur) var(--ease);
}

.segmented__btn.is-active {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   7. 弹窗 / 提示
   ============================================================ */
.modal {
  width: min(480px, calc(100vw - 36px));
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.modal::backdrop {
  background: rgba(3, 6, 12, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-5) var(--s-5) var(--s-3);
}

.modal__body {
  padding: 0 var(--s-5) var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

/* 轻提示：操作反馈（保存成功 / 已复制） */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 18px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  background: rgba(18, 26, 44, 0.96);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  color: var(--text);
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast svg {
  width: 15px;
  height: 15px;
  color: var(--ok);
}

/* ============================================================
   8. 进度条 / 配额
   ============================================================ */
.progress {
  height: 6px;
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

/* span 默认是 inline，高度不生效，必须转成 block 才能画出进度 */
.progress__bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--gradient-accent);
  transition: width 0.5s var(--ease);
}

.progress__bar--warn {
  background: linear-gradient(90deg, #ffb86b, #ff8a5c);
}

/* ============================================================
   9. 空状态 Empty
   ============================================================ */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-9) var(--s-6);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  text-align: center;
  background: rgba(255, 255, 255, 0.012);
}

.empty__icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--accent-soft);
  color: #c9b8ff;
}

.empty__icon svg {
  width: 22px;
  height: 22px;
}

.empty__title {
  font-size: 15px;
  font-weight: 600;
}

.empty__text {
  font-size: 13.5px;
  color: var(--text-3);
  max-width: 42ch;
}

/* ============================================================
   10. 折叠面板（FAQ）
   ============================================================ */
.faq {
  border-top: 1px solid var(--border);
}

.faq__item {
  border-bottom: 1px solid var(--border);
}

.faq__item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 18px 2px;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  color: var(--text);
}

.faq__item summary::-webkit-details-marker {
  display: none;
}

/* 右侧 + / − 指示器 */
.faq__item summary::after {
  content: "+";
  font-size: 18px;
  font-weight: 400;
  color: var(--text-3);
  transition: transform var(--dur) var(--ease);
}

.faq__item[open] summary::after {
  transform: rotate(45deg);
}

.faq__answer {
  padding: 0 2px 20px;
  font-size: 13.8px;
  line-height: 1.75;
  color: var(--text-2);
  max-width: 68ch;
}

/* ============================================================
   11. 通知条 Notice
   ============================================================ */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(124, 92, 255, 0.22);
  border-radius: var(--r-sm);
  background: rgba(124, 92, 255, 0.07);
  font-size: 13px;
  color: #c9c2e8;
  line-height: 1.55;
}

.notice svg {
  width: 15px;
  height: 15px;
  margin-top: 2px;
  color: var(--accent);
  flex: none;
}

/* ============================================================
   12. 应用级补充（正式站新增：提示条 / 表单按钮 / 禁用态）
   ============================================================ */

/* 顶部操作结果提示（新增地址成功、额度用尽等） */
.flash {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: var(--s-4);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  line-height: 1.5;
}

.flash--ok {
  border: 1px solid rgba(61, 220, 151, 0.24);
  background: var(--ok-soft);
  color: #a9e8ca;
}

.flash--warn {
  border: 1px solid rgba(255, 184, 107, 0.26);
  background: var(--warn-soft);
  color: #ffd3a3;
}

/* 警告类 notice（额度用满、支付未接入） */
.notice--warn {
  border-color: rgba(255, 184, 107, 0.26);
  background: var(--warn-soft);
  color: #ffd3a3;
}

.notice--warn svg {
  color: var(--warn);
}

/* 按钮被包裹在 form 里时，保持横向排列 */
.answer__actions form,
.address-card__actions form,
.row--end form,
.nav__logout {
  display: inline-flex;
  margin: 0;
}

/* 表格里的复制/删除按钮不要撑开行高 */
.address-card__actions form .btn {
  height: 34px;
}

/* 链接行做成按钮时，保持与 a 版本一致 */
.link-form {
  margin: 0;
}

.link-form .link-row {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
}

/* 禁用的主按钮（如额度用满时的“添加地址”） */
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}
