/* =========================================================
 * ai-gateway.css —— AI 网关模块共享样式
 * 与 security.css 保持同样的风格约定：仅定义共享的小颗粒组件
 * =======================================================*/

/* 健康状态指示点（与列表行内的文字配合使用） */
.health-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.health-dot.healthy  { background: #16a34a; }
.health-dot.degraded { background: #f59e0b; }
.health-dot.failed   { background: #dc2626; }
.health-dot.unknown  { background: #9ca3af; }

/* 概览页指标块（嵌在卡片内部，不再画外层 box） */
.metric-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}
.metric-row > .metric-cell {
  padding: 16px 20px;
  border-right: 1px solid #f1f5f9;
}
.metric-row > .metric-cell:last-child { border-right: 0; }
.metric-cell-label { font-size: 12px; color: #6b7280; }
.metric-cell-value { font-size: 22px; font-weight: 700; color: #1f2937; margin-top: 6px; line-height: 1.1; }
.metric-cell-hint  { font-size: 12px; color: #9ca3af; margin-top: 4px; }
.metric-cell-hint.is-good  { color: #16a34a; }
.metric-cell-hint.is-warn  { color: #b45309; }
.metric-cell-hint.is-bad   { color: #dc2626; }

@media (max-width: 768px) {
  .metric-row { grid-template-columns: repeat(2, 1fr); }
  .metric-row > .metric-cell:nth-child(2) { border-right: 0; }
}

/* =========================================================
 * 智能路由（Semantic Router）
 * =======================================================*/

/* 来源 / 决策机制切换 tab（pill 风格） */
.seg {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.seg > button {
  border: 0;
  background: transparent;
  color: #475569;
  font-size: 13px;
  padding: 5px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.15s;
  white-space: nowrap;
}
.seg > button.active {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.12);
}

/* 信号卡片 */
.signal-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.signal-card.is-off { opacity: 0.6; }
.signal-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #eef2f7;
}
.signal-card-body { padding: 16px; }

/* 信号选择卡（添加信号时用） */
.signal-pick {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition: 0.15s;
}
.signal-pick:hover { border-color: #93c5fd; background: #f8fafc; }
.signal-pick.is-added { opacity: 0.45; cursor: not-allowed; }

/* embedding 示例行 / 目标行 */
.example-row,
.target-row {
  display: grid;
  align-items: start;
  gap: 8px;
}
.example-row { grid-template-columns: 130px 1fr 24px; }
.target-row  { grid-template-columns: 140px 1fr 80px 24px; }

/* threshold 滑块 */
input[type="range"].thresh {
  width: 100%;
  accent-color: #2563eb;
}

/* 标签徽标 */
.label-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
}

/* MMLU 多选 chips */
.mmlu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
}
.mmlu-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #475569;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 5px 8px;
  cursor: pointer;
}
.mmlu-chip input { accent-color: #2563eb; }

/* toast */
#hydra-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1f2937;
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 80;
}
#hydra-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 640px) {
  .example-row { grid-template-columns: 100px 1fr 20px; }
  .target-row  { grid-template-columns: 110px 1fr 64px 20px; }
}

/* =========================================================
 * 三步向导 Step Bar
 * =======================================================*/
.step-bar {
  display: flex;
  align-items: flex-start;
}
.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.step-node {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  background: #f1f5f9;
  color: #9ca3af;
  border: 2px solid #e5e7eb;
  flex-shrink: 0;
}
.step-node.is-active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}
.step-node.is-done {
  background: #dcfce7;
  color: #16a34a;
  border-color: #86efac;
}
.step-label {
  font-size: 12px;
  white-space: nowrap;
  color: #9ca3af;
}
.step-label.active { color: #2563eb; font-weight: 600; }
.step-label.done   { color: #4b5563; }
.step-connector {
  flex: 1;
  height: 2px;
  background: #e5e7eb;
  margin-top: 13px; /* vertically center with 28px node */
  margin-left: 8px;
  margin-right: 8px;
  min-width: 32px;
}
.step-connector.done { background: #86efac; }

/* 创建/编辑页：内容区 + 底部操作栏 */
.form-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: calc(100vh - 56px - 48px); /* 顶栏 + page padding */
}
.form-page-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}
.form-footer-bar {
  flex-shrink: 0;
  margin-top: 20px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.04);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.form-footer-bar .form-footer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

/* 信号类型 / 字段说明气泡（较宽，容纳多行说明） */
.plugin-help-popover.signal-type-help,
.plugin-help-popover.signal-field-help,
.plugin-help-popover.route-status-help {
  width: 22rem;
  max-width: min(22rem, calc(100vw - 2rem));
  z-index: 80;
}
