/* ============================================================
   solonexus AI 客服 - 聊天窗口样式
   ============================================================ */

#qc-chat-root * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* ===== 悬浮按钮 ===== */
#qc-chat-btn {
  position: fixed;
  bottom: 88px;
  right: 32px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f8ef7, #2563eb);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9998;
  box-shadow: 0 6px 24px rgba(79,142,247,0.5);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), box-shadow 0.3s ease;
  user-select: none;
}
#qc-chat-btn svg {
  width: 26px;
  height: 26px;
  transition: transform 0.3s ease;
}
#qc-chat-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 10px 36px rgba(79,142,247,0.65);
}
#qc-chat-btn.qc-open svg {
  transform: scale(0.85);
}

/* 呼吸圆环 */
.qc-btn-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(79,142,247,0.4);
  animation: qcRingPulse 2s ease-in-out infinite;
}
@keyframes qcRingPulse {
  0%,100% { transform: scale(1); opacity: 0.6; }
  50%      { transform: scale(1.18); opacity: 0; }
}

/* 未读红点 */
.qc-unread {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0a0e1a;
}

/* ===== 聊天窗口 ===== */
#qc-chat-box {
  position: fixed;
  bottom: 160px;
  right: 32px;
  width: 380px;
  height: 560px;
  background: #0f1525;
  border: 1px solid rgba(100,140,220,0.2);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  z-index: 9999;
  box-shadow: 0 24px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(79,142,247,0.08);
  overflow: hidden;
  transform-origin: bottom right;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.4,0,0.2,1);
}
#qc-chat-box.qc-hidden {
  opacity: 0;
  transform: scale(0.92) translateY(12px);
  pointer-events: none;
}

/* ===== 头部 ===== */
.qc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: linear-gradient(135deg, #1a2d5a, #0f1c3a);
  border-bottom: 1px solid rgba(100,140,220,0.15);
  flex-shrink: 0;
}
.qc-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.qc-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4f8ef7, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(79,142,247,0.4);
}
.qc-avatar.sm {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 12px;
  flex-shrink: 0;
}
.qc-name {
  font-size: 14px;
  font-weight: 700;
  color: #e8edf8;
}
.qc-status {
  font-size: 11px;
  color: #6478a0;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.qc-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  box-shadow: 0 0 6px #22c55e;
  animation: qcDotBlink 2s ease-in-out infinite;
}
@keyframes qcDotBlink {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.4; }
}
.qc-header-actions {
  display: flex;
  gap: 6px;
}
.qc-header-actions button {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #9aaac8;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
}
.qc-header-actions button:hover {
  background: rgba(255,255,255,0.14);
  color: #e8edf8;
}

/* ===== 消息区 ===== */
.qc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}
.qc-messages::-webkit-scrollbar { width: 4px; }
.qc-messages::-webkit-scrollbar-track { background: transparent; }
.qc-messages::-webkit-scrollbar-thumb { background: rgba(100,140,220,0.25); border-radius: 4px; }

.qc-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: qcMsgIn 0.3s ease;
}
@keyframes qcMsgIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.qc-msg-user {
  flex-direction: row-reverse;
}
.qc-bubble {
  max-width: 260px;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.7;
  word-break: break-word;
}
.qc-msg-ai .qc-bubble {
  background: #1a2d4a;
  color: #c8d8f0;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(79,142,247,0.15);
}
.qc-msg-user .qc-bubble {
  background: linear-gradient(135deg, #4f8ef7, #2563eb);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.qc-msg-ai .qc-bubble code {
  background: rgba(79,142,247,0.15);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
}
.qc-time {
  font-size: 10px;
  color: #445070;
  margin-top: 4px;
  padding: 0 4px;
}
.qc-msg-ai > div { display: flex; flex-direction: column; }
.qc-msg-user > div { display: flex; flex-direction: column; align-items: flex-end; }

/* ===== 打字动效 ===== */
.qc-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px 8px;
  flex-shrink: 0;
}
.qc-dots {
  display: flex;
  gap: 4px;
  background: #1a2d4a;
  border: 1px solid rgba(79,142,247,0.15);
  padding: 10px 14px;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.qc-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4f8ef7;
  animation: qcDot 1.2s ease-in-out infinite;
}
.qc-dots span:nth-child(2) { animation-delay: 0.2s; }
.qc-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes qcDot {
  0%,80%,100% { transform: scale(0.6); opacity: 0.4; }
  40%          { transform: scale(1);   opacity: 1; }
}

/* ===== 输入区 ===== */
.qc-input-area {
  border-top: 1px solid rgba(100,140,220,0.12);
  padding: 10px 14px 12px;
  flex-shrink: 0;
  background: #0d1220;
}
.qc-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.qc-suggestions button {
  padding: 6px 13px;
  border-radius: 100px;
  border: 1px solid rgba(79,142,247,0.3);
  background: rgba(79,142,247,0.08);
  color: #6ea8fe;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-weight: 500;
}
.qc-suggestions button:hover {
  background: rgba(79,142,247,0.2);
  border-color: rgba(79,142,247,0.5);
  color: #fff;
}
.qc-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
#qcInput {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(100,140,220,0.2);
  border-radius: 12px;
  color: #e8edf8;
  font-size: 13px;
  padding: 10px 14px;
  resize: none;
  outline: none;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color 0.2s ease;
  font-family: inherit;
}
#qcInput::placeholder { color: #445070; }
#qcInput:focus { border-color: rgba(79, 142, 247, 0.5); background: rgba(79,142,247,0.06); }
#qcSendBtn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4f8ef7, #2563eb);
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;b
  flex-shrink: 0;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(79,142,247,0.35);
}
#qcSendBtn:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(79,142,247,0.5); }
#qcSendBtn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.qc-powered {
  text-align: center;
  font-size: 10px;
  color: #a5b7da;
  margin-top: 8px;
  letter-spacing: 0.5px;
}

/* ===== 倒计时提示条 ===== */
.qc-countdown {
  text-align: center;
  font-size: 11px;
  color: #f0b840;
  padding: 4px 14px 0;
  letter-spacing: 0.5px;
  min-height: 18px;
  opacity: 0;
  transition: opacity 0.4s ease;
  flex-shrink: 0;
}
.qc-countdown[style*='block'] {
  opacity: 1;
}

/* ===== 移动端适配 ===== */
@media (max-width: 480px) {
  #qc-chat-box {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }
  #qc-chat-btn {
    bottom: 24px;
    right: 20px;
  }
}
