/* View引擎 v2 样式 */

/* ─── 工具栏按钮 ─── */
.vt-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border: 1px solid #ddd; border-radius: 6px;
  background: #fff; cursor: pointer; font-size: 13px; color: #333;
  transition: all 0.15s;
}
.vt-btn:hover { background: #f0f7ff; border-color: #90caf9; }
.vt-btn.vt-primary { background: #1976d2; color: #fff; border-color: #1976d2; }
.vt-btn.vt-primary:hover { background: #1565c0; }
.vt-btn.vt-analyze { background: #7c4dff; color: #fff; border-color: #7c4dff; }
.vt-btn.vt-analyze:hover { background: #651fff; }
.vt-btn span { font-weight: 500; }
.vt-sep { width: 1px; height: 22px; background: #e0e0e0; margin: 0 4px; }

/* ─── 数据展示面板 ─── */
.data-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; text-align: center;
}

.data-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; margin-bottom: 8px; font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
}
.data-count { color: #333; }
.data-count b { color: #1976d2; font-size: 14px; }
.data-info { color: #4caf50; font-size: 12px; }

/* ─── 分页控件 ─── */
.data-pager {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; margin-top: 8px; border-top: 1px solid #f0f0f0;
  font-size: 13px;
}
.pager-left { display: flex; align-items: center; gap: 6px; color: #666; }
.pager-select {
  padding: 3px 6px; border: 1px solid #ddd; border-radius: 4px; font-size: 12px;
}
.pager-center { display: flex; align-items: center; gap: 4px; }
.pager-btn {
  padding: 4px 10px; border: 1px solid #ddd; border-radius: 4px;
  background: #fff; cursor: pointer; font-size: 12px; color: #333;
  transition: all 0.15s;
}
.pager-btn:hover:not(.disabled) { background: #e3f2fd; border-color: #64b5f6; }
.pager-btn.disabled { opacity: 0.4; cursor: not-allowed; }
.pager-info { color: #666; font-size: 12px; margin: 0 4px; }
.pager-input {
  width: 48px; padding: 3px 4px; border: 1px solid #ddd; border-radius: 4px;
  text-align: center; font-size: 12px;
}

/* ─── 数据表格 ─── */
.table-scroll { overflow-x: auto; max-width: 100%; }
.data-table.compact { font-size: 12px; border-collapse: collapse; width: 100%; }
.data-table.compact th {
  background: #f5f5f5; padding: 6px 8px; text-align: left;
  border-bottom: 2px solid #e0e0e0; white-space: nowrap;
  font-weight: 600; color: #333; position: sticky; top: 0;
}
.data-table.compact td {
  padding: 5px 8px; border-bottom: 1px solid #f0f0f0;
  color: #444; max-width: 200px; overflow: hidden; text-overflow: ellipsis;
}
.data-table.compact tbody tr:hover { background: #f8fbff; }

/* ─── 理解卡片 ─── */
.understand-card {
  background: #f8fbff; border: 1px solid #e3f2fd; border-radius: 8px;
  padding: 10px 12px; margin-bottom: 4px; font-size: 13px;
}
.sql-block {
  background: #263238; color: #b0bec5; padding: 8px 10px; border-radius: 6px;
  margin: 6px 0; overflow-x: auto; font-size: 11px;
}
.sql-block code { color: #80cbc4; white-space: pre-wrap; word-break: break-all; }
.sql-block b { color: #fff; }

/* ─── 对话消息 ─── */
.chat-msg { margin-bottom: 8px; }
.chat-msg.user { text-align: right; }
.chat-msg.user .chat-bubble {
  display: inline-block; background: #1976d2; color: #fff;
  padding: 8px 12px; border-radius: 12px 12px 2px 12px;
  max-width: 95%; text-align: left; font-size: 13px;
}
.chat-msg.system .chat-bubble {
  display: inline-block; background: #f5f5f5; color: #333;
  padding: 8px 12px; border-radius: 12px 12px 12px 2px;
  max-width: 95%; font-size: 13px;
}
.chat-bubble code { background: rgba(0,0,0,0.08); padding: 1px 4px; border-radius: 3px; font-size: 12px; }
.chat-msg.user .chat-bubble code { background: rgba(255,255,255,0.2); }

/* ─── 通用 ─── */
.loading {
  display: inline-block; font-style: italic; color: #888; font-size: 12px;
}
.loading::after {
  content: ''; display: inline-block; width: 14px; text-align: left;
  animation: dots 1.4s infinite;
}
@keyframes dots {
  0%, 20% { content: '.'; } 40% { content: '..'; } 60%, 100% { content: '...'; }
}

.empty-hint {
  text-align: center; color: #bbb; padding: 20px 10px; font-size: 13px;
}

/* ─── 报告弹窗 ─── */
.report-modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.report-modal {
  background: #fff; border-radius: 10px; width: 80%; max-width: 800px;
  max-height: 85vh; display: flex; flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.report-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid #eee;
}
.report-modal-title { font-size: 15px; font-weight: 600; }
.report-modal-close {
  border: none; background: none; font-size: 18px; cursor: pointer;
  color: #999; padding: 4px;
}
.report-modal-body { flex: 1; overflow-y: auto; padding: 16px; font-size: 13px; line-height: 1.6; }
.report-modal-body h2 { font-size: 18px; margin: 12px 0 6px; color: #1976d2; }
.report-modal-body h3 { font-size: 15px; margin: 10px 0 5px; color: #333; }
.report-modal-body h4 { font-size: 14px; margin: 8px 0 4px; color: #555; }
.report-modal-body table { font-size: 12px; margin: 6px 0; }
.report-modal-body blockquote {
  border-left: 3px solid #7c4dff; padding: 4px 10px; margin: 6px 0;
  background: #f3e5f5; color: #4a148c;
}
.report-modal-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; border-top: 1px solid #eee;
}
.report-meta { font-size: 12px; color: #999; }

/* ─── 小按钮 ─── */
.btn-xs {
  padding: 2px 8px; font-size: 11px; border: 1px solid #ddd;
  border-radius: 4px; background: #fff; cursor: pointer; color: #555;
}
.btn-xs:hover { background: #e3f2fd; border-color: #64b5f6; }
.btn-sm {
  padding: 6px 10px; font-size: 12px; border: 1px solid #ddd;
  border-radius: 6px; background: #fff; cursor: pointer; color: #333;
}
.btn-sm:hover { background: #f0f7ff; border-color: #90caf9; }
.btn-sm.btn-primary { background: #1976d2; color: #fff; border-color: #1976d2; }
.btn-sm.btn-primary:hover { background: #1565c0; }
.btn-sm.btn-analyze { background: #7c4dff; color: #fff; border-color: #7c4dff; }
.btn-sm.btn-analyze:hover { background: #651fff; }

/* ─── 数据源列表项 ─── */
.ds-item {
  padding: 8px 10px; border: 1px solid #eee; border-radius: 6px; margin-bottom: 6px;
  background: #fafafa;
}
.ds-name { font-size: 13px; font-weight: 500; }
.ds-type { font-size: 11px; color: #999; }
.ds-meta { font-size: 11px; color: #aaa; margin-top: 2px; display: flex; gap: 6px; }
.tag {
  display: inline-block; padding: 1px 6px; font-size: 10px;
  border-radius: 3px; background: #e0e0e0; color: #555;
}

/* ─── MCP 接口面板 ─── */
.mcp-layout { display: flex; gap: 16px; height: calc(100vh - 150px); min-height: 480px; }
.mcp-sidebar {
  width: 300px; flex-shrink: 0; background: #fff; border-radius: 10px;
  border: 1px solid #e0e0e0; display: flex; flex-direction: column; overflow: hidden;
}
.mcp-sidebar-head {
  padding: 12px 14px; border-bottom: 1px solid #eee; display: flex;
  align-items: center; justify-content: space-between;
}
.mcp-sidebar-head h3 { margin: 0; font-size: 14px; }
.mcp-tool-count {
  font-size: 11px; color: #7c4dff; background: #f3e5f5; border-radius: 10px;
  padding: 2px 8px; font-weight: 600;
}
.mcp-ds-wrap { padding: 10px 14px; border-bottom: 1px solid #eee; background: #fafbfc; }
.mcp-ds-label { display: block; font-size: 11px; color: #888; margin-bottom: 4px; }
.mcp-ds-wrap select {
  width: 100%; padding: 6px 8px; border-radius: 6px; border: 1px solid #ddd; font-size: 13px;
}
.mcp-tool-list { flex: 1; overflow-y: auto; padding: 8px; }
.mcp-tool-item {
  padding: 10px 12px; border: 1px solid #eee; border-radius: 8px; margin-bottom: 8px;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.mcp-tool-item:hover { background: #f5f9ff; border-color: #b3d4fc; }
.mcp-tool-item.mcp-tool-active {
  background: #e8f0fe; border-color: #1976d2; box-shadow: 0 1px 4px rgba(25,118,210,.15);
}
.mcp-tool-name { font-weight: 600; color: #1a56db; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.mcp-tool-ds {
  font-size: 10px; color: #7c4dff; background: #ede7f6; border-radius: 8px;
  padding: 1px 6px; font-weight: 600;
}
.mcp-tool-desc { color: #888; font-size: 11px; margin-top: 3px; line-height: 1.4; }

.mcp-main { flex: 1; min-width: 0; background: #fff; border-radius: 10px; border: 1px solid #e0e0e0; overflow-y: auto; padding: 20px; }
.mcp-empty { text-align: center; padding: 80px 20px; color: #888; }
.mcp-empty-icon { font-size: 44px; margin-bottom: 12px; }
.mcp-empty p { font-size: 14px; margin: 4px 0; }
.mcp-empty-sub { font-size: 12px; color: #aaa; }

.mcp-tool-card { border: 1px solid #e0e0e0; border-radius: 10px; padding: 20px; background: #fff; }
.mcp-tool-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mcp-tool-card-head h2 { margin: 0; color: #1a56db; font-size: 18px; }
.mcp-tool-badge {
  font-size: 11px; color: #fff; background: #7c4dff; border-radius: 10px;
  padding: 2px 10px; font-weight: 600;
}
.mcp-tool-card-desc { color: #666; font-size: 13px; line-height: 1.6; margin: 0 0 16px; }

.mcp-multi-panel {
  border: 1px solid #d1c4e9; background: #faf8ff; border-radius: 8px;
  padding: 12px; margin-bottom: 16px;
}
.mcp-multi-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mcp-multi-head span { font-size: 13px; font-weight: 600; color: #5e35b1; }
.mcp-multi-hint { font-size: 11px; color: #9575cd; font-weight: 400; }
.mcp-ds-multi-list { display: flex; flex-wrap: wrap; gap: 8px; }
.mcp-ds-check {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: #444;
  background: #fff; border: 1px solid #ddd; border-radius: 14px; padding: 3px 10px; cursor: pointer;
}
.mcp-ds-check:hover { border-color: #7c4dff; }
.mcp-ds-check input { margin: 0; }

.mcp-section-title { font-size: 14px; margin: 16px 0 8px; color: #333; }
.mcp-param-row { margin-bottom: 10px; }
.mcp-param-row label { display: block; font-size: 12px; color: #555; margin-bottom: 3px; }
.mcp-param-row label code { background: #f0f0f0; padding: 1px 5px; border-radius: 3px; font-size: 12px; color: #1976d2; }
.mcp-type { color: #999; font-size: 11px; }
.mcp-req { color: #e53935; font-weight: 700; }
.mcp-param-row input {
  width: 100%; padding: 7px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px;
  box-sizing: border-box;
}
.mcp-param-row input:focus { outline: none; border-color: #1976d2; box-shadow: 0 0 0 2px rgba(25,118,210,.12); }
.mcp-no-params { color: #888; font-size: 13px; }
.mcp-exec-btn {
  margin-top: 14px; padding: 9px 24px; background: #1976d2; color: #fff;
  border: none; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500;
}
.mcp-exec-btn:hover { background: #1565c0; }

.mcp-warn { padding: 12px; background: #fff3cd; border-radius: 6px; color: #856404; font-size: 13px; }
.mcp-running { padding: 12px; color: #888; font-size: 13px; }
.mcp-error { padding: 10px 12px; background: #fee; border-radius: 6px; color: #c00; font-size: 13px; }

.mcp-result-card { border: 1px solid #e0e0e0; border-radius: 10px; padding: 16px; margin-top: 14px; background: #fff; }
.mcp-result-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.mcp-source-badge {
  font-size: 12px; font-weight: 600; color: #7c4dff; background: #ede7f6;
  border-radius: 12px; padding: 3px 10px;
}
.mcp-result-title { margin: 0; color: #059669; font-size: 15px; }
.mcp-result-time { font-size: 12px; color: #888; margin-left: auto; }
.mcp-summary {
  padding: 6px 12px; background: #ecfdf5; border-radius: 4px; color: #065f46;
  font-size: 13px; margin-bottom: 8px;
}
.mcp-result-pre {
  background: #1e293b; color: #e2e8f0; padding: 12px; border-radius: 6px;
  overflow-x: auto; font-size: 12px; max-height: 400px; overflow-y: auto;
  margin: 0;
}

/* ─── 优化开关按钮（开=点亮 / 关=变暗） ─── */
.vt-btn.vt-opt-on {
  background: #e8f5e9; border-color: #4caf50; color: #2e7d32;
  box-shadow: 0 0 0 1px rgba(76,175,80,.3), 0 2px 6px rgba(76,175,80,.18);
}
.vt-btn.vt-opt-on:hover { background: #c8e6c9; border-color: #43a047; }
.vt-btn.vt-opt-off {
  background: #fafafa; border-color: #e0e0e0; color: #bdbdbd;
  opacity: .75; filter: grayscale(40%);
}
.vt-btn.vt-opt-off:hover { background: #f5f5f5; color: #9e9e9e; }
