/* ==================== AI 对话区域样式 ==================== */

/* 对话区域容器 */
.chat-area {
    width: 100%;
    max-width: 100%;
    padding: 0; /* 移除padding，让它跟随main-content滚动 */
    display: none; /* 默认隐藏，有对话时显示 */
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 对话消息容器 */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 0; /* 内边距改到这里 */
}

/* 隐藏对话消息容器的滚动条 */
.chat-messages::-webkit-scrollbar {
    width: 0;
    display: none;
}

/* 单条消息 */
.chat-message {
    display: flex;
    gap: 0; /* 移除gap，因为没有头像了 */
    animation: messageSlideIn 0.3s ease;
    margin-bottom: 12px;
}

@keyframes messageSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 用户消息靠右 */
.user-message {
    justify-content: flex-end;
}

/* AI消息靠左 */
.ai-message {
    justify-content: flex-start;
}

/* 消息气泡 */
.message-bubble {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: 18px;
    line-height: 1.7;
    font-size: 15px;
    word-wrap: break-word;
    background: #F7F7F8;
    color: #333;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* 用户消息气泡 - 紫蓝渐变 */
.user-message .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 6px;
}

/* AI消息气泡 */
.ai-message .message-bubble {
    background: #F7F7F8;
    color: #1a1a1a;
    border-bottom-left-radius: 6px;
}

/* 加粗文字样式 */
.message-bubble strong {
    font-weight: 600;
    color: inherit;
}

/* AI消息中的加粗文字 */
.ai-message .message-bubble strong {
    color: #1a1a1a;
    font-weight: 700;
}

/* 流式输出光标 */
.streaming-cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background-color: #667eea;
    margin-left: 2px;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* 加载动画 */
.message-bubble.loading {
    padding: 20px;
    background: white;
}

.typing-indicator {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* 消息内容格式 */
.message-bubble ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message-bubble li {
    margin: 4px 0;
}

.message-bubble p {
    margin: 8px 0;
}

.message-bubble p:first-child {
    margin-top: 0;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

/* 滚动条美化 */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}
