/* spssai-portal/spssai_portal/static/css/components/ai-chatbot.css */
#ai-chatbot-widget {
    position: fixed;
    right: 30px;
    bottom: 30px;
    z-index: 1050;
}

#chatbot-icon {
    position: relative;
    cursor: pointer;
    width: 60px;
    height: 60px;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

#chatbot-icon:hover {
    transform: scale(1.15) rotate(5deg);
}

#chatbot-icon:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
    transform: translate(-50%, -5px);
}

#chatbot-icon img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#chatbot-icon .tooltip-text {
    visibility: hidden;
    width: 130px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px 0;
    position: absolute;
    z-index: 1;
    bottom: 110%;
    left: 50%;
    margin-left: -65px;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    transform: translate(-50%, 5px);
    font-size: 13px;
}

#chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 370px;
    height: 600px;
    background-color: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: slide-in 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

#chatbot-window.hidden {
    display: none;
}

@keyframes slide-in {
    from { opacity: 0; transform: scale(0.8) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.chatbot-header {
    background: linear-gradient(135deg, #37474f, #263238);
    color: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

/* [核心新增] 新增样式 */
.chatbot-title-container {
    display: flex;
    align-items: center;
    gap: 10px; /* 头像和文字之间的间距 */
}

.chatbot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #fff; /* 添加一个白色边框，使其更突出 */
}

.chatbot-header h3 {
    margin: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
}

.chatbot-header .status-dot { width: 8px; height: 8px; background-color: #2ecc71; border-radius: 50%; margin-left: 8px; animation: pulse-green 2s infinite; }

@keyframes pulse-green { 0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(46, 204, 113, 0); } 100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); } }

#close-chatbot-btn { background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; opacity: 0.7; transition: opacity 0.2s, transform 0.2s; }
#close-chatbot-btn:hover { opacity: 1; transform: rotate(90deg); }

#chatbot-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f4f7f9;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message { display: flex; flex-direction: column; max-width: 85%; align-items: flex-start; }
.message.user { align-self: flex-end; align-items: flex-end; }
.message .bubble { padding: 12px 18px; border-radius: 20px; line-height: 1.6; font-size: 14px; word-wrap: break-word; }
.message.user .bubble { background-color: #e93b5a; color: #fff; border-bottom-right-radius: 5px; }
.message.ai .bubble { background-color: #ffffff; color: #333; border-bottom-left-radius: 5px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }

/* [核心新增] 预设问题按钮样式 */
.preset-question-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px; /* 与气泡文本的间距 */
    align-items: flex-start;
}
.preset-question-btn {
    background-color: #f1f3f5;
    border: 1px solid #dee2e6;
    border-radius: 15px;
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    color: #333;
    transition: all 0.2s;
    text-align: left;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.preset-question-btn:hover {
    background-color: #e9ecef;
    border-color: #ced4da;
    color: #000;
}
/* [修改] 确保旧的快捷问题容器不影响新布局 */
.chatbot-quick-questions {
    display: none; /* 既然已有新方案，可以直接隐藏旧的容器 */
}

/* Markdown Styles */
.message.ai .bubble p { margin: 0 0 8px 0; }
.message.ai .bubble p:last-child { margin-bottom: 0; }
.message.ai .bubble ul, .message.ai .bubble ol { margin: 8px 0; padding-left: 20px; }
.message.ai .bubble a { color: #e93b5a; text-decoration: underline; }

/* Thinking Animation */
.message.ai .bubble.thinking { display: flex; align-items: center; gap: 5px; background-color: #e9ecef; }
.message.ai .bubble.thinking .dot { width: 8px; height: 8px; background-color: #999; border-radius: 50%; animation: typing 1s infinite; }
.message.ai .bubble.thinking .dot:nth-child(2) { animation-delay: 0.2s; }
.message.ai .bubble.thinking .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1.0); } }

/* Feedback Buttons */
.feedback-buttons { margin-top: 8px; display: flex; gap: 8px; }
.feedback-btn { background: none; border: none; cursor: pointer; font-size: 16px; opacity: 0.5; transition: opacity 0.2s, transform 0.2s; }
.feedback-btn:hover { opacity: 1; transform: scale(1.2); }
.feedback-btn:disabled { cursor: default; }

.chatbot-quick-questions {
    padding: 10px 15px 15px 15px;
    border-top: 1px solid #e9ecef;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 120px;
    overflow-y: auto;
}
.quick-question { background-color: #f1f3f5; border: 1px solid transparent; border-radius: 15px; padding: 6px 14px; font-size: 12px; cursor: pointer; color: #333; transition: all 0.2s; }
.quick-question:hover { background-color: #e9ecef; border-color: #dee2e6; }

.chatbot-input-area { display: flex; padding: 15px; border-top: 1px solid #e9ecef; background-color: #fff; }
#chatbot-input { flex-grow: 1; border: none; padding: 8px; font-size: 14px; outline: none; background: transparent; }
#chatbot-send-btn { background: none; border: none; color: #e93b5a; font-size: 20px; cursor: pointer; transition: transform 0.2s; }
#chatbot-send-btn:hover { transform: scale(1.1); }
#chatbot-send-btn:disabled { color: #ccc; cursor: not-allowed; }

/* --- [核心新增] 固定的操作栏样式 --- */
.chatbot-actions {
    padding: 10px 15px;
    border-top: 1px solid #e9ecef;
    background-color: #f8f9fa; /* 使用稍有区别的背景色 */
    flex-shrink: 0; /* 防止被压缩 */
}

.chatbot-actions .action-btn {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease-in-out;
}

.chatbot-actions .action-btn:hover {
    background-color: #f1f3f5;
    border-color: #ced4da;
    color: #000;
}

.chatbot-actions .action-btn i {
    color: #e93b5a; /* 使用主题色 */
}