/* 评审智能体：可拖动头像浮窗（浅色面板 + 科技蓝点缀） */

.agent-fab {
  position: fixed;
  right: clamp(16px, 2vw, 32px);
  bottom: clamp(16px, 2vw, 32px);
  width: clamp(104px, 6.6vw, 132px);
  height: clamp(104px, 6.6vw, 132px);
  padding: 5px;
  border: 4px solid #ffffff;
  border-radius: 50%;
  /* 头像本身带浅色底，浮窗底色沿用教案2 的浅青，白边 + 柔光外圈 */
  background: var(--teal-soft);
  box-shadow: 0 14px 36px rgba(23, 60, 64, 0.3), 0 0 0 8px rgba(255, 255, 255, 0.26);
  z-index: 130;
  cursor: grab;
  touch-action: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.2s ease;
}
.agent-fab:hover { transform: scale(1.06); }
.agent-fab img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; pointer-events: none; }
.agent-fab.is-dragging {
  transition: none;
  cursor: grabbing;
  transform: scale(1.1);
  box-shadow: 0 18px 42px rgba(15, 40, 80, 0.38);
}

.agent-panel {
  position: fixed;
  left: auto;
  top: auto;
  width: min(386px, calc(100vw - 32px));
  height: min(580px, calc(100vh - 150px));
  display: flex;
  flex-direction: column;
  z-index: 140;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 26px 60px rgba(8, 24, 48, 0.28);
  overflow: hidden;
}

.agent-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg, #e7f1ee, #f9fbfa 62%, #fdf7ea);
}
.agent-head-avatar { flex: none; width: 46px; height: 46px; border-radius: 50%; object-fit: cover; box-shadow: 0 2px 8px rgba(15, 40, 80, 0.14); }
.agent-head-title { flex: 1; min-width: 0; }
.agent-head-title b {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.agent-online {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}
.agent-head-title small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-close { flex: none; border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }

.agent-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px;
  background: linear-gradient(180deg, #faf8f1, #f4f2ea);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.agent-log::-webkit-scrollbar { width: 5px; }
.agent-log::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }

.agent-msg {
  position: relative;
  max-width: 86%;
  padding: 9px 13px;
  border-radius: 15px;
  font-size: 13.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  animation: agent-in 0.18s ease both;
  box-shadow: 0 2px 8px rgba(15, 40, 80, 0.05);
}
.agent-msg.bot {
  align-self: flex-start;
  margin-left: 44px;
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--text);
  border-top-left-radius: 5px;
}
.agent-msg.bot::before {
  content: "";
  position: absolute;
  left: -44px;
  top: -3px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: url("/static/avatar-lucky.png?v=1") center/cover no-repeat;
  border: 1px solid var(--line);
}
.agent-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--teal), var(--teal-deep));
  color: #ffffff;
  border-bottom-right-radius: 5px;
}
.agent-msg.err { align-self: flex-start; background: var(--accent-soft); color: var(--red); }
@keyframes agent-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.agent-quick { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 44px; }
.agent-quick-chip {
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--teal-deep);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.agent-quick-chip:hover { background: var(--teal); color: #ffffff; border-color: var(--teal); }

.agent-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 11px 14px;
  margin-left: 44px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 15px;
  border-top-left-radius: 5px;
}
.agent-typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted-2); animation: agent-dot 0.9s infinite ease-in-out; }
.agent-typing i:nth-child(2) { animation-delay: 0.15s; }
.agent-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes agent-dot { 0%, 60%, 100% { transform: translateY(0); opacity: 0.45; } 30% { transform: translateY(-4px); opacity: 1; } }

.agent-status {
  padding: 7px 14px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--teal-deep);
  background: var(--teal-soft);
  border-top: 1px solid var(--line);
}

.agent-compose { display: flex; align-items: center; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: #ffffff; }
.agent-input {
  flex: 1;
  min-width: 0;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  outline: none;
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
}
.agent-input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(27, 106, 109, 0.12); }
.agent-mic, .agent-send {
  flex: none;
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  background: var(--teal);
  color: #ffffff;
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
}
.agent-mic.is-listening { background: var(--rose); animation: agent-pulse 1s infinite; }
.agent-mic:disabled, .agent-send:disabled { opacity: 0.45; cursor: not-allowed; }
@keyframes agent-pulse { 50% { opacity: 0.55; } }

/* 头部图标按钮（展开 / 清空） */
.agent-icon-btn {
  flex: none;
  padding: 3px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.agent-icon-btn:hover { background: var(--teal-soft); color: var(--teal-deep); }

/* 输入区：字数提示 */
.agent-input-wrap { position: relative; flex: 1; min-width: 0; display: flex; }
.agent-input-wrap .agent-input { width: 100%; padding-right: 54px; }
.agent-count {
  position: absolute;
  right: 12px;
  bottom: 7px;
  font-size: 10px;
  letter-spacing: 0.3px;
  color: var(--muted-2);
  pointer-events: none;
}
.agent-count.is-warn { color: var(--rose); font-weight: 600; }

/* 录音音量条 */
.agent-level {
  height: 4px;
  margin: 0 12px 8px;
  border-radius: 99px;
  background: rgba(27, 106, 109, 0.12);
  overflow: hidden;
}
.agent-level i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width 0.08s linear;
}

/* 底部语音操作条 */
.agent-foot { display: flex; gap: 8px; padding: 0 12px 10px; }
.agent-ghost-btn {
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--teal-deep);
  font-size: 11.5px;
  cursor: pointer;
}
.agent-ghost-btn:hover { background: var(--teal-soft); }

/* 消息内工具条 */
.agent-msg { padding-bottom: 7px; }
.agent-msg-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
  font-size: 10px;
  line-height: 1.2;
  color: var(--muted-2);
}
.agent-msg.user .agent-msg-tools { color: rgba(255, 255, 255, 0.72); }
.agent-msg-tools time { flex: none; letter-spacing: 0.3px; }
.agent-mini-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--teal);
  font-size: 10px;
  cursor: pointer;
}
.agent-msg.user .agent-mini-btn { color: rgba(255, 255, 255, 0.85); }
.agent-mini-btn:hover { text-decoration: underline; }

/* 发送键的「停止」态 */
.agent-send.is-stop { background: var(--rose); }

/* 展开（沉浸）模式 */
.agent-panel.is-wide {
  width: min(720px, 92vw);
  height: min(760px, calc(100vh - 96px));
}
.agent-panel.is-wide .agent-head { padding: 16px 18px; }
.agent-panel.is-wide .agent-head-title b { font-size: 17px; }
.agent-panel.is-wide .agent-log { padding: 20px 18px; gap: 14px; }
.agent-panel.is-wide .agent-msg { max-width: 75%; font-size: 16px; line-height: 1.8; }
.agent-panel.is-wide .agent-msg-tools { font-size: 12px; }
.agent-panel.is-wide .agent-mini-btn { font-size: 12px; }
.agent-panel.is-wide .agent-input { font-size: 15px; padding: 12px 60px 12px 16px; }
.agent-panel.is-wide .agent-count { font-size: 11px; }
.agent-panel.is-wide .agent-mic,
.agent-panel.is-wide .agent-send { font-size: 14px; padding: 11px 18px; }
.agent-panel.is-wide .agent-quick-chip { font-size: 12.5px; padding: 6px 13px; }

.agent-panel [hidden] { display: none !important; }

/* 全屏评审时让出画面：头像缩小隐藏，由卡片内的点评入口接管 */
body.rv-open .agent-fab {
  opacity: 0;
  transform: translateY(130px) scale(0.8);
  pointer-events: none;
}
