/**
 * AI 数字分身悬浮聊天框 —— 样式
 * 与 source/js/ai-chat-widget.js 配套使用
 */

.ai-chat-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  font-family: inherit;
}

.ai-chat-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #4a63b9, #6f86d6);
  color: #fff;
  font-size: 22px;
  box-shadow: 0 6px 20px rgba(74, 99, 185, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.ai-chat-toggle:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 10px 24px rgba(74, 99, 185, 0.5);
}

.ai-chat-toggle-active {
  transform: scale(0.92);
}

.ai-chat-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 340px;
  max-width: calc(100vw - 48px);
  height: 480px;
  max-height: calc(100vh - 140px);
  background: var(--efblog-background, #fff);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

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

.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, #4a63b9, #6f86d6);
  color: #fff;
  flex-shrink: 0;
}

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

.ai-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.6);
}

.ai-chat-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.ai-chat-subtitle {
  font-size: 11px;
  opacity: 0.85;
  line-height: 1.3;
}

.ai-chat-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.85;
  padding: 4px;
}
.ai-chat-close:hover { opacity: 1; }

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f5f6fa;
}

html[data-theme="dark"] .ai-chat-messages {
  background: #26262f;
}

.ai-chat-msg {
  display: flex;
  max-width: 88%;
}

.ai-chat-msg-user {
  align-self: flex-end;
  justify-content: flex-end;
}

.ai-chat-msg-assistant {
  align-self: flex-start;
}

.ai-chat-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.6;
  word-break: break-word;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.ai-chat-msg-user .ai-chat-bubble {
  background: #4a63b9;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ai-chat-msg-assistant .ai-chat-bubble {
  background: #fff;
  color: #333;
  border-bottom-left-radius: 4px;
}

html[data-theme="dark"] .ai-chat-msg-assistant .ai-chat-bubble {
  background: #33333d;
  color: #eee;
}

.ai-chat-loading {
  opacity: 0.6;
}

.ai-chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.ai-chat-quick-btn {
  border: 1px solid #4a63b9;
  color: #4a63b9;
  background: transparent;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-chat-quick-btn:hover {
  background: #4a63b9;
  color: #fff;
}

.ai-chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
  background: var(--efblog-background, #fff);
}

.ai-chat-input {
  flex: 1;
  resize: none;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.4;
  max-height: 96px;
  font-family: inherit;
  background: transparent;
  color: inherit;
}

.ai-chat-input:focus {
  outline: none;
  border-color: #4a63b9;
}

.ai-chat-send {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: #4a63b9;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.ai-chat-send:hover {
  background: #3a51a0;
}

@media (max-width: 480px) {
  .ai-chat-widget { right: 12px; bottom: 12px; }
  .ai-chat-panel {
    width: calc(100vw - 24px);
    right: -6px;
  }
}
