/* ============================================================
   tools-base.css — shared foundation for the developer toolbox
   Link once per tool page:  <link rel="stylesheet" href="tools-base.css">
   Covers: reset, palette, body, topbar, switcher TRIGGER, buttons,
   inputs, panes, placeholders, responsive. The switcher DROPDOWN
   styles are injected separately by tools-nav.js — not duplicated here.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d1117; --surface: #161b22; --surface2: #21262d; --border: #30363d;
  --accent: #388bfd; --text: #e6edf3; --text-muted: #8b949e;
  --green: #3fb950; --yellow: #d29922; --red: #f85149; --purple: #bc8cff;
  /* JSON syntax colors */
  --jk: #79c0ff; --js: #a5d6ff; --jn: #ffa657; --jb: #ff7b72;
  --mono: 'SF Mono', 'Consolas', 'Menlo', monospace;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif;
  background: var(--bg); color: var(--text);
  height: 100vh; display: flex; flex-direction: column; overflow: hidden;
}

/* ── TOPBAR ── */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface); flex-shrink: 0; flex-wrap: wrap;
}
.topbar-sep { width: 1px; height: 20px; background: var(--border); margin: 0 2px; }
.topbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── TOOL SWITCHER TRIGGER (dropdown styles come from tools-nav.js) ── */
.tool-switcher { position: relative; }
.sw-trigger {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; font-size: 13px; font-weight: 600;
  background: var(--surface2); user-select: none; transition: border-color .15s;
}
.sw-trigger:hover { border-color: var(--accent); }
.sw-icon-main { font-family: var(--mono); font-weight: 700; color: var(--green); }
.sw-arrow { color: var(--text-muted); font-size: 10px; }
/* 切换器里那个工具名如果是 <h1>，压它默认字号字重的规则在工具页自己的
   <style> 里，不在这儿 —— 本文件是单独缓存的，跟 html 会不同步，
   旧 css 配新 html 时 h1 会以 2em 粗体炸开。详见 format.html 里的说明。 */

/* ── CONTROLS ── */
select {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  padding: 4px 8px; border-radius: 6px; font-size: 12px; cursor: pointer; font-family: inherit;
}
select:focus { border-color: var(--accent); outline: none; }
button {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  padding: 5px 12px; border-radius: 6px; font-size: 12px; cursor: pointer;
  transition: background .15s; font-family: inherit; white-space: nowrap;
}
button:hover { background: var(--border); }
.btn-sm { font-size: 11px !important; padding: 3px 8px !important; }
.btn-accent { background: var(--accent) !important; border-color: var(--accent) !important; color: #fff !important; font-weight: 600; }
.btn-accent:hover { opacity: .88; }
.btn-danger { background: rgba(248,81,73,.15) !important; border-color: var(--red) !important; color: var(--red) !important; }
.btn-danger:hover { background: rgba(248,81,73,.28) !important; }

input[type=text], input[type=search], textarea {
  font-family: inherit;
}
input[type=checkbox] { accent-color: var(--accent); cursor: pointer; }
label { font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }

/* ── MAIN / PANES ── */
.main { display: flex; flex: 1; overflow: hidden; }
.pane { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.pane + .pane { border-left: 1px solid var(--border); }
.pane-header {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px; background: var(--surface); border-bottom: 1px solid var(--border);
  flex-shrink: 0; font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px;
}
.pane-title { flex: 1; }
.pane-content { flex: 1; overflow: auto; position: relative; }

/* ── PLACEHOLDER / ERROR ── */
.placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: var(--text-muted); gap: 8px; text-align: center; font-size: 13px;
}
.placeholder .icon { font-size: 28px; }
.error-msg {
  margin: 14px; padding: 12px 14px; background: #2d1516; border: 1px solid #6e3333;
  border-radius: 8px; color: var(--red); font-size: 12px; font-family: var(--mono);
}

/* ── badges ── */
.format-badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--surface2); color: var(--text-muted); flex-shrink: 0; }
.format-badge.detected { background: #1f3a1f; color: var(--green); }
.format-badge.err { background: #2d1516; color: var(--red); }
.lc-badge { font-size: 10px; color: var(--text-muted); background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 1px 7px; white-space: nowrap; font-weight: 400; }

/* ── RESPONSIVE ── */
@media (max-width: 760px) {
  .main { flex-direction: column; }
  .pane + .pane { border-left: none; border-top: 1px solid var(--border); }
  .topbar { padding: 6px 10px; gap: 6px; }
}
