/* 智航AI聊天面板样式 */
.ai-chat-container {
    position: fixed;
    top: var(--toolbar-height);
    left: 0;
    bottom: var(--status-bar-height);
    width: 400px;
    background: var(--background-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.ai-chat-container:not(.hidden) {
    transform: translateX(0);
}

/* 当AI聊天打开时，调整主容器的边距 */
.main-container.ai-chat-open {
    margin-left: 400px;
}

/* 聊天窗口头部 */
.ai-chat-header {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-chat-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

.ai-chat-header h3::before {
    content: '🤖';
    margin-right: 8px;
}

.ai-chat-header button {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 16px;
}

/* 消息列表区域 */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* 隐藏 Webkit 浏览器的默认滚动条 */
.ai-chat-messages::-webkit-scrollbar {
    display: none;
}

/* 如果你想要一个自定义的滚动条，可以取消上面的隐藏样式，使用下面的样式 */
/*
.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}
*/

/* 消息样式 */
.ai-message {
    margin-bottom: 15px;
    padding: 12px 15px;
    border-radius: 15px;
    max-width: 90%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 用户消息样式 */
.ai-message.user {
    background: var(--primary-color);
    margin-left: auto;
    border-top-right-radius: 0;
    border-bottom-right-radius: 15px;
    border-top-left-radius: 15px;
    border-bottom-left-radius: 15px;
    color: white;
}

/* 用户消息小三角 */
.ai-message.user::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 0;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-left-color: var(--primary-color);
    border-top-color: var(--primary-color);
    border-right: 0;
    border-top: 0;
    transform: translateY(0);
}

/* AI助手消息样式 */
.ai-message.assistant {
    background: var(--hover-color);
    margin-right: auto;
    border-top-left-radius: 0;
    border-bottom-left-radius: 15px;
    border-top-right-radius: 15px;
    border-bottom-right-radius: 15px;
}

/* AI助手消息小三角 */
.ai-message.assistant::after {
    content: '';
    position: absolute;
    left: -8px;
    top: 0;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-right-color: var(--hover-color);
    border-top-color: var(--hover-color);
    border-left: 0;
    border-top: 0;
    transform: translateY(0);
}

/* 消息时间戳 */
.ai-message::before {
    content: attr(data-time);
    position: absolute;
    bottom: -18px;
    font-size: 11px;
    color: var(--text-color);
    opacity: 0.5;
}

.ai-message.user::before {
    right: 5px;
}

.ai-message.assistant::before {
    left: 5px;
}

/* 调整代码块在消息中的样式 */
.ai-message.assistant pre {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    margin: 10px -5px;
    border-radius: 8px;
}

/* 输入区域 */
.ai-chat-input {
    padding: 10px;
    border-top: 1px solid var(--border-color);
}

.ai-chat-input textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--background-color);
    color: var(--text-color);
    resize: none;
    margin-bottom: 8px;
}

.ai-chat-input button {
    width: auto;
}

.ai-chat-input button:hover {
    background: var(--primary-color-dark, #0056b3);
}

/* 消息内容样式 */
.ai-message pre {
    position: relative;
    padding: 10px;
    padding-bottom: 35px;  /* 为底部按钮留出空间 */
    background: var(--background-color);
    border-radius: 4px;
    overflow-x: auto;
    margin: 10px 0;
    border: 1px solid var(--border-color);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.ai-message pre code {
    font-family: 'Fira Code', monospace;
    font-size: 0.9em;
    line-height: 1.5;
    tab-size: 4;
    display: block;
}

/* 行内代码样式 */
.ai-message code:not(pre code) {
    background: var(--background-color);
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
    border: 1px solid var(--border-color);
}

/* 隐藏代码块的滚动条 */
.ai-message pre::-webkit-scrollbar {
    height: 4px;
}

.ai-message pre::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.ai-message pre::-webkit-scrollbar-track {
    background: transparent;
}

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

.ai-message:last-child p:last-child {
    margin-bottom: 0;
}

/* 代码块容器 */
.code-block-container {
    position: relative;
    margin: 10px 0;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    padding-right: 40px;
}

/* 代码块 */
.code-block {
    font-family: 'Fira Code', monospace;
    font-size: 0.9em;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre;
}

/* 复制按钮样式 */
.code-copy-btn {
    position: absolute;
    bottom: 5px;          /* 改为底部定位 */
    right: 5px;
    padding: 4px 8px;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    opacity: 1;
    transition: all 0.2s ease;
    font-size: 14px;
    z-index: 10;
    color: var(--text-color);
    display: flex;        /* 添加 flex 布局 */
    align-items: center;  /* 垂直居中 */
    gap: 4px;            /* 图标和文字的间距 */
}

/* 添加文字说明 */
.code-copy-btn::after {
    content: '复制';
    font-size: 12px;
}

/* 复制成功状态 */
.code-copy-btn.copied::after {
    content: '已复制';
}

.code-copy-btn:hover {
    background: var(--hover-color);
}

.code-copy-btn.copied {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 有序列表样式 */
.ai-message ol {
    padding-left: 2em;
    margin: 0.5em 0;
}

.ai-message ol li {
    margin-bottom: 0.5em;
    padding-left: 0.5em;
}

/* 确保数字不会超出容器 */
.ai-message ol {
    list-style-position: inside;
}

/* 按钮容器样式 */
.ai-chat-buttons {
    display: flex;
    gap: 8px;  /* 按钮之间的间距 */
}

/* 调整按钮样式 */
.ai-chat-buttons button {
    flex: 1;      /* 按钮等宽 */
    padding: 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

/* 发送按钮样式 */
.ai-chat-buttons button:last-child {
    background: var(--primary-color);
    color: white;
}

/* 新对话按钮样式 */
.new-chat-btn {
    background: var(--hover-color) !important;  /* 使用不同的背景色 */
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
}

.new-chat-btn:hover {
    background: var(--button-hover-color) !important;
}

/* 系统消息样式 */
.ai-system-message {
    text-align: center;
    color: var(--text-color);
    opacity: 0.6;
    font-size: 12px;
    margin: 10px 0;
    padding: 5px;
    border-bottom: 1px solid var(--border-color);
}

/* 停止按钮样式 */
.stop-ai-btn {
    background-color: var(--error-color) !important;
    color: white !important;
    border: none;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.stop-ai-btn:hover {
    opacity: 0.9;
}

.stop-ai-btn.hidden {
    display: none;
}

/* 禁用状态的输入框和按钮样式 */
.ai-chat-input textarea:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.ai-chat-buttons button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 发送/停止按钮样式 */
.action-btn {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

/* 发送状态 */
.action-btn.send {
    background: var(--primary-color);
    color: white;
}

/* 停止状态 */
.action-btn.stop {
    background: var(--error-color);
    color: white;
}

/* 按钮悬停效果 */
.action-btn:hover {
    opacity: 0.9;
}

/* 禁用状态 */
.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
} 