/* 首页右下角 AI 问答组件。放在 banner-sections.css 之后加载。 */
.ai-chat-trigger{
  position:fixed;
  right:102px;
  bottom:34px;
  z-index:999;
  display:flex;
  align-items:center;
  gap:10px;
  min-width:126px;
  height:48px;
  padding:0 16px;
  border:1px solid rgba(32,180,255,.32);
  border-radius:14px;
  background:rgba(11,18,43,.9);
  color:var(--text-primary);
  box-shadow:0 12px 30px rgba(0,0,0,.28);
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
  cursor:pointer;
  transition:transform .25s ease,border-color .25s ease,box-shadow .25s ease,opacity .25s ease;
}

.ai-chat-trigger:hover{
  transform:translateY(-2px);
  border-color:rgba(32,180,255,.65);
  box-shadow:0 14px 34px rgba(32,180,255,.18);
}

.ai-chat-trigger.hidden{
  opacity:0;
  pointer-events:none;
  transform:translateY(14px);
}

.ai-trigger-dot{
  position:relative;
  width:9px;
  height:9px;
  flex:0 0 auto;
  border-radius:50%;
  background:#55dec6;
  box-shadow:0 0 12px rgba(85,222,198,.75);
}

.ai-trigger-dot::after{
  content:'';
  position:absolute;
  inset:-4px;
  border:1px solid rgba(85,222,198,.45);
  border-radius:50%;
  animation:aiTriggerPulse 2.4s ease-out infinite;
}

@keyframes aiTriggerPulse{
  0%{opacity:.8;transform:scale(.65)}
  70%,100%{opacity:0;transform:scale(1.7)}
}

.ai-trigger-copy{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  line-height:1.2;
}

.ai-trigger-copy strong{font-size:14px;font-weight:720}
.ai-trigger-copy small{margin-top:3px;color:var(--text-muted);font-size:10px;letter-spacing:.04em}

/* 两个按钮内部的装饰元素（脉冲圈、图标、文案）都不应该单独接收指针事件，
   点击目标始终是 <button> 本身，整块区域可点。 */
.ai-chat-trigger > *,
.floating-bot > *{pointer-events:none}

/* 右下角圆形按钮＝人工咨询（左侧胶囊按钮才是 AI 问答），
   两者视觉上必须能一眼区分，所以这里把图标换成人形并压出一行文字标签。 */
button.floating-bot{
  padding:0;
  border:0;
  flex-direction:column;
  gap:3px;
  line-height:1;
}

.floating-bot svg,
button.floating-bot svg{width:20px;height:20px}

.bot-label{
  font-size:10px;
  font-weight:700;
  letter-spacing:.06em;
}

/* 关闭态的对话框只是 opacity:0，仍以 z-index:1000 盖在两个入口按钮上方，
   会吃掉它们一半以上的点击区域。未显示时必须让它对指针透明。 */
.consult-dialog{pointer-events:none}
.consult-dialog.show{pointer-events:auto}

.consult-dialog.ai-chat-dialog{
  right:28px;
  bottom:102px;
  width:390px;
  max-height:min(650px,calc(100vh - 130px));
  overflow:hidden;
  background:rgba(11,18,43,.97);
  border-color:rgba(125,180,255,.2);
  box-shadow:0 24px 70px rgba(0,0,0,.5),0 0 40px rgba(32,180,255,.08);
  backdrop-filter:blur(18px);
  -webkit-backdrop-filter:blur(18px);
}

.ai-chat-dialog .dialog-header{
  padding:15px 18px;
  background:linear-gradient(120deg,#20b4ff,#4b7dff);
}

.ai-dialog-heading{display:flex;align-items:center;gap:10px}
.ai-dialog-heading h3{line-height:1.2}

.ai-online{
  display:inline-flex;
  align-items:center;
  gap:5px;
  margin-top:3px;
  color:rgba(4,16,27,.72);
  font-size:10.5px;
  font-weight:650;
}

.ai-online::before{
  content:'';
  width:6px;
  height:6px;
  border-radius:50%;
  background:#0b735e;
}

.ai-chat-content{
  display:flex;
  min-height:0;
  padding:16px;
  flex-direction:column;
  overflow:hidden;
}

.ai-chat-welcome{
  margin-bottom:12px;
  color:var(--text-secondary);
  font-size:12.5px;
  line-height:1.6;
}

.quick-questions{
  display:flex;
  gap:7px;
  margin-bottom:12px;
  padding-bottom:2px;
  overflow-x:auto;
  scrollbar-width:none;
}

.quick-questions::-webkit-scrollbar{display:none}

.quick-question{
  flex:0 0 auto;
  padding:7px 10px;
  border:1px solid rgba(32,180,255,.22);
  border-radius:999px;
  background:rgba(32,180,255,.07);
  color:#a9ddff;
  font-size:11.5px;
  cursor:pointer;
  transition:border-color .2s ease,background .2s ease;
}

.quick-question:hover{
  border-color:rgba(32,180,255,.5);
  background:rgba(32,180,255,.13);
}

.ai-chat-dialog .chat-messages{
  min-height:220px;
  height:310px;
  margin-bottom:12px;
  padding:14px;
}

.ai-chat-dialog .message-bubble{
  max-width:86%;
  padding:10px 13px;
  white-space:pre-wrap;
}

.ai-chat-dialog .chat-input-area{align-items:flex-end}

.ai-chat-dialog .chat-input-area textarea{
  min-height:44px;
  max-height:112px;
  flex:1;
  resize:none;
  padding:11px 12px;
  border:1px solid rgba(255,255,255,.12);
  border-radius:9px;
  outline:none;
  background:rgba(255,255,255,.055);
  color:var(--text-primary);
  font:inherit;
  font-size:13.5px;
  line-height:1.5;
}

.ai-chat-dialog .chat-input-area textarea:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(32,180,255,.1);
}

.ai-chat-dialog .send-btn{
  min-width:64px;
  height:44px;
  padding:0 15px;
}

.ai-chat-dialog .send-btn:disabled{opacity:.55;cursor:not-allowed}

.ai-chat-footer{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-top:10px;
}

.ai-chat-note{color:var(--text-muted);font-size:10.5px}

.human-consult-btn,.back-to-ai-btn{
  padding:0;
  border:0;
  background:none;
  color:#82d3ff;
  font-size:12px;
  font-weight:650;
  cursor:pointer;
}

.human-consult-btn:hover,.back-to-ai-btn:hover{color:#c3ecff}
.back-to-ai-btn{display:inline-flex;margin-bottom:14px}

.typing-bubble{display:flex;align-items:center;gap:5px;min-height:38px}
.typing-bubble i{width:5px;height:5px;border-radius:50%;background:#9ed8ff;animation:aiTyping 1.1s ease-in-out infinite}
.typing-bubble i:nth-child(2){animation-delay:.14s}
.typing-bubble i:nth-child(3){animation-delay:.28s}

@keyframes aiTyping{
  0%,60%,100%{opacity:.35;transform:translateY(0)}
  30%{opacity:1;transform:translateY(-3px)}
}

.message-bubble.streaming::after{
  content:'';
  display:inline-block;
  width:2px;
  height:1em;
  margin-left:2px;
  vertical-align:text-bottom;
  background:currentColor;
  animation:aiCursorBlink 0.9s step-end infinite;
}

@keyframes aiCursorBlink{
  0%,50%{opacity:1}
  50.01%,100%{opacity:0}
}

@media(max-width:560px){
  .ai-chat-trigger{
    right:88px;
    bottom:24px;
    min-width:108px;
    height:44px;
    padding:0 12px;
  }
  .ai-trigger-copy small{display:none}
  .consult-dialog.ai-chat-dialog{
    right:12px;
    bottom:88px;
    left:12px;
    width:auto;
    max-height:calc(100dvh - 112px);
  }
  .ai-chat-dialog .chat-messages{height:min(360px,42dvh)}
}

@media(prefers-reduced-motion:reduce){
  .ai-trigger-dot::after,.typing-bubble i{animation:none}
}
