/* =============================================================
   云成文轩教育 · AI 在线顾问（前台悬浮窗）
   ============================================================= */
.ai-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 900;
  width: 60px; height: 60px; border-radius: 50%; border: 1px solid #D3E3F6; cursor: pointer;
  background: linear-gradient(180deg, #FFFFFF 0%, #E6F0FC 100%);
  color: #fff; overflow: hidden;
  display: grid; place-items: center;
  box-shadow: 0 12px 28px rgba(13, 60, 120, .24), 0 2px 6px rgba(13, 60, 120, .12);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.ai-fab:hover {
  transform: translateY(-3px); border-color: #1565C0;
  box-shadow: 0 16px 34px rgba(13, 60, 120, .3), 0 3px 8px rgba(13, 60, 120, .16);
}
.ai-fab svg { width: 76%; height: 76%; }

/* 客服人员头像（头戴耳麦半身像）配色：浅底 + 品牌蓝人像 */
.ai-person { display: block; --ai-ink: #1565C0; --ai-hs: #0D47A1; --ai-face: #FFFFFF; }
.ai-person .p-body { fill: var(--ai-ink); }
.ai-person .p-hs { color: var(--ai-hs); fill: currentColor; }
.ai-person .p-eye { fill: var(--ai-face); }
.ai-person .p-mouth { stroke: var(--ai-face); fill: none; }

.ai-fab .ai-dot {
  position: absolute; top: 7px; right: 7px; width: 10px; height: 10px; border-radius: 50%;
  background: #38D07A; border: 2px solid #fff; z-index: 2;
}
.ai-fab-label {
  position: fixed; right: 92px; bottom: 38px; z-index: 899;
  background: #fff; color: #22384F; font-size: 13px; padding: 7px 12px; border-radius: 8px;
  box-shadow: 0 6px 18px rgba(13, 60, 120, .16); border: 1px solid #E3EBF4;
  white-space: nowrap; pointer-events: none;
}
.ai-fab-label::after {
  content: ''; position: absolute; right: -5px; top: 50%; margin-top: -5px;
  width: 8px; height: 8px; background: #fff; border-right: 1px solid #E3EBF4;
  border-top: 1px solid #E3EBF4; transform: rotate(45deg);
}

.ai-panel {
  position: fixed; right: 24px; bottom: 96px; z-index: 901;
  width: 372px; height: 560px; max-height: calc(100vh - 130px);
  background: #fff; border-radius: 14px; border: 1px solid #E1E9F3;
  box-shadow: 0 24px 60px rgba(13, 60, 120, .22);
  display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; transform: translateY(14px) scale(.98); pointer-events: none;
  transition: opacity .22s, transform .22s;
}
.ai-panel.on { opacity: 1; transform: none; pointer-events: auto; }

.ai-head {
  background: var(--c-primary, #1565C0); color: #fff; padding: 14px 16px;
  display: flex; align-items: center; gap: 10px;
}
.ai-head .ai-ava {
  width: 38px; height: 38px; border-radius: 50%; background: #fff; flex: none;
  display: grid; place-items: center; overflow: hidden;
  box-shadow: 0 2px 8px rgba(6, 30, 60, .22);
}
.ai-head .ai-ava svg { width: 100%; height: 100%; }
.ai-head b { font-size: 14.5px; display: block; line-height: 1.3; }
.ai-head i { font-style: normal; font-size: 11.5px; opacity: .82; }
.ai-head .ai-x {
  margin-left: auto; background: none; border: none; color: #fff; font-size: 22px;
  line-height: 1; cursor: pointer; opacity: .8; padding: 0 2px;
}
.ai-head .ai-x:hover { opacity: 1; }

.ai-body { flex: 1; overflow-y: auto; padding: 16px 14px 6px; background: #F7FAFD; }
.ai-body::-webkit-scrollbar { width: 6px; }
.ai-body::-webkit-scrollbar-thumb { background: #CFDCEA; border-radius: 3px; }

.ai-msg { display: flex; gap: 8px; margin-bottom: 14px; }
.ai-msg .ai-ava2 {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 12px; background: #E3EEFB; color: #1565C0; font-weight: 700; overflow: hidden;
}
.ai-msg .ai-ava2 svg { width: 100%; height: 100%; }
.ai-msg .ai-bub {
  max-width: 78%; background: #fff; border: 1px solid #E4ECF5; color: #22384F;
  padding: 10px 12px; border-radius: 10px; font-size: 13.5px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-word;
}
.ai-msg.me { flex-direction: row-reverse; }
.ai-msg.me .ai-bub { background: #1565C0; border-color: #1565C0; color: #fff; }
.ai-msg.me .ai-ava2 { background: #E9EFF6; color: #5A7590; }

/* 人工客服回复 */
.ai-msg .ai-tag {
  display: inline-block; margin: 0 6px 4px 0; padding: 1px 8px; border-radius: 9px;
  background: #E8890C; color: #fff; font-size: 11px; font-weight: 700; vertical-align: 1px;
}
.ai-msg.human .ai-bub { border-color: #F2D9AE; background: #FFFDF7; }
.ai-msg.sys { justify-content: center; }
.ai-msg.sys .ai-sysline {
  font-size: 12px; color: #7E95AC; background: #EDF3FA;
  border-radius: 12px; padding: 5px 14px;
}

.ai-typing span {
  display: inline-block; width: 5px; height: 5px; margin: 0 2px; border-radius: 50%;
  background: #9FB6CC; animation: aib 1.1s infinite;
}
.ai-typing span:nth-child(2) { animation-delay: .18s; }
.ai-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes aib { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.ai-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px 36px; }
.ai-chips button {
  border: 1px solid #BFD7F0; background: #fff; color: #1565C0; border-radius: 16px;
  padding: 6px 12px; font-size: 12.5px; cursor: pointer; font-family: inherit;
}
.ai-chips button:hover { background: #EAF2FC; }

.ai-lead {
  margin: 0 0 14px 36px; background: #fff; border: 1px solid #E4ECF5;
  border-radius: 10px; padding: 12px; max-width: 82%;
}
.ai-lead h4 { margin: 0 0 4px; font-size: 13.5px; color: #1B2F45; }
.ai-lead p { margin: 0 0 10px; font-size: 12px; color: #6B819B; line-height: 1.55; }
.ai-lead input {
  width: 100%; box-sizing: border-box; margin-bottom: 8px; padding: 9px 10px;
  border: 1px solid #D8E3EF; border-radius: 7px; font-size: 13px; font-family: inherit; color: #22384F;
}
.ai-lead input:focus { outline: none; border-color: #1565C0; box-shadow: 0 0 0 3px rgba(21, 101, 192, .1); }
.ai-lead .ai-row2 { display: flex; gap: 8px; }
.ai-lead .ai-row2 input { margin-bottom: 8px; }
.ai-lead button {
  width: 100%; border: none; background: #E8890C; color: #fff; border-radius: 7px;
  padding: 10px; font-size: 13.5px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.ai-lead button:disabled { opacity: .6; cursor: default; }
.ai-lead .ai-err { color: #C62828; font-size: 12px; margin: 6px 0 0; }

.ai-done { margin: 0 0 14px 36px; background: #EFFAF3; border: 1px solid #C8EBD5; border-radius: 10px; padding: 12px; max-width: 82%; }
.ai-done b { display: block; font-size: 13.5px; color: #14683A; margin-bottom: 4px; }
.ai-done span { font-size: 12.5px; color: #2C6B4A; line-height: 1.6; display: block; }
.ai-done a {
  display: inline-block; margin-top: 8px; font-size: 12.5px; color: #0F6E3B;
  font-weight: 700; text-decoration: none; border-bottom: 1px solid #9FD8B6;
}

.ai-foot {
  border-top: 1px solid #E7EEF6; padding: 10px 12px; background: #fff;
}
.ai-inrow { display: flex; gap: 8px; align-items: flex-end; }
.ai-inrow textarea {
  flex: 1; resize: none; border: 1px solid #D8E3EF; border-radius: 9px; padding: 9px 11px;
  font-size: 13.5px; font-family: inherit; color: #22384F; height: 40px; max-height: 90px; line-height: 1.4;
}
.ai-inrow textarea:focus { outline: none; border-color: #1565C0; box-shadow: 0 0 0 3px rgba(21, 101, 192, .1); }
.ai-inrow button {
  flex: none; width: 62px; height: 40px; border: none; border-radius: 9px; background: #1565C0;
  color: #fff; font-size: 13.5px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.ai-inrow button:disabled { background: #A9C3DC; cursor: default; }
.ai-tip { margin-top: 7px; font-size: 11px; color: #93A2B5; text-align: center; line-height: 1.5; }

@media (max-width: 640px) {
  .ai-fab { right: 16px; bottom: 16px; width: 52px; height: 52px; }
  .ai-fab-label { display: none; }
  .ai-panel {
    right: 0; left: 0; bottom: 0; width: 100%; height: 78vh; max-height: none;
    border-radius: 16px 16px 0 0; border-left: none; border-right: none; border-bottom: none;
  }
  .ai-msg .ai-bub { max-width: 82%; }
}
