/* ============ 在线咨询 / 留言浮窗 ============ */
.lf-chat-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1080;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

.lf-chat-fab {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #1c2b4a, #2b4a7f);
  color: #fff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(18, 36, 66, 0.35);
  position: relative;
  transition: transform .2s;
}
.lf-chat-fab:hover { transform: scale(1.06); }
.lf-chat-fab .bi-chat-dots { font-size: 26px; }
.lf-chat-fab .lf-state-dot {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #6c757d;
}
.lf-chat-fab.online .lf-state-dot { background: #28a745; }
.lf-chat-fab.offline .lf-state-dot { background: #adb5bd; }

.lf-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 94px;
  width: 420px;
  max-width: calc(100vw - 40px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(18, 36, 66, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.98);
  pointer-events: none;
  transition: opacity .22s, transform .22s;
}
.lf-chat-panel.open { opacity: 1; transform: none; pointer-events: auto; }

.lf-chat-head {
  background: linear-gradient(135deg, #1c2b4a, #2b4a7f);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.lf-chat-head .lf-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #d9b36a;
  color: #1c2b4a;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.lf-chat-head .lf-title { line-height: 1.3; }
.lf-chat-head .lf-title b { font-size: 15px; }
.lf-chat-head .lf-status { font-size: 12px; opacity: .92; }
.lf-chat-head .lf-status .dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #28a745; margin-right: 5px;
}
.lf-chat-head .lf-status.off .dot { background: #adb5bd; }
.lf-chat-close {
  margin-left: auto;
  background: none; border: none; color: rgba(255,255,255,.85);
  font-size: 18px; cursor: pointer;
}

.lf-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #f4f6fa;
}

/* 消息气泡 */
.lf-msg { display: flex; margin-bottom: 12px; }
.lf-msg .lf-bubble {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}
.lf-msg.visitor { justify-content: flex-end; }
.lf-msg.visitor .lf-bubble {
  background: #2b4a7f;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.lf-msg.admin .lf-bubble {
  background: #fff;
  color: #1c2b4a;
  border: 1px solid #e3e9f2;
  border-bottom-left-radius: 4px;
}
.lf-msg .lf-meta { font-size: 11px; color: #8a94a6; margin: 3px 4px 0; }
.lf-msg.visitor .lf-meta { text-align: right; }

.lf-chat-tip {
  text-align: center;
  font-size: 12px;
  color: #8a94a6;
  margin: 4px 0 12px;
}

/* 输入区 */
.lf-chat-input { border-top: 1px solid #e6ebf3; padding: 12px 14px; background: #fff; }
.lf-chat-input .lf-name-row {
  display: flex; gap: 8px; margin-bottom: 8px;
}
.lf-chat-input .lf-name-row input {
  flex: 1;
  border: 1px solid #dfe5ef;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
}
.lf-chat-input .lf-name-row input:focus { border-color: #2b4a7f; }
.lf-chat-input .lf-send-row { display: flex; gap: 8px; align-items: flex-end; }
.lf-chat-input textarea {
  flex: 1;
  border: 1px solid #dfe5ef;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  resize: none;
  outline: none;
  min-height: 46px;
  max-height: 110px;
  font-family: inherit;
}
.lf-chat-input textarea:focus { border-color: #2b4a7f; }
.lf-chat-send {
  width: 50px; height: 46px;
  border: none; border-radius: 8px;
  background: #2b4a7f; color: #fff;
  font-size: 16px;
  cursor: pointer;
}
.lf-chat-send:disabled { background: #b9c3d4; cursor: not-allowed; }

/* 留言表单（离线）与咨询资料表单（在线首访）共用：表单渲染在可滚动消息区，作为白色卡片展示 */
.lf-leave-form, .lf-consult-form {
  background: #fff;
  border: 1px solid #e6ebf3;
  border-radius: 12px;
  padding: 14px 16px 16px;
}
.lf-form-tip { font-size: 12px; color: #8a94a6; margin-bottom: 10px; line-height: 1.5; }
.lf-leave-form label, .lf-consult-form label { font-size: 13px; color: #3a465c; margin: 7px 0 3px; display: block; }
.lf-leave-form input, .lf-leave-form textarea,
.lf-consult-form input, .lf-consult-form textarea,
.lf-leave-form select, .lf-consult-form select {
  width: 100%;
  border: 1px solid #dfe5ef;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.lf-leave-form input:focus, .lf-leave-form textarea:focus,
.lf-consult-form input:focus, .lf-consult-form textarea:focus,
.lf-leave-form select:focus, .lf-consult-form select:focus { border-color: #2b4a7f; }
.lf-leave-submit {
  width: 100%;
  margin-top: 14px;
  padding: 11px;
  border: none; border-radius: 8px;
  background: linear-gradient(135deg, #1c2b4a, #2b4a7f);
  color: #fff; font-size: 15px;
  cursor: pointer;
}
.lf-leave-submit:disabled { opacity: .6; cursor: not-allowed; }
.lf-leave-ok {
  text-align: center;
  padding: 28px 12px;
  color: #3a465c;
}
.lf-leave-ok .bi { font-size: 42px; color: #28a745; display: block; margin-bottom: 10px; }

/* 自定义咨询领域下拉（div 实现，兼容内嵌浏览器，避免原生 select 下拉被裁剪） */
.lf-area-select { position: relative; }
.lf-area-trigger {
  width: 100%;
  border: 1px solid #dfe5ef;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: #fff;
  color: #3a465c;
  box-sizing: border-box;
}
.lf-area-trigger .placeholder { color: #8a94a6; }
.lf-area-trigger .bi { color: #8a94a6; font-size: 12px; }
.lf-area-options {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #dfe5ef;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(18, 36, 66, 0.15);
  max-height: 156px;
  overflow-y: auto;
  z-index: 120;
}
.lf-area-options .opt { padding: 7px 12px; font-size: 13px; color: #3a465c; cursor: pointer; }
.lf-area-options .opt:hover { background: #eef3fa; }
.lf-area-options .opt.selected { background: #eef3fa; color: #1f4e8c; font-weight: 600; }

@media (max-width: 480px) {
  .lf-chat-panel { right: 10px; bottom: 86px; width: calc(100vw - 20px); }
  .lf-chat-fab { right: 0; bottom: 0; }
}
