/* ===== 兴华 站内 AI 问答 悬浮组件 =====
   仅作用于 .xh-ai-* 命名空间，不污染站点原有样式
   配色取自站点变量：canvas #0B1E31 / accent #1D95D4 / accent2 #E8934A */

.xh-ai-fab,
.xh-ai-panel,
.xh-ai-panel * {
  box-sizing: border-box;
}

.xh-ai-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9998;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: #1D95D4;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(11, 30, 49, .28), 0 2px 6px rgba(11, 30, 49, .18);
  transition: transform .2s cubic-bezier(.22,.61,.36,1), background .2s;
}
.xh-ai-fab:hover { transform: translateY(-2px); background: #0E7FB3; }
.xh-ai-fab-text {
  font: 700 17px/1 "Inter", -apple-system, "Segoe UI", Arial, sans-serif;
  letter-spacing: .06em;
  color: #fff;
  user-select: none;
}
.xh-ai-fab:hover .xh-ai-fab-text { opacity: .95; }

.xh-ai-panel {
  position: fixed;
  right: 22px;
  bottom: 92px;
  z-index: 9999;
  width: 372px;
  max-width: calc(100vw - 32px);
  height: 552px;
  max-height: calc(100vh - 130px);
  display: none;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  background: #0B1E31;
  color: #E9EEF4;
  font-family: var(--body, "Inter", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif);
  font-size: 14px;
  line-height: 1.6;
  box-shadow: 0 24px 60px rgba(11, 30, 49, .45), 0 4px 14px rgba(11, 30, 49, .3);
  border: 1px solid rgba(255, 255, 255, .10);
  transform-origin: bottom right;
}
.xh-ai-panel.is-open { display: flex; animation: xhAiIn .22s cubic-bezier(.22,.61,.36,1); }
@keyframes xhAiIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.xh-ai-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  background: #10273C;
  border-bottom: 1px solid rgba(255, 255, 255, .10);
  flex: none;
}
.xh-ai-head .xh-ai-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(140deg, #1D95D4, #0E7FB3);
  display: flex; align-items: center; justify-content: center;
  font: 700 12px/1 var(--mono, monospace);
  letter-spacing: .04em;
  color: #fff;
  flex: none;
}
.xh-ai-title { font-weight: 700; font-size: 14px; letter-spacing: .01em; }
.xh-ai-sub {
  font-size: 11px;
  color: #9AA8BB;
  margin-top: 1px;
}
.xh-ai-spacer { flex: 1; }
.xh-ai-lang {
  display: flex;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  overflow: hidden;
  flex: none;
}
.xh-ai-lang button {
  border: 0;
  background: transparent;
  color: #9AA8BB;
  font: 600 11px/1 inherit;
  padding: 5px 9px;
  cursor: pointer;
}
.xh-ai-lang button.is-on { background: #1D95D4; color: #fff; }
.xh-ai-close {
  border: 0; background: transparent; color: #9AA8BB;
  width: 26px; height: 26px; border-radius: 6px; cursor: pointer;
  font-size: 18px; line-height: 1; flex: none;
}
.xh-ai-close:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.xh-ai-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  scroll-behavior: smooth;
}
.xh-ai-body::-webkit-scrollbar { width: 6px; }
.xh-ai-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); border-radius: 3px; }

.xh-ai-msg {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.xh-ai-msg .xh-ai-bubble {
  max-width: 84%;
  padding: 9px 12px;
  border-radius: 12px;
  word-break: break-word;
  white-space: pre-wrap;
}
.xh-ai-msg.bot .xh-ai-bubble {
  background: #16334D;
  border: 1px solid rgba(255, 255, 255, .08);
  border-bottom-left-radius: 4px;
  color: #E9EEF4;
}
.xh-ai-msg.user { justify-content: flex-end; }
.xh-ai-msg.user .xh-ai-bubble {
  background: #1D95D4;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.xh-ai-bubble a {
  color: #7FD1F5;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.xh-ai-msg.user .xh-ai-bubble a { color: #EAF7FF; }

.xh-ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 14px 10px;
  flex: none;
}
.xh-ai-chip {
  border: 1px solid rgba(29, 149, 212, .45);
  background: rgba(29, 149, 212, .10);
  color: #BEE6F8;
  border-radius: 999px;
  padding: 5px 11px;
  font: 500 12px/1.4 inherit;
  cursor: pointer;
  white-space: nowrap;
  flex: none;
}
.xh-ai-chip:hover { background: rgba(29, 149, 212, .22); color: #fff; }

.xh-ai-foot {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, .10);
  background: #10273C;
}
.xh-ai-input {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: #0B1E31;
  color: #E9EEF4;
  border-radius: 10px;
  padding: 9px 11px;
  font: 400 13px/1.5 inherit;
  outline: none;
  resize: none;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  max-height: 84px;
}
.xh-ai-input::-webkit-scrollbar { width: 0; display: none; }
.xh-ai-input:focus { border-color: #1D95D4; }
.xh-ai-input::placeholder { color: #6F8199; }
.xh-ai-send {
  flex: none;
  border: 0;
  border-radius: 10px;
  background: #1D95D4;
  color: #fff;
  font: 600 13px/1 inherit;
  padding: 0 15px;
  cursor: pointer;
}
.xh-ai-send:hover { background: #0E7FB3; }
.xh-ai-send:disabled { background: #2C4A66; color: #8496AC; cursor: default; }

.xh-ai-note {
  padding: 0 14px 8px;
  font-size: 10.5px;
  color: #6F8199;
  flex: none;
}

@media (max-width: 560px) {
  .xh-ai-panel {
    right: 10px;
    left: 10px;
    bottom: 84px;
    width: auto;
    height: min(70vh, 540px);
  }
  .xh-ai-fab { right: 16px; bottom: 16px; }
}
