/* ============================================================
   喵数据 · AI 悬浮聊天窗样式（科技蓝主题，与全站视觉统一）
   只需 <link> 引入本文件，JS 会自动生成右下角聊天框。
   ============================================================ */

/* 悬浮按钮（右下角品牌 logo 按钮） */
#miao-chat-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 60px;
  height: 60px;
  border: 2px solid rgba(74,153,232, 0.38);
  border-radius: 16px;
  background: #0b0d10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(74,153,232, 0.35);
  z-index: 999998;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
#miao-chat-fab svg, #miao-chat-fab img { display: block; width: 100%; height: 100%; object-fit: contain; }
#miao-chat-fab:hover {
  transform: translateY(-3px) scale(1.05);
  border-color: rgba(74,153,232, 0.65);
  box-shadow: 0 12px 30px rgba(74,153,232, 0.5);
}

/* 聊天面板 */
#miao-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 96px;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 120px);
  background: #0f1216;
  border: 1px solid rgba(74,153,232, 0.18);
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s ease, opacity 0.22s ease;
}
#miao-chat-panel.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* 面板头部 */
#miao-chat-header {
  background: linear-gradient(135deg, #16191f 0%, #0b0d10 100%);
  color: #4a99e8;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(74,153,232, 0.2);
}
#miao-chat-header .miao-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(74,153,232, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
}
#miao-chat-header .miao-avatar svg, #miao-chat-header .miao-avatar img { display: block; width: 100%; height: 100%; object-fit: contain; }
#miao-chat-header .miao-title {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
  color: #4a99e8;
}
#miao-chat-header .miao-sub {
  font-size: 11px;
  color: #8b93a1;
}
#miao-chat-close {
  background: transparent;
  border: none;
  color: #4a99e8;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

/* 消息区 */
#miao-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #0f1216;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.miao-msg {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}
.miao-msg.bot {
  align-self: flex-start;
  background: #1a1e25;
  color: #d8dde6;
  border: 1px solid rgba(74,153,232, 0.1);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.miao-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #3a7ec7 0%, #4a99e8 100%);
  color: #05111a;
  border-bottom-right-radius: 4px;
}

/* “正在输入”三个点动画 */
.miao-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.miao-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6b7280;
  animation: miao-blink 1.2s infinite ease-in-out;
}
.miao-typing span:nth-child(2) { animation-delay: 0.2s; }
.miao-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes miao-blink {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* 底部输入区 */
#miao-chat-footer {
  border-top: 1px solid rgba(74,153,232, 0.15);
  padding: 10px;
  background: #0f1216;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#miao-chat-input {
  width: 100%;
  background: #1a1e25;
  border: 1px solid rgba(74,153,232, 0.2);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  color: #d8dde6;
  resize: none;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
  max-height: 96px;
  line-height: 1.4;
}
#miao-chat-input::placeholder { color: #6b7280; }
#miao-chat-input:focus { border-color: #4a99e8; }
#miao-chat-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
#miao-chat-send {
  margin-left: auto;
  background: linear-gradient(135deg, #3a7ec7 0%, #4a99e8 100%);
  color: #05111a;
  border: none;
  border-radius: 12px;
  padding: 8px 18px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
}
#miao-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }
#miao-chat-limit {
  font-size: 11px;
  color: #6b7280;
}

/* 小屏适配 */
@media (max-width: 480px) {
  #miao-chat-panel { right: 12px; bottom: 84px; width: calc(100vw - 24px); }
  #miao-chat-fab { right: 16px; bottom: 16px; }
}
