/* MCP 管理页样式 — 毛玻璃体系 */

.mcp-page {
  padding: 24px 32px;
  /* 与工具页对齐：单列列表统一 900 上限并居中 */
  max-width: 900px;
  margin: 0 auto;
  /* 轻量灰底托起灰色解释文字，背景图仍透出 */
  background: var(--glass-bg-soft);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

.mcp-page__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.mcp-page__title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0;
  /* 浮在背景图上，加描边光晕 */
  text-shadow: var(--text-halo);
}

.mcp-page__subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 4px 0 0;
  text-shadow: var(--text-halo);
}

.mcp-page__subtitle code {
  background: var(--glass-bg);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: var(--text-xs);
}

.mcp-page__actions {
  display: flex;
  gap: 8px;
}

/* 标题旁的问号帮助：悬停/聚焦弹出轻浮窗，移开即隐 */
.mcp-help {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
  cursor: help;
  user-select: none;
}

.mcp-help__pop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 50;
  width: 320px;
  max-width: 70vw;
  padding: 10px 14px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  /* 默认隐藏 */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  /* 内容样式：脱离标题的粗体/大字 */
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: 1.7;
  color: var(--color-text-secondary);
  text-align: left;
  white-space: normal;
  cursor: default;
}

.mcp-help:hover .mcp-help__pop,
.mcp-help:focus .mcp-help__pop,
.mcp-help:focus-within .mcp-help__pop {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mcp-help__pop strong { color: var(--color-text-primary); font-weight: 600; }

.mcp-help__pop code {
  padding: 1px 5px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  font-size: var(--text-xs);
  font-family: var(--font-mono, monospace);
}

.mcp-help__example {
  display: block;
  margin-top: 6px;
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

/* 按钮 */
.mcp-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--glass-border);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.mcp-btn--primary {
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}

.mcp-btn--primary:hover { background: rgba(0, 0, 0, 0.9); }

.mcp-btn--secondary {
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.12);
}

.mcp-btn--secondary:hover { background: rgba(0, 0, 0, 0.65); }

.mcp-btn--danger {
  background: transparent;
  color: var(--color-error);
  border-color: var(--color-error);
  font-size: var(--text-xs);
  padding: 4px 10px;
}

.mcp-btn--danger:hover { background: rgba(239,68,68,0.1); }

/* 添加表单 */
.mcp-add-form {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.mcp-add-form__row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mcp-add-form__input {
  flex: 1;
  min-width: 120px;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--glass-border);
  background: rgba(0,0,0,0.15);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-family: inherit;
}

.mcp-add-form__input--wide { flex: 2; }

.mcp-add-form__input::placeholder { color: var(--color-text-muted); }

.mcp-add-form__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}

.mcp-add-form__error {
  color: var(--color-error);
  font-size: var(--text-xs);
  margin-right: auto;
}

/* 列表 */
.mcp-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mcp-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  transition: opacity 0.2s;
}

.mcp-card--disabled { opacity: 0.5; }

.mcp-card__status {
  flex-shrink: 0;
}

.mcp-card__dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-text-muted);
}

.mcp-card__dot--on {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34,197,94,0.5);
}

/* 进行中：琥珀色脉冲，告知正在连接/处理 */
.mcp-card__dot--pending {
  background: var(--color-warning);
  animation: mcp-dot-pulse 1s ease-in-out infinite;
}

@keyframes mcp-dot-pulse {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 1; }
}

/* 进行中禁用：按钮/开关变灰、禁止交互 */
.mcp-btn:disabled,
.mcp-toggle input:disabled + .mcp-toggle__slider {
  opacity: 0.55;
  cursor: not-allowed;
}

.mcp-card__info {
  flex: 1;
  min-width: 0;
}

.mcp-card__name {
  font-weight: 600;
  font-size: var(--text-sm);
}

.mcp-card__meta {
  margin-top: 2px;
}

.mcp-card__meta code {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  word-break: break-all;
}

.mcp-card__stats {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 3px;
}

.mcp-card__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Toggle 开关 */
.mcp-toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.mcp-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.mcp-toggle__slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  /* OFF：红槽，明确表示「未启用」 */
  background: var(--color-error);
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 20px;
  /* 凹槽感：内阴影让轨道像被压进去的沟槽，滑块嵌在其中 */
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);
  transition: 0.2s;
}

.mcp-toggle__slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  /* 真居中：靠 top:50%+translateY 而非 bottom 像素，避免取整偏下 */
  top: 50%;
  transform: translateY(-50%);
  /* 立体滑块：上浅下深渐变成圆顶（深灰）+ 落影浮起 + 顶部高光 + 底部内阴影 */
  background: linear-gradient(180deg, #5c5c66 0%, #3f3f46 100%);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 1px rgba(0, 0, 0, 0.3);
  border-radius: 50%;
  transition: 0.2s;
}

.mcp-toggle input:checked + .mcp-toggle__slider {
  /* ON：绿槽 */
  background: var(--color-success);
}

.mcp-toggle input:checked + .mcp-toggle__slider::before {
  /* 保持垂直居中的同时右移 */
  transform: translate(16px, -50%);
}

/* 空态 */
.mcp-empty {
  text-align: center;
  padding: 48px 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  text-shadow: var(--text-halo);
}
