/* ===================== 浮动按钮 ===================== */
.fab {
  position: fixed;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: grab;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #466aff 0%, #00c6ff 100%);
  box-shadow: 0 6px 20px rgba(70, 106, 255, 0.45);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.2s ease;
  touch-action: none;
  user-select: none;
}
.fab:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 26px rgba(70, 106, 255, 0.6);
}
.fab:active {
  cursor: grabbing;
  transform: scale(0.97);
}
.fabIcon {
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 1px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.fabHidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.6);
}

/* ===================== 聊天面板 ===================== */
.panel {
  position: fixed;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: var(--ifm-background-surface-color, #ffffff);
  border: 1px solid var(--ifm-color-emphasis-300, #e3e6ec);
  border-radius: 16px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  animation: pop 0.18s ease;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.panelMobile {
  left: 0 !important;
  right: 0 !important;
  top: auto !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 78vh !important;
  border-radius: 16px 16px 0 0;
}

/* 标题栏 */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(135deg, #466aff 0%, #5b7bff 100%);
  color: #fff;
}
.headerTitle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
}
.headerBadge {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 12px;
  font-weight: 800;
}
.headerBtns {
  display: flex;
  gap: 2px;
}
.iconBtn {
  background: transparent;
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  transition: background 0.15s ease;
}
.iconBtn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* 消息区 */
.body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  background: var(--ifm-background-color, #f7f8fa);
  scroll-behavior: smooth;
}
.welcome {
  text-align: center;
  padding: 18px 6px;
}
.welcomeTitle {
  font-size: 15px;
  font-weight: 700;
  color: var(--ifm-color-emphasis-900, #1f2329);
  margin-bottom: 8px;
}
.welcomeDesc {
  font-size: 13px;
  line-height: 1.7;
  color: var(--ifm-color-emphasis-700, #4e5969);
  margin-bottom: 16px;
}
.quickList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
.quickBtn {
  background: var(--ifm-background-surface-color, #fff);
  border: 1px solid var(--ifm-color-emphasis-300, #e3e6ec);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--ifm-color-emphasis-800, #1f2329);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}
.quickBtn:hover {
  border-color: #466aff;
  color: #466aff;
  background: rgba(70, 106, 255, 0.06);
}

/* 单条消息 */
.msg {
  display: flex;
  margin-bottom: 12px;
}
.msgUser {
  justify-content: flex-end;
}
.msgBot {
  justify-content: flex-start;
}
.bubble {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.7;
  word-break: break-word;
  white-space: pre-wrap;
}
.bubbleUser {
  background: #466aff;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.bubbleBot {
  background: var(--ifm-background-surface-color, #fff);
  color: var(--ifm-color-emphasis-900, #1f2329);
  border: 1px solid var(--ifm-color-emphasis-300, #e3e6ec);
  border-bottom-left-radius: 4px;
}
.bubbleErr {
  border-color: #ff6b6b;
  color: #d33;
  background: rgba(255, 107, 107, 0.08);
}
.docLink {
  color: #466aff;
  text-decoration: underline;
  word-break: break-all;
}
.cursor {
  display: inline-block;
  animation: blink 1s steps(2) infinite;
  color: #466aff;
}
@keyframes blink {
  50% { opacity: 0; }
}
.typing {
  color: var(--ifm-color-emphasis-600, #8a909c);
}
.dot {
  animation: blink 1.2s infinite;
}
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

/* 输入区 */
.footer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--ifm-color-emphasis-300, #e3e6ec);
  background: var(--ifm-background-surface-color, #fff);
}
.textarea {
  flex: 1;
  resize: none;
  max-height: 110px;
  border: 1px solid var(--ifm-color-emphasis-300, #e3e6ec);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 13.5px;
  line-height: 1.5;
  background: var(--ifm-background-color, #fff);
  color: var(--ifm-color-emphasis-900, #1f2329);
  outline: none;
  font-family: inherit;
}
.textarea:focus {
  border-color: #466aff;
  box-shadow: 0 0 0 2px rgba(70, 106, 255, 0.15);
}
.sendBtn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  background: #466aff;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.sendBtn:hover {
  background: #3655e8;
}

/* ===================== 设置弹层 ===================== */
.modalMask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: pop 0.16s ease;
}
.modal {
  width: 100%;
  max-width: 420px;
  background: var(--ifm-background-surface-color, #fff);
  border-radius: 14px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
.modalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  font-weight: 700;
  font-size: 15px;
  color: var(--ifm-color-emphasis-900, #1f2329);
  border-bottom: 1px solid var(--ifm-color-emphasis-300, #e3e6ec);
}
.modalHeader .iconBtn {
  color: var(--ifm-color-emphasis-600, #8a909c);
}
.modalHeader .iconBtn:hover {
  background: var(--ifm-color-emphasis-200, #eef0f3);
}
.modalBody {
  padding: 16px;
  max-height: 60vh;
  overflow-y: auto;
}
.field {
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ifm-color-emphasis-800, #1f2329);
  margin-bottom: 6px;
}
.hint {
  font-weight: 400;
  color: var(--ifm-color-emphasis-600, #8a909c);
  font-size: 12px;
}
.input {
  width: 100%;
  border: 1px solid var(--ifm-color-emphasis-300, #e3e6ec);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13px;
  background: var(--ifm-background-color, #fff);
  color: var(--ifm-color-emphasis-900, #1f2329);
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
}
.input:focus {
  border-color: #466aff;
  box-shadow: 0 0 0 2px rgba(70, 106, 255, 0.15);
}
.presetRow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.presetBtn {
  border: 1px solid var(--ifm-color-emphasis-300, #e3e6ec);
  background: var(--ifm-background-color, #fff);
  color: var(--ifm-color-emphasis-800, #1f2329);
  border-radius: 7px;
  padding: 5px 11px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.presetBtn:hover {
  border-color: #466aff;
}
.presetActive {
  border-color: #466aff;
  background: rgba(70, 106, 255, 0.1);
  color: #466aff;
}
.tip {
  margin-top: 4px;
  padding: 9px 11px;
  background: rgba(70, 106, 255, 0.06);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ifm-color-emphasis-700, #4e5969);
}
.modalFooter {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--ifm-color-emphasis-300, #e3e6ec);
}
.cancelBtn {
  border: 1px solid var(--ifm-color-emphasis-300, #e3e6ec);
  background: var(--ifm-background-color, #fff);
  color: var(--ifm-color-emphasis-800, #1f2329);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
}
.cancelBtn:hover {
  background: var(--ifm-color-emphasis-200, #eef0f3);
}
.saveBtn {
  border: none;
  background: #466aff;
  color: #fff;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.saveBtn:hover {
  background: #3655e8;
}

/* ===================== 暗色模式微调 ===================== */
:global(html[data-theme='dark']) .bubbleBot {
  background: #2a2b3d;
  border-color: #3a3b5c;
}
:global(html[data-theme='dark']) .body {
  background: #1a1b2e;
}
