/* ==========================================================================
   查56 · 网页端在线咨询组件（web-chat.css）
   --------------------------------------------------------------------------
   设计约束（重要，改样式前先读）：
   1. 配色只用站点既有色：导航蓝 #0a8ddf / 强调橙 #f85100 / 正文 #1f2d3d。
      红色 #e53935 是保留色，只允许出现在「未读角标」上。
   2. 全部类名以 .wc- 前缀 + 低特异性（单类选择器），不覆盖站点既有样式。
   3. 这是「人对人的工单」而不是 AI 客服：不做头像、不做"正在输入"、不做机器人标识。
   4. 页面上同时只应该有一颗橙色实心按钮 —— 当前动作（发送 / 进入咨询）。
   ========================================================================== */

:root {
  --wc-ink: #1f2d3d;
  --wc-ink2: #5b6b7c;
  --wc-blue: #0a8ddf;
  --wc-act: #f85100;
  --wc-line: #e7edf3;
  --wc-bg: #f6f8fa;
  --wc-new: #e53935;
  --wc-font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

/* ---------- 顶栏（首页顶部条）：登录 / 我的咨询 / 退出登录 ----------
   站点原布局是 .sui-brand(float:left) + ul.sui-nav(float:right) 分列两侧，
   两个浮动子元素让父级 .top-line 高度塌陷成 0（视觉高度全靠 .navbar-inner 的
   min-height:40px 撑着）；窗口一窄，右侧入口就被挤到第二行 —— 老板反馈的
   「欢迎来到…」和「我的咨询」上下两行就是这么来的。
   这里改成 flex 单行，并让左侧文案在极窄屏收缩为省略号，保证「永远一行」。 */
.sui-navbar .top-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
}
.sui-navbar .top-line > .sui-brand {
  flex: 0 1 auto;
  min-width: 0;
  float: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sui-navbar .top-line > ul.sui-nav {
  flex: 0 0 auto;
  float: none;
  display: flex;
  align-items: center;
  margin: 0;
}

.wc-top-entry {
  float: none;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 0;
  font-size: 12.5px;
  line-height: 26px;
  font-family: var(--wc-font);
  white-space: nowrap;
}
/* 用 li.wc-top-entry button 提高特异性，避免被站点 .sui-nav li a 之类的规则盖掉 */
li.wc-top-entry button {
  display: inline-block;
  height: 26px;
  padding: 0 12px;
  border: 1px solid var(--wc-blue);
  border-radius: 13px;
  background: #fff;
  color: var(--wc-blue);
  font-size: 12.5px;
  line-height: 24px;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  font-family: var(--wc-font);
}
li.wc-top-entry button:hover {
  background: var(--wc-blue);
  color: #fff;
  text-decoration: none;
}
/* 「退出登录」是低频动作，做成次要按钮（灰描边），不和「我的咨询」抢视线 */
li.wc-top-entry button.wc-top-out {
  border-color: var(--wc-line);
  color: var(--wc-ink2);
}
li.wc-top-entry button.wc-top-out:hover {
  background: var(--wc-bg);
  color: var(--wc-ink);
  border-color: #cdd8e0;
}
.wc-top-entry .wc-top-name {
  color: var(--wc-ink2);
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 窄屏时可隐藏的欢迎语（只留「客服热线：0731-89565657」） */
.sui-navbar .top-line .wc-hi { font-style: normal; }
.wc-top-badge {
  display: none;
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--wc-new);
  color: #fff;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.wc-top-badge.wc-on { display: block; }

/* 公共货源会话：多家公司都能回复 → 气泡顶部标注「哪家公司/谁」说的 */
.wc-bubble .wc-sender {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--wc-blue);
  margin-bottom: 2px;
}

/* ---------- 右侧贴边书签（右上角入口） ---------- */
.wc-tab {
  position: fixed;
  right: 0;
  top: 132px;
  z-index: 990;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px 10px 12px;
  background: #fff;
  border: 1px solid var(--wc-line);
  border-right: none;
  border-radius: 22px 0 0 22px;
  box-shadow: -2px 3px 12px rgba(31, 45, 61, .10);
  color: var(--wc-ink);
  font-family: var(--wc-font);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  position: fixed;
  transition: padding .16s ease, box-shadow .16s ease;
}
.wc-tab::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  border-radius: 0 2px 2px 0;
  background: var(--wc-act);
}
.wc-tab:hover { box-shadow: -3px 4px 16px rgba(31, 45, 61, .16); }
.wc-tab-ico { font-size: 14px; line-height: 1; }
.wc-tab-txt { white-space: nowrap; }
.wc-tab-new {
  display: none;
  color: var(--wc-new);
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.wc-tab.wc-hasnew .wc-tab-txt { display: none; }
.wc-tab.wc-hasnew .wc-tab-new { display: inline; }
.wc-tab.wc-hasnew { animation: wcPulse 1.6s ease-in-out 3; }
@keyframes wcPulse {
  0%, 100% { box-shadow: -2px 3px 12px rgba(31, 45, 61, .10); }
  50%      { box-shadow: -2px 3px 12px rgba(229, 57, 53, .45); }
}

/* ---------- 卡片上的「在线咨询」按钮（放在「时效」下面一行） ---------- */
.wc-consult-li {
  list-style: none;
  float: none;      /* 站点里信息列可能带 float，显式复位让它独占一行 */
  clear: both;
  display: block;
  margin: 8px 0 0;
}
.wc-btn-consult {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 14px;
  border: 1px solid var(--wc-act);
  border-radius: 4px;
  background: #fff;
  color: var(--wc-act);
  font-size: 13px;
  font-family: var(--wc-font);
  cursor: pointer;
  white-space: nowrap;
  transition: background .14s ease, color .14s ease;
}
.wc-btn-consult:hover { background: var(--wc-act); color: #fff; }
.wc-btn-consult .wc-btn-ico { font-size: 13px; line-height: 1; }

/* ---------- 遮罩 / 弹窗底座 ---------- */
.wc-mask {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(16, 24, 32, .48);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-family: var(--wc-font);
  -webkit-tap-highlight-color: transparent;
}
.wc-modal {
  position: relative;
  width: 380px;
  max-width: 100%;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(16, 24, 32, .24);
  display: flex;
  flex-direction: column;
  max-height: 78vh;
  overflow: hidden;
  animation: wcIn .18s ease-out;
}
.wc-modal.wc-modal-sm { width: 340px; }
@keyframes wcIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
.wc-head {
  flex: 0 0 auto;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--wc-line);
}
.wc-head-row { display: flex; align-items: baseline; gap: 8px; padding-right: 26px; }
.wc-head-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--wc-ink);
  letter-spacing: .01em;
  margin: 0;
  line-height: 1.3;
}
.wc-head-sub {
  font-size: 12px;
  color: var(--wc-ink2);
  margin: 5px 0 0;
  line-height: 1.5;
}
.wc-head-sub .wc-line-road { color: var(--wc-act); }
.wc-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #9aa7b4;
  font-size: 18px;
  line-height: 26px;
  cursor: pointer;
  padding: 0;
  font-family: var(--wc-font);
}
.wc-close:hover { background: var(--wc-bg); color: var(--wc-ink); }

/* ---------- 扫码登录弹窗 ---------- */
.wc-qr-wrap { padding: 20px 16px 18px; text-align: center; }
.wc-qr-box {
  width: 220px;
  height: 220px;
  margin: 0 auto;
  border: 1px solid var(--wc-line);
  border-radius: 10px;
  background: var(--wc-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.wc-qr-box img { width: 100%; height: 100%; object-fit: contain; display: block; }
.wc-qr-ph { font-size: 12.5px; color: #9aa7b4; line-height: 1.9; padding: 0 10px; }
.wc-qr-fail { font-size: 13px; color: var(--wc-new); line-height: 1.9; padding: 0 10px; }
.wc-qr-tip {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--wc-ink2);
  line-height: 1.8;
}
.wc-qr-tip b { color: var(--wc-ink); }
.wc-qr-why {
  margin: 12px 0 0;
  padding: 9px 12px;
  background: #fff7f2;
  border-radius: 8px;
  font-size: 12px;
  color: #8a6350;
  line-height: 1.7;
  text-align: left;
}
.wc-linkbtn {
  margin-top: 12px;
  border: none;
  background: none;
  color: var(--wc-blue);
  font-size: 12.5px;
  cursor: pointer;
  padding: 4px 6px;
  font-family: var(--wc-font);
}
.wc-linkbtn:hover { text-decoration: underline; }
.wc-hidden { display: none !important; }

/* ---------- 聊天弹窗 ---------- */
.wc-body {
  flex: 1 1 auto;
  overflow-y: auto;
  background: var(--wc-bg);
  padding: 14px 14px 6px;
  -webkit-overflow-scrolling: touch;
}
.wc-msg { display: flex; margin-bottom: 10px; }
.wc-msg.wc-me { justify-content: flex-end; }
.wc-bubble {
  max-width: 78%;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
  color: var(--wc-ink);
  background: #fff;
  border: 1px solid var(--wc-line);
}
.wc-msg.wc-me .wc-bubble {
  background: var(--wc-act);
  border-color: var(--wc-act);
  color: #fff;
}
.wc-msg.wc-sys { justify-content: center; margin: 6px 0 12px; }
.wc-msg.wc-sys .wc-bubble {
  background: transparent;
  border: none;
  color: #9aa7b4;
  font-size: 12px;
  padding: 2px 8px;
  text-align: center;
}
.wc-time {
  text-align: center;
  font-size: 11.5px;
  color: #9aa7b4;
  margin: 4px 0 10px;
  font-variant-numeric: tabular-nums;
}
.wc-empty {
  text-align: center;
  padding: 26px 18px 30px;
  color: var(--wc-ink2);
  font-size: 13px;
  line-height: 1.9;
}
.wc-empty b { color: var(--wc-ink); }

/* 会话列表（我的咨询） */
.wc-conv {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  border: none;
  border-bottom: 1px solid var(--wc-line);
  padding: 12px 14px;
  cursor: pointer;
  font-family: var(--wc-font);
}
.wc-conv:hover { background: #fafcfd; }
.wc-conv-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wc-conv-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--wc-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wc-conv-new {
  flex: 0 0 auto;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--wc-new);
  color: #fff;
  font-size: 11px;
  line-height: 17px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.wc-conv-sub {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--wc-ink2);
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wc-conv-meta {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: #9aa7b4;
  display: flex;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.wc-tag-wait { color: var(--wc-act); }
.wc-tag-reply { color: #2e9e5b; }

/* ---------- 输入区 ---------- */
.wc-foot {
  flex: 0 0 auto;
  border-top: 1px solid var(--wc-line);
  background: #fff;
  padding: 10px 12px 12px;
}
.wc-input-row { display: flex; gap: 8px; align-items: flex-end; }
.wc-input {
  flex: 1 1 auto;
  min-height: 40px;
  max-height: 104px;
  padding: 9px 11px;
  border: 1px solid var(--wc-line);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--wc-ink);
  resize: none;
  font-family: var(--wc-font);
  box-sizing: border-box;
}
.wc-input:focus { outline: none; border-color: var(--wc-blue); }
.wc-send {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: 8px;
  background: var(--wc-act);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  font-family: var(--wc-font);
}
.wc-send:hover { background: #e04a00; }
.wc-send:disabled { background: #d9dee3; cursor: default; }
.wc-foot-note {
  margin: 8px 0 0;
  font-size: 11.5px;
  color: #9aa7b4;
  line-height: 1.6;
}
.wc-foot-note a { color: var(--wc-blue); text-decoration: none; }

/* ---------- 轻提示 ---------- */
.wc-toast {
  position: fixed;
  left: 50%;
  top: 84px;
  transform: translateX(-50%);
  z-index: 100001;
  max-width: 76vw;
  padding: 9px 16px;
  border-radius: 18px;
  background: rgba(31, 45, 61, .92);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  font-family: var(--wc-font);
  box-shadow: 0 6px 20px rgba(16, 24, 32, .22);
  animation: wcIn .16s ease-out;
}

/* ---------- 键盘可达性 ---------- */
.wc-modal :focus-visible,
.wc-tab:focus-visible,
.wc-btn-consult:focus-visible,
li.wc-top-entry button:focus-visible {
  outline: 2px solid var(--wc-blue);
  outline-offset: 2px;
}

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  .wc-modal { width: 100%; max-height: 86vh; }
  .wc-tab { top: auto; bottom: 78px; font-size: 12.5px; padding: 9px 12px 9px 11px; }
  .wc-top-entry { margin-left: 0; gap: 6px; }
  .wc-top-entry .wc-top-name { display: none; }
  /* 窄屏只留「客服热线：…」，把位置让给右侧的登录 / 我的咨询 / 退出登录 */
  .sui-navbar .top-line .wc-hi { display: none; }
  li.wc-top-entry button { padding: 0 9px; font-size: 12px; }
  .wc-qr-box { width: 204px; height: 204px; }
}

/* ---------- 尊重 reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .wc-modal { animation: none; }
  .wc-tab.wc-hasnew { animation: none; }
  .wc-tab, .wc-btn-consult { transition: none; }
}
