/* ── CSS custom properties (neon dark palette) ────────────────────────────── */
:root {
  --bg:       #0d0e1a;
  --surface:  #12131f;
  --surface2: #1a1b2e;
  --border:   #2a2b3d;
  --border2:  #3a3b55;

  --cyan:     #00f5ff;
  --magenta:  #ff2d95;
  --green:    #39ff14;
  --yellow:   #ffe600;
  --purple:   #bf5fff;
  --orange:   #ff6b35;

  --fg:       #e2e8f0;
  --fg-dim:   #8892a4;
  --fg-muted: #4a5568;

  --sidebar-w: 260px;
  --radius:    8px;
  --font-mono: "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace;
}

/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cyan); text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, textarea { font: inherit; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.brand-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.5px;
  text-shadow: 0 0 12px rgba(0, 245, 255, 0.4);
}
.brand-sub {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 2px;
  letter-spacing: 0.3px;
}

/* Search */
.search-wrap {
  position: relative;
  padding: 12px 12px 8px;
  flex-shrink: 0;
}
.search-icon {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--fg-muted);
  pointer-events: none;
}
#search {
  width: 100%;
  padding: 7px 28px 7px 32px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  outline: none;
  font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#search::placeholder { color: var(--fg-muted); }
#search:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(0, 245, 255, 0.15);
}
.search-clear {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-muted);
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s;
}
.search-clear:hover { color: var(--fg); }

/* Tool list nav */
.tool-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0 16px;
}
.tool-list::-webkit-scrollbar { width: 4px; }
.tool-list::-webkit-scrollbar-track { background: transparent; }
.tool-list::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 14px 6px;
}
.category-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--bg);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.tool-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 20px;
  color: var(--fg-dim);
  font-size: 13px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
  user-select: none;
}
.tool-item:hover {
  color: var(--fg);
  background: rgba(255,255,255,0.04);
}
.tool-item.active {
  color: var(--cyan);
  border-left-color: var(--cyan);
  background: rgba(0, 245, 255, 0.07);
  font-weight: 500;
}
.tool-item .arrow {
  font-size: 10px;
  opacity: 0;
  transition: opacity 0.12s;
}
.tool-item:hover .arrow,
.tool-item.active .arrow { opacity: 1; }

.no-results {
  padding: 20px 16px;
  color: var(--orange);
  font-size: 13px;
}

/* ── Main content ─────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
}

/* Welcome splash */
.welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  color: var(--fg-muted);
}
.welcome-glyph {
  font-size: 48px;
  filter: drop-shadow(0 0 16px rgba(0,245,255,0.5));
  margin-bottom: 4px;
}
.welcome-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--cyan);
  text-shadow: 0 0 20px rgba(0,245,255,0.35);
}
.welcome-sub { font-size: 15px; }
.welcome-chips {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.chip {
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--bg);
  letter-spacing: 0.5px;
}
.chip-cyan    { background: var(--cyan); }
.chip-magenta { background: var(--magenta); }
.chip-green   { background: var(--green); }
.chip-yellow  { background: var(--yellow); }

/* Tool panel */
.tool-panel { display: flex; flex-direction: column; gap: 24px; max-width: 820px; }

.tool-header { display: flex; flex-direction: column; gap: 6px; }
.tool-header-top { display: flex; align-items: center; gap: 10px; }

.category-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--bg);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.tool-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(0,245,255,0.25);
}
.tool-desc { color: var(--fg-dim); font-size: 14px; }

/* Form */
.tool-form { display: flex; flex-direction: column; gap: 20px; }

.field-wrap { display: flex; flex-direction: column; gap: 6px; }

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--cyan);
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.field-required { color: var(--orange); font-size: 13px; }

.field-input,
.field-textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  outline: none;
  font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
  resize: vertical;
}
.field-input::placeholder,
.field-textarea::placeholder { color: var(--fg-muted); }
.field-input:focus,
.field-textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(0, 245, 255, 0.15);
}
.field-textarea { min-height: 120px; font-family: var(--font-mono); font-size: 12px; line-height: 1.5; }

/* Option toggles */
.option-group { display: flex; flex-wrap: wrap; gap: 6px; }
.option-btn {
  padding: 5px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--fg-dim);
  transition: all 0.12s;
  cursor: pointer;
}
.option-btn:hover { border-color: var(--border2); color: var(--fg); }
.option-btn.active {
  background: var(--cyan);
  border-color: var(--cyan);
  color: var(--bg);
  font-weight: 700;
  box-shadow: 0 0 8px rgba(0,245,255,0.3);
}
.option-default-dot::after { content: " ●"; font-size: 10px; opacity: 0.7; }

/* Run bar */
.run-bar { display: flex; align-items: center; gap: 16px; }

.btn-run {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 28px;
  background: var(--cyan);
  color: var(--bg);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  transition: opacity 0.15s, box-shadow 0.15s;
  box-shadow: 0 0 0 rgba(0,245,255,0);
}
.btn-run:hover:not(:disabled) { box-shadow: 0 0 16px rgba(0,245,255,0.4); }
.btn-run:disabled { opacity: 0.5; cursor: not-allowed; }

.form-error { color: var(--orange); font-size: 12px; }

/* Spinner */
.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(0,0,0,0.3);
  border-top-color: var(--bg);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Result */
.result-wrap {
  border: 1px solid var(--green);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.1);
}
.result-wrap.error {
  border-color: var(--orange);
  box-shadow: 0 0 12px rgba(255, 107, 53, 0.1);
}
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.result-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--green);
}
.result-wrap.error .result-badge { color: var(--orange); }

.btn-copy {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--fg-dim);
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: color 0.12s, border-color 0.12s;
}
.btn-copy svg { width: 13px; height: 13px; }
.btn-copy:hover { color: var(--fg); border-color: var(--border2); }
.btn-copy.copied { color: var(--green); border-color: var(--green); }

.result-output {
  padding: 16px 18px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--fg);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--bg);
}
.result-output::-webkit-scrollbar { width: 4px; }
.result-output::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ── Utilities ────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Sidebar footer (Docs button) ─────────────────────────────────────────── */
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  flex-shrink: 0;
}
.docs-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  color: var(--fg-muted);
  font-size: 13px;
  border-radius: var(--radius);
  transition: color 0.12s, background 0.12s;
  user-select: none;
}
.docs-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.docs-btn:hover { color: var(--fg); background: rgba(255,255,255,0.04); }
.docs-btn.active {
  color: var(--purple);
  background: rgba(191,95,255,0.08);
}

/* ── CLI hint strip ───────────────────────────────────────────────────────── */
.cli-hint-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 6px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  overflow-x: auto;
}
.cli-hint-wrap::-webkit-scrollbar { height: 3px; }
.cli-hint-wrap::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
.cli-hint-label {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--purple);
  color: var(--bg);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.cli-hint {
  font-family: var(--font-mono);
  color: var(--fg-dim);
  font-size: 12px;
  white-space: nowrap;
}

/* ── Docs panel ───────────────────────────────────────────────────────────── */
.docs-panel {
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 820px;
}
.docs-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--purple);
  text-shadow: 0 0 12px rgba(191,95,255,0.25);
}
.docs-section { display: flex; flex-direction: column; gap: 12px; }
.docs-section h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--cyan);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.docs-section h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-dim);
  margin-top: 4px;
}
.docs-section p { color: var(--fg-dim); font-size: 13px; line-height: 1.7; }
.docs-code {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.75;
  color: var(--fg);
  white-space: pre;
  overflow-x: auto;
}
.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.docs-table th {
  text-align: left;
  padding: 6px 12px;
  color: var(--fg-muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.docs-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.5;
}
.docs-table tr:last-child td { border-bottom: none; }
.docs-table .td-id {
  font-family: var(--font-mono);
  color: var(--cyan);
  font-size: 12px;
  white-space: nowrap;
}
.docs-table .td-name { color: var(--fg-dim); white-space: nowrap; }
.docs-table .td-cli {
  font-family: var(--font-mono);
  color: var(--fg-dim);
  font-size: 11.5px;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    min-width: unset;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 45vh;
  }
  .main { padding: 20px 16px; }
  .tool-panel { max-width: 100%; }
}
