/* ============================================================================
   BNB Agent Marketplace — 设计系统
   设计语言："BNB Dark" — 深色、精密、链上原生
   色彩：深海军蓝底 + BNB 金 + 链上青
   ========================================================================== */

:root {
  /* 色彩系统 */
  --bg-0: #0b0e14;          /* 最深背景 */
  --bg-1: #11151d;          /* 页面背景 */
  --bg-2: #181d27;          /* 卡片背景 */
  --bg-3: #1f2531;          /* 悬浮/激活 */
  --line: #262d3a;          /* 边框 */
  --line-strong: #333b4b;   /* 强边框 */

  --gold: #f0b90b;          /* BNB 金 — 主品牌 */
  --gold-soft: #f8d33a;     /* 金·亮 */
  --gold-dim: #8a6d12;      /* 金·暗 */
  --cyan: #19e0d4;          /* 链上青 — 数据/核验 */
  --cyan-dim: #0e8a82;

  --text-0: #f4f6fb;        /* 主文字 */
  --text-1: #c6cdd8;        /* 次级 */
  --text-2: #838c9c;        /* 弱 */
  --text-3: #555e6d;        /* 禁用 */

  --ok: #0ecb81;            /* 核验通过 */
  --ok-bg: rgba(14, 203, 129, 0.12);
  --warn: #f0b90b;
  --warn-bg: rgba(240, 185, 11, 0.12);
  --err: #f6465d;
  --err-bg: rgba(246, 70, 93, 0.12);
  --info: #5b8cff;
  --info-bg: rgba(91, 140, 255, 0.12);

  /* 场景色 */
  --sc-rebalancing: #5b8cff;
  --sc-grid: #19e0d4;
  --sc-yield: #a06bff;
  --sc-health: #ff7a59;

  /* 字体 */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, "Menlo", "Consolas", monospace;

  /* 尺寸 */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --gap: 16px;

  /* 阴影 */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-glow-gold: 0 0 0 1px rgba(240, 185, 11, 0.35), 0 8px 32px rgba(240, 185, 11, 0.12);

  /* 动效 */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ----------------------------------------------------------------------------
   基础重置
   -------------------------------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(240, 185, 11, 0.07), transparent 60%),
    radial-gradient(1000px 500px at -10% 0%, rgba(25, 224, 212, 0.06), transparent 55%),
    var(--bg-1);
  color: var(--text-0);
  line-height: 1.55;
  min-height: 100vh;
  font-feature-settings: "cv11", "ss01";
  letter-spacing: -0.01em;
}

a { color: inherit; text-decoration: none; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  color: inherit;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

.mono { font-family: var(--font-mono); }

/* ----------------------------------------------------------------------------
   布局
   -------------------------------------------------------------------------- */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 20px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #0b0e14;
  font-size: 16px;
  box-shadow: var(--shadow-glow-gold);
}

.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.02em; }
.brand-sub { font-size: 11px; color: var(--text-2); margin-top: -2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.nav-item:hover { background: var(--bg-3); color: var(--text-0); }
.nav-item.active { background: var(--bg-3); color: var(--gold); }

.nav-icon { width: 18px; height: 18px; opacity: 0.9; }

.sidebar-foot {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-2);
}

.main {
  padding: 28px 36px 60px;
  max-width: 1280px;
  width: 100%;
  justify-self: center;
}

/* ----------------------------------------------------------------------------
   顶部条
   -------------------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.page-desc { color: var(--text-2); font-size: 14px; margin-top: 4px; }

.topbar-actions { display: flex; gap: 10px; align-items: center; }

.network-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 100px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-1);
}

.network-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }

/* ----------------------------------------------------------------------------
   按钮
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease);
  white-space: nowrap;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  color: #0b0e14;
  box-shadow: 0 2px 12px rgba(240, 185, 11, 0.25);
}
.btn-primary:hover { box-shadow: 0 4px 20px rgba(240, 185, 11, 0.4); }

.btn-ghost { background: var(--bg-2); border: 1px solid var(--line); color: var(--text-1); }
.btn-ghost:hover { background: var(--bg-3); color: var(--text-0); }

.btn-cyan { background: linear-gradient(135deg, var(--cyan-dim), var(--cyan)); color: #04110f; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ----------------------------------------------------------------------------
   搜索与筛选
   -------------------------------------------------------------------------- */
.searchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.searchbar:focus-within { border-color: var(--gold-dim); box-shadow: 0 0 0 3px rgba(240, 185, 11, 0.1); }

.searchbar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  padding: 12px 0;
  font-size: 14px;
  color: var(--text-0);
}
.searchbar input::placeholder { color: var(--text-3); }

.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 18px 0 22px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 100px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-1);
  transition: all 0.16s var(--ease);
}
.chip:hover { border-color: var(--line-strong); color: var(--text-0); }
.chip.active { background: var(--gold); border-color: var(--gold); color: #0b0e14; font-weight: 600; }

.chip-dot { width: 8px; height: 8px; border-radius: 50%; }

/* ----------------------------------------------------------------------------
   场景标签
   -------------------------------------------------------------------------- */
.scenario-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.scenario-rebalancing { color: var(--sc-rebalancing); background: rgba(91, 140, 255, 0.12); }
.scenario-grid { color: var(--sc-grid); background: rgba(25, 224, 212, 0.1); }
.scenario-yield { color: var(--sc-yield); background: rgba(160, 107, 255, 0.12); }
.scenario-health { color: var(--sc-health); background: rgba(255, 122, 89, 0.12); }

/* ----------------------------------------------------------------------------
   状态徽章
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.badge-verified { color: var(--ok); background: var(--ok-bg); }
.badge-unverified { color: var(--text-2); background: var(--bg-3); }
.badge-latest { color: var(--cyan); background: rgba(25, 224, 212, 0.1); }
.badge-legacy { color: var(--text-3); background: var(--bg-3); }
.badge-dispute { color: var(--err); background: var(--err-bg); }

/* ----------------------------------------------------------------------------
   卡片网格
   -------------------------------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--gap);
}

.agent-card {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  position: relative;
  overflow: hidden;
}
.agent-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.agent-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-2);
}
.agent-card:hover::before { opacity: 1; }

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }

.agent-avatar {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
}
.agent-avatar.rebalancing { background: rgba(91, 140, 255, 0.16); color: var(--sc-rebalancing); }
.agent-avatar.grid { background: rgba(25, 224, 212, 0.13); color: var(--sc-grid); }
.agent-avatar.yield { background: rgba(160, 107, 255, 0.16); color: var(--sc-yield); }
.agent-avatar.health { background: rgba(255, 122, 89, 0.16); color: var(--sc-health); }

.agent-name { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
.agent-key { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); margin-top: 3px; word-break: break-all; }

.card-body { font-size: 13px; color: var(--text-1); margin-bottom: 16px; }

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.metric { text-align: center; }
.metric-value { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric-label { font-size: 11px; color: var(--text-2); margin-top: 2px; }

.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ----------------------------------------------------------------------------
   排名分数
   -------------------------------------------------------------------------- */
.rank-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.rank-num { font-size: 22px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.rank-label { font-size: 10px; color: var(--text-3); letter-spacing: 0.06em; text-transform: uppercase; }

/* ----------------------------------------------------------------------------
   详情页
   -------------------------------------------------------------------------- */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--gap);
  align-items: start;
}

.panel {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.panel-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

.key-value { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.key-value:last-child { border-bottom: none; }
.kv-key { color: var(--text-2); }
.kv-value { color: var(--text-0); font-family: var(--font-mono); font-size: 12px; text-align: right; word-break: break-all; }

/* 指标进度 */
.metric-bar { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.metric-bar-label { width: 120px; font-size: 12px; color: var(--text-2); flex-shrink: 0; }
.metric-bar-track { flex: 1; height: 6px; background: var(--bg-3); border-radius: 4px; overflow: hidden; }
.metric-bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--cyan-dim), var(--cyan)); }
.metric-bar-fill.unverified { background: linear-gradient(90deg, var(--text-3), var(--text-2)); }
.metric-bar-value { width: 60px; font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }

/* 版本时间线 */
.version-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.version-item:hover { border-color: var(--line-strong); }
.version-item.active { border-color: var(--gold-dim); background: var(--bg-3); }
.version-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.version-tag { font-weight: 700; font-size: 14px; }
.version-date { font-size: 11px; color: var(--text-3); }

/* ----------------------------------------------------------------------------
   评价
   -------------------------------------------------------------------------- */
.review {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.review:last-child { border-bottom: none; }
.review-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.reviewer { font-family: var(--font-mono); font-size: 12px; color: var(--text-1); }
.stars { color: var(--gold); font-size: 14px; letter-spacing: 2px; }
.review-comment { font-size: 13px; color: var(--text-1); }
.review-meta { font-size: 11px; color: var(--text-3); margin-top: 6px; }

/* ----------------------------------------------------------------------------
   表单
   -------------------------------------------------------------------------- */
.form-section { margin-bottom: 22px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text-1); margin-bottom: 6px; display: block; }
.form-hint { font-size: 11px; color: var(--text-3); margin-top: 4px; }

.field {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 14px;
  color: var(--text-0);
  outline: none;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.field:focus { border-color: var(--gold-dim); box-shadow: 0 0 0 3px rgba(240, 185, 11, 0.1); }
.field::placeholder { color: var(--text-3); }

textarea.field { min-height: 96px; resize: vertical; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.segmented {
  display: inline-flex;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}
.segmented button {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-2);
  transition: all 0.16s var(--ease);
}
.segmented button.active { background: var(--bg-3); color: var(--text-0); font-weight: 600; }

/* ----------------------------------------------------------------------------
   空状态与加载
   -------------------------------------------------------------------------- */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-2);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text-1); margin-bottom: 4px; }

.skeleton {
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 50%, var(--bg-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ----------------------------------------------------------------------------
   响应式
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr; }
  .main { padding: 20px 16px 60px; }
}

/* ----------------------------------------------------------------------------
   动效工具
   -------------------------------------------------------------------------- */
.fade-in { animation: fadeIn 0.35s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
