/* 官网智小宝浮窗 — 与宠哈哈深蓝主色对齐 */
:root {
  --chh-ai-navy: #0b3a5c;
  --chh-ai-navy-deep: #072a44;
  --chh-ai-accent: #1a7a6d;
  --chh-ai-bg: #f4f7f9;
  --chh-ai-panel: #ffffff;
  --chh-ai-line: #d9e2ea;
  --chh-ai-muted: #6b7c8a;
  --chh-ai-user: #e8f2f8;
  --chh-ai-shadow: 0 12px 40px rgba(7, 42, 68, 0.22);
}

#chh-ai-fab {
  position: fixed;
  right: 22px;
  bottom: 200px;
  z-index: 99980;
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: linear-gradient(145deg, var(--chh-ai-navy) 0%, var(--chh-ai-navy-deep) 100%);
  color: #fff;
  box-shadow: var(--chh-ai-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
  padding: 0;
}

#chh-ai-fab:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 16px 44px rgba(7, 42, 68, 0.3);
}

#chh-ai-fab .chh-ai-fab-paw {
  font-size: 18px;
  line-height: 1;
}

#chh-ai-fab .chh-ai-fab-text {
  font-size: 10px;
  letter-spacing: 0.5px;
  font-weight: 600;
}

#chh-ai-panel {
  position: fixed;
  right: 22px;
  bottom: 270px;
  z-index: 99990;
  width: min(380px, calc(100vw - 28px));
  height: min(560px, calc(100vh - 100px));
  background: var(--chh-ai-panel);
  border-radius: 16px;
  box-shadow: var(--chh-ai-shadow);
  border: 1px solid var(--chh-ai-line);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: "PingFang SC", "Microsoft YaHei", "阿里巴巴普惠体 M", sans-serif;
}

#chh-ai-panel.is-open {
  display: flex;
  animation: chhAiIn 0.22s ease;
}

@keyframes chhAiIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.chh-ai-head {
  flex: 0 0 auto;
  background: linear-gradient(120deg, var(--chh-ai-navy) 0%, #14507a 100%);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chh-ai-head-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chh-ai-head-title strong {
  font-size: 16px;
  font-weight: 650;
}

.chh-ai-head-title span {
  font-size: 12px;
  opacity: 0.85;
}

.chh-ai-head-actions {
  display: flex;
  gap: 6px;
}

.chh-ai-icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.chh-ai-icon-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.chh-ai-body {
  flex: 1 1 auto;
  overflow-y: auto;
  background: var(--chh-ai-bg);
  padding: 14px 12px 8px;
  -webkit-overflow-scrolling: touch;
}

.chh-ai-msg {
  display: flex;
  margin-bottom: 12px;
  gap: 8px;
  align-items: flex-start;
}

.chh-ai-msg.is-user {
  flex-direction: row-reverse;
}

.chh-ai-avatar {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--chh-ai-navy);
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.chh-ai-msg.is-user .chh-ai-avatar {
  background: var(--chh-ai-accent);
}

.chh-ai-bubble {
  max-width: 78%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.55;
  color: #243642;
  background: #fff;
  border: 1px solid var(--chh-ai-line);
  white-space: pre-wrap;
  word-break: break-word;
}

.chh-ai-msg.is-user .chh-ai-bubble {
  background: var(--chh-ai-user);
  border-color: #c5d8e6;
}

.chh-ai-bubble.is-error {
  color: #a33;
  border-color: #f0c8c8;
  background: #fff5f5;
}

.chh-ai-bubble.is-typing {
  color: var(--chh-ai-muted);
  font-style: italic;
}

.chh-ai-hints {
  margin: 4px 0 12px;
}

.chh-ai-hints-title {
  font-size: 12px;
  color: var(--chh-ai-muted);
  margin: 0 0 8px 40px;
}

.chh-ai-hint {
  display: block;
  width: calc(100% - 40px);
  margin: 0 0 8px 40px;
  text-align: left;
  border: 1px dashed #b7c9d6;
  background: #fff;
  color: var(--chh-ai-navy);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.chh-ai-hint:hover {
  background: #eef6fb;
  border-color: var(--chh-ai-navy);
}

.chh-ai-foot {
  flex: 0 0 auto;
  border-top: 1px solid var(--chh-ai-line);
  background: #fff;
  padding: 10px 12px 12px;
}

.chh-ai-remain {
  font-size: 11px;
  color: var(--chh-ai-muted);
  margin-bottom: 8px;
  min-height: 14px;
}

.chh-ai-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chh-ai-input-row textarea {
  flex: 1 1 auto;
  min-height: 42px;
  max-height: 96px;
  resize: none;
  border: 1px solid var(--chh-ai-line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.4;
  outline: none;
  font-family: inherit;
  background: #fafcfd;
}

.chh-ai-input-row textarea:focus {
  border-color: #7aa3bf;
  background: #fff;
}

.chh-ai-send {
  flex: 0 0 auto;
  height: 42px;
  min-width: 64px;
  border: none;
  border-radius: 10px;
  background: var(--chh-ai-navy);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 14px;
}

.chh-ai-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.chh-ai-send:not(:disabled):hover {
  background: var(--chh-ai-navy-deep);
}

@media (max-width: 640px) {
  #chh-ai-fab {
    right: 14px;
    bottom: 88px;
    width: 54px;
    height: 54px;
  }

  #chh-ai-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100vw;
    height: min(78vh, 640px);
    border-radius: 16px 16px 0 0;
  }
}
