/* ==========================================================================
   开思云聚数智顾问 - AI Agent 悬浮对话挂件样式
   ========================================================================== */

:root {
  --ai-primary: #2563eb;
  --ai-gradient: linear-gradient(135deg, #1d4ed8 0%, #2563eb 50%, #06b6d4 100%);
  --ai-glow: rgba(37, 99, 235, 0.35);
  --ai-bg-dark: rgba(15, 23, 42, 0.94);
}

/* 悬浮唤醒球 */
#ks-ai-launcher {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 10px 12px;
  background: var(--ai-gradient);
  color: #ffffff;
  border-radius: 999px;
  box-shadow: 0 10px 25px -3px var(--ai-glow), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
}

#ks-ai-launcher:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 16px 32px -4px rgba(6, 182, 212, 0.45);
}

.ks-ai-avatar {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #38bdf8;
}

.ks-ai-avatar svg {
  width: 22px;
  height: 22px;
  fill: #38bdf8;
}

.ks-ai-pulse {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: #10b981;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: ks-pulse 2s infinite;
}

@keyframes ks-pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.ks-ai-text {
  display: flex;
  flex-direction: column;
}

.ks-ai-text-title {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.2;
}

.ks-ai-text-sub {
  font-size: 10.5px;
  opacity: 0.88;
  letter-spacing: 0.5px;
}

/* 聊天窗口主体 */
#ks-ai-chat-window {
  position: fixed;
  bottom: 86px;
  right: 28px;
  width: 380px;
  max-width: calc(100vw - 36px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--ai-bg-dark);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(56, 189, 248, 0.2);
  border-radius: 20px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(20px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.96);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

#ks-ai-chat-window.ks-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* 聊天顶部导航栏 */
.ks-chat-header {
  padding: 14px 18px;
  background: rgba(30, 41, 59, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ks-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ks-chat-header-title {
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
}

.ks-chat-header-status {
  font-size: 11px;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 5px;
}

.ks-chat-header-status span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

.ks-chat-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 6px;
  transition: all 0.2s;
}

.ks-chat-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

/* 聊天内容滚屏区 */
.ks-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ks-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: ks-msg-in 0.25s ease-out;
}

@keyframes ks-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.ks-msg-bot {
  align-self: flex-start;
}

.ks-msg-user {
  align-self: flex-end;
}

.ks-msg-bubble {
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
}

.ks-msg-bot .ks-msg-bubble {
  background: rgba(30, 41, 59, 0.9);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
}

.ks-msg-user .ks-msg-bubble {
  background: var(--ai-primary);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

/* 快捷推荐问题 */
.ks-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.ks-chip {
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #7dd3fc;
  font-size: 11.5px;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}

.ks-chip:hover {
  background: rgba(37, 99, 235, 0.35);
  color: #ffffff;
  border-color: #38bdf8;
}

/* 底部输入框 */
.ks-chat-input-area {
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 8px;
}

.ks-chat-input {
  flex: 1;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 8px 12px;
  color: #ffffff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.ks-chat-input:focus {
  border-color: #38bdf8;
}

.ks-chat-send-btn {
  background: var(--ai-gradient);
  border: none;
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.ks-chat-send-btn:hover {
  opacity: 0.9;
}
