/*! livechat-widget.css 与 widget.js 共用 ?v= 或 /widget-version.php */
.lc-widget {
  position: fixed;
  /* 与常见「回到顶部」同高 bottom:20px；整体左移，避免压住其右侧方块 */
  --lc-corner-margin: 20px;
  --lc-side-btn-width: 56px; /* 侧方固定按钮（如回顶）大致宽度，可按主题改 */
  --lc-side-gap: 14px; /* 与侧方按钮的间隔 */
  right: calc(var(--lc-corner-margin) + var(--lc-side-btn-width) + var(--lc-side-gap));
  bottom: var(--lc-corner-margin);
  z-index: 2147483000;
  font-family: "Segoe UI", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  --lc-accent: #1677ff;
  --lc-accent-dark: #0958d9;
  --lc-bg: #ffffff;
  --lc-muted: #64748b;
  --lc-line: #e2e8f0;
  --lc-logbg: linear-gradient(180deg, #f1f5f9 0%, #f8fafc 100%);
}

/* 手机端：靠右缘、整体上移，避开底部固定导航（搜索/购物车等） */
@media (max-width: 768px) {
  .lc-widget {
    /* 底部主导航条高度，主题不同可改 56–80 */
    --lc-mobile-tab-clearance: 72px;
    right: calc(10px + env(safe-area-inset-right, 0px));
    bottom: calc(12px + var(--lc-mobile-tab-clearance) + env(safe-area-inset-bottom, 0px));
  }
}

.lc-fab {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(160deg, var(--lc-accent) 0%, var(--lc-accent-dark) 100%);
  box-shadow: 0 6px 20px rgba(22, 119, 255, 0.45);
  display: grid;
  place-items: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.lc-fab:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 28px rgba(22, 119, 255, 0.55);
}
.lc-fab-inner {
  display: grid;
  place-items: center;
}
.lc-fab-svg {
  width: 28px;
  height: 28px;
  display: block;
}

.lc-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: min(92vw, 300px);
  height: auto;
  max-height: min(85vh, 520px);
  background: var(--lc-bg);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.lc-panel.lc-panel--chat {
  width: min(94vw, 340px);
  height: min(78vh, 480px);
  max-height: min(78vh, 480px);
}

.lc-panel[hidden] {
  display: none !important;
}

.lc-home {
  position: relative;
  padding: 26px 20px 22px;
}
.lc-home[hidden] {
  display: none !important;
}

.lc-home-x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.lc-home-x:hover {
  background: #e2e8f0;
  color: #334155;
}

.lc-home-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
  padding-right: 28px;
}
.lc-home-desc {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--lc-muted);
  line-height: 1.5;
}

.lc-btn-primary {
  display: block;
  width: 100%;
  margin-top: 22px;
  padding: 14px 16px;
  border: 0;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(180deg, #3b8cff 0%, var(--lc-accent) 48%, var(--lc-accent-dark) 100%);
  box-shadow: 0 4px 14px rgba(22, 119, 255, 0.35);
  transition: filter 0.15s, transform 0.1s;
}
.lc-btn-primary:hover {
  filter: brightness(1.05);
}
.lc-btn-primary:active {
  transform: scale(0.99);
}

.lc-btn-secondary {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 12px;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--lc-line);
  background: #fff;
  color: #0f172a;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.lc-btn-secondary:hover {
  border-color: #cbd5e1;
  background: #fafafa;
}

.lc-ex-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(145deg, #fda4af, #f472b6);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(244, 114, 182, 0.35);
}

.lc-ex-text {
  text-align: left;
  line-height: 1.35;
}

.lc-chat-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.lc-chat-wrap[hidden] {
  display: none !important;
}

.lc-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--lc-line);
  background: linear-gradient(180deg, #fafbff, #fff);
  flex-shrink: 0;
}
.lc-back {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--lc-line);
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: #334155;
}
.lc-topbar-title {
  font-weight: 700;
  font-size: 15px;
  color: #0f172a;
}

.lc-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--lc-line);
  flex-shrink: 0;
}
.lc-hero-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--lc-accent), #60a5fa);
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
}
.lc-hero-avatar .lc-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4ade80;
  position: absolute;
  bottom: 2px;
  right: 2px;
  border: 2px solid #fff;
  font-style: normal;
}
.lc-hero-name {
  font-weight: 700;
  font-size: 15px;
  color: #0f172a;
}
.lc-hero-sub {
  font-size: 12px;
  color: var(--lc-muted);
  margin-top: 2px;
}

.lc-log {
  flex: 1;
  overflow: auto;
  padding: 12px 14px;
  background: var(--lc-logbg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lc-row {
  display: flex;
  width: 100%;
}
.lc-row.lc-me {
  justify-content: flex-end;
}
.lc-row.lc-them {
  justify-content: flex-start;
}

.lc-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px 16px 6px 16px;
  font-size: 14px;
  word-break: break-word;
}
.lc-bubble-me {
  background: linear-gradient(135deg, var(--lc-accent), #3b82f6);
  color: #fff;
  box-shadow: 0 4px 14px rgba(22, 119, 255, 0.28);
}
.lc-bubble-them {
  background: #fff;
  color: #0f172a;
  border: 1px solid #e4e7f2;
  border-radius: 16px 16px 16px 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.lc-bubble-nick {
  display: block;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 4px;
}
.lc-bubble-me .lc-bubble-nick {
  color: rgba(255, 255, 255, 0.92);
}
.lc-bubble-them .lc-bubble-nick {
  color: rgba(15, 23, 42, 0.55);
}
.lc-bubble-body {
  display: block;
}
.lc-bubble img {
  display: block;
  max-width: min(220px, 70vw);
  border-radius: 10px;
}

.lc-sys {
  text-align: center;
  font-size: 12px;
  color: var(--lc-muted);
  padding: 4px 8px;
}

.lc-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 14px;
  border-top: 1px solid var(--lc-line);
  background: #fff;
  flex-shrink: 0;
}
.lc-plus {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--lc-line);
  background: #f8fafc;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--lc-accent);
  display: grid;
  place-items: center;
}
.lc-ta {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  max-height: 100px;
  padding: 10px 12px;
  border: 1px solid var(--lc-line);
  border-radius: 20px;
  font-family: inherit;
  font-size: 14px;
  resize: none;
  line-height: 1.35;
}
.lc-air {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(135deg, var(--lc-accent), #3b82f6);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(22, 119, 255, 0.35);
}
