/* MCP management modal. Reuses .overlay/.search-overlay/.search-page from
   search.css for the shell; this file styles the server/tool nesting and the
   toggle switches. */

.mcp-header { display: grid; gap: 6px; }
.mcp-header h1 { margin: 0; font-size: 22px; }
.mcp-header p { margin: 0; color: var(--muted); font-size: 14px; }

/* The MCP page reuses .search-page, whose shared grid has four rows for the
   search overlay (back link, header, field, results). This page has only a
   header + results, so those two children would land in the first two `auto`
   rows and the results would grow unbounded (no scroll). Constrain to a header
   row plus a scrollable results region so .search-results' overflow:auto (and
   min-height:0) can take effect when the list gets long. */
#mcpModal .search-page { grid-template-rows: auto minmax(0, 1fr); }
/* Give the scrolled list a little breathing room at the bottom edge. */
#mcpModal .mcp-results { padding-bottom: 24px; }

.mcp-results { display: flex; flex-direction: column; gap: 12px; }

.mcp-server {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
  overflow: hidden;
}

.mcp-server-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
}
.mcp-server-meta { display: grid; gap: 2px; min-width: 0; }
.mcp-server-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcp-server-count { color: var(--muted); font-size: 13px; }

/* Nested tools sit indented under the server, separated by a divider. */
.mcp-tool-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-2) 45%, var(--panel));
}
.mcp-tool {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 16px 11px 30px;
}
.mcp-tool + .mcp-tool { border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.mcp-tool-info { display: grid; gap: 2px; min-width: 0; }
.mcp-tool-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcp-tool-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
}

/* When a whole server is off, dim its tool rows to signal they're inactive. */
.mcp-server.disabled .mcp-tool-list { opacity: .55; }

/* Sliding toggle switch built from a visually-hidden checkbox + a track. */
.mcp-switch {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  width: 42px;
  height: 24px;
  cursor: pointer;
}
.mcp-switch input {
  position: absolute;
  inset: 0;
  z-index: 1;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.mcp-switch input:disabled { cursor: not-allowed; }
.mcp-switch-track {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  transition: background .15s ease, border-color .15s ease;
}
.mcp-switch-track::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transform: translateY(-50%);
  transition: transform .15s ease, background .15s ease;
}
.mcp-switch input:checked + .mcp-switch-track {
  background: var(--accent);
  border-color: var(--accent);
}
.mcp-switch input:checked + .mcp-switch-track::after {
  transform: translate(18px, -50%);
  background: #fff;
}
.mcp-switch input:focus-visible + .mcp-switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.mcp-switch input:disabled + .mcp-switch-track { opacity: .6; }
