/* ==========================================================================
   长沙向滢科技有限公司 · 在线客服悬浮窗样式
   设计令牌与 css/style.css 保持一致（品牌蓝 → 亮青）
   ========================================================================== */

.xyc {
  --xyc-brand-900: var(--brand-900, #082d68);
  --xyc-brand-800: var(--brand-800, #0b4da2);
  --xyc-brand-600: var(--brand-600, #1e7fe0);
  --xyc-cyan: var(--cyan, #29b6e8);
  --xyc-navy: var(--navy, #05224a);
  --xyc-ink: var(--ink, #0f2643);
  --xyc-text: var(--text, #3b4d68);
  --xyc-muted: var(--muted, #6d7f99);
  --xyc-line: var(--line, #e3ebf6);
  --xyc-bg: #f4f8fe;
  --xyc-white: #fff;
  --xyc-radius: 16px;
  --xyc-shadow: 0 18px 48px rgba(8, 45, 104, 0.22);
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1200;
  font-family: "Inter", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.xyc *,
.xyc *::before,
.xyc *::after { box-sizing: border-box; }

/* 面板内的区块用了 display:flex 布局，会覆盖 HTML [hidden] 默认的 display:none，
   这里显式兜底，保证「首次表单 / 对话区 / 输入区 / 快捷提问」的显隐切换可靠生效 */
.xyc [hidden] { display: none !important; }

.xyc button { font-family: inherit; cursor: pointer; }

/* ---------------------------------------------------------------- 悬浮入口 */
.xyc__launcher {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 58px;
  padding: 0 22px 0 18px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--xyc-brand-800), var(--xyc-brand-600) 60%, var(--xyc-cyan));
  box-shadow: 0 12px 30px rgba(11, 77, 162, 0.36);
  transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1), box-shadow 0.28s;
}
.xyc__launcher:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(11, 77, 162, 0.44);
}
.xyc__launcher:active { transform: translateY(-1px) scale(0.98); }
.xyc__launcher svg { width: 24px; height: 24px; flex: none; }
.xyc__launcher-txt {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.6px;
  white-space: nowrap;
}
.xyc__pulse {
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  border: 2px solid rgba(41, 182, 232, 0.55);
  animation: xyc-pulse 2.6s ease-out infinite;
  pointer-events: none;
}
@keyframes xyc-pulse {
  0% { transform: scale(0.94); opacity: 0.9; }
  70% { transform: scale(1.14); opacity: 0; }
  100% { transform: scale(1.14); opacity: 0; }
}
.xyc__badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
  box-shadow: 0 3px 10px rgba(239, 68, 68, 0.5);
  display: none;
}
.xyc__badge.is-on { display: block; animation: xyc-pop 0.36s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes xyc-pop {
  0% { transform: scale(0.3); }
  60% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* ---------------------------------------------------------------- 对话面板 */
.xyc__panel {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: 384px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 130px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--xyc-radius);
  box-shadow: var(--xyc-shadow);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.97);
  transform-origin: bottom right;
  transition: opacity 0.26s ease, transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1), visibility 0.26s;
}
.xyc.is-open .xyc__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.xyc.is-open .xyc__launcher { opacity: 0; visibility: hidden; transform: scale(0.9); }

/* 头部 */
.xyc__head {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 16px 18px;
  color: #fff;
  background: linear-gradient(120deg, var(--xyc-navy), var(--xyc-brand-800) 62%, var(--xyc-brand-600));
  overflow: hidden;
}
.xyc__head::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -60px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 1px solid rgba(127, 218, 245, 0.22);
  transform: rotate(-18deg);
  pointer-events: none;
}
.xyc__head::before {
  content: '';
  position: absolute;
  right: -10px;
  top: -20px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 1px solid rgba(41, 182, 232, 0.24);
  pointer-events: none;
}
.xyc__avatar {
  position: relative;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.xyc__avatar img { width: 100%; height: 100%; object-fit: contain; padding: 7px; }
.xyc__avatar svg { width: 22px; height: 22px; }
.xyc__id { position: relative; z-index: 1; min-width: 0; flex: 1; }
.xyc__name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.xyc__state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 400;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}
.xyc__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  flex: none;
}
.xyc__state.is-online .xyc__dot {
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.28);
  animation: xyc-blink 2s ease-in-out infinite;
}
@keyframes xyc-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
.xyc__desc {
  font-size: 12px;
  opacity: 0.78;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.xyc__acts { position: relative; z-index: 1; display: flex; gap: 4px; }
.xyc__icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: grid;
  place-items: center;
  transition: background 0.2s;
}
.xyc__icon-btn:hover { background: rgba(255, 255, 255, 0.26); }
.xyc__icon-btn svg { width: 16px; height: 16px; }

/* 消息区 */
.xyc__body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 16px 8px;
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(219, 234, 254, 0.55) 0%, rgba(255, 255, 255, 0) 60%),
    var(--xyc-bg);
  scrollbar-width: thin;
  scrollbar-color: #c3d3e8 transparent;
}
.xyc__body::-webkit-scrollbar { width: 6px; }
.xyc__body::-webkit-scrollbar-thumb { background: #c3d3e8; border-radius: 3px; }

.xyc__day {
  text-align: center;
  margin: 6px 0 14px;
}
.xyc__day span {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(15, 38, 67, 0.06);
  color: var(--xyc-muted);
  font-size: 11.5px;
}

.xyc__row {
  display: flex;
  gap: 9px;
  margin-bottom: 14px;
  align-items: flex-end;
  animation: xyc-in 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
}
@keyframes xyc-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.xyc__row--me { flex-direction: row-reverse; }
.xyc__ava {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--xyc-line);
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(11, 77, 162, 0.08);
}
.xyc__ava img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.xyc__ava svg { width: 17px; height: 17px; color: var(--xyc-brand-800); }
.xyc__col { display: flex; flex-direction: column; max-width: 76%; }
.xyc__row--me .xyc__col { align-items: flex-end; }
.xyc__bubble {
  padding: 10px 13px;
  border-radius: 14px;
  background: #fff;
  color: var(--xyc-ink);
  box-shadow: 0 2px 8px rgba(11, 77, 162, 0.08);
  word-break: break-word;
  white-space: pre-wrap;
  font-size: 14px;
}
.xyc__row--agent .xyc__bubble { border-bottom-left-radius: 5px; }
.xyc__row--me .xyc__bubble {
  background: linear-gradient(135deg, var(--xyc-brand-800), var(--xyc-brand-600));
  color: #fff;
  border-bottom-right-radius: 5px;
  box-shadow: 0 4px 14px rgba(11, 77, 162, 0.3);
}
.xyc__meta {
  font-size: 11px;
  color: var(--xyc-muted);
  margin-top: 5px;
  padding: 0 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.xyc__sys {
  text-align: center;
  margin: 4px 0 16px;
}
.xyc__sys span {
  display: inline-block;
  max-width: 88%;
  padding: 7px 13px;
  border-radius: 10px;
  background: rgba(41, 182, 232, 0.1);
  border: 1px dashed rgba(41, 182, 232, 0.4);
  color: #2a6ba8;
  font-size: 12.5px;
  white-space: pre-wrap;
}

.xyc__typing { display: flex; gap: 4px; padding: 13px 15px; }
.xyc__typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9db6d4;
  animation: xyc-dots 1.3s infinite ease-in-out;
}
.xyc__typing i:nth-child(2) { animation-delay: 0.18s; }
.xyc__typing i:nth-child(3) { animation-delay: 0.36s; }
@keyframes xyc-dots {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* 快捷提问 */
.xyc__quick {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 4px 16px 10px;
  background: var(--xyc-bg);
}
.xyc__chip {
  border: 1px solid rgba(11, 77, 162, 0.2);
  background: #fff;
  color: var(--xyc-brand-800);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12.5px;
  transition: all 0.2s;
}
.xyc__chip:hover {
  background: var(--xyc-brand-800);
  border-color: var(--xyc-brand-800);
  color: #fff;
  transform: translateY(-1px);
}

/* 输入区 */
.xyc__foot {
  flex: none;
  border-top: 1px solid var(--xyc-line);
  background: #fff;
  padding: 10px 12px 8px;
}
.xyc__form { display: flex; align-items: flex-end; gap: 9px; }
.xyc__input {
  flex: 1;
  min-height: 42px;
  max-height: 108px;
  padding: 10px 13px;
  border: 1px solid var(--xyc-line);
  border-radius: 12px;
  background: var(--xyc-bg);
  color: var(--xyc-ink);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.55;
  resize: none;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.xyc__input:focus {
  border-color: var(--xyc-brand-600);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(30, 127, 224, 0.12);
}
.xyc__send {
  flex: none;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--xyc-brand-800), var(--xyc-brand-600));
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 16px rgba(11, 77, 162, 0.28);
  transition: transform 0.2s, opacity 0.2s;
}
.xyc__send:hover { transform: translateY(-2px); }
.xyc__send:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.xyc__send svg { width: 19px; height: 19px; }
.xyc__tip {
  text-align: center;
  font-size: 11px;
  color: #9aabc2;
  margin-top: 6px;
}
.xyc__tip b { color: var(--xyc-brand-800); font-weight: 600; }

/* 首次进入：称呼表单 */
.xyc__gate {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 26px 24px;
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(219, 234, 254, 0.7) 0%, rgba(255, 255, 255, 0) 62%),
    #fff;
}
.xyc__gate h4 {
  margin: 0 0 6px;
  font-size: 17px;
  color: var(--xyc-ink);
  letter-spacing: 0.3px;
}
.xyc__gate p { margin: 0 0 18px; color: var(--xyc-muted); font-size: 13px; }
.xyc__field { margin-bottom: 12px; }
.xyc__field label {
  display: block;
  font-size: 12.5px;
  color: var(--xyc-text);
  margin-bottom: 5px;
  font-weight: 600;
}
.xyc__field input {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--xyc-line);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--xyc-ink);
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.xyc__field input:focus {
  border-color: var(--xyc-brand-600);
  box-shadow: 0 0 0 3px rgba(30, 127, 224, 0.12);
}
.xyc__start {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.6px;
  background: linear-gradient(135deg, var(--xyc-brand-800), var(--xyc-brand-600) 70%, var(--xyc-cyan));
  box-shadow: 0 8px 20px rgba(11, 77, 162, 0.28);
  transition: transform 0.2s;
}
.xyc__start:hover { transform: translateY(-2px); }

/* 新消息提示条 */
.xyc__newtip {
  position: absolute;
  left: 50%;
  bottom: 112px;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--xyc-brand-800);
  color: #fff;
  font-size: 12.5px;
  box-shadow: 0 8px 20px rgba(11, 77, 162, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.24s, visibility 0.24s, transform 0.24s;
  z-index: 3;
  cursor: pointer;
}
.xyc__newtip.is-on { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(-4px); }

/* 离线提示 */
.xyc__offline {
  flex: none;
  padding: 8px 16px;
  background: #fff7ed;
  border-top: 1px solid #fed7aa;
  color: #b45309;
  font-size: 12.5px;
  text-align: center;
  display: none;
}
.xyc__offline.is-on { display: block; }

/* ------------------------------------------------------------- 移动端 */
@media (max-width: 640px) {
  .xyc { right: 14px; bottom: 14px; }
  .xyc__launcher { height: 52px; padding: 0 18px 0 15px; }
  .xyc__launcher-txt { font-size: 14px; }
  .xyc__panel {
    position: fixed;
    right: 0;
    left: 0;
    bottom: 0;
    top: 0;
    width: auto;
    max-width: none;
    height: auto;
    max-height: none;
    border-radius: 0;
    transform: translateY(3%);
  }
  .xyc.is-open .xyc__panel { transform: translateY(0); }
  .xyc__head { padding: 14px 14px 14px 16px; }
  .xyc__body { padding: 16px 14px 8px; }
  .xyc__quick { padding: 4px 14px 10px; }
  .xyc__col { max-width: 82%; }
  .xyc__newtip { bottom: 118px; }
}

/* 深色底(site-footer 之上的场景)不生效，保持白底保证可读 */

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  .xyc * { animation: none !important; transition: none !important; }
}
