body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f5f7fa;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 标题栏 */
.chat-header {
    padding: 12px 16px;
    background-color: #fff;
    border-bottom: 1px solid #ebeef5;
    text-align: center;
    font-size: 18px;
    font-weight: 500;
    color: #1d2129;
    position: relative;
    z-index: 10;
}

/* 消息列表容器：保持原有内边距 */
.chat-message-list {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    scrollbar-width: thin;
    display: flex;
    flex-direction: column;
}

/* ######## 核心修改1：对话框延长+移除头像+内容铺满 ######## */
.chat-message-item {
    margin-bottom: 16px;
    max-width: 90%;
    /* 对话框延长到90%宽度（原80%） */
    display: flex;
    /* 移除头像相关样式，直接让内容容器占满 */
}

/* AI消息左对齐：取消头像后无需反向排列 */
.chat-message-ai {
    align-self: flex-start;
}

.chat-message-user {
    align-self: flex-end;
}

/* ######## 核心修改2：移除头像容器 ######## */
.chat-avatar {
    display: none;
    /* 彻底隐藏头像 */
}

/* ######## 核心修改3：内容容器铺满+调整内边距 ######## */
.chat-message-content {
    padding: 12px 16px;
    /* 增加内边距，提升视觉长度 */
    border-radius: 16px;
    position: relative;
    word-break: break-word;
    width: 100%;
    /* 内容铺满对话框 */
    max-width: 100%;
    /* 取消最大宽度限制，确保铺满 */
}

.chat-message-content-ai {
    background-color: #fff;
    border: 1px solid #ebeef5;
}

.chat-message-content-user {
    background-color: #4080ff;
    color: #fff;
}

/* ######## 核心修改4：仅有思维链时显示左侧竖线 ######## */
.reasoning-chain {
    font-size: 13px;
    color: #86909c;
    line-height: 1.5;
    padding: 6px 0 8px;
    margin-bottom: 4px;
    /* 关键：默认隐藏竖线，有内容时通过JS添加样式显示 */
    border-left: 2px solid transparent;
    /* 透明边框占位，避免布局跳动 */
    padding-left: 8px;
}

/* 有思维链时显示灰色竖线（通过JS动态添加此类） */
.reasoning-chain.has-content {
    border-left-color: #e5e6eb;
}

.result-content {
    font-size: 15px;
    line-height: 1.5;
}

/* 时间戳样式：调整位置，适配无头像布局 */
.chat-timestamp {
    font-size: 10px;
    color: #86909c;
    text-align: right;
    margin-top: 6px;
    line-height: 1;
}

.chat-message-user .chat-timestamp {
    color: rgba(255, 255, 255, 0.6);
}

/* 加载动画容器：调整位置 */
.chat-loading {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    vertical-align: middle;
}

/* 输入框区域（保持原有） */
.chat-input-container {
    padding: 12px;
    background-color: #fff;
    border-top: 1px solid #ebeef5;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    z-index: 10;
    box-sizing: border-box;
    width: 100%;
}

.file-upload-area {
    display: flex;
    align-items: center;
    gap: 8px;
}

.upload-btn {
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 14px;
}

.file-info {
    font-size: 12px;
    color: #86909c;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.chat-form {
    width: 100%;
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input {
    flex: 1;
    border-radius: 24px;
    min-width: 0;
}

.chat-send-btn {
    border-radius: 24px;
    padding: 0 16px;
    white-space: nowrap;
}

/* 错误提示样式（保持原有） */
.chat-error-text {
    color: #f53f3f;
    font-size: 12px;
    text-align: center;
    margin: 4px 0;
    display: none;
    height: 16px;
}

/* Markdown 内容修复（保持原有） */
.reasoning-chain p,
.result-content p {
    margin: 0 0 6px 0;
}

.reasoning-chain p:last-child,
.result-content p:last-child {
    margin-bottom: 0;
}

/* 文件消息样式（适配无头像布局） */
.file-message {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-icon {
    font-size: 16px;
}
/* 新增对话框历史侧边栏样式 */
.history-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.history-sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.history-item:hover {
    background: #f5f7fa;
}

.history-item.active {
    background: #e8f3ff;
    border-left: 3px solid #4080ff;
}

.history-title {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-time {
    font-size: 12px;
    color: #86909c;
    margin-top: 4px;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99;
    display: none;
}

.overlay.show {
    display: block;
}
button {
    border: none;
    background: transparent;
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.new-chat-btn {
    position: absolute;
    right: 16px;
    top: 12px;
}

.knowledge-btn {
    position: absolute;
    right: 66px;
    top: 12px;
    border: none;
    background: transparent;
}

.menu-btn {
    position: absolute;
    left: 16px;
    top: 12px;
    border: none;
    background: transparent;
}

.chat-header {
    position: relative;
    text-align: center;
}
