/* ==========================================================
   ZKBKW 在线客服 · 独立样式（不影响站点原有样式）
   ========================================================== */

.zkchat {
  --zc-brand: #1b62f5;
  --zc-brand-2: #2b74ff;
  --zc-brand-dark: #1049ce;
  --zc-ink: #15181e;
  --zc-ink-700: #3b4553;
  --zc-ink-500: #6c7686;
  --zc-ink-400: #98a1ae;
  --zc-line: #e7ebf1;
  --zc-line-soft: #eef1f6;
  --zc-bg: #f5f7fa;
  --zc-green: #00a870;
  --zc-amber: #b25e00;
  --zc-amber-bg: #fff4e5;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- 悬浮启动按钮 ---------------- */
.zkchat-launcher {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: 62px;
  height: 62px;
  border: 0;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  z-index: 2147483000;
  background: linear-gradient(140deg, #3b7cff 0%, #1b62f5 48%, #1049ce 100%);
  box-shadow: 0 10px 28px rgba(27, 98, 245, 0.36), 0 2px 8px rgba(16, 73, 206, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.28s ease;
  -webkit-tap-highlight-color: transparent;
}
.zkchat-launcher:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 14px 34px rgba(27, 98, 245, 0.42), 0 2px 8px rgba(16, 73, 206, 0.3);
}
.zkchat-launcher:active { transform: scale(0.95); }
.zkchat-launcher svg { width: 30px; height: 30px; display: block; }

.zkchat-launcher .zkchat-ping {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(27, 98, 245, 0.45);
  animation: zkchat-ping 2.6s ease-out infinite;
  pointer-events: none;
}
@keyframes zkchat-ping {
  0% { transform: scale(1); opacity: 0.7; }
  70% { transform: scale(1.45); opacity: 0; }
  100% { transform: scale(1.45); opacity: 0; }
}

.zkchat-launcher .zkchat-dot {
  position: absolute;
  right: 3px;
  bottom: 4px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--zc-green);
  border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
}
.zkchat-launcher .zkchat-unread {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: 11px;
  background: #ff3b30;
  border: 2px solid #fff;
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  display: none;
}
.zkchat-launcher.has-unread .zkchat-unread { display: block; }
.zkchat-launcher.has-unread .zkchat-ping { display: none; }

/* 首次进入的提示气泡 */
.zkchat-tip {
  position: fixed;
  right: 92px;
  bottom: calc(33px + env(safe-area-inset-bottom, 0px));
  max-width: 220px;
  padding: 10px 14px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(16, 30, 60, 0.14), 0 2px 8px rgba(16, 30, 60, 0.06);
  color: var(--zc-ink-700);
  font-size: 13.5px;
  line-height: 1.5;
  z-index: 2147482999;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
  cursor: pointer;
}
.zkchat-tip.show { opacity: 1; transform: translateX(0); pointer-events: auto; }
.zkchat-tip::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: 16px;
  width: 12px;
  height: 12px;
  background: #fff;
  transform: rotate(45deg);
  border-radius: 2px;
}

/* ---------------- 聊天面板 ---------------- */
.zkchat-panel {
  position: fixed;
  right: 20px;
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  width: 396px;
  height: min(660px, calc(100vh - 132px));
  background: #fff;
  border-radius: 22px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 2147483001;
  box-shadow: 0 28px 70px rgba(12, 26, 54, 0.22), 0 6px 18px rgba(12, 26, 54, 0.08);
  transform-origin: bottom right;
  transform: translateY(14px) scale(0.96);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.24s ease, visibility 0.24s;
}
.zkchat-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
}

/* 头部 */
.zkchat-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 14px 13px 16px;
  background: linear-gradient(135deg, #2b74ff 0%, #1b62f5 46%, #1049ce 100%);
  color: #fff;
  position: relative;
}
.zkchat-head::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120px 60px at 12% 0%, rgba(255, 255, 255, 0.22), transparent 70%);
  pointer-events: none;
}
.zkchat-ava {
  position: relative;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 1.5px solid rgba(255, 255, 255, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.zkchat-ava svg { width: 24px; height: 24px; }
.zkchat-ava .zkchat-online {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #2ee08a;
  border: 2px solid #1b62f5;
}
.zkchat-id { min-width: 0; flex: 1; }
.zkchat-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.zkchat-sub {
  margin-top: 2px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.82);
  display: flex;
  align-items: center;
  gap: 5px;
}
.zkchat-sub i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #2ee08a;
  box-shadow: 0 0 0 3px rgba(46, 224, 138, 0.22);
}
.zkchat-hd-actions { display: flex; align-items: center; gap: 4px; }
.zkchat-hbtn {
  width: 32px;
  height: 32px;
  border: 0;
  padding: 0;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.zkchat-hbtn:hover { background: rgba(255, 255, 255, 0.18); }
.zkchat-hbtn svg { width: 18px; height: 18px; }

/* 消息区 */
.zkchat-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(circle at 100% 0, rgba(27, 98, 245, 0.045), transparent 46%),
    var(--zc-bg);
  padding: 16px 13px 6px;
  scrollbar-width: thin;
}
.zkchat-body::-webkit-scrollbar { width: 6px; }
.zkchat-body::-webkit-scrollbar-thumb { background: #d7dde7; border-radius: 3px; }
.zkchat-body::-webkit-scrollbar-track { background: transparent; }

.zkchat-time {
  text-align: center;
  font-size: 11px;
  color: var(--zc-ink-400);
  margin: 4px 0 14px;
}
.zkchat-time span {
  background: rgba(228, 234, 243, 0.85);
  padding: 3px 10px;
  border-radius: 10px;
}

.zkchat-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 13px;
  animation: zkchat-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes zkchat-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.zkchat-row.bot { justify-content: flex-start; }
.zkchat-row.user { justify-content: flex-end; }

.zkchat-mini {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(140deg, #3b7cff, #1049ce);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
  box-shadow: 0 2px 6px rgba(27, 98, 245, 0.25);
}
.zkchat-mini svg { width: 16px; height: 16px; }
.zkchat-row.user .zkchat-mini { display: none; }

.zkchat-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 82%;
  min-width: 0;
  align-items: flex-start;
}
.zkchat-row.user .zkchat-stack { align-items: flex-end; }

.zkchat-bubble {
  max-width: 100%;
  padding: 10px 13px;
  font-size: 14.5px;
  line-height: 1.68;
  letter-spacing: 0.1px;
  white-space: pre-wrap;
  word-break: break-word;
}
.zkchat-row.bot .zkchat-bubble {
  background: #fff;
  color: var(--zc-ink);
  border-radius: 16px 16px 16px 5px;
  box-shadow: 0 1px 3px rgba(16, 30, 60, 0.07), 0 0 0 1px rgba(16, 30, 60, 0.03);
}
.zkchat-row.user .zkchat-bubble {
  background: linear-gradient(135deg, #2f78ff, #1b62f5);
  color: #fff;
  border-radius: 16px 16px 5px 16px;
  box-shadow: 0 3px 10px rgba(27, 98, 245, 0.26);
}

/* 气泡内的选项按钮 */
.zkchat-opts {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  max-width: 268px;
}
.zkchat-opt {
  border: 1px solid #d5e2fd;
  background: #fff;
  color: var(--zc-brand);
  font-size: 13.5px;
  padding: 9px 13px;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.16s ease;
  font-family: inherit;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
.zkchat-opt:hover {
  background: #f0f5ff;
  border-color: #b9cffb;
  transform: translateX(2px);
}
.zkchat-opt:active { transform: scale(0.98); }

/* 卡片 */
.zkchat-card {
  background: #fff;
  border: 1px solid var(--zc-line-soft);
  border-radius: 15px;
  padding: 13px 14px;
  box-shadow: 0 2px 8px rgba(16, 30, 60, 0.05);
  width: 100%;
  box-sizing: border-box;
  font-size: 13.5px;
}
.zkchat-card-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--zc-line);
  margin-bottom: 9px;
}
.zkchat-card-h b {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--zc-ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
}
.zkchat-pill {
  flex-shrink: 0;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 600;
  background: var(--zc-amber-bg);
  color: var(--zc-amber);
}
.zkchat-pill.blue { background: #f0f5ff; color: #1049ce; }
.zkchat-pill.green { background: #e8f8f1; color: #00754d; }
.zkchat-kv { display: flex; gap: 8px; margin-bottom: 6px; font-size: 13px; line-height: 1.5; }
.zkchat-kv:last-child { margin-bottom: 0; }
.zkchat-kv span { flex-shrink: 0; color: var(--zc-ink-400); min-width: 52px; }
.zkchat-kv em {
  font-style: normal;
  color: var(--zc-ink-700);
  word-break: break-all;
}
.zkchat-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.zkchat-chips i {
  font-style: normal;
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f0f5ff;
  color: #1049ce;
}
.zkchat-card-f {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--zc-ink-400);
  line-height: 1.5;
}

/* 联系方式表单卡 */
.zkchat-form { width: 100%; }
.zkchat-form input,
.zkchat-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--zc-line);
  background: #fbfcfe;
  border-radius: 11px;
  padding: 9px 11px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--zc-ink);
  margin-bottom: 8px;
  outline: none;
  transition: border-color 0.16s ease, background 0.16s ease;
  resize: none;
}
.zkchat-form input:focus,
.zkchat-form textarea:focus { border-color: #9dbcfa; background: #fff; }
.zkchat-form textarea { height: 58px; line-height: 1.5; }
.zkchat-form button {
  width: 100%;
  border: 0;
  border-radius: 11px;
  padding: 10px;
  background: linear-gradient(135deg, #2f78ff, #1b62f5);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(27, 98, 245, 0.25);
  transition: filter 0.16s ease;
}
.zkchat-form button:hover { filter: brightness(1.06); }
.zkchat-form .err { color: #e0342a; font-size: 12px; margin: -3px 0 7px; display: none; }
.zkchat-form .err.show { display: block; }

/* 正在输入 */
.zkchat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border-radius: 16px 16px 16px 5px;
  padding: 13px 15px;
  box-shadow: 0 1px 3px rgba(16, 30, 60, 0.07);
}
.zkchat-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b9c6d8;
  animation: zkchat-bounce 1.3s infinite ease-in-out;
}
.zkchat-typing i:nth-child(2) { animation-delay: 0.16s; }
.zkchat-typing i:nth-child(3) { animation-delay: 0.32s; }
@keyframes zkchat-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.55; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* 底部输入区 */
.zkchat-foot {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid var(--zc-line-soft);
}
.zkchat-plus {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: 1px solid var(--zc-line);
  background: #fff;
  border-radius: 11px;
  color: var(--zc-ink-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.16s ease;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}
.zkchat-plus:hover { border-color: #b9cffb; color: var(--zc-brand); background: #f7faff; }
.zkchat-plus svg { width: 19px; height: 19px; }

.zkchat-inputwrap {
  flex: 1;
  min-width: 0;
  background: var(--zc-bg);
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 4px 6px 4px 12px;
  display: flex;
  align-items: center;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.zkchat-inputwrap:focus-within { background: #fff; border-color: #c3d6fc; }
.zkchat-inputwrap textarea {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  resize: none;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--zc-ink);
  padding: 6px 0;
  max-height: 96px;
  box-sizing: border-box;
}
.zkchat-inputwrap textarea::placeholder { color: var(--zc-ink-400); }

.zkchat-send {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(140deg, #2f78ff, #1b62f5);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(27, 98, 245, 0.3);
  transition: transform 0.16s ease, opacity 0.16s ease, filter 0.16s ease;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.zkchat-send:hover { filter: brightness(1.08); transform: translateY(-1px); }
.zkchat-send:active { transform: scale(0.93); }
.zkchat-send svg { width: 18px; height: 18px; }
.zkchat-send[disabled] { opacity: 0.38; box-shadow: none; cursor: default; transform: none; }

/* ---------------- 抽屉（历史 / 常见问题） ---------------- */
.zkchat-sheet {
  position: absolute;
  inset: 0;
  background: #fff;
  z-index: 5;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  visibility: hidden;
}
.zkchat-sheet.open { transform: translateY(0); visibility: visible; }
.zkchat-sheet-h {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--zc-line-soft);
}
.zkchat-sheet-h b { font-size: 15px; font-weight: 600; color: var(--zc-ink); }
.zkchat-sheet-h button {
  border: 0;
  background: transparent;
  color: var(--zc-ink-500);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  font-family: inherit;
}
.zkchat-sheet-h button:hover { background: var(--zc-bg); color: var(--zc-brand); }
.zkchat-sheet-body { flex: 1; overflow-y: auto; padding: 12px 14px 20px; }

.zkchat-history-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 11px;
  border-radius: 13px;
  cursor: pointer;
  transition: background 0.16s ease;
  margin-bottom: 4px;
}
.zkchat-history-item:hover { background: var(--zc-bg); }
.zkchat-history-item.active { background: #f0f5ff; }
.zkchat-hist-ico {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 11px;
  background: #f0f5ff;
  color: var(--zc-brand);
  display: flex;
  align-items: center;
  justify-content: center;
}
.zkchat-hist-ico svg { width: 17px; height: 17px; }
.zkchat-hist-main { flex: 1; min-width: 0; }
.zkchat-hist-t {
  font-size: 13.5px;
  color: var(--zc-ink);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.zkchat-hist-s { font-size: 11.5px; color: var(--zc-ink-400); margin-top: 3px; }
.zkchat-hist-del {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--zc-ink-400);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.zkchat-hist-del:hover { background: #fff0ef; color: #e0342a; }
.zkchat-hist-del svg { width: 15px; height: 15px; }

.zkchat-qs-group { margin-bottom: 18px; }
.zkchat-qs-group h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--zc-ink-400);
  margin: 0 0 8px 3px;
  letter-spacing: 0.6px;
}
.zkchat-qs-list { display: flex; flex-direction: column; gap: 7px; }
.zkchat-qs-list button {
  border: 1px solid var(--zc-line-soft);
  background: #fff;
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 13.5px;
  color: var(--zc-ink-700);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.16s ease;
  line-height: 1.45;
}
.zkchat-qs-list button:hover {
  border-color: #c3d6fc;
  background: #f7faff;
  color: var(--zc-brand);
}

.zkchat-empty {
  text-align: center;
  color: var(--zc-ink-400);
  font-size: 13px;
  padding: 50px 20px;
  line-height: 1.7;
}

/* ---------------- 手机端全屏 ---------------- */
@media (max-width: 640px) {
  .zkchat-launcher {
    width: 56px;
    height: 56px;
    right: 15px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .zkchat-launcher svg { width: 27px; height: 27px; }
  .zkchat-tip { right: 80px; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); font-size: 13px; }

  .zkchat-panel {
    inset: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease, visibility 0.3s;
  }
  .zkchat-panel.open { transform: translateY(0); }
  .zkchat-head { padding: 14px 12px 14px 15px; }
  .zkchat-name { font-size: 15.5px; }
  .zkchat-bubble { font-size: 15px; }
  .zkchat-stack { max-width: 87%; }
  .zkchat-body { padding: 16px 12px 6px; }
  .zkchat-inputwrap textarea { font-size: 16px; }
}

/* 常见问题按钮：用文字代替 + 号，避免被当成上传文件 */
.zkchat-faq {
  width: auto;
  height: 44px;
  padding: 0 12px;
  border-radius: 13px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--zc-ink-500);
  background: #fff;
  align-self: flex-end;
}
.zkchat-faq:active { background: #f2f5fb; }
