/* 在线留言聊天窗（2026-11-15）
   挂在 .floater 上的右下角面板。设计上跟会员弹窗（member-modal.css）保持同一套语言：
   白卡、细边、圆角 14、主色只在「自己说的话」和主按钮上出现，不铺大面积色块。 */

.hqt-cw[hidden] { display: none; }

.hqt-cw {
  position: fixed;
  inset: 0;
  z-index: 99990;
  pointer-events: none;
}

/* 桌面端不压暗整页：留言窗是辅助面板，不是必须处理完才能走的弹窗 */
.hqt-cw__mask {
  position: absolute;
  inset: 0;
  background: transparent;
  pointer-events: auto;
}

.hqt-cw__panel {
  position: absolute;
  right: 22px;
  bottom: 96px;
  /* 老板 2026-11-15：原来的 372 宽太小，至少 3 倍面积。
     面积靠「宽 + 高」一起给，但高度必须先把 bottom 距离和顶部留白扣掉，
     否则面板会顶出屏幕（第一版写 100vh-78，实测 top=-18，被截掉一截）。 */
  width: min(1120px, calc(100vw - 56px));
  height: min(960px, calc(100vh - 128px));
  max-height: none;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e5e8ee;
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(16, 24, 40, .16);
  overflow: hidden;
  pointer-events: auto;
  transform: translateY(8px);
  opacity: 0;
  transition: transform .18s ease, opacity .18s ease;
}

.hqt-cw.is-on .hqt-cw__panel { transform: translateY(0); opacity: 1; }

/* ---------------- 头部 ---------------- */
.hqt-cw__hd {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid #eef1f6;
  background: #fff;
}
.hqt-cw__av {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand, #4f46e5);
  color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  overflow: hidden;
}
/* 头像改成站点 LOGO（2026-11-15 老板要求）。LOGO 多为深色字+透明底，
   直接贴品牌蓝会糊，所以给白底 + 内边距，按 contain 缩放，不裁切。 */
.hqt-cw__av-img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
  padding: 2px;
  box-sizing: border-box;
}
.hqt-cw__tt { flex: 1 1 auto; min-width: 0; }
.hqt-cw__tt b { display: block; font-size: 13.5px; font-weight: 600; color: #1a2233; line-height: 1.3; }
.hqt-cw__tt span { display: flex; align-items: center; gap: 5px; margin-top: 2px; font-size: 11.5px; color: #8890a3; }
.hqt-cw__tt i {
  width: 6px; height: 6px; border-radius: 50%;
  background: #2eab5b; display: inline-block;
}
.hqt-cw__x {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  border: none; background: none; cursor: pointer;
  color: #98a1b3; font-size: 20px; line-height: 1;
  border-radius: 7px;
}
.hqt-cw__x:hover { background: #f2f4f9; color: #4a5468; }

/* ---------------- 消息区 ---------------- */
.hqt-cw__bd {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  /* 首次打开只有一行提示时不要撑出大块空白，给个下限就够 */
  min-height: 92px;
  max-height: none;
  overflow-y: auto;
  padding: 20px 22px;
  background: #fafbfd;
  overscroll-behavior: contain;
}

.hqt-cw__tip {
  width: 100%;
  max-width: 900px;
  margin: 0 auto 16px;
  padding: 11px 13px;
  border-radius: 10px;
  background: #f2f5fd;
  border: 1px solid #e4eaf9;
  color: #5a6480;
  font-size: 13px;
  line-height: 1.65;
}
.hqt-cw__tip b { color: #1a2233; font-weight: 600; }

/* 联系方式下面那行小字：说清楚为什么要留、安全不安全 */
.hqt-cw__hint {
  margin-top: 6px;
  padding-left: 2px;
  font-size: 11.5px;
  line-height: 1.5;
  color: #98a1b3;
}

/* ---------- 首屏引导（面板放大后不能空着一大片） ---------- */
.hqt-cw__hi {
  margin: auto;
  padding: 8px 12px 20px;
  max-width: 900px;
  width: 100%;
  text-align: center;
}
.hqt-cw__hi-t { font-size: 19px; font-weight: 600; color: #1a2233; letter-spacing: -.01em; }
.hqt-cw__hi-s { margin-top: 9px; font-size: 13.5px; color: #8890a3; line-height: 1.65; }
.hqt-cw__qs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
}
.hqt-cw__q {
  max-width: 100%;
  padding: 11px 16px;
  border: 1px solid #e5e8ee;
  border-radius: 10px;
  background: #fff;
  color: #3b4457;
  font-size: 13.5px;
  font-family: inherit;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.hqt-cw__q:hover {
  border-color: var(--brand, #4f46e5);
  color: var(--brand, #4f46e5);
  background: #f7f7ff;
}

.hqt-cw__m {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
  align-items: flex-start;
}
.hqt-cw__m--me { align-items: flex-end; }
.hqt-cw__b {
  /* 面板变宽后不能跟着无限变宽：一行超过 40 来个字就不好读了 */
  max-width: min(700px, 74%);
  padding: 10px 14px;
  border-radius: 13px;
  border-bottom-left-radius: 4px;
  background: #fff;
  border: 1px solid #e5e8ee;
  color: #1a2233;
  font-size: 15px;
  line-height: 1.72;
  white-space: pre-wrap;
  word-break: break-word;
}
.hqt-cw__m--me .hqt-cw__b {
  background: var(--brand, #4f46e5);
  border-color: var(--brand, #4f46e5);
  color: #fff;
  border-radius: 12px;
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 12px;
}
.hqt-cw__t { margin-top: 4px; font-size: 11px; color: #a2a9b8; }
.hqt-cw__m--me .hqt-cw__t { text-align: right; }

/* 「正在翻译 / 已发出」这类状态，用一条系统消息表示，不做成气泡 */
/* 系统自动消息（引导留电话）：居中、浅底、不带头像，一眼看出不是人说的 */
.hqt-cw__note {
  max-width: 78%;
  margin: 4px auto 12px;
  padding: 7px 12px;
  border-radius: 8px;
  background: #f4f6fb;
  border: 1px dashed #dde3ef;
  color: #5a6480;
  font-size: 12.5px;
  line-height: 1.65;
  text-align: center;
}

.hqt-cw__sys {
  margin: 0 0 12px;
  text-align: center;
  font-size: 11.5px;
  color: #98a1b3;
}

/* ---------------- 输入区 ---------------- */
.hqt-cw__ft {
  border-top: 1px solid #eef1f6;
  padding: 12px 18px 14px;
  background: #fff;
}
.hqt-cw__row {
  display: flex;
  gap: 10px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}
.hqt-cw__row + .hqt-cw__row { margin-top: 9px; }
/* 发送行：左边「急事直接打 400…」，右边发送按钮（2026-11-15 老板要求同一行）。
   按钮不拉满整行 —— 1120 宽的面板里一条通栏按钮很笨重。 */
.hqt-cw__row--send {
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
}
/* 电话号码要显眼：真着急的人扫一眼就要看见，不能是小灰字 */
.hqt-cw__call {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 15px;
  line-height: 1.4;
  color: #4a5468;
  text-decoration: none;
  white-space: nowrap;
}
.hqt-cw__call b {
  font-size: 17px;
  font-weight: 700;
  color: var(--brand, #4f46e5);
  letter-spacing: .01em;
}
.hqt-cw__call:hover { color: #1a2233; }
.hqt-cw__call:hover b { text-decoration: underline; }
.hqt-cw__calltip { flex: 1 1 auto; min-width: 0; font-size: 12.5px; color: #98a1b3; }
/* 会员态只有「手机号」一个框，别让它拉满 900 —— 跟留言框差不多宽就够 */
.hqt-cw__ft .hqt-cw__row > .hqt-cw__in:only-child { max-width: 420px; }

.hqt-cw__in, .hqt-cw__ta {
  width: 100%;
  /* flex 子项的 min-width 默认是 auto，输入框会按 size 属性撑到几百像素，
     两个并排就顶破面板（手机实测右边那个被切掉半截） */
  min-width: 0;
  flex: 1 1 0;
  box-sizing: border-box;
  border: 1px solid #dfe3eb;
  border-radius: 9px;
  font-size: 14px;
  color: #1a2233;
  background: #fff;
  font-family: inherit;
}
.hqt-cw__in { height: 42px; padding: 0 12px; }
.hqt-cw__ta { height: 88px; padding: 10px 12px; resize: none; line-height: 1.65; }
.hqt-cw__ta:focus, .hqt-cw__in:focus {
  outline: none;
  border-color: var(--brand, #4f46e5);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .1);
}

.hqt-cw__send {
  flex: 0 0 auto;
  min-width: 148px;
  height: 42px;
  padding: 0 22px;
  border: none;
  border-radius: 9px;
  background: var(--brand, #4f46e5);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.hqt-cw__send:hover { filter: brightness(.94); }
.hqt-cw__send:disabled { opacity: .55; cursor: not-allowed; }

.hqt-cw__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  max-width: 900px;
  margin: 8px auto 0;
  font-size: 11.5px;
  color: #98a1b3;
}
.hqt-cw__foot a { color: var(--brand, #4f46e5); text-decoration: none; }
.hqt-cw__foot a:hover { text-decoration: underline; }

.hqt-cw__err {
  display: none;
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #fdf0f0;
  border: 1px solid #f7d6d6;
  color: #b83a3a;
  font-size: 12.5px;
  line-height: 1.5;
}
.hqt-cw__err.is-on { display: block; }

/* ---------------- 悬浮按钮上的未读红点 ---------------- */
.hqt-chat-dot {
  position: absolute;
  top: 6px; right: 8px;
  min-width: 8px; height: 8px;
  border-radius: 50%;
  background: #c0392b;
  box-shadow: 0 0 0 2px #fff;
}

/* ---------------- 手机：整屏 ---------------- */
@media (max-width: 900px) {
  .hqt-cw__qs { grid-template-columns: 1fr; }
  .hqt-cw__q { text-align: center; }
  .hqt-cw__row { flex-wrap: wrap; }
  .hqt-cw__foot { flex-wrap: wrap; justify-content: flex-start; gap: 4px 14px; }
}

@media (max-width: 640px) {
  .hqt-cw__panel {
    inset: 0;
    right: 0; bottom: 0;
    width: auto;
    max-height: none;
    height: 100%;
    border-radius: 0;
    border: none;
  }
  .hqt-cw__bd { max-height: none; }
  .hqt-cw__ta { height: 74px; }
  body.hqt-cw-open { overflow: hidden; }
  /* 登录后台的人看自己站点时，顶部有一条固定工具栏（手机 46px），
     不避开就会把「在线留言」标题和关闭按钮压住 —— 老板验收时正是登录状态。 */
  body.admin-bar .hqt-cw__panel { top: 46px; height: calc(100% - 46px); }
}

/* ===== 引导留联系方式：卡片式（2026-11-15 第二轮） =====
   老板：「现在的显示效果太不明显了，没有很好的引导作用」。
   原来是一行 12.5px 灰色虚线小字居中 —— 在整个白底聊天流里，它长得像系统通知，
   客户直接划过去；而且看完了还得自己切回底部输入框打号码，这一步又筛掉一批人。
   现在：淡靛蓝卡片把眼睛拉住 + 现场给输入框和提交按钮，填完就地变绿色确认条。
   颜色只用品牌靛蓝一个色系，不新增第二套语言。 */
.hqt-cw__ask {
  /* 用 width 而不是 max-width：里面输入框是 flex:1，基准宽度为 0，
     只写 max-width 时卡片会按标题文字收缩成一小块，输入框被挤成一条缝。 */
  width: min(620px, 94%);
  max-width: 100%;
  align-self: flex-start;   /* 消息区是 flex column，不写会被拉满整行 */
  margin: 6px 0 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #eef0fe;
  border: 1px solid #d9ddfb;
}
.hqt-cw__ask-hd { display: flex; gap: 10px; align-items: flex-start; }
/* 图标块做成实心靛蓝：淡底 + 细线图标在浅蓝卡上等于没有，起不到「锚点」作用 */
.hqt-cw__ask-ic {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  border-radius: 10px;
  background: var(--brand, #4f46e5);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.hqt-cw__ask-ic svg { width: 18px; height: 18px; }
.hqt-cw__ask-tx { min-width: 0; }
.hqt-cw__ask-tx b {
  display: block;
  font-size: 15px; font-weight: 600; line-height: 1.45;
  color: #2b2680;
}
.hqt-cw__ask-tx span {
  display: block; margin-top: 3px;
  font-size: 13px; line-height: 1.6;
  color: #4a4699;
}
.hqt-cw__ask-row { display: flex; gap: 8px; margin-top: 12px; }
/* min-width:0 是必须的：flex 子项默认 auto，input 会按自身宽度撑破卡片 */
.hqt-cw__ask-in {
  flex: 1 1 0; min-width: 0;
  height: 40px; padding: 0 12px;
  border: 1px solid #c9cff7; border-radius: 9px;
  background: #fff; color: #232a3d;
  font: inherit; font-size: 14px;
}
.hqt-cw__ask-in::placeholder { color: #a2a8c0; }
.hqt-cw__ask-in:focus {
  outline: none; border-color: var(--brand, #4f46e5);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .14);
}
.hqt-cw__ask-btn {
  flex: 0 0 auto;
  height: 40px; padding: 0 20px;
  border: 0; border-radius: 9px;
  background: var(--brand, #4f46e5); color: #fff;
  font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer;
}
.hqt-cw__ask-btn:hover { background: #4338ca; }
.hqt-cw__ask-btn:disabled { opacity: .6; cursor: default; }
.hqt-cw__ask-err { margin-top: 7px; font-size: 12px; line-height: 1.5; color: #d93a42; }
.hqt-cw__ask-err:empty { display: none; }

/* 填完之后：卡片消失，留一条绿色确认，客户知道确实送到了。
   宽度跟着内容走 —— 定宽会在右边留一大片空绿，看着像加载没完成。 */
.hqt-cw__ok {
  display: inline-block;
  align-self: flex-start;   /* 同上：flex 子项默认 stretch，会拉成一整条 */
  margin: 2px 0 12px;
  padding: 9px 15px;
  border-radius: 9px;
  background: #eaf7ef;
  border: 1px solid #cfe9d8;
  color: #12673a;
  font-size: 13.5px; line-height: 1.6;
}
.hqt-cw__ok::before { content: '✓'; margin-right: 7px; font-weight: 700; }

@media (max-width: 640px) {
  /* 手机整屏，卡片可以占满，输入框别被挤成一条缝 */
  .hqt-cw__ask { width: 100%; max-width: 100%; padding: 13px 14px; }
  .hqt-cw__ok { max-width: 100%; }
  .hqt-cw__ask-btn { padding: 0 16px; }
}
