/* 玄易在线机器人浮窗样式 */
:root {
  --xy-online-primary: #c9302c;
  --xy-online-primary-dark: #a52a25;
  --xy-online-bg: #fff8f0;
  --xy-online-text: #333;
  --xy-online-muted: #888;
  --xy-online-border: rgba(200, 150, 100, 0.25);
  --xy-online-shadow: 0 10px 30px rgba(0,0,0,0.18);
}

.xy-online-widget {
  position: fixed;
  z-index: 9999;
  right: 18px;
  top: 130px;
  cursor: pointer;
  user-select: none;
  touch-action: none;
}

.xy-online-avatar-wrap {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  border: 2px solid #fff;
  background: #fff;
  animation: xy-online-pulse 2.4s infinite;
}

.xy-online-avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

@keyframes xy-online-pulse {
  0% { box-shadow: 0 0 0 0 rgba(201,48,44,0.45); }
  70% { box-shadow: 0 0 0 14px rgba(201,48,44,0); }
  100% { box-shadow: 0 0 0 0 rgba(201,48,44,0); }
}

.xy-online-hover-tip {
  position: absolute;
  top: 66px;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: #fff;
  color: var(--xy-online-text);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  box-shadow: var(--xy-online-shadow);
  border: 1px solid var(--xy-online-border);
  max-width: 220px;
  width: max-content;
  opacity: 0;
  transition: all .25s ease;
  pointer-events: none;
}

.xy-online-widget:hover .xy-online-hover-tip,
.xy-online-hover-tip.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 聊天面板 */
.xy-online-panel {
  position: fixed;
  z-index: 10000;
  right: 18px;
  top: 198px;
  width: 360px;
  max-width: calc(100vw - 36px);
  height: 520px;
  max-height: calc(100vh - 230px);
  background: var(--xy-online-bg);
  border-radius: 16px;
  box-shadow: var(--xy-online-shadow);
  border: 1px solid var(--xy-online-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.92) translateY(-10px);
  opacity: 0;
  visibility: hidden;
  transition: all .25s ease;
}

.xy-online-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  visibility: visible;
}

.xy-online-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--xy-online-primary), var(--xy-online-primary-dark));
  color: #fff;
}

.xy-online-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.xy-online-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.6);
}

.xy-online-header-title {
  font-weight: 700;
  font-size: 15px;
}

.xy-online-header-sub {
  font-size: 11px;
  opacity: .9;
}

.xy-online-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.xy-online-tools button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.xy-online-tools button:hover { background: rgba(255,255,255,0.35); }

.xy-online-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.xy-online-msg {
  display: flex;
  gap: 8px;
  max-width: 85%;
}

.xy-online-msg.bot { align-self: flex-start; }
.xy-online-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.xy-online-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.xy-online-msg-bubble {
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.xy-online-msg.bot .xy-online-msg-bubble {
  background: #fff;
  color: var(--xy-online-text);
  border-bottom-left-radius: 4px;
}

.xy-online-msg.user .xy-online-msg-bubble {
  background: linear-gradient(135deg, var(--xy-online-primary), var(--xy-online-primary-dark));
  color: #fff;
  border-bottom-right-radius: 4px;
}

.xy-online-msg.qr {
  align-items: flex-start;
}

.xy-online-msg-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.xy-online-msg-qr-wrap img {
  width: 160px;
  height: 160px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--xy-online-border);
  background: #fff;
}

.xy-online-msg-qr-wrap .xy-online-msg-bubble {
  margin-top: 8px;
  text-align: center;
}

.xy-online-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 10px;
}

.xy-online-suggestions button {
  background: #fff;
  border: 1px solid var(--xy-online-border);
  color: var(--xy-online-primary);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
}

.xy-online-suggestions button:hover {
  background: var(--xy-online-primary);
  color: #fff;
  border-color: var(--xy-online-primary);
}

.xy-online-input-area {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--xy-online-border);
  background: #fff;
  display: flex;
  gap: 8px;
}

.xy-online-input-area input {
  flex: 1;
  border: 1px solid var(--xy-online-border);
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 13px;
  outline: none;
}

.xy-online-input-area input:focus { border-color: var(--xy-online-primary); }

.xy-online-input-area button {
  background: var(--xy-online-primary);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 0 18px;
  font-size: 13px;
  cursor: pointer;
}

.xy-online-input-area button:hover { background: var(--xy-online-primary-dark); }

.xy-online-popup-toast {
  position: fixed;
  z-index: 9998;
  right: 18px;
  top: 194px;
  width: 320px;
  max-width: calc(100vw - 36px);
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--xy-online-shadow);
  border: 1px solid var(--xy-online-border);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  transform: translateY(-20px);
  opacity: 0;
  visibility: hidden;
  transition: all .3s ease;
}

.xy-online-popup-toast.show {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.xy-online-popup-toast img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.xy-online-popup-toast .toast-content { flex: 1; }
.xy-online-popup-toast .toast-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}
.xy-online-popup-toast .toast-text {
  font-size: 13px;
  color: var(--xy-online-text);
  line-height: 1.45;
}
.xy-online-popup-toast .toast-close {
  background: none;
  border: none;
  color: var(--xy-online-muted);
  cursor: pointer;
  font-size: 16px;
}

@media (max-width: 480px) {
  .xy-online-panel {
    right: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .xy-online-widget {
    right: 10px;
    top: 105px;
  }
  .xy-online-popup-toast {
    right: 10px;
    top: 169px;
    width: calc(100vw - 20px);
  }
}
