/* ==========================================================================
   Verlux Omnichannel Support Widget v2.0 — OpenLux Ceremony & Obsidian Edition
   ========================================================================== */

#vlx-sup-root {
  position: fixed;
  right: 20px;
  bottom: 22px;
  z-index: 9990;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* 当页面打开原生模态框时自动礼让层级 */
html[data-vlx-modal-open="1"] #vlx-sup-root {
  z-index: 30;
}

/* 右下角 OpenLux 风格高定悬浮钮 + 悬停 Tooltip */
#vlx-sup-fab {
  height: 46px;
  padding: 0 18px 0 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #171b26 0%, #0b0d13 100%);
  color: #f4f4f6;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(235, 100, 42, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.18s ease, box-shadow 0.18s ease;
  position: relative;
}

#vlx-sup-fab:hover {
  border-color: #eb642a;
  transform: translateY(-2px);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(235, 100, 42, 0.52), 0 0 24px rgba(235, 100, 42, 0.2);
}

/* 控制台与登录页自动采用 OpenLux 同款 48x48 圆形星芒气泡钮 */
html[data-vlx-auth="1"] #vlx-sup-fab,
html[data-vlx-console="1"] #vlx-sup-fab {
  width: 48px;
  height: 48px;
  padding: 0;
  justify-content: center;
}
html[data-vlx-auth="1"] #vlx-sup-fab .vlx-sup-fab-txt,
html[data-vlx-auth="1"] #vlx-sup-fab .vlx-sup-dot,
html[data-vlx-console="1"] #vlx-sup-fab .vlx-sup-fab-txt,
html[data-vlx-console="1"] #vlx-sup-fab .vlx-sup-dot {
  display: none;
}

#vlx-sup-tip {
  pointer-events: none;
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(10, 12, 18, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.16s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
#vlx-sup-fab:hover #vlx-sup-tip {
  opacity: 1;
  transform: translateY(0);
}

.vlx-sup-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 9px rgba(16, 185, 129, 0.9);
  flex-shrink: 0;
}

#vlx-sup-badge {
  position: absolute;
  top: -5px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #eb642a;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(235, 100, 42, 0.65);
  border: 2px solid #090b10;
}
#vlx-sup-badge.show { display: inline-flex; }

/* 灵动岛弹簧形变聊天主面板 */
#vlx-sup-panel {
  position: fixed;
  right: 20px;
  bottom: 80px;
  width: 400px;
  max-width: calc(100vw - 24px);
  height: 580px;
  max-height: calc(100vh - 106px);
  background: #0b0d13;
  color: #f4f4f6;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9995;
  transform-origin: bottom right;
}
#vlx-sup-panel.open {
  display: flex;
  animation: vlxIslandExpand 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes vlxIslandExpand {
  from { opacity: 0; transform: scale(0.86) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* 面板顶栏：AI 态 vs 人工专席翡翠流光态 */
.vlx-sp-head {
  padding: 14px 16px;
  background: linear-gradient(180deg, #151924 0%, #0f121a 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  position: relative;
  transition: background 0.35s ease;
}
#vlx-sup-panel.human-mode .vlx-sp-head {
  background:
    radial-gradient(ellipse 90% 100% at 15% 0%, rgba(16, 185, 129, 0.18), transparent 68%),
    linear-gradient(180deg, #111c21 0%, #0d131a 100%);
  border-bottom-color: rgba(16, 185, 129, 0.24);
}

.vlx-sp-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.vlx-sp-avatar {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, rgba(235, 100, 42, 0.24), rgba(235, 100, 42, 0.06));
  border: 1px solid rgba(235, 100, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  transition: all 0.3s ease;
}
#vlx-sup-panel.human-mode .vlx-sp-avatar {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.26), rgba(56, 189, 248, 0.12));
  border-color: rgba(16, 185, 129, 0.55);
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.22);
}
.vlx-sp-avatar-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #eb642a;
  border: 2px solid #0f121a;
}
#vlx-sup-panel.human-mode .vlx-sp-avatar-dot {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.vlx-sp-title {
  font-size: 13.8px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vlx-sp-sub {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 2px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#vlx-sup-panel.human-mode .vlx-sp-sub {
  color: #6ee7b7;
}

.vlx-sp-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.vlx-btn-human {
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(235, 100, 42, 0.55);
  background: linear-gradient(180deg, rgba(235, 100, 42, 0.22) 0%, rgba(235, 100, 42, 0.1) 100%);
  color: #ffb38a;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.vlx-btn-human:hover {
  background: linear-gradient(180deg, #ff7a3d 0%, #eb642a 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(235, 100, 42, 0.38);
}
.vlx-btn-human.is-human {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.14);
  color: #6ee7b7;
  cursor: default;
  box-shadow: none;
}

.vlx-btn-close {
  width: 29px;
  height: 29px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #a1a1aa;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.vlx-btn-close:hover { color: #ffffff; background: rgba(255, 255, 255, 0.1); }

/* ==========================================================================
   转人工高奢三步握手过渡舞台 (Handoff Ceremony Overlay)
   ========================================================================== */
#vlxHandoffOverlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  background:
    radial-gradient(circle at 50% 38%, rgba(16, 185, 129, 0.16), rgba(235, 100, 42, 0.08) 42%, transparent 72%),
    rgba(9, 11, 16, 0.94);
  backdrop-filter: blur(14px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
}
#vlxHandoffOverlay.active {
  display: flex;
  animation: vlxFadeIn 0.2s ease;
}
@keyframes vlxFadeIn { from { opacity: 0; } to { opacity: 1; } }

.vlx-ho-rings {
  position: relative;
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}
.vlx-ho-ring1, .vlx-ho-ring2 {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(235, 100, 42, 0.55);
  animation: vlxSonar 1.4s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}
.vlx-ho-ring2 {
  border-color: rgba(16, 185, 129, 0.65);
  animation-delay: 0.45s;
}
@keyframes vlxSonar {
  0% { transform: scale(0.68); opacity: 0.95; }
  100% { transform: scale(1.42); opacity: 0; }
}
.vlx-ho-core {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, #162329 0%, #0f141d 100%);
  border: 1px solid rgba(16, 185, 129, 0.55);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 0 24px rgba(16, 185, 129, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #34d399;
}

.vlx-ho-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.vlx-ho-step {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  color: #6ee7b7;
  min-height: 18px;
}
.vlx-ho-bar {
  width: 190px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  margin-top: 16px;
  overflow: hidden;
}
.vlx-ho-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #eb642a 0%, #10b981 100%);
  transition: width 0.32s ease;
}

/* ==========================================================================
   对话流内的真人专席入驻铭牌卡 (Live Presence Card)
   ========================================================================== */
.vlx-presence-card {
  align-self: stretch;
  margin: 4px 2px;
  padding: 13px 14px;
  border-radius: 15px;
  background:
    radial-gradient(ellipse 85% 90% at 90% 0%, rgba(16, 185, 129, 0.14), transparent 65%),
    linear-gradient(180deg, #131924 0%, #0e121a 100%);
  border: 1px solid rgba(16, 185, 129, 0.32);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
}
.vlx-pc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 10px;
}
.vlx-pc-live {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #34d399;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.vlx-pc-live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}
.vlx-pc-sync {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}
.vlx-pc-body {
  display: flex;
  align-items: center;
  gap: 11px;
}
.vlx-pc-ava {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #eb642a 0%, #ff9c73 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(235, 100, 42, 0.38);
  flex-shrink: 0;
}
.vlx-pc-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #ffffff;
}
.vlx-pc-role {
  font-size: 11.5px;
  color: #94a3b8;
  margin-top: 1px;
}
.vlx-pc-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 10.8px;
  color: #9ca3af;
}

.vlx-join-pill {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
  font-size: 11.5px;
  font-weight: 600;
}

/* 访客防失联联系方式条 */
.vlx-sp-contact {
  padding: 8px 14px;
  background: rgba(16, 185, 129, 0.07);
  border-bottom: 1px solid rgba(16, 185, 129, 0.18);
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  flex-shrink: 0;
}
.vlx-sp-contact.show { display: flex; }
.vlx-sp-contact input {
  flex: 1;
  height: 28px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #080a0f;
  color: #ffffff;
  font-size: 11.5px;
  outline: none;
}
.vlx-sp-contact button {
  height: 28px;
  padding: 0 11px;
  border-radius: 7px;
  border: none;
  background: #10b981;
  color: #04130d;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

/* 消息区 */
.vlx-sp-msgs {
  flex: 1;
  padding: 14px 14px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 11px;
  font-size: 13px;
  line-height: 1.58;
}

.vlx-m-row {
  display: flex;
  flex-direction: column;
  max-width: 88%;
}
.vlx-m-row.user { align-self: flex-end; align-items: flex-end; }
.vlx-m-row.bot, .vlx-m-row.agent { align-self: flex-start; align-items: flex-start; }
.vlx-m-row.system { align-self: center; max-width: 94%; }

.vlx-m-meta {
  font-size: 10.5px;
  color: #71717a;
  margin-bottom: 3px;
  padding: 0 2px;
}

.vlx-m-bubble {
  padding: 10px 13px;
  border-radius: 14px;
  word-break: break-word;
}
.vlx-m-row.bot .vlx-m-bubble {
  background: #151923;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e4e4e7;
  border-bottom-left-radius: 4px;
}
.vlx-m-row.agent .vlx-m-bubble {
  background: linear-gradient(180deg, #152524 0%, #101b22 100%);
  border: 1px solid rgba(16, 185, 129, 0.34);
  color: #f4f4f6;
  border-bottom-left-radius: 4px;
}
.vlx-m-row.user .vlx-m-bubble {
  background: linear-gradient(180deg, #ff7a3d 0%, #eb642a 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}
.vlx-m-row.system .vlx-m-bubble {
  background: rgba(255, 255, 255, 0.045);
  border: 1px dashed rgba(255, 255, 255, 0.13);
  color: #a1a1aa;
  font-size: 11.5px;
  text-align: center;
  padding: 7px 11px;
  border-radius: 10px;
}

.vlx-m-bubble code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11.8px;
  background: rgba(0, 0, 0, 0.35);
  padding: 1px 5px;
  border-radius: 4px;
  color: #ffb38a;
}
.vlx-m-row.user .vlx-m-bubble code { color: #fff; background: rgba(0,0,0,0.22); }
.vlx-m-bubble a { color: #ff9c73; text-decoration: underline; }
.vlx-m-img {
  display: block;
  max-width: 224px;
  max-height: 224px;
  border-radius: 9px;
  margin-top: 6px;
  cursor: zoom-in;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.vlx-sp-quick {
  padding: 4px 12px 9px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.vlx-sp-qbtn {
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.11);
  color: #d4d4d8;
  cursor: pointer;
  transition: all 0.14s;
}
.vlx-sp-qbtn:hover { border-color: #eb642a; color: #ffffff; }

.vlx-sp-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 11px;
  background: #080a0f;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.vlx-btn-upload {
  width: 35px;
  height: 35px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.04);
  color: #a1a1aa;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.vlx-btn-upload:hover { color: #ffffff; border-color: #eb642a; }

.vlx-sp-input {
  flex: 1;
  height: 36px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #11141d;
  color: #ffffff;
  font-size: 13px;
  outline: none;
}
.vlx-sp-input:focus { border-color: #eb642a; }
#vlx-sup-panel.human-mode .vlx-sp-input:focus { border-color: #10b981; }

.vlx-btn-send {
  height: 36px;
  padding: 0 14px;
  border-radius: 9px;
  border: none;
  background: linear-gradient(180deg, #ff7a3d 0%, #eb642a 100%);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.vlx-btn-send:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 600px) {
  #vlx-sup-panel {
    right: 10px;
    left: 10px;
    bottom: 74px;
    width: auto;
    max-width: none;
    height: 76vh;
  }
}
