/* AI 导购组件样式（独立命名空间 .aig-，不污染站点原有样式） */
.aig-root{ position:relative; z-index:9998; }

/* ---------- 悬浮按钮：可拖动，位置由 JS 写入 left/top ---------- */
.aig-fab{
  position:fixed; left:auto; top:auto; z-index:9999;
  width:56px; height:56px; padding:0; border:0; background:transparent;
  cursor:grab; touch-action:none; -webkit-user-select:none; user-select:none;
  -webkit-tap-highlight-color:transparent; outline:none;
  -webkit-appearance:none; appearance:none;
}
.aig-fab.aig-dragging{ cursor:grabbing; }
.aig-fab-bubble{
  display:flex; align-items:center; justify-content:center;
  width:56px; height:56px; border-radius:50%;
  background:linear-gradient(135deg,#2f6fff 0%,#7b3fe4 100%);
  box-shadow:0 10px 26px rgba(47,111,255,.38), 0 2px 8px rgba(0,0,0,.12);
  color:#fff; transition:transform .18s ease, box-shadow .18s ease;
  position:relative;
}
.aig-fab:hover .aig-fab-bubble{ transform:translateY(-2px) scale(1.04); box-shadow:0 14px 30px rgba(47,111,255,.45); }
.aig-fab.aig-dragging .aig-fab-bubble{ transform:scale(.96); transition:none; }
.aig-fab-bubble svg{ width:27px; height:27px; display:block; pointer-events:none; }
.aig-fab-label{
  position:absolute; top:50%; right:66px; transform:translateY(-50%) translateX(6px);
  background:#fff; color:#2b3445; font-size:13px; line-height:1;
  padding:9px 13px; border-radius:999px; white-space:nowrap;
  box-shadow:0 6px 18px rgba(20,30,60,.16);
  opacity:0; pointer-events:none;
  transition:opacity .2s ease, transform .2s ease;
}
.aig-fab:hover .aig-fab-label,
.aig-fab.aig-tip .aig-fab-label{ opacity:1; transform:translateY(-50%) translateX(0); }
.aig-dot{
  position:absolute; top:3px; right:3px; width:11px; height:11px; border-radius:50%;
  background:#22c55e; border:2px solid #fff;
}

/* ---------- 对话框：位置由 JS 跟随按钮计算 ---------- */
.aig-panel{
  position:fixed; left:auto; top:auto; z-index:9999;
  width:374px; max-width:calc(100vw - 32px);
  height:min(586px, calc(100vh - 130px));
  display:none; flex-direction:column;
  background:#fff; border-radius:18px; overflow:hidden;
  box-shadow:0 24px 60px rgba(15,25,50,.24), 0 4px 14px rgba(15,25,50,.10);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  animation:aig-pop .18s ease-out;
}
@keyframes aig-pop{ from{ opacity:0; transform:translateY(10px) scale(.98);} to{ opacity:1; transform:none;} }
.aig-root.aig-open .aig-panel{ display:flex; }

.aig-head{
  flex:0 0 auto; display:flex; align-items:center; gap:10px;
  padding:13px 14px; color:#fff;
  background:linear-gradient(135deg,#2f6fff 0%,#7b3fe4 100%);
}
.aig-head-avatar{
  width:32px; height:32px; border-radius:10px; background:rgba(255,255,255,.18);
  display:flex; align-items:center; justify-content:center; font-size:16px;
}
.aig-head-txt{ flex:1 1 auto; min-width:0; }
.aig-head-title{ font-size:14px; font-weight:600; line-height:1.3; }
.aig-head-sub{ font-size:11px; opacity:.82; line-height:1.4; margin-top:1px; }
.aig-close{
  flex:0 0 auto; width:28px; height:28px; border:0; border-radius:8px; cursor:pointer;
  background:rgba(255,255,255,.16); color:#fff; font-size:16px; line-height:1;
  display:flex; align-items:center; justify-content:center;
}
.aig-close:hover{ background:rgba(255,255,255,.28); }

.aig-body{
  flex:1 1 auto; overflow-y:auto; padding:14px; background:#f6f8fc;
  scrollbar-width:thin;
}
.aig-body::-webkit-scrollbar{ width:6px; }
.aig-body::-webkit-scrollbar-thumb{ background:#cfd8e6; border-radius:6px; }

.aig-msg{ display:flex; gap:8px; margin-bottom:12px; align-items:flex-start; }
.aig-msg-av{
  flex:0 0 auto; width:26px; height:26px; border-radius:9px; font-size:13px;
  display:flex; align-items:center; justify-content:center;
  background:linear-gradient(135deg,#2f6fff,#7b3fe4); color:#fff;
}
.aig-bubble{
  max-width:calc(100% - 44px); padding:9px 12px; border-radius:12px;
  font-size:13px; line-height:1.72; color:#26303f; word-break:break-word;
  background:#fff; box-shadow:0 1px 2px rgba(16,24,40,.06);
  border-top-left-radius:4px;
}
.aig-msg-user{ flex-direction:row-reverse; }
.aig-msg-user .aig-bubble{
  background:linear-gradient(135deg,#2f6fff,#5b6cf9); color:#fff;
  border-top-left-radius:12px; border-top-right-radius:4px; box-shadow:none;
}
.aig-msg-user .aig-msg-av{ background:#d7dfef; color:#5b6b85; }
.aig-bubble a{ color:#2f6fff; text-decoration:underline; }
.aig-msg-user .aig-bubble a{ color:#eaf0ff; }

.aig-bubble b{ font-weight:600; }
.aig-bubble .aig-line{ display:block; height:6px; }

.aig-chips{ display:flex; flex-wrap:wrap; gap:8px; margin:2px 0 12px 34px; }
.aig-chip{
  border:1px solid #d5e0f5; background:#fff; color:#33507f; cursor:pointer;
  font-size:12px; line-height:1; padding:8px 11px; border-radius:999px;
  transition:all .15s ease;
}
.aig-chip:hover{ border-color:#2f6fff; color:#2f6fff; background:#f2f6ff; }

.aig-typing{ display:inline-flex; gap:4px; align-items:center; height:16px; }
.aig-typing i{
  width:6px; height:6px; border-radius:50%; background:#9db0cc; display:block;
  animation:aig-blink 1.2s infinite ease-in-out;
}
.aig-typing i:nth-child(2){ animation-delay:.18s; }
.aig-typing i:nth-child(3){ animation-delay:.36s; }
@keyframes aig-blink{ 0%,80%,100%{ opacity:.28; transform:translateY(0);} 40%{ opacity:1; transform:translateY(-3px);} }

.aig-foot{
  flex:0 0 auto; border-top:1px solid #eaeff7; background:#fff; padding:9px 10px 8px;
}
.aig-input-wrap{
  display:flex; align-items:flex-end; gap:8px; background:#f4f7fc;
  border:1px solid #e3eaf6; border-radius:12px; padding:6px 6px 6px 11px;
}
.aig-input-wrap textarea{
  flex:1 1 auto; border:0; outline:none; resize:none; background:transparent;
  font-size:13px; line-height:1.5; max-height:88px; min-height:20px; padding:5px 0;
  font-family:inherit; color:#26303f;
}
.aig-send{
  flex:0 0 auto; width:32px; height:32px; border:0; border-radius:9px; cursor:pointer;
  background:linear-gradient(135deg,#2f6fff,#7b3fe4); color:#fff;
  display:flex; align-items:center; justify-content:center;
}
.aig-send[disabled]{ opacity:.45; cursor:not-allowed; }
.aig-send svg{ width:16px; height:16px; }
.aig-tip{
  text-align:center; font-size:11px; color:#9aa7bd; padding:6px 0 0;
}

/* ---------- 移动端：按钮可拖动，对话窗贴底展开 ---------- */
@media (max-width:560px){
  .aig-fab{ width:50px; height:50px; }
  .aig-fab-bubble{ width:50px; height:50px; }
  .aig-fab-bubble svg{ width:24px; height:24px; }
  .aig-fab-label{ display:none; }
  .aig-panel{
    width:100%; max-width:100%; height:80vh;
    border-radius:18px 18px 0 0;
  }
}
