/* ZLINK AI Live Customer Service Floating Widget (20261130) - Dark & Light Glassmorphism */
.zlk-lc-root {
  --lc-bg: rgba(15, 23, 42, 0.90);
  --lc-bg-solid: #0f172a;
  --lc-surface: rgba(30, 41, 59, 0.72);
  --lc-surface-hover: rgba(51, 65, 85, 0.78);
  --lc-border: rgba(148, 163, 184, 0.18);
  --lc-border-strong: rgba(56, 189, 248, 0.32);
  --lc-ink: #f1f5f9;
  --lc-ink-sub: #94a3b8;
  --lc-ink-muted: #64748b;
  --lc-primary: #3b82f6;
  --lc-accent: #38bdf8;
  --lc-grad: linear-gradient(135deg, #2563eb 0%, #0ea5e9 55%, #6366f1 100%);
  --lc-visitor-bubble: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  --lc-admin-bubble: rgba(30, 41, 59, 0.92);
  --lc-shadow: 0 22px 54px rgba(2, 6, 23, 0.58), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  --lc-fab-shadow: 0 12px 30px rgba(37, 99, 235, 0.44), 0 0 0 1px rgba(255, 255, 255, 0.18) inset;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9990;
  line-height: 1.5;
  box-sizing: border-box;
}

:root[data-theme="light"] .zlk-lc-root {
  --lc-bg: rgba(255, 255, 255, 0.95);
  --lc-bg-solid: #ffffff;
  --lc-surface: rgba(241, 245, 249, 0.92);
  --lc-surface-hover: rgba(226, 232, 240, 0.95);
  --lc-border: rgba(100, 116, 139, 0.18);
  --lc-border-strong: rgba(37, 99, 235, 0.28);
  --lc-ink: #0f172a;
  --lc-ink-sub: #475569;
  --lc-ink-muted: #64748b;
  --lc-admin-bubble: #f1f5f9;
  --lc-shadow: 0 20px 50px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(15, 23, 42, 0.05);
  --lc-fab-shadow: 0 12px 28px rgba(37, 99, 235, 0.34), 0 0 0 1px rgba(255, 255, 255, 0.35) inset;
}

.zlk-lc-root *,
.zlk-lc-root *::before,
.zlk-lc-root *::after {
  box-sizing: border-box;
}

.zlk-lc-root[hidden] {
  display: none !important;
}

/* 右下角悬浮触发器 */
.zlk-lc-fab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 20px 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--lc-grad);
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: var(--lc-fab-shadow);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.22s ease, opacity 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.zlk-lc-fab:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 36px rgba(37, 99, 235, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.26) inset;
}

.zlk-lc-fab:active {
  transform: translateY(0) scale(0.98);
}

.zlk-lc-fab__icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
}

.zlk-lc-fab__icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.zlk-lc-fab__dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #34d399;
  border: 2px solid #1d4ed8;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.85);
}

.zlk-lc-fab__dot.is-busy {
  background: #fbbf24;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.85);
}

.zlk-lc-fab__dot.is-offline {
  background: #94a3b8;
  box-shadow: none;
}

.zlk-lc-fab__badge {
  position: absolute;
  top: -6px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.55);
  border: 2px solid var(--lc-bg-solid);
  animation: zlkLcPop 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.zlk-lc-fab__badge[hidden] {
  display: none !important;
}

@keyframes zlkLcPop {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* 聊天主面板 */
.zlk-lc-panel {
  position: fixed;
  right: 24px;
  bottom: 88px;
  width: 384px;
  height: min(600px, calc(100dvh - 116px));
  min-height: 400px;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  background: var(--lc-bg);
  backdrop-filter: blur(22px) saturate(1.25);
  -webkit-backdrop-filter: blur(22px) saturate(1.25);
  border: 1px solid var(--lc-border);
  box-shadow: var(--lc-shadow);
  overflow: hidden;
  transform-origin: bottom right;
  transition: opacity 0.22s ease, transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0.22s;
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
}

.zlk-lc-panel.is-closed {
  opacity: 0;
  transform: translateY(16px) scale(0.95);
  visibility: hidden;
  pointer-events: none;
}

/* 顶部栏 */
.zlk-lc-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.22), rgba(56, 189, 248, 0.10));
  border-bottom: 1px solid var(--lc-border);
  flex-shrink: 0;
}

.zlk-lc-head__info {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.zlk-lc-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--lc-grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.32);
}

.zlk-lc-avatar svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.zlk-lc-head__text {
  min-width: 0;
}

.zlk-lc-head__title-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.zlk-lc-head__name {
  font-size: 15px;
  font-weight: 700;
  color: var(--lc-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zlk-lc-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(52, 211, 153, 0.15);
  color: #10b981;
  flex-shrink: 0;
}

:root[data-theme="dark"] .zlk-lc-status-pill {
  color: #34d399;
}

.zlk-lc-status-pill.is-busy {
  background: rgba(251, 191, 36, 0.16);
  color: #f59e0b;
}

.zlk-lc-status-pill.is-offline {
  background: rgba(148, 163, 184, 0.18);
  color: var(--lc-ink-sub);
}

.zlk-lc-status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.zlk-lc-head__sub {
  font-size: 11.5px;
  color: var(--lc-ink-sub);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zlk-lc-head__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.zlk-lc-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--lc-ink-sub);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.zlk-lc-icon-btn:hover {
  background: var(--lc-surface-hover);
  color: var(--lc-ink);
}

.zlk-lc-icon-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 消息滚动区 */
.zlk-lc-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.25) transparent;
}

.zlk-lc-body::-webkit-scrollbar {
  width: 5px;
}

.zlk-lc-body::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 999px;
}

/* 常见问题快捷卡片 */
.zlk-lc-faq-card {
  background: var(--lc-surface);
  border: 1px solid var(--lc-border);
  border-radius: 15px;
  padding: 11px 12px;
}

.zlk-lc-faq-card__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--lc-ink-sub);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.zlk-lc-faq-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.zlk-lc-faq-btn {
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--lc-border);
  background: rgba(59, 130, 246, 0.06);
  color: var(--lc-ink);
  font-size: 12.5px;
  line-height: 1.4;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.12s ease;
}

.zlk-lc-faq-btn:hover {
  background: rgba(59, 130, 246, 0.14);
  border-color: var(--lc-border-strong);
  transform: translateX(2px);
}

.zlk-lc-faq-btn span {
  flex: 1;
  min-width: 0;
}

.zlk-lc-faq-btn i {
  font-style: normal;
  color: var(--lc-accent);
  font-size: 13px;
}

/* 消息气泡 */
.zlk-lc-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: zlkLcFadeUp 0.18s ease;
}

@keyframes zlkLcFadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.zlk-lc-msg--admin {
  align-self: flex-start;
}

.zlk-lc-msg--visitor {
  align-self: flex-end;
}

.zlk-lc-msg__meta {
  font-size: 10.5px;
  color: var(--lc-ink-muted);
  margin-bottom: 3px;
  padding: 0 3px;
}

.zlk-lc-msg--visitor .zlk-lc-msg__meta {
  text-align: right;
}

.zlk-lc-msg__bubble {
  padding: 9.5px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}

.zlk-lc-msg--admin .zlk-lc-msg__bubble {
  background: var(--lc-admin-bubble);
  color: var(--lc-ink);
  border: 1px solid var(--lc-border);
  border-top-left-radius: 5px;
}

.zlk-lc-msg--visitor .zlk-lc-msg__bubble {
  background: var(--lc-visitor-bubble);
  color: #ffffff;
  border-top-right-radius: 5px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

.zlk-lc-msg__bubble a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.zlk-lc-msg__img-wrap {
  padding: 5px !important;
  overflow: hidden;
}

.zlk-lc-msg__img {
  display: block;
  max-width: 220px;
  max-height: 240px;
  width: auto;
  height: auto;
  border-radius: 11px;
  cursor: zoom-in;
  object-fit: cover;
  background: rgba(148, 163, 184, 0.12);
}

.zlk-lc-msg__caption {
  padding: 6px 7px 3px;
  font-size: 12.5px;
}

/* 订单关联抽屉条 */
.zlk-lc-order-bar {
  padding: 8px 12px;
  background: var(--lc-surface);
  border-top: 1px solid var(--lc-border);
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.zlk-lc-order-bar[hidden] {
  display: none !important;
}

.zlk-lc-order-input {
  flex: 1;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--lc-border);
  background: var(--lc-bg);
  color: var(--lc-ink);
  padding: 0 10px;
  font-size: 12.5px;
  outline: none;
}

.zlk-lc-order-input:focus {
  border-color: var(--lc-accent);
}

.zlk-lc-order-send {
  height: 32px;
  padding: 0 11px;
  border-radius: 9px;
  border: 0;
  background: var(--lc-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* Emoji 面板 */
.zlk-lc-emoji-pop {
  padding: 8px 10px;
  background: var(--lc-surface);
  border-top: 1px solid var(--lc-border);
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  flex-shrink: 0;
}

.zlk-lc-emoji-pop[hidden] {
  display: none !important;
}

.zlk-lc-emoji-item {
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.14s ease, transform 0.12s ease;
}

.zlk-lc-emoji-item:hover {
  background: var(--lc-surface-hover);
  transform: scale(1.15);
}

/* 工具条 + 输入区 */
.zlk-lc-foot {
  border-top: 1px solid var(--lc-border);
  background: var(--lc-surface);
  padding: 8px 11px 10px;
  flex-shrink: 0;
}

.zlk-lc-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.zlk-lc-tools__left {
  display: flex;
  align-items: center;
  gap: 5px;
}

.zlk-lc-tool-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 27px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--lc-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--lc-ink-sub);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.zlk-lc-tool-pill:hover,
.zlk-lc-tool-pill.is-active {
  color: var(--lc-ink);
  border-color: var(--lc-border-strong);
  background: rgba(59, 130, 246, 0.12);
}

.zlk-lc-paste-tip {
  font-size: 10.5px;
  color: var(--lc-ink-muted);
}

.zlk-lc-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.zlk-lc-textarea {
  flex: 1;
  min-height: 38px;
  max-height: 98px;
  padding: 8px 11px;
  border-radius: 12px;
  border: 1px solid var(--lc-border);
  background: var(--lc-bg);
  color: var(--lc-ink);
  font-size: 13.5px;
  line-height: 1.45;
  resize: none;
  outline: none;
  font-family: inherit;
  transition: border-color 0.16s ease;
}

.zlk-lc-textarea:focus {
  border-color: var(--lc-accent);
}

.zlk-lc-textarea::placeholder {
  color: var(--lc-ink-muted);
}

.zlk-lc-send-btn {
  width: 40px;
  height: 38px;
  border-radius: 12px;
  border: 0;
  background: var(--lc-grad);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.34);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.zlk-lc-send-btn:hover {
  transform: translateY(-1px);
}

.zlk-lc-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.zlk-lc-send-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 大图预览灯箱 */
.zlk-lc-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(2, 6, 23, 0.86);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  cursor: zoom-out;
}

.zlk-lc-lightbox[hidden] {
  display: none !important;
}

.zlk-lc-lightbox img {
  max-width: min(94vw, 1080px);
  max-height: 88dvh;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}

/* 手机端自适应抽屉布局 */
@media (max-width: 640px) {
  .zlk-lc-root {
    right: 14px;
    bottom: calc(18px + env(safe-area-inset-bottom));
  }

  .zlk-lc-fab {
    height: 48px;
    padding: 0 15px 0 13px;
    font-size: 13.5px;
    gap: 7px;
  }

  .zlk-lc-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    height: min(82dvh, 640px);
    border-radius: 22px 22px 0 0;
    border-bottom: 0;
  }

  .zlk-lc-foot {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }

  .zlk-lc-paste-tip {
    display: none;
  }
}
