/* 访客端在线客服挂件样式。
   配色沿用前台主色：主蓝 #1f5a96、辅青 #0f766e、正文 #0f172a。 */

.lcw {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  font-family: inherit;
  font-size: 14px;
}

/* 悬浮按钮：唯一的主操作入口 */
.lcw-launcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: #1f5a96;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
}

.lcw-launcher:hover { background: #17456f; }
.lcw-launcher:focus-visible { outline: 2px solid #0f766e; outline-offset: 2px; }

/* 未读角标 */
.lcw-badge {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #b91c1c;
  color: #fff;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
}

.lcw-badge[hidden] { display: none; }

/* 面板 */
.lcw-panel {
  width: 320px;
  margin-bottom: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.2);
  overflow: hidden;
}

.lcw-panel[hidden] { display: none; }

.lcw-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  padding: 12px 14px;
  background: #1f5a96;
  color: #fff;
}

.lcw-head strong { font-size: 15px; font-weight: 500; }
.lcw-head small { grid-column: 1; color: #dbeafe; font-size: 12px; }

.lcw-close {
  grid-row: 1 / span 2;
  grid-column: 2;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.lcw-close:hover { background: rgba(255, 255, 255, 0.16); }

/* 消息区：固定高度可滚动，长会话不会把面板顶出屏幕 */
.lcw-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 260px;
  padding: 12px;
  overflow-y: auto;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
}

.lcw-empty-log {
  margin: auto;
  color: #64748b;
  font-size: 13px;
  text-align: center;
}

.lcw-msg { display: flex; flex-direction: column; max-width: 85%; }
.lcw-msg--visitor { align-self: flex-end; align-items: flex-end; }
.lcw-msg--staff { align-self: flex-start; align-items: flex-start; }

.lcw-bubble {
  margin: 0;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.lcw-msg--visitor .lcw-bubble {
  background: #1f5a96;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.lcw-msg--staff .lcw-bubble {
  background: #fff;
  color: #0f172a;
  border: 1px solid #e6eef8;
  border-bottom-left-radius: 4px;
}

.lcw-time { margin-top: 2px; color: #64748b; font-size: 11px; }

/* 联系方式（选填，默认折叠） */
.lcw-contact { padding: 10px 12px 0; }
.lcw-contact summary {
  color: #1f5a96;
  font-size: 13px;
  cursor: pointer;
}

.lcw-field { margin: 8px 0 0; }

.lcw-field input,
.lcw-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  color: #0f172a;
  box-sizing: border-box;
}

.lcw-hint { margin: 6px 0 0; color: #64748b; font-size: 12px; line-height: 1.5; }

/* 输入区 */
.lcw-form { display: grid; gap: 8px; padding: 12px; }
.lcw-form textarea { resize: vertical; min-height: 68px; }

.lcw-send {
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  background: #0f766e;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.lcw-send:hover { background: #0b5c56; }
.lcw-send:disabled { background: #94a3b8; cursor: default; }
.lcw-send:focus-visible { outline: 2px solid #1f5a96; outline-offset: 2px; }

/* 状态提示：每一步操作后都立刻给结论 */
.lcw-status { margin: 0; padding: 0 12px 12px; color: #64748b; font-size: 12px; min-height: 16px; }
.lcw-status--error { color: #b91c1c; }

/* 读屏可用但不占视觉空间的标签 */
.lcw-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 窄屏改为底部铺满的抽屉，避免 320px 在小屏上挤成一团 */
@media (max-width: 480px) {
  .lcw { right: 8px; left: 8px; bottom: 8px; }
  .lcw-panel { width: auto; }
  .lcw-log { height: 44vh; }
  .lcw-launcher { width: 100%; justify-content: center; }
}
