/* 展厅智能体：可拖动头像浮窗，独立于 app.css，仅 /hall 加载 */

.agent-fab {
  position: fixed;
  right: clamp(16px, 2vw, 32px);
  bottom: clamp(16px, 2vw, 32px);
  width: 62px;
  height: 62px;
  padding: 3px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--teal-soft);
  box-shadow: 0 10px 28px rgba(23, 60, 64, 0.28);
  z-index: 50;
  cursor: grab;
  touch-action: none;
  transition: transform 0.18s ease, box-shadow 0.18s 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 16px 40px rgba(23, 60, 64, 0.38);
}

.agent-panel {
  position: fixed;
  left: auto;
  top: auto;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 150px));
  display: flex;
  flex-direction: column;
  z-index: 60;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(23, 60, 64, 0.24);
  overflow: hidden;
}

.agent-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg, var(--teal-soft), #f7fbf9 60%, #fff7f3);
}
.agent-head-avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.agent-head-title { flex: 1; min-width: 0; }
.agent-head-title b { display: flex; align-items: center; gap: 6px; font-family: var(--serif); font-size: 15px; font-weight: 500; letter-spacing: 1px; 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(47, 139, 98, 0.14); }
.agent-head-title small { display: block; margin-top: 2px; font-size: 11px; line-height: 1.5; color: var(--muted); 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, var(--frame), #f8faf9);
  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(23, 60, 64, 0.05);
}
.agent-msg.bot { align-self: flex-start; margin-left: 34px; background: #ffffff; border: 1px solid var(--line); color: var(--text); border-top-left-radius: 5px; }
.agent-msg.bot::before {
  content: "";
  position: absolute;
  left: -34px;
  top: -2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: url("/static/avatar-lucky.png?v=8") center/cover no-repeat;
  border: 1px solid var(--line);
}
.agent-msg.user { align-self: flex-end; background: var(--teal); 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: 34px; }
.agent-quick-chip {
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--teal);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.agent-quick-chip:hover { background: var(--teal); color: #ffffff; }

.agent-typing { align-self: flex-start; display: flex; gap: 4px; padding: 11px 14px; margin-left: 34px; 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(--muted);
  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 { 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(--accent); 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: #c2543a; font-weight: 500; }

/* 录音音量条 */
.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);
  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(--accent); }

/* 展开（沉浸）模式：大屏远距离观看 */
.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; }

/* ACTION open_group：定位高亮 2 秒 */
.hall-col.is-flash { animation: agent-flash 2s ease; }
@keyframes agent-flash {
  0%, 100% { box-shadow: none; }
  18%, 62% {
    box-shadow: 0 0 0 3px rgba(176, 138, 69, 0.55), 0 14px 34px rgba(23, 60, 64, 0.18);
    border-radius: 14px;
  }
}

.agent-panel [hidden] { display: none !important; }
