/* ===== 前台在线客服悬浮窗样式 ===== */
.kefu-fab {
  position: fixed;
  right: 18px;
  bottom: 96px;
  z-index: 9990;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2f6bff, #6a3bff);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 6px 18px rgba(47, 107, 255, 0.4);
  cursor: pointer;
  transition: transform 0.15s;
}
.kefu-fab:hover { transform: scale(1.06); }
.kefu-fab-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ff4757;
  border: 2px solid #fff;
  animation: kefuPulse 1.2s infinite;
}
@keyframes kefuPulse { 0%,100% { transform: scale(1);} 50% { transform: scale(1.25);} }

.kefu-panel {
  position: fixed;
  right: 18px;
  bottom: 158px;
  z-index: 9991;
  width: 370px;
  height: 560px;
  max-height: calc(100vh - 190px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  border: 1px solid #eef1f6;
}
.kefu-p-head {
  padding: 12px 14px;
  color: #fff;
  background: linear-gradient(135deg, #2f6bff, #6a3bff);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.kefu-p-title { font-size: 15px; font-weight: 600; }
.kefu-p-status { font-size: 12px; opacity: 0.92; margin-top: 2px; }
.kefu-p-ops { display: flex; gap: 10px; align-items: center; }
.kefu-p-btn {
  font-size: 12px;
  cursor: pointer;
  opacity: 0.95;
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 4px;
}
.kefu-p-btn:hover { background: rgba(255, 255, 255, 0.15); }
.kefu-p-close { font-size: 20px; line-height: 1; border: none; padding: 0 4px; }

.kefu-p-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  background: #f5f7fb;
}
.kefu-msg { display: flex; margin-bottom: 12px; }
.kefu-msg.user { justify-content: flex-end; }
.kefu-msg .kefu-av {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e3e8f5;
  color: #7b8db5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.kefu-msg.user .kefu-av { margin-left: 8px; background: linear-gradient(135deg, #2f6bff, #6a3bff); color: #fff; }
.kefu-msg.agent .kefu-av { margin-right: 8px; }
.kefu-bubble {
  max-width: 75%;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}
.kefu-msg.user .kefu-bubble { background: #2f6bff; color: #fff; border-top-right-radius: 2px; }
.kefu-msg.agent .kefu-bubble { background: #fff; color: #333; border: 1px solid #eef1f6; border-top-left-radius: 2px; }
.kefu-bubble img.kefu-img {
  max-width: 180px;
  max-height: 200px;
  border-radius: 6px;
  display: block;
  cursor: pointer;
}
.kefu-time { font-size: 11px; color: #b0b8c8; margin: 3px 0 0 38px; }
.kefu-msg.user .kefu-time { text-align: right; margin: 3px 8px 0 0; }

.kefu-card {
  width: 230px;
  background: #fff;
  border: 1px solid #e6eaf3;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.kefu-card img { width: 100%; height: 130px; object-fit: cover; display: block; background: #f2f4f9; }
.kefu-card .kc-info { padding: 8px 10px; }
.kefu-card .kc-name {
  font-size: 13px;
  color: #333;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kefu-card .kc-price { color: #ff2e63; font-size: 15px; font-weight: 700; margin-top: 4px; }
.kefu-sys { text-align: center; color: #9aa4b8; font-size: 12px; margin: 10px 0; }

.kefu-p-tools {
  display: flex;
  align-items: center;
  padding: 6px 8px 0;
  gap: 2px;
  border-top: 1px solid #eef1f6;
  flex-shrink: 0;
}
.kefu-tool {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  color: #5a6478;
  font-size: 19px;
}
.kefu-tool:hover { background: #f0f3fa; }

.kefu-emoji-panel {
  height: 148px;
  overflow-y: auto;
  background: #fff;
  border-top: 1px solid #eef1f6;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  flex-shrink: 0;
}
.kefu-emoji-panel span {
  font-size: 22px;
  text-align: center;
  cursor: pointer;
  padding: 3px 0;
  border-radius: 4px;
  line-height: 1.4;
}
.kefu-emoji-panel span:hover { background: #f0f3fa; }

.kefu-p-input {
  display: flex;
  padding: 8px 10px 12px;
  gap: 8px;
  align-items: flex-end;
  border-top: 1px solid #eef1f6;
  flex-shrink: 0;
}
.kefu-p-input textarea {
  flex: 1;
  resize: none;
  border: 1px solid #e3e8f3;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  height: 38px;
  max-height: 90px;
  line-height: 1.4;
  outline: none;
  font-family: inherit;
}
.kefu-p-input textarea:focus { border-color: #2f6bff; }
.kefu-p-send {
  padding: 0 16px;
  height: 38px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #2f6bff, #6a3bff);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.kefu-p-send:disabled { opacity: 0.5; cursor: not-allowed; }

.kefu-ended { text-align: center; padding: 24px 0; color: #9aa4b8; font-size: 13px; }

@media (max-width: 768px) {
  .kefu-fab { right: 14px; bottom: 76px; }
  .kefu-panel { right: 8px; left: 8px; bottom: 76px; width: auto; height: 72vh; max-height: none; }
}
