/* ============================================
   AI 前台小助手「小金」浮层
   前缀 aiw- 避免与站点样式冲突；金色主题跟随 :root 变量
   ============================================ */
.aiw-fab {
  position: fixed;
  right: 30px;
  bottom: 102px;                /* 悬在右下电话按钮正上方 */
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid var(--gold, #C8A456);
  color: var(--gold-dark, #A8862E);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(168, 134, 46, 0.25);
  z-index: 1100;
  transition: transform .25s, background .25s, color .25s, box-shadow .25s;
}
.aiw-fab:hover { background: var(--gold, #C8A456); color: #fff; transform: scale(1.08); }
.aiw-fab svg { width: 26px; height: 26px; }
.aiw-fab .aiw-online {
  position: absolute; right: 1px; bottom: 1px;
  width: 13px; height: 13px; border-radius: 50%;
  background: #34b56a; border: 2px solid #fff;
}
.aiw-panel {
  position: fixed;
  right: 30px;
  bottom: 176px;                /* 悬在 AI 按钮正上方 */
  width: 372px;
  max-height: min(540px, calc(100vh - 230px));
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border, #E5DDC9);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(168, 134, 46, 0.22);
  overflow: hidden;
  z-index: 1110;
}
.aiw-panel[hidden] { display: none; }

/* 头部 */
.aiw-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(120deg, var(--gold, #C8A456), var(--gold-dark, #A8862E));
  color: #fff;
}
.aiw-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #fff; color: var(--gold-dark, #A8862E);
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.aiw-title { font-size: 14px; font-weight: 600; line-height: 1.2; }
.aiw-sub { font-size: 11px; opacity: .92; margin-top: 1px; }
.aiw-close {
  margin-left: auto; width: 28px; height: 28px; flex: none;
  border: 0; border-radius: 50%; background: rgba(255,255,255,.18);
  color: #fff; font-size: 15px; cursor: pointer; line-height: 1;
}
.aiw-close:hover { background: rgba(255,255,255,.32); }

/* 消息区 */
.aiw-chat {
  flex: 1; min-height: 220px; max-height: 360px;
  overflow-y: auto;
  padding: 14px;
  background: var(--bg, #FDFBF7);
  scroll-behavior: smooth;
}
.aiw-msg {
  max-width: 82%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13.5px; line-height: 1.65;
  word-break: break-word;
  margin-bottom: 10px;
  white-space: normal;
}
.aiw-msg.aiw-bot {
  background: #fff; color: var(--text, #2A2A2A);
  border: 1px solid var(--border, #E5DDC9);
  border-top-left-radius: 4px;
  align-self: flex-start;
}
.aiw-msg.aiw-user {
  background: var(--gold, #C8A456); color: #fff;
  border-top-right-radius: 4px;
  align-self: flex-end;
}
.aiw-chat { display: flex; flex-direction: column; align-items: stretch; }
.aiw-msg { align-self: flex-start; }
.aiw-msg.aiw-user { align-self: flex-end; }
.aiw-msg a { color: inherit; text-decoration: underline; }
.aiw-msg.aiw-bot a { color: var(--gold-dark, #A8862E); }

/* 快捷问题 */
.aiw-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 12px; background: var(--bg, #FDFBF7); }
.aiw-chip {
  border: 1px solid var(--gold, #C8A456);
  background: #fff; color: var(--gold-dark, #A8862E);
  font-size: 12.5px; border-radius: 999px;
  padding: 6px 12px; cursor: pointer; transition: all .2s;
}
.aiw-chip:hover { background: var(--gold-light, #E8D49A); border-color: var(--gold-dark, #A8862E); }

/* 输入区 */
.aiw-inputbar {
  display: flex; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--border, #E5DDC9);
  background: #fff;
}
.aiw-inputbar input {
  flex: 1; min-width: 0;
  border: 1px solid var(--border, #E5DDC9); border-radius: 999px;
  padding: 8px 14px; font-size: 13.5px; outline: none;
  color: var(--text, #2A2A2A); background: var(--bg, #FDFBF7);
}
.aiw-inputbar input:focus { border-color: var(--gold, #C8A456); }
.aiw-send {
  border: 0; border-radius: 999px; padding: 0 18px;
  background: var(--gold, #C8A456); color: #fff;
  font-size: 13.5px; cursor: pointer; transition: background .2s;
}
.aiw-send:hover { background: var(--gold-dark, #A8862E); }
.aiw-send:disabled { opacity: .6; cursor: default; }
.aiw-foot {
  font-size: 11px; color: var(--text-light, #6B6B6B);
  text-align: center; padding: 6px 10px;
  background: var(--bg-warm, #F5EFE3);
  border-top: 1px solid var(--border, #E5DDC9);
}

/* 正在输入动画 */
.aiw-typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 2px; }
.aiw-typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold, #C8A456);
  animation: aiw-bounce 1s infinite ease-in-out;
}
.aiw-typing i:nth-child(2) { animation-delay: .15s; }
.aiw-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes aiw-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

@media (max-width: 560px) {
  .aiw-fab { right: 20px; bottom: 84px; width: 50px; height: 50px; }
  .aiw-fab svg { width: 22px; height: 22px; }
  .aiw-panel { right: 16px; left: 16px; width: auto; bottom: 148px; max-height: calc(100vh - 200px); }
  .aiw-chat { max-height: none; }
}
