/* 广软借阅站 · 智能小助手界面样式
   风格：浅蓝主色（对齐《广软借阅站-产品需求文档》），干净、校园感 */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --paper: #f2f8fd;        /* 浅蓝白背景 */
  --paper-2: #e9f3fb;
  --ink: #1f3a54;          /* 深蓝墨主文字 */
  --ink-soft: #5e7a96;
  --brand: #4da3e8;        /* 浅蓝主色 */
  --brand-deep: #2f86c9;
  --brand-pale: #d9ecfb;   /* 用户气泡浅蓝 */
  --line: #d3e6f5;
  --bubble-bot: #ffffff;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: linear-gradient(160deg, #dce9f5 0%, #eef4fa 100%);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  /* 桌面端给个"手机展示"衬底，模拟小程序在真机上的观感 */
  display: flex; justify-content: center; align-items: center;
}

/* 手机尺寸容器：微信小程序常见机型宽度 */
.app {
  width: min(390px, 100vw);
  height: min(844px, 100vh);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  box-shadow: 0 20px 60px rgba(31, 58, 84, .18);
  border-radius: 20px;
  overflow: hidden;
  position: relative;
}
@media (max-width: 480px) {
  /* 真机/窄屏：去掉投影圆角，占满全屏 */
  body { align-items: stretch; background: var(--paper); }
  .app { width: 100vw; height: 100vh; border-radius: 0; box-shadow: none; }
}

/* ---- 仿小程序状态栏（时间+信号电池） ---- */
.mp-status {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 22px 2px;
  font-size: 12.5px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #5fb0ec 0%, #3e92d6 100%);
  letter-spacing: .3px;
}
.mp-status .mp-icons { font-size: 11px; letter-spacing: 2px; }

/* ---- 仿小程序导航栏（居中标题 + 右侧胶囊） ---- */
.mp-nav {
  display: flex; align-items: center; justify-content: center;
  position: relative;
  padding: 6px 14px 10px;
  background: linear-gradient(135deg, #5fb0ec 0%, #3e92d6 100%);
}
.mp-title {
  color: #fff; font-size: 15.5px; font-weight: 600; letter-spacing: .5px;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mp-capsule {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; gap: 6px;
  width: 76px; height: 26px;
  border: 1px solid rgba(255,255,255,.5); border-radius: 999px;
  background: rgba(255,255,255,.22);
  font-size: 11px; color: #fff;
  justify-content: space-evenly;
}
.mp-capsule span { line-height: 1; }
.mp-capsule i {
  width: 1px; height: 14px; background: rgba(255,255,255,.5);
}
.mp-nav { border-bottom: 1px solid rgba(255,255,255,.25); }

/* 聊天区 */
.chat { flex: 1; overflow-y: auto; padding: 14px 12px 6px; scrollbar-width: none; }

.msg { display: flex; margin-bottom: 14px; }
.msg-user { justify-content: flex-end; }
.msg-bot { justify-content: flex-start; }

.bubble {
  max-width: 82%;
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.65;
  word-break: break-word;
}
.msg-user .bubble {
  background: var(--brand-pale);
  color: var(--ink);
  border-bottom-right-radius: 4px;
}
.msg-bot .bubble {
  background: var(--bubble-bot);
  color: var(--ink);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(47, 134, 201, .05);
}

/* 系统提示条（转接人工中等） */
.sys-note {
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--paper-2);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 6px 12px;
  margin: 2px auto 14px;
  width: fit-content;
}

/* 查询等待提示（问题下方居中灰字，答案返回前一刻消失） */
.query-status {
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
  opacity: .85;
  margin: -4px auto 14px;
  animation: query-pulse 1.2s ease-in-out infinite;
}
@keyframes query-pulse {
  0%, 100% { opacity: .55; }
  50% { opacity: .95; }
}

/* 快捷问题（欢迎语下方的建议区，flex 换行——小程序宫格式建议） */
.chips-inline {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 2px 0 16px;
  padding-left: 2px;
}
.chip {
  padding: 6px 13px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  transition: all .15s;
  box-shadow: 0 1px 2px rgba(47, 134, 201, .06);
}
.chip:hover, .chip:active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* 输入栏（仿聊天会话底栏：＋ 圆钮 + 圆角输入条） */
.composer {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px 6px;
  background: #fff;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.plus {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  font-size: 19px; line-height: 1;
  cursor: pointer;
}
.plus:hover { border-color: var(--brand); color: var(--brand-deep); }
#input {
  flex: 1;
  padding: 9px 14px;
  font-size: 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--paper-2);
  outline: none;
  font-family: inherit;
  color: var(--ink);
}
#input:focus { background: #fff; border-color: var(--brand); }
#send {
  padding: 0 18px; height: 34px;
  border: none;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
#send:hover { background: var(--brand-deep); }

/* 底部安全区 + 仿 iOS home indicator */
.mp-homebar {
  height: 22px;
  position: relative;
  background: #fff;
  flex-shrink: 0;
}
.mp-homebar::before {
  content: '';
  position: absolute; left: 50%; top: 7px; transform: translateX(-50%);
  width: 120px; height: 5px; border-radius: 999px;
  background: rgba(31, 58, 84, .25);
}

/* 滚动条（聊天区已藏，规则保留给窄内容区） */
.chat::-webkit-scrollbar { display: none; }

/* ---------- Agent 执行轨迹面板（默认收起的轻量折叠条）---------- */
.trace-panel {
  margin: 4px 0 14px 0;
  font-size: 12px;
}
.trace-head {
  color: #8a8377;
  cursor: pointer;
  padding: 4px 10px;
  border-left: 2px solid #e8e2d8;
  user-select: none;
}
.trace-head:hover { color: #6b6459; }
.trace-body {
  background: #faf8f4;
  border: 1px solid #e8e2d8;
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 4px;
  max-height: 320px;
  overflow-y: auto;
}
.trace-section {
  padding: 6px 0;
  border-bottom: 1px dashed #e8e2d8;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
  font-family: Consolas, 'Courier New', monospace;
  color: #5c554b;
}
.trace-section:last-child { border-bottom: none; }
.trace-section b { color: #4a4438; }
