/**
 * tools.css — 工具数据页公共样式（爆仓/恐贪/矿机/挖矿看板等）
 * 目录：style/tools.css；配合 include/header.php、footer_site.php
 * 气质对齐 tokens：锌灰底 + 白卡片 + 琥珀强调；禁止再依赖 layui
 */

/* —— 页内标题：与币种页 .page-hero 一致，工具页可带图标 —— */
.tool-hero {
  padding: 12px 0 10px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 16px;
  text-align: center;
}
.tool-hero-icon {
  width: 40px;
  height: 40px;
  vertical-align: middle;
  margin-right: 10px;
  border-radius: 8px;
}
.tool-hero h1 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.tool-hero p {
  margin: 6px auto 0;
  color: var(--color-muted);
  font-size: 14px;
  max-width: 42rem;
}

/* —— 卡片 / 面板 —— */
.tool-card,
.tool-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.tool-card-header,
.tool-panel-header {
  display: flex;
  align-items: center;
  justify-content: center; /* 卡片标题居中（各工具页共用） */
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-2);
  text-align: center;
}
.tool-card-header h2,
.tool-card-header h3,
.tool-panel-header h2,
.tool-panel-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  color: var(--color-text);
  text-align: center;
}
.tool-card-body,
.tool-panel-body {
  padding: 16px;
}

/* —— 指标卡网格 —— */
.tool-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.tool-stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  text-align: center;
}
.tool-stat-label {
  font-size: 13px;
  color: var(--color-muted);
  margin-bottom: 8px;
}
.tool-stat-value {
  font-family: var(--font-mono);
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.tool-stat-value.is-up,
.tool-stat-value.positive,
.positive {
  color: var(--color-up);
}
.tool-stat-value.is-down,
.tool-stat-value.negative,
.negative {
  color: var(--color-down);
}
.tool-stat-value.is-brand {
  color: var(--color-brand);
}
.tool-stat-unit {
  margin-top: 6px;
  font-size: 12px;
  color: var(--color-muted);
}

/* —— 表格（对齐 coin-history.data-table，工具页可独立引用） —— */
.tool-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tool-table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tool-table th,
.tool-table td,
.data-table th,
.data-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--color-border);
  text-align: center;
  white-space: nowrap;
}
.tool-table th,
.data-table th {
  font-weight: 600;
  color: var(--color-muted);
  background: var(--color-surface-2);
}
.tool-table tbody tr:hover,
.data-table tbody tr:hover {
  background-color: color-mix(in srgb, var(--color-brand) 8%, #fff);
}
.tool-table a,
.data-table a {
  color: var(--color-brand);
  text-decoration: none;
}
.tool-table a:hover,
.data-table a:hover {
  color: var(--color-brand-hover);
}

/* —— 按钮（与 coin-history .btn 同形，工具页自包含） —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s var(--ease), background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.btn:hover {
  border-color: var(--color-brand);
  color: var(--color-brand);
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary {
  background: var(--color-brand);
  border-color: var(--color-brand);
  color: #fff;
}
.btn-primary:hover {
  background: var(--color-brand-hover);
  border-color: var(--color-brand-hover);
  color: #fff;
}
.btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}
.btn-xs {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}
.btn.is-active,
.btn-danger {
  background: var(--color-brand);
  border-color: var(--color-brand);
  color: #fff;
}
.tool-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

/* —— 交易所推荐条 —— */
.tool-exchange {
  margin-bottom: 16px;
}
.tool-exchange .exchange-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

/* —— 图表区 —— */
.tool-chart {
  min-height: 360px;
  width: 100%;
}
.tool-chart-lg {
  min-height: 480px;
}

/* —— 说明文 —— */
.tool-explain {
  font-size: 14px;
  line-height: 1.7;
  color: var(--color-text);
}
.tool-explain p {
  margin: 0 0 10px;
}
.tool-explain p:last-child {
  margin-bottom: 0;
}

/* —— 表单（浏览器查询等） —— */
.tool-form {
  max-width: 560px;
  margin: 0 auto;
}
.tool-form-row {
  margin-bottom: 16px;
}
.tool-form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
}
.tool-input,
.tool-select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: 14px;
  box-sizing: border-box;
}
.tool-input:focus,
.tool-select:focus {
  outline: 2px solid color-mix(in srgb, var(--color-brand) 35%, transparent);
  border-color: var(--color-brand);
}
.tool-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

/* —— 加载态 —— */
.tool-loading {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-brand);
  border-radius: 50%;
  vertical-align: middle;
}
@media (prefers-reduced-motion: no-preference) {
  .tool-loading {
    animation: tool-spin 0.8s linear infinite;
  }
}
@keyframes tool-spin {
  to { transform: rotate(360deg); }
}

/* —— 涨跌小胶囊 —— */
.tag-up,
.tag-down {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.tag-up {
  background: color-mix(in srgb, var(--color-up) 12%, #fff);
  color: var(--color-up);
}
.tag-down {
  background: color-mix(in srgb, var(--color-down) 12%, #fff);
  color: var(--color-down);
}

/* —— 双栏布局（恐贪指数等） —— */
.tool-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* —— 摘要条（矿池 24h 统计等） —— */
.tool-summary {
  padding: 12px 16px;
  margin-bottom: 12px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.tool-summary strong {
  color: var(--color-brand);
}

/* —— 排名徽章（矿池榜前三） —— */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}
.rank-badge.is-1 {
  background: #ffd700;
  color: #333;
}
.rank-badge.is-2 {
  background: #c0c0c0;
  color: #333;
}
.rank-badge.is-3 {
  background: #cd7f32;
  color: #fff;
}

/* —— 表格列对齐 —— */
.tool-table th.is-left,
.tool-table td.is-left {
  text-align: left;
}
.tool-table th.is-right,
.tool-table td.is-right {
  text-align: right;
}

/* —— 恐贪指数语义色 —— */
.text-fear {
  color: var(--color-down);
  font-weight: 600;
}
.text-greed {
  color: var(--color-up);
  font-weight: 600;
}

/* —— 减半倒计时（half/） —— */
.tool-countdown {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.tool-countdown .tool-stat-value {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
}

/* —— 币种标签（browser/） —— */
.tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}
.tool-tag {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface-2);
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 600;
}

/* —— 响应式视频 —— */
.tool-video {
  display: block;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

/* —— 表单校验态 —— */
.tool-input.is-valid {
  border-color: var(--color-up);
}
.tool-input.is-invalid {
  border-color: var(--color-down);
}

/* —— Vue 未编译前隐藏 —— */
[v-cloak] {
  display: none !important;
}

@media (max-width: 767px) {
  .tool-countdown {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .tool-stats {
    grid-template-columns: 1fr;
  }
  .tool-grid-2 {
    grid-template-columns: 1fr;
  }
  .tool-stats.tool-countdown {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .tool-chart {
    min-height: 280px;
  }
  .tool-chart-lg {
    min-height: 320px;
  }
  .tool-form-actions .btn {
    flex: 1;
  }
  .tool-coin-grid {
    grid-template-columns: 1fr 1fr;
  }
  .tool-indicator-table .tool-indicator-head,
  .tool-indicator-table .tool-indicator-row {
    grid-template-columns: 32px 2fr 1fr 1fr;
    padding: 10px 12px;
    font-size: 12px;
  }
  .tool-indicator-table .tool-indicator-head > :nth-child(4),
  .tool-indicator-table .tool-indicator-head > :nth-child(6),
  .tool-indicator-table .tool-indicator-head > :nth-child(7),
  .tool-indicator-table .tool-indicator-row > :nth-child(4),
  .tool-indicator-table .tool-indicator-row > :nth-child(6),
  .tool-indicator-table .tool-indicator-row > :nth-child(7) {
    display: none;
  }
  .tool-status-bar {
    flex-direction: column;
    align-items: stretch;
  }
}

/* —— 双列卡片网格（爆仓页表格区等） —— */
.tool-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 16px;
}

/* —— 币种爆仓卡片网格 —— */
.tool-coin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.tool-coin-card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.tool-coin-card .coin-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-muted);
  margin-bottom: 8px;
}
.tool-coin-card .coin-amount {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
}
.tool-coin-card .coin-count {
  margin-top: 6px;
  font-size: 12px;
  color: var(--color-muted);
}

/* —— 提示条（爆仓日历汇总等） —— */
.tool-alert {
  padding: 12px 16px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--color-brand) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--color-brand) 25%, var(--color-border));
  font-size: 14px;
  text-align: center;
}
.tool-alert .highlight {
  color: var(--color-brand);
  font-weight: 700;
}

/* —— 交易所单元格 —— */
.tool-exchange-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.tool-exchange-cell img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
}

/* —— 统计卡补充说明 —— */
.tool-stat-detail {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-muted);
}
.tool-stat-detail .highlight {
  color: var(--color-brand);
  font-weight: 600;
}

/* —— 工具页 Tab 切换（爆仓等） —— */
.tool-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}

.tool-loading-block {
  text-align: center;
  padding: 48px 16px;
  color: var(--color-muted);
}
.tool-loading-block .tool-loading {
  width: 36px;
  height: 36px;
  border-width: 3px;
  margin-bottom: 12px;
}

/* —— 逃顶页：状态条与指标表 —— */
.tool-status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 16px;
  margin-bottom: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.tool-hit-rate {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}
.tool-main-progress {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  min-width: 200px;
}
.tool-main-progress-bar {
  flex: 1;
  height: 22px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}
.tool-main-progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--color-down) 0%, var(--color-brand) 50%, var(--color-up) 100%);
  border-radius: 999px;
  transition: width 0.5s var(--ease);
}
.tool-label-hold {
  color: var(--color-down);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}
.tool-label-sell {
  color: var(--color-up);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

.tool-update-time {
  text-align: right;
  font-size: 13px;
  color: var(--color-muted);
  margin-bottom: 12px;
}

/* 逃顶指标表：桌面七列网格 */
.tool-indicator-table .tool-indicator-head,
.tool-indicator-table .tool-indicator-row {
  display: grid;
  grid-template-columns: 40px 2fr 1fr 1fr 1fr 1fr 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
}
.tool-indicator-table .tool-indicator-head {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
}
.tool-indicator-table .tool-indicator-row {
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
}
.tool-indicator-table .tool-indicator-row:hover {
  background: color-mix(in srgb, var(--color-brand) 6%, #fff);
}
.tool-indicator-name {
  font-weight: 600;
}
.tool-indicator-index {
  font-weight: 700;
  color: var(--color-muted);
}
.tool-current-value {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
}
.tool-ref-value {
  color: var(--color-muted);
  font-family: var(--font-mono);
}
.tool-hit-yes {
  text-align: center;
  color: var(--color-down);
  font-weight: 700;
  font-size: 16px;
}
.tool-hit-no {
  text-align: center;
  color: var(--color-up);
  font-weight: 700;
  font-size: 16px;
}
.tool-row-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tool-row-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}
.tool-row-progress-fill {
  height: 100%;
  background: var(--color-down);
  border-radius: 999px;
  transition: width 0.4s var(--ease);
}
.tool-row-progress-text {
  min-width: 42px;
  font-size: 12px;
  color: var(--color-muted);
}
.tool-error-msg {
  text-align: center;
  padding: 40px 16px;
  color: var(--color-up);
}
.tool-table .highlight {
  color: var(--color-brand);
  font-weight: 700;
}
.tool-table .long-amount {
  color: var(--color-down);
  font-weight: 600;
}
.tool-table .short-amount {
  color: var(--color-up);
  font-weight: 600;
}
.tool-table .date-cell {
  font-weight: 600;
}

/* 逃顶页涨跌箭头 */
.tool-current-value .value-change img {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

/* —— 全球市值榜（globalassets/）：加密资产高亮行 —— */
.tool-table tr.is-crypto {
  background: color-mix(in srgb, var(--color-brand) 12%, #fff);
}
.tool-table tr.is-crypto:hover {
  background: color-mix(in srgb, var(--color-brand) 18%, #fff);
}
.tool-table .cell-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}
.tool-table .cell-logo img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tool-table .cell-ellipsis {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-badge.is-muted {
  background: var(--color-surface-2);
  color: var(--color-muted);
  border: 1px solid var(--color-border);
}

/* —— 矿机收益（kuangji/）：币种切换、表格副文案、电费占比条 —— */
.tool-coin-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0 8px;
  margin-bottom: 12px;
}
.tool-coin-tabs .btn {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
  flex-shrink: 0;
}
.tool-table.tool-miner th:nth-child(1),
.tool-table.tool-miner td:nth-child(1) {
  text-align: left;
}
.tool-table.tool-miner th:not(:first-child),
.tool-table.tool-miner td:not(:first-child) {
  text-align: right;
}
.tool-table.tool-miner th:nth-child(8),
.tool-table.tool-miner td:nth-child(8) {
  text-align: center;
}
.tool-subtext {
  display: block;
  font-size: 11px;
  color: var(--color-muted);
  margin-top: 2px;
}
.tool-inline-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 88px;
}
.tool-inline-progress-bar {
  flex: 1;
  height: 18px;
  background: var(--color-border);
  border-radius: 6px;
  overflow: hidden;
}
.tool-inline-progress-fill {
  height: 100%;
  background: var(--color-brand);
  border-radius: 6px;
  transition: width 0.35s var(--ease);
}
.tool-inline-progress-text {
  min-width: 36px;
  font-size: 11px;
  color: var(--color-muted);
  text-align: right;
}
.tool-showmore {
  text-align: center;
  margin-top: 12px;
}

/* —— 轻提示（kuangji ETH 等，替 layui.layer） —— */
.tool-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  z-index: 9999;
  max-width: min(92vw, 420px);
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--color-text);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.tool-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* —— BNB 销毁（bnb/burn/）：说明区图片 —— */
.tool-explain img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 12px auto;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

@media (max-width: 767px) {
  .tool-table .cell-ellipsis {
    max-width: 88px;
  }
  .tool-coin-tabs {
    justify-content: flex-start;
  }
}

/* —— 交易所余额榜：合计行与名称截断 —— */
.tool-table tr.is-summary {
  font-weight: 700;
  background: var(--color-surface-2);
}
.tool-table tr.is-summary td {
  border-top: 2px solid var(--color-border);
}
.tool-name-ellipsis {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}
