/* ==========================================================================
   AIAero - 飞行器智能体设计平台
   style.css : 全局样式表
   ========================================================================== */

/* ---------- 设计变量 ---------- */
:root {
  --primary: #2f6fe4;
  --primary-dark: #1e56c8;
  --accent: #6b5bf5;
  --bg: #f5f6fa;
  --sidebar-bg: #ffffff;
  --text: #2b2f36;
  --text-sub: #8a919e;
  --border: #e8eaf0;
  --green: #22c55e;
  --card-shadow: 0 4px 18px rgba(30, 40, 70, .08);
}

/* ---------- 基础重置 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ==========================================================================
   顶栏
   ========================================================================== */
.topbar {
  height: 48px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 14px;
  position: relative;
  z-index: 20;
}
.logo { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 700; color: #1a1f2b; cursor: pointer; }
.logo svg { width: 26px; height: 26px; }
.logo .aero { color: var(--primary); }
.icon-btn {
  background: none; border: none; cursor: pointer; color: #444;
  font-size: 18px; padding: 4px 6px; border-radius: 6px;
  display: flex; align-items: center;
}
.icon-btn:hover { background: #f0f2f7; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-sub); margin-left: 6px; }
.breadcrumb .sep { color: #c3c8d2; }
.breadcrumb .cur { color: var(--text); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; color: #555; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, #7db2ff, #3b6fe0);
  color: #fff; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}

/* ==========================================================================
   布局
   ========================================================================== */
.app { display: flex; height: calc(100% - 48px); }
.sidebar {
  width: 172px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
  transition: width .2s;
}
.app.collapsed .sidebar { width: 0; padding: 12px 0; overflow: hidden; }
.main { flex: 1; overflow: auto; position: relative; }

/* ---------- 导航项 ---------- */
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  font-size: 13.5px; color: #3c4350;
  cursor: pointer; white-space: nowrap; user-select: none;
}
.nav-item:hover { background: #f2f4f9; }
.nav-item.active { background: #e8effc; color: var(--primary); font-weight: 600; }
.nav-item .ico { width: 17px; text-align: center; font-size: 15px; }
.nav-sub { padding-left: 39px; font-size: 13px; }
.nav-caret { margin-left: auto; font-size: 10px; color: #9aa1ad; transition: transform .2s; }
.nav-group.open .nav-caret { transform: rotate(90deg); }
.nav-children { display: none; }
.nav-group.open .nav-children { display: block; }

/* ==========================================================================
   视图容器
   ========================================================================== */
.view { display: none; height: 100%; }
.view.visible { display: block; }

/* ==========================================================================
   视图一：全智能对话（首页）
   ========================================================================== */
.home-wrap { max-width: 860px; margin: 0 auto; padding: 60px 24px 24px; }

.cards { display: flex; justify-content: center; gap: 40px; margin-bottom: 90px; }
.card {
  width: 200px; border-radius: 10px; overflow: hidden;
  box-shadow: var(--card-shadow); cursor: pointer;
  background: #000; position: relative;
  transition: transform .18s, box-shadow .18s;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 10px 26px rgba(30, 40, 70, .16); }
.card img { width: 100%; height: 168px; object-fit: cover; display: block; }
.card .cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, .72); color: #fff;
  font-size: 14px; padding: 8px 12px; text-align: center;
}

.input-bar {
  display: flex; align-items: center;
  background: #fff; border-radius: 14px;
  box-shadow: var(--card-shadow);
  padding: 18px; gap: 12px;
}
.input-bar textarea {
  flex: 1; border: none; outline: none; resize: none;
  font-size: 14.5px; font-family: inherit; color: var(--text);
  height: 44px; line-height: 22px; background: transparent;
}
.send-btn {
  width: 38px; height: 38px; border-radius: 10px; border: none;
  background: var(--accent); color: #fff; font-size: 16px;
  cursor: pointer; flex-shrink: 0; transition: background .15s;
}
.send-btn:hover { background: #5747e8; }
.send-btn:disabled { background: #c9c6f5; cursor: not-allowed; }

.mode-toggles { display: flex; justify-content: center; gap: 26px; margin-top: 34px; }
.mode-chip {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border-radius: 999px;
  padding: 9px 20px; font-size: 13.5px; color: #3c4350;
  box-shadow: var(--card-shadow); cursor: pointer; user-select: none;
  border: 1.5px solid transparent;
}
.mode-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.mode-chip.selected { border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* ==========================================================================
   视图二：处理中
   ========================================================================== */
.process-wrap { height: 100%; display: flex; align-items: center; justify-content: center; }
.steps { display: flex; flex-direction: column; gap: 26px; }
.step { display: flex; align-items: center; gap: 12px; opacity: .28; transition: opacity .4s; }
.step.on { opacity: 1; }
.step .st-icon {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #fff; background: #b9bfca; flex-shrink: 0;
}
.step.done .st-icon { background: #3c4350; }
.step.running .st-icon { background: transparent; color: #3c4350; }
.step .st-main { font-size: 14.5px; color: var(--text); font-weight: 600; }
.step .st-sub { font-size: 11.5px; color: var(--text-sub); margin-top: 2px; }

.spinner {
  width: 16px; height: 16px;
  border: 2.5px solid #d6dae2; border-top-color: #3c4350;
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   视图三：全智能工作流
   ========================================================================== */
.wf-wrap { height: 100%; display: flex; flex-direction: column; padding: 14px 18px 0; }

.agents-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; margin-bottom: 12px; }
.agent-chip {
  background: #fff; border-radius: 10px; box-shadow: var(--card-shadow);
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; cursor: pointer; user-select: none;
  border: 2px solid transparent; position: relative;
  font-size: 13px; color: #3c4350;
  overflow: hidden; white-space: nowrap;
}
.agent-chip .ag-ico {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #fff; flex-shrink: 0;
}
.agent-chip .gdot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-left: auto; flex-shrink: 0; }
.agent-chip.active { border-color: var(--accent); background: #eef0ff; }
.agent-chip.working .gdot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.wf-body { flex: 1; display: flex; gap: 14px; min-height: 0; }

/* ---------- 对话面板 ---------- */
.chat-panel {
  flex: 1.6; display: flex; flex-direction: column;
  background: #fff; border-radius: 12px; box-shadow: var(--card-shadow);
  min-width: 0; overflow: hidden;
}
.chat-scroll { flex: 1; overflow-y: auto; padding: 18px 22px; }
.chat-scroll::-webkit-scrollbar { width: 6px; }
.chat-scroll::-webkit-scrollbar-thumb { background: #d9dde5; border-radius: 3px; }

.dispatch-banner {
  background: #dfe6fb; border-radius: 10px;
  padding: 14px 16px; font-size: 14.5px; color: #2b3a66;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px; font-weight: 600;
}

/* ---------- 消息气泡 ---------- */
.msg { display: flex; gap: 10px; margin-bottom: 18px; }
.msg .m-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 15px;
}
.msg .m-body { flex: 1; min-width: 0; }
.msg .m-head { font-size: 12px; color: var(--text-sub); margin-bottom: 5px; }
.msg .m-head b { color: var(--text); font-weight: 600; margin-right: 6px; }
.msg .bubble {
  background: #fdf3e7; border-radius: 4px 12px 12px 12px;
  padding: 13px 15px; font-size: 13.5px; line-height: 1.75; color: #4a4438;
  white-space: pre-wrap;
}
.msg.user { flex-direction: row-reverse; }
.msg.user .bubble { background: #eef2ff; border-radius: 12px 4px 12px 12px; color: #2b3a66; }
.msg .m-avatar.user-av { background: linear-gradient(135deg, #8fb0ff, #4a72e8); }
.bubble .quote { border-left: 3px solid #d9c9a8; padding-left: 10px; color: #8a7a5a; margin-bottom: 8px; }

.cursor-blink {
  display: inline-block; width: 7px; height: 14px;
  background: #b0a68e; vertical-align: -2px;
  animation: blink .8s step-start infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- 结果卡片 ---------- */
.result-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fafbfd; margin-top: 6px; }
.result-card img { width: 100%; max-height: 300px; object-fit: contain; background: #eef0f4; display: block; }
.result-card .rc-body { padding: 12px 16px; }
.result-card h4 { font-size: 14px; color: var(--primary); margin-bottom: 8px; }
.kv { display: flex; flex-wrap: wrap; gap: 8px; }
.kv span { background: #eef2ff; color: #3b5bdb; font-size: 12px; padding: 4px 10px; border-radius: 6px; }
.dl-btn {
  margin-top: 10px; background: var(--primary); color: #fff;
  border: none; border-radius: 8px; padding: 8px 18px; font-size: 13px; cursor: pointer;
}
.dl-btn:hover { background: var(--primary-dark); }

/* ---------- 文件预览面板 ---------- */
.file-panel {
  flex: .7; background: #fff; border-radius: 12px; box-shadow: var(--card-shadow);
  display: flex; align-items: center; justify-content: center;
  color: #b6bcc8; font-size: 13.5px; min-width: 180px;
}

/* ---------- 底部控制 & 人工确认条 ---------- */
.wf-footer { display: flex; justify-content: flex-end; gap: 12px; padding: 10px 2px 14px; }
.wf-footer button {
  padding: 8px 26px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; font-size: 13.5px; cursor: pointer; color: #3c4350;
}
.wf-footer button.danger { color: #d64545; border-color: #f0c9c9; }
.wf-footer button:hover { background: #f7f8fb; }

.confirm-bar {
  display: none; gap: 10px; padding: 10px 22px 14px;
  border-top: 1px solid var(--border);
  align-items: center; font-size: 13px; color: var(--text-sub);
}
.confirm-bar.show { display: flex; }
.confirm-bar button { padding: 7px 22px; border-radius: 8px; border: none; cursor: pointer; font-size: 13px; }
.confirm-bar .ok { background: var(--primary); color: #fff; }
.confirm-bar .skip { background: #f0f1f5; color: #555; }

/* ---------- 轻提示 ---------- */
.toast {
  position: fixed; top: 60px; left: 50%;
  transform: translateX(-50%) translateY(-16px);
  background: rgba(30, 35, 45, .88); color: #fff; font-size: 13px;
  padding: 9px 20px; border-radius: 8px;
  opacity: 0; pointer-events: none;
  transition: all .25s; z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 1000px) {
  .cards { gap: 18px; }
  .card { width: 160px; }
  .agents-row { grid-template-columns: repeat(4, 1fr); }
  .file-panel { display: none; }
}
