/*测试AI聊天室*/
#difyAIUI {
    display: flex;
    height: 90vh;
    overflow: hidden;
}

/* 侧边栏样式 */
.sidebar {
    width: 320px;
    background: linear-gradient(135deg, #1a1b25 0%, #2d2e3a 100%);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 20px;
    height: 100%;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

/* Dify AI聊天室 */
.app-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
    font-size: 20px;
    font-weight: 600;
}

.app-title i {
    color: #aa71c7 !important;
}

.title-content {
    display: flex;
    flex-direction: column;
}

.app-description {
    font-size: 12px;
    font-weight: normal;
    color: white;
    margin-top: 2px;
}

/* 新建对话 */
.new-chat-btn {
    background: linear-gradient(135deg, #7e6af5 0%, #aa71c7 100%);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    transition: all 0.3s;
    font-weight: 500;
    box-shadow: 0 4px 10px rgba(126, 106, 245, 0.3);
}

.new-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(126, 106, 245, 0.4);
}

/* 多个对话 */
.conversation-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color 0.3s;
}

.conversation-item:hover {
    background-color: #353641;
}

.conversation-item.active {
    background-color: #3f404d;
}

/* 删除对话 */
.delete-btn {
    margin-left: auto;
    color: #6b7280;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}

.delete-btn:hover {
    color: #ff4d4d;
}

/* 主聊天区域样式 */
.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: #f9fafb;
}

/* 标题 */
.chat-header {
    padding: 18px 25px;
    border-bottom: 1px solid #e5e7eb;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chat-title {
    font-weight: 600;
    font-size: 18px;
    color: #1f2937;
}

/* 内容 */
.chat-messages {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 25px;
    background-color: #f9fafb;
}

.message {
    max-width: 75%;
    padding: 20px;
    border-radius: 16px;
    line-height: 1.6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.user-message {
    align-self: flex-end;
    background: linear-gradient(135deg, #7e6af5 0%, #6a5af3 100%);
    color: white;
    border-bottom-right-radius: 6px;
}

.ai-message {
    align-self: flex-start;
    background-color: white;
    color: #1f2937;
    border-bottom-left-radius: 6px;
    border: 1px solid #e5e7eb;
}

.message-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 14px;
}

.thinking {
    padding: 20px;
    color: #6b7280;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: white;
    border-radius: 16px;
    align-self: flex-start;
    max-width: 75%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* 输入区域样式 */
.input-container {
    padding: 25px;
    background-color: white;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.input-box {
    display: flex;
    gap: 15px;
    max-width: 900px;
    margin: 0 auto;
    align-items: flex-end;
}

.message-input {
    flex: 1;
    padding: 16px 20px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    resize: none;
    min-height: 60px;
    max-height: 150px;
    font-size: 16px;
    background-color: #f9fafb;
    color: #1f2937;
    transition: border-color 0.3s;
    line-height: 1.5;
}

.message-input:focus {
    outline: none;
    border-color: #7e6af5;
    box-shadow: 0 0 0 3px rgba(126, 106, 245, 0.1);
}

.send-btn {
    background: linear-gradient(135deg, #7e6af5 0%, #6a5af3 100%);
    color: white;
    border: none;
    border-radius: 12px;
    width: 60px;
    height: 60px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(126, 106, 245, 0.3);
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(126, 106, 245, 0.4);
}

.send-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 响应式设计 */
@media (max-width: 968px) {
    .sidebar {
        width: 280px;
    }

    .message {
        max-width: 85%;
    }
}

@media (max-width: 768px) {
    #difyAIUI {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 40vh;
    }

    .main-container {
        height: 60vh;
    }

    .message {
        max-width: 90%;
    }
}

/* 滚动条样式 */
/*::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #2a2b36;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #7e6af5;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6a5af3;
}*/

.main-container ::-webkit-scrollbar-track {
    background: #e5e7eb;
}

/* Markdown 样式 */
.ai-message pre {
    background-color: #f3f4f6;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

.ai-message code {
    background-color: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

.ai-message p {
    margin-bottom: 10px;
}

.ai-message ul, .ai-message ol {
    margin: 10px 0 10px 20px;
}

/* 状态指示器 */
.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-connected {
    background-color: #10b981;
}

.status-disconnected {
    background-color: #ef4444;
}

/* 加载动画 */
.spinner {
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* 错误提示 */
.error-message {
    background-color: #fee2e2;
    color: #dc2626;
    padding: 10px;
    border-radius: 8px;
    margin: 10px 0;
    border-left: 4px solid #dc2626;
}



/* Markdown表格样式 - 带滚动条 */
.markdown-table-container {
    overflow-x: auto;
    margin: 1rem 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
    max-width: 100%;

    /* 自定义滚动条样式 */
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f5f5f5;
}

/* Webkit浏览器滚动条样式 */
.markdown-table-container::-webkit-scrollbar {
    height: 8px;
}

.markdown-table-container::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 4px;
}

.markdown-table-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.markdown-table-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.markdown-table {
    width: auto; /* 改为auto，让表格根据内容自适应宽度 */
    min-width: 100%; /* 最小宽度为容器宽度 */
    border-collapse: collapse;
    font-size: 14px;
    background: white;
}

/* 确保表头在滚动时保持固定 */
.markdown-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.markdown-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    border: none;
    white-space: nowrap; /* 防止表头文字换行 */
}

.markdown-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #e8e8e8;
    color: #333;
    white-space: nowrap; /* 防止单元格文字换行 */
}

.markdown-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.markdown-table tr:hover {
    background-color: #e3f2fd;
    transition: background-color 0.2s ease;
}

.streaming-indicator {
    margin-left: 10px;
    color: #909399;
    font-size: 12px;
}
/* 发送者标签基础样式 */
.sender-label {
    font-size: 13px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

/* 用户标签样式 */
.sender-label.user {
    color: #4b5563;
    background: rgba(243, 244, 246, 0.7);
    border: 1px solid rgba(229, 231, 235, 0.5);
}

/* AI标签样式（紫色渐变主题） */
.sender-label.ai {
    color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 6px rgba(118, 75, 162, 0.25);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
}

/* 悬停效果（可选） */
.sender-label:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 呼吸灯指示器（保持原有样式） */
.ai-breathing-indicator {
    margin-left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 10px;
    color: #6366f1;
    font-size: 10px;
    font-weight: 500;
    animation: breathing 2s infinite ease-in-out;
}

.breathing-text {
    letter-spacing: 0.5px;
}

.breathing-dots::after {
    content: '...';
    animation: dots 1.5s infinite steps(3, end);
}

@keyframes breathing {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes dots {
    0% { content: '.'; }
    33% { content: '..'; }
    66%, 100% { content: '...'; }
}