/* ==========================================================================
   在线客服面板（2026-11-28）
   --------------------------------------------------------------------------
   挂载：layouts/product.blade.php 的 .floatbar 之后（fixed，不参与复刻页坐标）
   入口：右下角第三段胶囊（原「电话」）
   约束：字号只用 14 / 15，主色 var(--c-primary)，圆角与站内卡片一致
   ========================================================================== */

/* 胶囊 hover 提示（第三段） */
.fb-pop--chatnote {
  position: absolute;
  right: 58px;
  bottom: -8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #111;
  color: #fff;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity .16s, transform .16s, visibility .16s;
}
.fb-seg--chat:hover .fb-pop--chatnote,
.fb-seg--chat:focus-visible .fb-pop--chatnote {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.fb-pop--chatnote em {
  font-style: normal;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}
.fb-pop--chatnote i {
  font-style: normal;
  font-size: 12px;
  line-height: 1.2;
  color: rgba(255, 255, 255, .66);
}

/* ---------- 面板 ---------- */
.chatp {
  position: fixed;
  /* 🔴 2026-11-29：原来是 24px，会正好压住右侧胶囊（宽 49 + 右边距 20）。
     鼠标悬停自动弹出后，按钮被面板盖住，用户找不到关闭/再次打开的入口。
     改 82px = 胶囊 49 + 边距 20 + 间隙 13，面板贴在胶囊左侧。 */
  right: 82px;
  bottom: 100px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  width: 368px;
  max-width: calc(100vw - 32px);
  height: 528px;
  max-height: calc(100vh - 132px);
  border: 1px solid #ececec;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .18);
  overflow: hidden;
}
.chatp[hidden] { display: none; }

.chatp__hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  background: #fff;
}
.chatp__who { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.chatp__who b {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: #111;
}
.chatp__who span { font-size: 12px; line-height: 1.3; color: #9a9a9a; }

.chatp__close {
  flex: none;
  width: 28px;
  height: 28px;
  margin: -4px -6px 0 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: #9a9a9a;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.chatp__close:hover { background: #f2f2f2; color: #111; }

/* 消息区 */
.chatp__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  background: #fafafa;
  -webkit-overflow-scrolling: touch;
}

.chatm {
  max-width: 84%;
  margin-bottom: 12px;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
  white-space: pre-wrap;
}
.chatm--visitor {
  margin-left: auto;
  background: var(--c-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chatm--staff {
  background: #fff;
  color: #111;
  border: 1px solid #ececec;
  border-bottom-left-radius: 4px;
}
.chatm--system {
  max-width: 92%;
  margin: 0 auto 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #f0f0f0;
  color: #6b6b6b;
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}
.chatm__at {
  margin-top: 5px;
  font-size: 11px;
  line-height: 1;
  opacity: .55;
}

/* 输入区 */
.chatp__form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #f0f0f0;
  background: #fff;
}
.chatp__form textarea {
  flex: 1;
  min-height: 44px;
  max-height: 96px;
  padding: 11px 12px;
  border: 1px solid #e2e2e2;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: #111;
  resize: none;
}
.chatp__form textarea:focus { outline: none; border-color: var(--c-primary); }
.chatp__form textarea::placeholder { color: #b5b5b5; }

.chatp__form button {
  flex: none;
  height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 22px;
  background: var(--c-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
}
.chatp__form button:disabled { opacity: .45; cursor: not-allowed; }

.chatp__tip {
  margin: 0;
  padding: 8px 16px 12px;
  font-size: 12px;
  line-height: 1.6;
  color: #a8a8a8;
  text-align: center;
  background: #fff;
}
.chatp__tip a { color: #a8a8a8; text-decoration: underline; }

/* ---------- 移动端：底部全宽 ---------- */
@media (max-width: 767px) {
  .chatp {
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    height: 86vh;
    max-height: none;
    border-radius: 16px 16px 0 0;
    border-bottom: 0;
  }
  .chatm { max-width: 88%; }
}

/* 乐观上屏的三种状态（2026-11-28）
   发送时先出现、灰一点；成功转正常；失败标红并保留内容（用户可复制重发） */
.chatm--visitor.is-pending { opacity: .55; }
.chatm--visitor.is-failed {
  background: #fdecea;
  color: #b3261e;
  border: 1px solid #f5c6c2;
}

/* 预约回电浮层里的客服团队图（2026-11-28）
   放在标题上方，宽度跟浮层内容宽一致（272 - 36 = 236） */
.fb-pop--call .fb-pop__team--call {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 0 12px;
  border-radius: 10px;
  object-fit: cover;
  object-position: center 30%;
  max-height: 120px;
}


/* 智能助手的气泡（2026-11-29）
   和客服气泡区分开：浅蓝底 + 左侧一道边，右上角挂「智能助手」小标签。
   客户一眼就知道这句是机器答的，不会拿它当人工承诺。 */
.chatm--ai {
  align-self: flex-start;
  background: #f2f7ff;
  border: 1px solid #dbe8ff;
  border-left: 3px solid #7aa7f0;
  color: #1c2b45;
  position: relative;
}
.chatm--ai::before {
  content: "智能助手";
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  line-height: 1.4;
  color: #5b7fc7;
  letter-spacing: .3px;
}
/* AI 回答里带知识库路径，长串不能撑破气泡 */
.chatm--ai { word-break: break-word; }
