/* MongoDB 命令生成工具样式：MongoDB 品牌绿主题，左配置 / 右输出两栏。
   站点外壳（导航条 / 广告位）的自包含样式在本文件顶部 —— 工具页不引 assets/site.css。 */

:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #e5e7eb;
  --text: #1f2328;
  --muted: #6b7280;
  --accent: #13aa52;
  --accent-dark: #0f8f45;
  --accent-soft: #e8f7ee;
  --field-line: #c9e5d5;
  --bad: #b91c1c;
  --ok: #0f766e;
  --code-bg: #1e2329;
  --code-text: #e6edf3;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------ 站点外壳 */
.site-nav {
  display: flex; align-items: center; gap: 16px;
  height: 52px; padding: 0 20px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.site-nav a { text-decoration: none; color: var(--muted); font-size: 13px; }
.site-nav a:hover { color: var(--accent); }
.site-nav .brand {
  display: flex; align-items: center; gap: 7px;
  font-size: 13.5px; font-weight: 650; color: var(--text);
}
.site-nav .brand i {
  width: 20px; height: 20px; border-radius: 5px; background: #2563eb; color: #fff;
  font-size: 10px; font-style: normal; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.site-nav .back { margin-left: auto; }

.ad { position: relative; display: flex; justify-content: center; }
.ad:empty { display: none; }
.ad-frame { display: block; width: 100%; height: 100%; border: 0; }
.ad-inline { width: 100%; max-width: 1180px; height: 90px; margin: 0 auto; }
.ad-label {
  position: absolute; right: 8px; top: 2px; pointer-events: none;
  font-size: 10px; line-height: 14px; padding: 0 4px; border-radius: 4px;
  color: #9ca3af; background: rgba(255,255,255,.9); border: 1px solid var(--line);
}

/* ------------------------------------------------------------ 页面 */
.page { max-width: 1180px; margin: 0 auto; padding: 30px 20px 44px; }

h1 { margin: 0 0 8px; font-size: 26px; font-weight: 650; text-align: center; letter-spacing: .2px; }
.lead { margin: 0 0 24px; text-align: center; color: var(--muted); font-size: 13.5px; }

.workspace { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

/* ------------------------------------------------------------ 面板 */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; background: var(--accent); color: #fff;
}
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.panel.output .panel-head { background: var(--code-bg); }
/* 左侧表单比右侧输出长：让输出吸顶，向下滚动看后面的字段时命令始终可见 */
.panel.output { position: sticky; top: 16px; }
.panel-body { padding: 16px; }

/* 模式切换（面板头里的三个小按钮） */
.tabs { display: flex; gap: 4px; background: rgba(255,255,255,.18); border-radius: 8px; padding: 3px; }
.tabs button {
  border: 0; background: transparent; color: rgba(255,255,255,.9);
  font: 12.5px inherit; padding: 5px 10px; border-radius: 6px; cursor: pointer;
  white-space: nowrap;
}
.tabs button:hover { background: rgba(255,255,255,.16); }
.tabs button.active { background: #fff; color: var(--accent-dark); font-weight: 600; }

/* 输出区的三个动作按钮 */
.acts { display: flex; gap: 8px; flex-wrap: wrap; }
.acts button {
  border: 1px solid rgba(255,255,255,.32); background: transparent; color: #fff;
  font: 12.5px inherit; padding: 6px 12px; border-radius: 7px; cursor: pointer;
}
.acts button:hover { background: rgba(255,255,255,.14); }
.acts button.primary { background: var(--accent); border-color: var(--accent); font-weight: 600; }
.acts button.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.acts button.primary.done { background: #0f766e; border-color: #0f766e; }
.acts #btnClear:hover { background: #7f1d1d; border-color: #b91c1c; }

/* ------------------------------------------------------------ 表单 */
.field { margin-bottom: 15px; }
.field[hidden] { display: none; }
.field label {
  display: block; margin-bottom: 6px;
  font-size: 13px; font-weight: 600; color: #374151;
}
.field .q {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--line);
  color: var(--muted); font-size: 10px; font-weight: 400; cursor: help;
}
.field input[type="text"],
.field select,
.field textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--field-line); border-radius: 8px;
  background: #fff; color: var(--text);
  font: 13px var(--mono); outline: none;
}
.field textarea { resize: vertical; line-height: 1.7; min-height: 76px; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input::placeholder, .field textarea::placeholder { color: #b6bcc6; }
.field select { font-family: inherit; font-size: 13.5px; cursor: pointer; }

.field-row { display: flex; gap: 10px; }
.field-row > .field { flex: 1; min-width: 0; }

.hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); line-height: 1.7; }
.hint code {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 4px; padding: 0 4px; font-size: 11.5px;
}
.mini {
  margin-top: 7px; border: 1px solid var(--field-line); background: #fff;
  color: var(--accent-dark); font: 12px inherit; padding: 5px 10px;
  border-radius: 7px; cursor: pointer;
}
.mini:hover { background: var(--accent-soft); border-color: var(--accent); }

.err {
  margin: 4px 0 0; padding: 9px 11px; font-size: 12.5px; line-height: 1.7;
  color: var(--bad); background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px;
}
.err[hidden] { display: none; }

/* ------------------------------------------------------------ 输出 */
.code {
  margin: 0; padding: 16px;
  background: var(--code-bg); color: var(--code-text);
  font: 13px/1.75 var(--mono);
  min-height: 380px; max-height: 70vh; overflow: auto;
  white-space: pre; tab-size: 2;
}
.code.empty { color: #6b7280; font-style: italic; }

.foot-note {
  margin: 22px 0 0; text-align: center;
  font-size: 12.5px; color: var(--muted); line-height: 1.9;
}

/* ------------------------------------------------------------ 响应式 */
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .panel.output { position: static; }   /* 上下排列时不需要吸顶 */
  .code { min-height: 240px; }
}
@media (max-width: 640px) {
  .page { padding: 22px 16px 34px; }
  h1 { font-size: 21px; }
  .panel-head { flex-wrap: wrap; }
  .field-row { flex-direction: column; gap: 0; }
  .acts button { padding: 5px 9px; }
}
