/* ============================================================
   MonkeyPay · 商户 API 模拟器 —— 商用开放平台风格
   ============================================================ */
:root {
  --brand: #2f54eb;          /* 主品牌蓝 */
  --brand-2: #1d39c4;
  --brand-bg: #eef2ff;       /* 主色浅底 */
  --navy: #0d1b2e;           /* 顶栏深蓝 */
  --navy-2: #152844;
  --ok: #18a058;  --ok-bg: #e8f7ef;
  --warn: #d97706; --warn-bg: #fef4e6;
  --err: #d4380d; --err-bg: #fdeeea;
  --bg: #f4f6fa;             /* 页面底色 */
  --card: #ffffff;
  --line: #e3e8f0;
  --line-2: #eef1f6;
  --text: #16233b;
  --text-2: #5b6b84;
  --text-3: #93a1b8;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(13, 27, 46, .14);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
#app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ============ 顶栏（深色） ============ */
.topbar {
  display: flex; align-items: center; gap: 14px; height: 56px; padding: 0 20px;
  background: linear-gradient(180deg, var(--navy), var(--navy-2));
  color: #dbe4f0; flex-shrink: 0; box-shadow: 0 1px 0 rgba(255,255,255,.06) inset;
}
.logo { display: flex; align-items: center; gap: 10px; color: #fff; min-width: 260px; }
.logo .mark {
  width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center;
  background: linear-gradient(135deg, #4a7dff, #2f54eb); color: #fff;
  font-size: 14px; font-weight: 700; box-shadow: 0 2px 8px rgba(79, 125, 255, .35);
}
.logo .name { font-size: 15px; font-weight: 600; letter-spacing: .2px; }
.logo .name small { color: #8fa3c4; font-weight: 400; margin-left: 6px; font-size: 11px; letter-spacing: .5px; }
.tb-sep { width: 1px; height: 22px; background: rgba(255,255,255,.14); }

.topbar .env-switch { display: flex; align-items: center; }
.tb-label { font-size: 12px; color: #93a5c6; margin-right: 8px; }
.env-select, .topbar select {
  height: 30px; border: 1px solid rgba(255,255,255,.18); border-radius: 6px; padding: 0 10px;
  background: rgba(255,255,255,.06); color: #e6edf9; font-size: 12.5px; outline: none; cursor: pointer;
}
.env-select option { color: #16233b; background: #fff; }
.spacer { flex: 1; }

.doc-link {
  color: #b7c6e2; font-size: 13px; text-decoration: none; padding: 5px 10px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,.16);
}
.doc-link:hover { color: #fff; border-color: rgba(255,255,255,.4); }

/* 商户身份切换 */
.merchant-box { position: relative; }
.merchant-trigger {
  height: 32px; display: inline-flex; align-items: center; gap: 8px; padding: 0 8px 0 12px;
  border: 1px solid rgba(255,255,255,.22); border-radius: 7px; background: rgba(255,255,255,.08);
  color: #fff; cursor: pointer; font-size: 13px;
}
.merchant-trigger:hover { background: rgba(255,255,255,.14); }
.merchant-trigger .caret { font-size: 10px; color: #93a5c6; }
.mch-badge {
  background: rgba(74, 125, 255, .28); color: #cfe0ff; border-radius: 5px; padding: 1px 8px;
  font-size: 12px; font-weight: 600; font-family: var(--mono); letter-spacing: .3px;
}
.merchant-panel {
  position: absolute; right: 0; top: 42px; width: 356px; background: #fff; border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 18px; display: none; z-index: 30; color: var(--text);
}
.merchant-box.open .merchant-panel { display: block; }
.mp-title { font-weight: 600; margin-bottom: 14px; font-size: 14px; display:flex; align-items:center; gap:8px; }
.mp-title .lock { color: var(--brand); }
.mp-row {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer; margin-bottom: 8px; transition: all .15s;
}
.mp-row:hover { border-color: var(--brand); background: #fafbff; }
.mp-row.sel { border-color: var(--brand); background: var(--brand-bg); }
.mp-row input[type=radio] { accent-color: var(--brand); margin-top: 3px; }
.mp-label { font-weight: 500; font-size: 13.5px; }
.mp-sub { color: var(--text-3); font-size: 12px; margin-top: 1px; }
.mp-demo-key {
  background: #f7f9fc; border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px;
  font-family: var(--mono); font-size: 12px; margin: 4px 2px 10px; color: var(--text-2); word-break: break-all;
  position: relative; line-height: 1.8;
}
.mp-demo-key .tag { color: var(--text-3); }
.mp-fields label { display: block; font-size: 12.5px; color: var(--text-2); margin: 12px 0 5px; font-weight: 500; }
.mp-fields input {
  width: 100%; height: 32px; border: 1px solid var(--line); border-radius: 7px; padding: 0 10px;
  font-family: var(--mono); font-size: 12.5px; outline: none; background: #fbfcfe;
}
.mp-fields input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(47,84,235,.12); }
.mp-tip { font-size: 11.5px; color: var(--text-3); margin-top: 8px; display: none; line-height:1.6;}
.mp-tip.show { display: block; }
.mp-actions { display: flex; gap: 10px; margin-top: 16px; justify-content: flex-end; }

/* ============ 主体 ============ */
.main { display: flex; flex: 1; overflow: hidden; }

/* 左侧导航 */
.side {
  width: 248px; background: #fff; border-right: 1px solid var(--line); overflow-y: auto;
  flex-shrink: 0; padding: 12px 0 20px;
}
.side::-webkit-scrollbar, .content::-webkit-scrollbar { width: 6px; height: 6px; }
.side::-webkit-scrollbar-thumb, .content::-webkit-scrollbar-thumb { background: #d4dae6; border-radius: 3px; }
.nav-group { margin-bottom: 2px; }
.nav-group-title {
  padding: 14px 20px 6px; font-size: 11.5px; color: var(--text-3); font-weight: 600;
  letter-spacing: 1.2px; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 16px 8px 24px;
  color: var(--text-2); cursor: pointer; font-size: 13px; border-left: 3px solid transparent;
  transition: all .12s;
}
.nav-item:hover { background: #f6f8fc; color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, var(--brand-bg), transparent); border-left-color: var(--brand);
  color: var(--brand-2); font-weight: 600;
}
.nav-item .nav-api {
  font-size: 10.5px; color: var(--text-3); font-family: var(--mono); background: #f2f4f9;
  padding: 1px 5px; border-radius: 4px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-item.active .nav-api { background: #fff; color: var(--brand); }
.nav-badge {
  background: linear-gradient(135deg,#4a7dff,#2f54eb); color: #fff; font-size: 10px;
  padding: 1px 7px; border-radius: 9px; font-weight: 600; box-shadow: 0 1px 4px rgba(47,84,235,.35);
}

/* 右侧内容 */
.content { flex: 1; overflow-y: auto; padding: 24px 32px 60px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.page-title { font-size: 20px; font-weight: 700; letter-spacing: .2px; }
.page-api {
  font-family: var(--mono); font-size: 12px; color: var(--brand-2); background: var(--brand-bg);
  padding: 3px 10px; border-radius: 6px; word-break: break-all; border: 1px solid #dbe4ff;
}
.page-env-tip {
  font-size: 13px; color: var(--text-3); margin-bottom: 20px; display: flex; align-items: center; gap: 14px;
  padding-bottom: 14px; border-bottom: 1px solid var(--line-2);
}
.env-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
.env-dot.test { background: var(--ok); box-shadow: 0 0 0 3px rgba(24,160,88,.15); }
.env-dot.prod { background: var(--warn); box-shadow: 0 0 0 3px rgba(217,119,6,.15); }

/* 面板卡片 */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 16px; box-shadow: var(--shadow); overflow: hidden;
}
.panel-title {
  font-weight: 600; font-size: 13.5px; padding: 13px 18px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 8px; color: var(--text);
}
.panel-title .ic { color: var(--brand); }
.panel-body { padding: 16px 18px; }
.panel-body.mono {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.75; color: #33415c;
  white-space: pre-wrap; word-break: break-all; background: #f8fafd;
  margin: 0; padding: 14px 16px;
}

/* 参数表单 */
.field-row { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 13px; }
.field-row label {
  width: 158px; flex-shrink: 0; padding-top: 7px; font-size: 13px; color: var(--text-2); text-align: right;
}
.field-row label .req { color: var(--err); margin-left: 2px; }
.field-wrap { flex: 1; min-width: 0; }
.field-wrap input, .field-wrap select, .field-wrap textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 8px 11px; font-size: 13px;
  outline: none; background: #fbfcfe; color: var(--text); font-family: inherit; transition: all .12s;
}
.field-wrap textarea { font-family: var(--mono); font-size: 12.5px; resize: vertical; min-height: 66px; line-height: 1.6; }
.field-wrap input:focus, .field-wrap select:focus, .field-wrap textarea:focus {
  border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(47,84,235,.12);
}
.field-desc { font-size: 12px; color: var(--text-3); margin-top: 5px; line-height: 1.5; }
.field-wrap .type-tag {
  font-size: 10.5px; color: var(--text-3); font-family: var(--mono); margin-left: 6px;
}

/* 占位提示（开发中） */
.placeholder-note {
  background: #fffaf0; border: 1px solid #ffe1b3; color: #9a5b00; border-radius: 8px;
  padding: 10px 14px; font-size: 13px; margin-bottom: 16px; line-height: 1.6;
}
.placeholder-note b { color: #7a4a00; }

/* 按钮 */
.btn {
  height: 32px; padding: 0 16px; border-radius: 7px; border: 1px solid var(--line); background: #fff;
  font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--text-2);
  transition: all .12s; font-family: inherit;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary {
  background: linear-gradient(180deg, #3d6bff, var(--brand)); border-color: var(--brand); color: #fff;
  font-weight: 500; box-shadow: 0 2px 6px rgba(47,84,235,.3);
}
.btn.primary:hover { background: linear-gradient(180deg, #2f5af0, var(--brand-2)); color:#fff; box-shadow: 0 4px 12px rgba(47,84,235,.4); }
.btn.ghost-blue { border-color: var(--brand); color: var(--brand); background: #fff; }
.btn.ghost-blue:hover { background: var(--brand-bg); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn:disabled:hover { background: #fff; color: #fff; }

/* 响应区 */
.resp-box { min-height: 90px; }
.resp-head { display: flex; gap: 10px; align-items: center; }
.resp-status { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 20px; }
.resp-status.code0 { background: var(--ok-bg); color: var(--ok); }
.resp-status.code-err { background: var(--err-bg); color: var(--err); }
.resp-status.http-err { background: var(--warn-bg); color: var(--warn); }
.resp-meta { font-size: 12px; color: var(--text-3); margin-left: auto; font-family: var(--mono); }
.resp-empty { color: var(--text-3); font-size: 13px; padding: 10px 0; }

/* 请求历史 */
.history-item {
  display: flex; gap: 12px; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--line-2);
  font-size: 12.5px; cursor: pointer; font-family: var(--mono); transition: background .1s;
}
.history-item:hover { background: #f6f8fc; }
.history-item .h-time { color: var(--text-3); flex-shrink: 0; font-size: 11.5px; }
.history-item .h-method { color: var(--brand-2); font-weight: 700; flex-shrink: 0; width: 46px; }
.history-item .h-path { color: var(--text-2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item .h-code { font-weight: 600; flex-shrink: 0; }
.history-item .h-code.ok { color: var(--ok); }
.history-item .h-code.bad { color: var(--err); }

/* 向导步骤 */
.step-row { display: flex; gap: 12px; margin-bottom: 12px; position: relative; }
.step-line { position: absolute; left: 15px; top: 30px; bottom: -12px; width: 2px; background: var(--line); }
.step-row:last-child .step-line { display: none; }
.step-num {
  width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg,#3d6bff,#2f54eb);
  color: #fff; font-size: 13px; display: grid; place-items: center; flex-shrink: 0; font-weight: 600;
  box-shadow: 0 2px 6px rgba(47,84,235,.3); z-index: 1; position: relative;
}
.step-num.done { background: linear-gradient(135deg,#22b573,#18a058); box-shadow: 0 2px 6px rgba(24,160,88,.3); }
.step-content { flex: 1; padding-bottom: 6px; }
.step-title { font-weight: 600; font-size: 13.5px; padding-top: 6px; }
.step-desc { font-size: 12.5px; color: var(--text-2); margin: 4px 0 8px; }
.kv-inline {
  font-family: var(--mono); background: #f3f6fb; padding: 1px 7px; border-radius: 5px; font-size: 12px;
  color: var(--brand-2); border: 1px solid var(--line);
}

/* misc */
.hidden { display: none !important; }
.text-3 { color: var(--text-3); }
.mono { font-family: var(--mono); }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; }
.status-enum { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.status-chip {
  font-size: 11.5px; background: #f7f9fc; border: 1px solid var(--line); padding: 3px 10px;
  border-radius: 20px; color: var(--text-2); font-family: var(--mono);
}
.status-chip b { color: var(--text); margin-right: 4px; }

/* 折叠区 */
.collapse-head {
  display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
  padding: 10px 16px; font-size: 13px; color: var(--text-2); font-weight: 500;
}
.collapse-head:hover { color: var(--brand); }
.collapse-head .arrow { transition: transform .15s; font-size: 10px; }
.collapse-head.open .arrow { transform: rotate(90deg); }
