/* 官网留资窗 · 右下角在线客服对话组件（微盟风格） */
#llbcLeadRoot {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* 悬浮气泡 */
.llbc-lead-bubble {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0066FF 0%, #1a3b85 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 102, 255, .35);
  position: relative;
  transition: transform .2s ease;
}
.llbc-lead-bubble:hover { transform: scale(1.06); }
.llbc-lead-bubble .llbc-lead-bubble-tip {
  position: absolute;
  top: -6px; right: -6px;
  background: #ff3b30;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 10px;
}

/* 面板 */
.llbc-lead-panel {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9995;
  width: 340px;
  max-width: calc(100vw - 36px);
  height: 520px;
  max-height: calc(100vh - 40px);
  background: #f5f7fa;
  border: 0.5px solid #e4e9f0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(26, 59, 133, .22);
  display: flex;
  flex-direction: column;
}
.llbc-lead-panel[hidden] { display: none; }

/* 顶部品牌头栏 */
.llbc-lead-head {
  background: linear-gradient(135deg, #1a3b85 0%, #0066FF 100%);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.llbc-lead-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600; flex-shrink: 0;
}
.llbc-lead-head-main { flex: 1; min-width: 0; }
.llbc-lead-title { font-size: 15px; font-weight: 600; line-height: 1.2; }
.llbc-lead-status { font-size: 12px; opacity: .9; margin-top: 3px; display: flex; align-items: center; gap: 5px; }
.llbc-lead-status .dot {
  width: 7px; height: 7px; border-radius: 50%; background: #2bd47a;
  box-shadow: 0 0 0 2px rgba(43,212,122,.25);
}
.llbc-lead-close {
  background: transparent; border: none; color: rgba(255,255,255,.9);
  font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; flex-shrink: 0;
}
.llbc-lead-close:hover { color: #fff; }

/* 对话区域 */
.llbc-lead-chat {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.llbc-msg { display: flex; gap: 8px; align-items: flex-start; }
.llbc-msg-service .llbc-msg-avatar {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  background: #1a3b85; color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
}
.llbc-msg-visitor { flex-direction: row-reverse; }
.llbc-msg-visitor .llbc-msg-avatar {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  background: #0066FF; color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
}
.llbc-bubble {
  max-width: 78%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}
.llbc-msg-service .llbc-bubble {
  background: #fff;
  color: #1f2937;
  border-top-left-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.llbc-msg-visitor .llbc-bubble {
  background: #0066FF;
  color: #fff;
  border-top-right-radius: 2px;
}
.llbc-msg-time { font-size: 11px; color: #9aa4b2; margin-top: 4px; }

/* 表单卡片（嵌入对话流） */
.llbc-lead-card {
  background: #fff;
  border: 1px solid #e4e9fA;
  border-radius: 12px;
  padding: 12px;
  width: 100%;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.llbc-lead-card-title { font-size: 13px; font-weight: 600; color: #1a3b85; margin-bottom: 10px; }
.llbc-lead-form input,
.llbc-lead-form select,
.llbc-lead-form textarea {
  width: 100%; box-sizing: border-box;
  padding: 9px 10px; margin-bottom: 9px;
  border: 1px solid #d9e1ee; border-radius: 8px;
  font-size: 13px; color: #333; background: #fff;
  font-family: inherit;
}
.llbc-lead-form textarea { resize: vertical; min-height: 52px; }
.llbc-lead-form input:focus,
.llbc-lead-form select:focus,
.llbc-lead-form textarea:focus {
  outline: none; border-color: #0066FF; box-shadow: 0 0 0 3px rgba(0,102,255,.12);
}
.llbc-lead-submit {
  width: 100%; background: #0066FF; color: #fff; border: none;
  border-radius: 8px; padding: 11px; font-size: 14px; font-weight: 600;
  cursor: pointer; margin-top: 2px;
}
.llbc-lead-submit:disabled { opacity: .6; cursor: default; }
.llbc-lead-privacy { font-size: 11px; color: #9aa4b2; text-align: center; margin-top: 8px; }
.llbc-lead-err { font-size: 12px; color: #e24b4a; margin: -4px 0 8px; min-height: 14px; }

/* 底部输入栏 */
.llbc-lead-foot {
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid #e4e9f0;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.llbc-lead-foot .llbc-emoji { font-size: 20px; cursor: pointer; user-select: none; flex-shrink: 0; }
.llbc-lead-foot input {
  flex: 1;
  border: 1px solid #e1e6ee;
  border-radius: 18px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.llbc-lead-foot input:focus { border-color: #0066FF; }
.llbc-lead-send {
  background: #0066FF; color: #fff; border: none; border-radius: 18px;
  padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; flex-shrink: 0;
}
.llbc-lead-send:disabled { opacity: .5; cursor: default; }

/* 成功态 */
.llbc-lead-success { text-align: center; padding: 8px 0; }
.llbc-lead-success .ok-icon {
  width: 40px; height: 40px; border-radius: 50%; background: #eaf3de;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 8px;
}

/* 深色主题适配 */
[data-theme="dark"] .llbc-lead-panel { background: #161e29; border-color: #2a3543; }
[data-theme="dark"] .llbc-lead-chat { background: #161e29; }
[data-theme="dark"] .llbc-msg-service .llbc-bubble { background: #22304a; color: #e6ebf2; }
[data-theme="dark"] .llbc-lead-card { background: #1f2937; border-color: #2a3543; }
[data-theme="dark"] .llbc-lead-card-title { color: #6ea8ff; }
[data-theme="dark"] .llbc-lead-form input,
[data-theme="dark"] .llbc-lead-form select,
[data-theme="dark"] .llbc-lead-form textarea { background: #111820; border-color: #2a3543; color: #e6ebf2; }
[data-theme="dark"] .llbc-lead-foot { background: #1f2937; border-color: #2a3543; }
[data-theme="dark"] .llbc-lead-foot input { background: #111820; border-color: #2a3543; color: #e6ebf2; }
[data-theme="dark"] .llbc-lead-privacy,
[data-theme="dark"] .llbc-msg-time { color: #8a96a8; }

/* 移动端：底部全宽抽屉（PC 端保持右下角弹窗） */
@media (max-width: 768px) {
  .llbc-lead-bubble {
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .llbc-lead-panel {
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    max-width: 100%;
    height: 88vh;
    max-height: 88vh;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 40px rgba(26, 59, 133, .25);
  }
  .llbc-lead-head { padding: 14px; }
  .llbc-lead-chat { padding: 14px 12px 8px; }
  .llbc-bubble { max-width: 84%; }
  .llbc-lead-foot {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  }
}

/* ═══ 移动端底部常驻咨询条（微盟风格）：电话 + 在线 ═══ */
.llbc-mobile-bar { display: none; }

@media (max-width: 768px) {
  /* 气泡被常驻条取代 */
  .llbc-lead-bubble { display: none !important; }
  /* 常驻条占位，避免遮挡页脚内容 */
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }

  .llbc-mobile-bar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 9990;
    gap: 10px;
    padding: 9px 12px calc(9px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 0.5px solid #e4e9f0;
    box-shadow: 0 -4px 20px rgba(26, 59, 133, .10);
  }
  .llbc-bar-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 46px;
    border: none;
    border-radius: 23px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform .15s ease, opacity .15s ease;
  }
  .llbc-bar-btn:active { transform: scale(.97); opacity: .92; }
  .llbc-bar-phone {
    background: linear-gradient(135deg, #07c160 0%, #05a050 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(7, 193, 96, .28);
  }
  .llbc-bar-chat {
    background: linear-gradient(135deg, #0066FF 0%, #1a3b85 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 102, 255, .28);
  }
  /* 面板打开时常驻条退场（抽屉 88vh 已覆盖，双保险） */
  #llbcLeadRoot:has(.llbc-lead-panel:not([hidden])) .llbc-mobile-bar { display: none; }
}

/* ═══ 移动端互动弹窗：底部抽屉卡片（15s 首弹 / 1 分钟再弹）═══ */
.llbc-engage-mask {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(15, 23, 42, .48);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
.llbc-engage-mask.show { opacity: 1; visibility: visible; }
.llbc-engage-sheet {
  width: 100%;
  max-width: 460px;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 24px 20px calc(18px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  transform: translateY(100%);
  transition: transform .32s cubic-bezier(.2, .8, .3, 1);
}
.llbc-engage-mask.show .llbc-engage-sheet { transform: translateY(0); }
.llbc-engage-avatar {
  width: 54px; height: 54px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a3b85 0%, #0066FF 100%);
  color: #fff;
  font-size: 22px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(0, 102, 255, .30);
}
.llbc-engage-title { font-size: 18px; font-weight: 700; color: #1f2937; }
.llbc-engage-desc { font-size: 13px; color: #6b7686; margin: 6px 0 18px; }
.llbc-engage-actions { display: flex; gap: 10px; }
.llbc-engage-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 14px 8px 12px;
  border: none;
  border-radius: 14px;
  color: #fff;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s ease;
}
.llbc-engage-btn:active { transform: scale(.97); }
.llbc-engage-btn-main { font-size: 15px; font-weight: 700; }
.llbc-engage-btn-sub { font-size: 11px; opacity: .92; }
.llbc-engage-phone {
  background: linear-gradient(135deg, #07c160 0%, #05a050 100%);
  box-shadow: 0 5px 14px rgba(7, 193, 96, .30);
}
.llbc-engage-chat {
  background: linear-gradient(135deg, #0066FF 0%, #1a3b85 100%);
  box-shadow: 0 5px 14px rgba(0, 102, 255, .30);
}
.llbc-engage-later {
  background: none;
  border: none;
  margin-top: 14px;
  padding: 8px 20px;
  font-size: 13px;
  color: #9aa4b2;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.llbc-engage-later:active { color: #6b7686; }

/* 深色主题适配（常驻条 + 互动弹窗） */
[data-theme="dark"] .llbc-mobile-bar { background: #1f2937; border-top-color: #2a3543; }
[data-theme="dark"] .llbc-engage-sheet { background: #1f2937; }
[data-theme="dark"] .llbc-engage-title { color: #e6ebf2; }
[data-theme="dark"] .llbc-engage-desc { color: #8a96a8; }

/* 窄屏弹窗按钮堆叠 */
@media (max-width: 350px) {
  .llbc-engage-actions { flex-direction: column; }
  .llbc-engage-btn { flex-direction: row; justify-content: center; gap: 8px; padding: 12px; }
}
