/* 主流AI搜索引擎风格 - 消息样式（DeepSeek风格） */

/* 消息容器 */
.message-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0;
    max-width: 100%;
}

/* ========== 用户消息样式 ========== */
.user-bubble {
    align-self: flex-end;
    max-width: 85%;
    position: relative;
    margin: 12px 0;
    animation: slideInRight 0.25s ease-out;
}

.user-bubble-inner {
    background: #eff4ff;
    /* 淡蓝紫色背景 */
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.6;
    color: #18181b;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.user-bubble-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    margin-top: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.user-bubble:hover .user-bubble-actions {
    opacity: 1;
}

.user-action-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #71717a;
    font-size: 14px;
    transition: all 0.2s;
    border-radius: 4px;
}

.user-action-btn:hover {
    color: #18181b;
    background: #f4f4f5;
}

/* ========== AI消息样式 ========== */
.ai-bubble {
    max-width: 100%;
    margin: 16px 0;
    animation: slideInLeft 0.25s ease-out;
}

/* AI消息头部 */
.ai-bubble-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 13px;
}

.ai-model-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: #eff6ff;
    /* 淡蓝色背景 */
    border: 1px solid #dbeafe;
    border-radius: 20px;
    color: #1e40af;
    font-weight: 500;
}

.ai-model-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-status-text {
    color: #71717a;
    font-size: 13px;
}

.ai-status-text .time {
    font-weight: 500;
}

/* AI消息内容 */
.ai-bubble-content {
    background: transparent;
    padding: 0;
    font-size: 15px;
    line-height: 1.8;
    color: #27272a;
}

/* 段落间距 */
.ai-bubble-content p {
    margin: 0 0 16px 0;
}

.ai-bubble-content p:last-child {
    margin-bottom: 0;
}

/* emoji增强 */
.ai-bubble-content p:has(>strong:first-child) {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

/* 标题样式 */
.ai-bubble-content h1,
.ai-bubble-content h2,
.ai-bubble-content h3 {
    font-weight: 600;
    margin: 20px 0 12px 0;
    color: #18181b;
}

.ai-bubble-content h1 {
    font-size: 22px;
}

.ai-bubble-content h2 {
    font-size: 18px;
}

.ai-bubble-content h3 {
    font-size: 16px;
}

/* 列表样式 */
.ai-bubble-content ul,
.ai-bubble-content ol {
    margin: 12px 0;
    padding-left: 24px;
}

.ai-bubble-content li {
    margin: 8px 0;
    line-height: 1.8;
}

.ai-bubble-content ul li {
    list-style-type: disc;
}

.ai-bubble-content ol li {
    list-style-type: decimal;
}

/* 代码块样式 */
.ai-bubble-content pre {
    background: #18181b;
    color: #e4e4e7;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0;
    font-size: 13px;
    line-height: 1.6;
    border: 1px solid #27272a;
}

.ai-bubble-content code {
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
}

/* 行内代码 */
.ai-bubble-content :not(pre)>code {
    background: #f4f4f5;
    color: #e11d48;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    border: 1px solid #e4e4e7;
}

/* 引用块 */
.ai-bubble-content blockquote {
    border-left: 3px solid #3b82f6;
    padding-left: 16px;
    margin: 16px 0;
    color: #52525b;
    font-style: normal;
    background: #f9fafb;
    padding: 12px 16px;
    border-radius: 0 6px 6px 0;
}

/* 链接样式 */
.ai-bubble-content a {
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.2s;
}

.ai-bubble-content a:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* AI消息底部操作栏 */
.ai-bubble-footer {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 12px;
    padding-top: 8px;
}

.ai-action-btn {
    background: transparent;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #71717a;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-action-btn:hover {
    background: #f4f4f5;
    color: #18181b;
}

.ai-action-btn:active {
    transform: scale(0.96);
}

.ai-action-btn i {
    font-size: 14px;
}

/* 点赞/点踩按钮变体 */
.ai-action-btn.liked {
    color: #3b82f6;
}

.ai-action-btn.disliked {
    color: #ef4444;
}

/* ========== 加载状态 ========== */
.loading-spinner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #71717a;
    font-size: 14px;
    padding: 8px 0;
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background: #71717a;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========== 错误消息 ========== */
.error-message {
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #991b1b;
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 8px 0;
}

.error-message::before {
    content: '⚠';
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ========== 欢迎消息 ========== */
.welcome-message {
    text-align: center;
    padding: 60px 20px;
}

.welcome-message h2 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #18181b;
}

.welcome-message p {
    font-size: 15px;
    color: #71717a;
    max-width: 500px;
    margin: 0 auto;
}

/* ========== 动画 ========== */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .user-bubble {
        max-width: 90%;
    }

    .ai-bubble-content {
        font-size: 14px;
    }

    .user-bubble-inner {
        font-size: 14px;
    }
}

/* ========== 暗黑模式 ========== */
.theme-dark .user-bubble-inner {
    background: #2a2d3a;
    color: #e4e4e7;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.theme-dark .ai-bubble {
    background: #27272a;
    color: #fafafa;
}

.theme-dark .ai-model-badge {
    background: #1e3a8a;
    border-color: #1e40af;
    color: #93c5fd;
}

.theme-dark .ai-bubble-content {
    color: #e4e4e7;
}

.theme-dark .ai-bubble-content h1,
.theme-dark .ai-bubble-content h2,
.theme-dark .ai-bubble-content h3 {
    color: #fafafa;
}

.theme-dark .ai-bubble-content :not(pre)>code {
    background: #27272a;
    border-color: #3f3f46;
    color: #fb7185;
}

.theme-dark .ai-bubble-content blockquote {
    background: #27272a;
    border-left-color: #3b82f6;
    color: #a1a1aa;
}

.theme-dark .ai-action-btn {
    color: #a1a1aa;
}

.theme-dark .ai-action-btn:hover {
    background: #27272a;
    color: #fafafa;
}

.theme-dark .user-action-btn {
    color: #a1a1aa;
}

.theme-dark .user-action-btn:hover {
    background: #27272a;
    color: #fafafa;
}