/* ==================== KIMI风格 - 急救垂域大模型 ==================== */

/* 基础重置 */
html {
    min-width: 320px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
    line-height: 1.6;
    background-color: #f5f5f5;
    min-width: 320px;
    color: #333;
}

/* 主页面布局 - 仅对主页面生效 */
body.main-page {
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* ==================== 侧边栏切换按钮 - Kimi风格 ==================== */
.sidebar-toggle-btn {
    position: fixed;
    /* 收起状态：垂直居中于左侧边缘 */
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    z-index: 1001;
    width: 20px;
    height: 40px;
    background-color: #ffffff;
    color: #8f8f8f;
    border: 1px solid #e5e5e7;
    border-left: none;
    border-radius: 0 4px 4px 0;
    box-shadow: 1px 0 4px rgba(0,0,0,0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
}

.sidebar-toggle-btn:hover {
    background-color: #f9f9f9;
    color: #5f5f5f;
}

.sidebar-toggle-btn .toggle-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

/* 英文内容专用样式 */
.english-content {
    font-family: 'Times New Roman', serif;
    font-style: italic;
    line-height: 1.5;
}

/* 消息内容字体优化 */
.message-content {
    font-family: 'Times New Roman', serif;
    line-height: 1.5;
    white-space: normal; /* 改为 normal，避免自动换行 */
    /* 其他现有样式保持不变 */
}

/* 确保中文内容使用合适的字体 */
.message-content:lang(zh) {
    font-family: 'Microsoft YaHei', 'SimSun', serif;
    font-style: normal;
}

body:not(.sidebar-hidden) .sidebar-toggle-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

body.sidebar-hidden .sidebar-toggle-btn .toggle-icon {
    transform: scaleX(-1);
}
/* 侧边栏展开时的状态：位于侧边栏内部右上角，与h1对齐 */
body:not(.sidebar-hidden) .sidebar-toggle-btn {
    top: 0;
    transform: none;
    left: var(--km-sidebar-width); /* 使用变量控制位置 */
    margin-left: -24px; /* 向左偏移自身宽度，进入侧边栏内部 */
    height: 48px; /* 匹配 h1 高度 */
    width: 24px;
    background-color: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

/* ==================== 侧边栏 - KIMI风格 ==================== */
.sidebar {
    width: var(--km-sidebar-width); /* 使用变量控制宽度 */
    background-color: #f7f7f8;
    border-right: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 999;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

body.sidebar-hidden .sidebar {
    transform: translateX(-100%);
    position: absolute;
    height: 100%;
}

.sidebar h1 {
    padding: 12px 8px 10px;
    font-size: 13px;
    font-weight: 600;
    color: #1f1f1f;
    border-bottom: none;
    margin: 0;
}

/* 可滚动的会话列表区域 */
.scrollable-section {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* 固定在底部的区域 */
.fixed-bottom-section {
    flex-shrink: 0;
    padding: 8px;
    border-top: 1px solid #e5e5e7;
}

.section {
    margin-bottom: 0;
    padding: 0;
}

.section h3 {
    display: none;
}

/* 模型选择区域样式调整 */
.model-section {
    margin-bottom: 20px;
}

.model-section h3 {
    margin-bottom: 15px;
    color: #ecf0f1;
}

.btn {
    width: 100%;
    padding: 8px 15px;
    margin-bottom: 8px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background-color: #4CAF50;
    color: white;
    font-weight: 500;
}

.btn-primary:hover {
    background-color: #45a049;
}

/* 新建会话按钮 - Kimi风格，保持固定不滚动 */
.new-chat-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(100% - 24px);
    margin: 6px 12px;
    padding: 8px 10px;
    background-color: transparent;
    border: 1px dashed #d0d0d2;
    border-radius: 8px;
    color: #5f5f5f;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    flex-shrink: 0;
}

.new-chat-btn:hover {
    background-color: #ededef;
    border-color: #b0b0b2;
    color: #1f1f1f;
}

.new-chat-btn .action-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.new-chat-btn .new-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* 会话按钮 - Kimi风格 */
.btn-session {
    background-color: transparent;
    color: #5f5f5f;
    text-align: left;
    justify-content: space-between;
    padding: 6px 10px;
    margin: 1px 6px;
    border-radius: 6px;
    font-size: 12px;
    transition: all 0.15s ease;
    position: relative;
}

.btn-session:hover {
    background-color: #ededef;
    color: #1f1f1f;
}

.btn-session.active {
    background-color: #e5e5e7;
    color: #1f1f1f;
}

/* 查看更多按钮 */
.show-more-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 12px;
    margin: 8px;
    color: #8f8f8f;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    border-radius: 6px;
}

.show-more-btn:hover {
    background-color: #ededef;
    color: #5f5f5f;
}

.show-more-btn .arrow-icon {
    font-size: 14px;
    transform: rotate(90deg);
}

select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e5e7;
    border-radius: 8px;
    font-size: 13px;
    background-color: white;
    cursor: pointer;
    color: #1f1f1f;
}

/* ==================== 主内容区域 - KIMI风格 ==================== */
.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    position: relative;
    overflow: hidden;
}

body.sidebar-hidden .main-content {
    margin-left: 0;
}

/* 头部 Header */
.header {
    padding: 12px 24px;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e5e7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 48px;
    flex-shrink: 0;
    transition: padding-left 0.2s ease;
}

.header h2 {
    font-size: 14px;
    font-weight: 500;
    color: #1f1f1f;
    margin: 0;
}

body.sidebar-hidden .header {
    padding-left: 60px; /* 收起侧边栏时，Header左侧留出空间给展开按钮 */
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 模型选择器样式 */
/* 模型选择器响应式优化 */
.model-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    min-width: 200px;
}

.model-selector label {
    font-size: 13px;
    font-weight: 400;
    color: #5f5f5f;
    white-space: nowrap;
}

.model-selector select {
    width: auto;
    min-width: 120px;
    max-width: 200px;
    padding: 6px 12px;
    border: 1px solid #e5e5e7;
    border-radius: 8px;
    font-size: 13px;
    background-color: white;
    color: #1f1f1f;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.model-selector select:focus {
    outline: none;
    border-color: #1a73e8;
}

.model-selector select:hover {
    border-color: #d0d0d2;
}

/* ==================== KIMI风格欢迎界面 ==================== */

.welcome-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    padding: 40px 20px;
}

    .logo-title {
        font-size: 36px;
        font-weight: 600;
        margin-bottom: 12px;
        letter-spacing: 2px;
        color: #1f1f1f;
    }

    .welcome-subtitle {
        font-size: 14px;
        color: #5f5f5f;
        margin-bottom: 32px;
        text-align: center;
        line-height: 1.5;
    }

    .search-box-container {
        width: 100%;
        max-width: 680px;
        padding: 16px;
        border-radius: 12px;
        background-color: #f7f7f8;
        box-shadow: none;
    }

    .prompt-area {
        border: 1px solid #e5e5e7;
        border-radius: 24px;
        padding: 6px 6px 6px 16px;
        display: flex;
        align-items: center;
        background-color: #fff;
    }

    .prompt-input {
        flex: 1;
        border: none;
        outline: none;
        font-size: 14px;
        padding: 8px 8px;
        background: transparent;
        color: #1f1f1f;
    }

    .prompt-input::placeholder {
        color: #8f8f8f;
    }

    .file-upload-btn-inline {
        font-size: 18px;
        cursor: pointer;
        padding: 8px;
        color: #5f5f5f;
        transition: color 0.15s ease;
        border-radius: 8px;
    }

    .file-upload-btn-inline:hover {
        color: #1f1f1f;
        background: #ededef;
    }

    .send-btn-inline {
        background-color: #1a73e8;
        color: white;
        border: none;
        border-radius: 20px;
        padding: 8px 18px;
        font-size: 13px;
        font-weight: 500;
        cursor: pointer;
        transition: background-color 0.15s ease;
    }

    .send-btn-inline:hover {
        background-color: #1557b0;
    }

/* 工具卡片区域 - KIMI风格 */

.related-content {
    display: flex;
    gap: 16px;
    margin-top: 40px;
    width: 100%;
    max-width: 680px;
}

    .content-card {
        flex: 1;
        border-radius: 12px;
        overflow: hidden;
        border: 1px solid #e5e5e7;
        background-color: #fff;
        cursor: pointer;
        transition: all 0.15s ease;
    }

    .content-card:hover {
        border-color: #d0d0d2;
        transform: translateY(-2px);
    }

    .card-image-placeholder {
        height: 100px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 14px;
    }

    .card-footer {
        padding: 12px 14px;
        font-size: 13px;
        font-weight: 500;
        color: #1f1f1f;
    }

/* 聊天界面 */

.chat-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    min-height: 0;
}

/* 聊天容器 - KIMI风格居中布局 */

.chat-container {
    flex: 1;
    padding: 30px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
    /* 确保滚动条在最右侧，通过调整width/margin或使用absolute定位的parent */
    width: 100%; 
    max-width: 100%; /* 占满整个 main-content */
}

/* 对话内容居中容器 */
.chat-content-wrapper {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.message {
    margin-bottom: 0;
    display: flex;
    align-items: flex-start;
    max-width: 800px; /* 限制消息本身的最大宽度 */
    margin-left: auto;
    margin-right: auto; /* 居中 */
    width: 100%;
    padding: 0;
}

.message.user {
    justify-content: flex-end;
}

/* 消息内容 - KIMI风格 */
.message-content {
    max-width: 85%;
    min-width: 0;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 15px;
}

/* MathJax 公式样式优化 */
.message-content .MathJax {
    font-size: 1em !important;
}

.message-content .MathJax_Display {
    margin: 0.5em 0 !important;
}

.message-content .MathJax_CHTML {
    vertical-align: baseline !important;
}

.message.user .message-content {
    background-color: #1a73e8;
    color: white;
    border-radius: 16px 16px 4px 16px;
}

.message.assistant .message-content {
    background-color: #ffffff;
    color: #1f1f1f;
    border-radius: 16px 16px 16px 4px;
    border: 1px solid #e5e5e7;
}

/* 文件预览容器优化 */
.file-preview-container {
    border-top: 1px solid #bdc3c7;
    background-color: #f8f9fa;
    padding: 15px 20px;
    max-height: 200px;
    min-height: 60px;
    overflow-y: auto;
    flex-shrink: 0;
}

.file-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: bold;
    color: #2c3e50;
}

.clear-files-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.clear-files-btn:hover {
    background-color: #c0392b;
}

.file-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.file-preview-item {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px;
    background-color: white;
    min-width: 120px;
    max-width: 150px;
}

.file-preview-item.image {
    text-align: center;
}

.file-preview-item.document {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-preview-image {
    width: 100px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 5px;
}

.file-icon {
    font-size: 24px;
    color: #7f8c8d;
}

.file-name {
    font-size: 12px;
    color: #2c3e50;
    word-break: break-all;
    line-height: 1.2;
}

.file-size {
    font-size: 10px;
    color: #7f8c8d;
    margin-top: 2px;
}

.remove-file-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-file-btn:hover {
    background-color: #c0392b;
}

/* ==================== 输入容器 - KIMI风格 ==================== */
.input-container {
    padding: 16px 24px 20px;
    background-color: #ffffff;
    border-top: 1px solid #e5e5e7;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
}

.file-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #ffffff;
    border: 1px solid #e5e5e7;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 18px;
    flex-shrink: 0;
    color: #5f5f5f;
}

.file-upload-btn:hover {
    background: #ededef;
    color: #1f1f1f;
}

.input-container input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: 10px 16px;
    border: 1px solid #e5e5e7;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    background-color: #ffffff;
    transition: border-color 0.15s ease;
    color: #1f1f1f;
}

.input-container input[type="text"]::placeholder {
    color: #8f8f8f;
}

.input-container input[type="text"]:focus {
    border-color: #1a73e8;
}

.send-btn {
    padding: 10px 20px;
    background-color: #1a73e8;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.15s ease;
    flex-shrink: 0;
}

.send-btn:hover {
    background-color: #1557b0;
}

.send-btn:disabled {
    background-color: #e5e5e7;
    color: #8f8f8f;
    cursor: not-allowed;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-warning {
    background-color: #f39c12;
    color: white;
}

.btn-warning:hover {
    background-color: #e67e22;
}

/* 消息中的文件显示样式 */
.message-files {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.message.user .message-files {
    border-top-color: rgba(255,255,255,0.2);
}

.message.assistant .message-files {
    border-top-color: rgba(44,62,80,0.2);
}

.message-file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
}

.message-file-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
}

.message.user .message-file-item {
    background-color: rgba(255,255,255,0.2);
    color: white;
}

.message.assistant .message-file-item {
    background-color: rgba(44,62,80,0.1);
    color: #2c3e50;
}

.message-file-icon {
    font-size: 14px;
}


/* 文件上传相关样式 */
.file-upload-container {
    display: flex;
    align-items: center;
    margin-right: 10px;
}

.file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-right: 10px;
}

.file-item {
    display: flex;
    align-items: center;
    background-color: #ecf0f1;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
}

.file-item .file-name {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item .remove-file {
    margin-left: 5px;
    cursor: pointer;
    color: #e74c3c;
}

.file-item .remove-file:hover {
    color: #c0392b;
}

/* 添加缩略图样式 */
.message-file-thumbnail {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.message-file-thumbnail:hover {
    transform: scale(1.05);
}

.message-file-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 5px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f9f9f9;
}

.message-file-name {
    margin-top: 5px;
    font-size: 12px;
    text-align: center;
    word-break: break-all;
}

/* 模态框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    transform: scale(0.95);
    transition: transform 0.2s ease;
    overflow: hidden;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

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

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f1f1f;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #8f8f8f;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.15s;
}

.modal-close:hover {
    background-color: #ededef;
    color: #5f5f5f;
}

.modal-body {
    padding: 20px;
}

.modal-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e5e7;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
    color: #1f1f1f;
}

.modal-input:focus {
    border-color: #1a73e8;
}

.modal-footer {
    padding: 16px 20px;
    background-color: #f9f9f9;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
}

.modal-btn-cancel {
    background-color: #ffffff;
    border-color: #e5e5e7;
    color: #5f5f5f;
}

.modal-btn-cancel:hover {
    background-color: #ededef;
    color: #1f1f1f;
}

.modal-btn-primary {
    background-color: #1a73e8;
    color: white;
}

.modal-btn-primary:hover {
    background-color: #1557b0;
}

/* 图像剪裁弹窗样式 - 复用模态框基础样式或独立定义 */
.crop-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crop-modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90%;
    display: flex;
    flex-direction: column;
}

.crop-modal-header {
    padding: 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.crop-modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.crop-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crop-close-btn:hover {
    color: #2c3e50;
}

.crop-modal-body {
    padding: 20px;
    flex: 1;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.crop-container {
    position: relative;
    max-width: 100%;
    max-height: 100%;
}

#cropCanvas {
    max-width: 100%;
    max-height: 500px;
    border: 1px solid #ddd;
}

.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.crop-selection {
    position: absolute;
    border: 2px solid #3498db;
    background-color: rgba(52, 152, 219, 0.1);
    cursor: move;
    pointer-events: all;
    min-width: 50px;
    min-height: 50px;
}

.crop-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #3498db;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
}

.crop-handle-nw {
    top: -6px;
    left: -6px;
    cursor: nw-resize;
}

.crop-handle-ne {
    top: -6px;
    right: -6px;
    cursor: ne-resize;
}

.crop-handle-sw {
    bottom: -6px;
    left: -6px;
    cursor: sw-resize;
}

.crop-handle-se {
    bottom: -6px;
    right: -6px;
    cursor: se-resize;
}

.crop-modal-footer {
    padding: 20px;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

/* 会话按钮样式 - Kimi风格 */
.btn-session {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: calc(100% - 16px);
    text-align: left;
    position: relative;
}

/* 会话名称样式 */
.session-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: inherit;
}

/* 会话操作容器 */
.session-actions {
    display: none;
    align-items: center;
    gap: 2px;
    margin-left: 8px;
}

.btn-session:hover .session-actions {
    display: flex;
}

/* 编辑图标样式 - Kimi风格三点 */
.edit-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    opacity: 0;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s ease;
    cursor: pointer;
    color: #8f8f8f;
}

.edit-icon svg {
    width: 16px;
    height: 16px;
}

.btn-session:hover .edit-icon {
    opacity: 1;
}

.edit-icon:hover {
    background-color: #e5e5e7;
    color: #5f5f5f;
}

/* 会话菜单样式 - Kimi风格 */
.session-menu {
    background: white;
    border: 1px solid #e5e5e7;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    min-width: 140px;
    overflow: hidden;
    z-index: 1000;
    padding: 4px;
}

.menu-option {
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 6px;
    color: #5f5f5f;
}

.menu-option:hover {
    background-color: #ededef;
    color: #1f1f1f;
}

.menu-option.delete-option {
    color: #e74c3c;
}

.menu-option.delete-option:hover {
    background-color: #fef2f2;
    color: #dc2626;
}

/* 移除原有的重命名图标样式，因为已经被新的编辑图标替代 */
.rename-icon {
    display: none;
}

/* 加载指示器样式 */
.loading-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #5f5f5f;
    font-style: normal;
    font-size: 13px;
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #1a73e8;
    animation: loading-bounce 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes loading-bounce {
    0%, 80%, 100% {
        transform: scale(0.7);
        opacity: 0.4;
    }
    40% {
        transform: scale(1.1);
        opacity: 1;
    }
}

.loading-text {
    font-size: 13px;
    color: #5f5f5f;
}

.loading-message {
    opacity: 0.8;
}

/* 在现有样式基础上添加Markdown样式 */
.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.6;
    word-wrap: break-word;
    font-size: 14px;
}

/* Markdown标题样式 */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
    margin: 0.5em 0;
    font-weight: bold;
}

.message-content h1 { font-size: 1.5em; }
.message-content h2 { font-size: 1.3em; }
.message-content h3 { font-size: 1.1em; }

/* 加粗和斜体 */
.message-content strong {
    font-weight: bold;
}

.message-content em {
    font-style: italic;
}

/* 代码块样式 */
.message-content code {
    background-color: rgba(0, 0, 0, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
}

.message-content pre {
    background-color: #f7f7f8;
    padding: 12px 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.5em 0;
    border: 1px solid #e5e5e7;
}

.message-content pre code {
    background: none;
    padding: 0;
}

/* 列表样式 */
.message-content ul,
.message-content ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.message-content li {
    margin: 0.2em 0;
}

/* 引用样式 */
.message-content blockquote {
    border-left: 4px solid #ddd;
    margin: 0.5em 0;
    padding-left: 1em;
    color: #666;
}

/* 表格样式 */
.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5em 0;
}

.message-content th,
.message-content td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.message-content th {
    background-color: rgba(0, 0, 0, 0.1);
    font-weight: bold;
}

/* MathJax 公式样式优化 */
.message-content .MathJax {
    font-size: 1em !important;
}

.message-content .MathJax_Display {
    margin: 0.5em 0 !important;
}

/* 确保行内公式不会破坏行高 */
.message-content .MathJax_CHTML {
    vertical-align: baseline !important;
}

/* 用户信息区域 - KIMI风格 */
.user-section {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.user-section:hover {
    transform: none;
    box-shadow: none;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 8px;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.user-info:hover {
    background: #ededef;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #1a73e8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: #1f1f1f;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-level {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #8f8f8f;
    margin: 0;
}

.user-level-badge {
    background: #e8f0fe;
    color: #1a73e8;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}


/* 拖拽上传样式 */
.drag-over {
    background-color: rgba(74, 144, 226, 0.1);
    border: 2px dashed #4a90e2;
    transition: all 0.3s ease;
}

.input-container.drag-over {
    background-color: rgba(74, 144, 226, 0.15);
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(74, 144, 226, 0.3);
}

#chatContainer.drag-over {
    position: relative;
}

#chatContainer.drag-over::before {
    content: "拖拽文件到此处上传";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(74, 144, 226, 0.9);
    color: white;
    padding: 20px 40px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* 添加更细致的响应式断点 */

/* 大屏幕优化 (1200px+) */
@media (min-width: 1200px) {
    .header {
        padding-left: calc(var(--km-sidebar-width) + 24px);
    }
    
    body:not(.sidebar-hidden) .header {
        padding-left: calc(var(--km-sidebar-width) + 24px);
    }
}

/* 中等屏幕优化 (992px - 1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
    .header {
        padding-left: calc(var(--km-sidebar-width) + 24px);
    }
    
    body:not(.sidebar-hidden) .header {
        padding-left: calc(var(--km-sidebar-width) + 24px);
    }
}

/* 小屏幕优化 (769px - 991px) */
@media (max-width: 991px) and (min-width: 769px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding-left: 80px;
    }
    
    .header-controls {
        width: 100%;
        justify-content: flex-start;
    }
    
    .model-selector {
        min-width: 180px;
    }
    
    .message-content {
        max-width: 85%;
    }
}

/* 平板优化 (481px - 768px) */
@media (max-width: 768px) and (min-width: 481px) {
    .sidebar {
        width: 240px;
        min-width: 220px;
    }
    
    .user-section {
        padding: 15px;
    }
    
    .user-avatar {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .user-name {
        font-size: 15px;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 15px;
        padding-left: 80px;
    }
    
    .header-controls {
        width: 100%;
        justify-content: flex-start;
    }
    
    .model-selector {
        min-width: 160px;
    }
    
    .model-selector select {
        min-width: 120px;
        font-size: 13px;
    }
    
    .input-container {
        padding: 15px;
        gap: 8px;
    }
    
    .input-container input[type="text"] {
        min-width: 150px;
        font-size: 14px;
        padding: 12px;
    }
    
    .send-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .message-content {
        max-width: 90%;
        min-width: 150px;
        padding: 12px;
    }
}

/* 手机优化 (320px - 480px) */
@media (max-width: 480px) {
    body {
        min-width: 320px;
    }
    
    .sidebar {
        width: 220px;
        min-width: 200px;
    }
    
    .user-section {
        padding: 12px;
    }
    
    .user-info {
        gap: 10px;
    }
    
    .user-avatar {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .user-name {
        font-size: 14px;
    }
    
    .user-level-badge {
        padding: 3px 8px;
        font-size: 10px;
    }
    
    .header {
        padding: 12px;
        padding-left: 60px;
        gap: 10px;
    }
    
    .model-selector {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        min-width: 140px;
    }
    
    .model-selector select {
        min-width: 100px;
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .model-selector label {
        font-size: 12px;
    }
    
    .input-container {
        padding: 12px;
        gap: 6px;
        flex-wrap: nowrap;
    }
    
    .input-container input[type="text"] {
        min-width: 120px;
        font-size: 14px;
        padding: 10px;
    }
    
    .send-btn {
        padding: 10px 16px;
        font-size: 14px;
        flex-shrink: 0;
    }
    
    .file-upload-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
        flex-shrink: 0;
    }
    
    .message-content {
        max-width: 95%;
        min-width: 120px;
        padding: 10px;
        font-size: 14px;
    }
    
    .chat-container {
        padding: 15px;
        gap: 12px;
    }
    
    .sidebar-toggle-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
        top: 15px;
        left: 15px;
    }
    
    body:not(.sidebar-hidden) .sidebar-toggle-btn {
        left: 250px;
    }
}

/* 超小屏幕优化 (最小320px) */
@media (max-width: 360px) {
    .sidebar {
        width: 200px;
        min-width: 180px;
    }
    
    .input-container {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .input-container input[type="text"] {
        min-width: auto;
        width: 100%;
    }
    
    .send-btn, .file-upload-btn {
        align-self: flex-end;
    }
    
    .message-content {
        min-width: 100px;
        max-width: 98%;
    }
}

/* 防止水平滚动的通用规则 */
* {
    box-sizing: border-box;
}

.sidebar, .main-content, .header, .chat-container, .input-container {
    overflow-x: hidden;
}

/* 确保弹性布局在所有缩放级别下正常工作 */
.header-controls {
    flex-wrap: wrap;
    min-width: 0;
}

.model-selector {
    flex-shrink: 0;
}

/* 优化滚动条样式 */
.chat-container::-webkit-scrollbar,
.scrollable-section::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-track,
.scrollable-section::-webkit-scrollbar-track {
    background: transparent;
}

.chat-container::-webkit-scrollbar-thumb,
.scrollable-section::-webkit-scrollbar-thumb {
    background: #d0d0d2;
    border-radius: 3px;
}

.chat-container::-webkit-scrollbar-thumb:hover,
.scrollable-section::-webkit-scrollbar-thumb:hover {
    background: #b0b0b2;
}

/* 加载更多指示器样式 */
.load-more-indicator {
    text-align: center;
    padding: 10px;
    color: #8f8f8f;
    font-size: 12px;
    border-top: 1px solid #e5e5e7;
    margin-top: 10px;
}

.load-more-indicator span {
    opacity: 0.7;
}

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

/* 确保会话列表容器有足够的高度来触发滚动 */
#sessionList {
    min-height: 200px;
}

/* 响应通知样式 */
#notificationContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 300px;
    pointer-events: none;
}

#notificationContainer > div {
    pointer-events: auto;
}

/* 响应式适配 */
@media (max-width: 768px) {
    #notificationContainer {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* 复制按钮样式 */
.copy-button-container {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e5e5e7;
}

.copy-markdown-btn {
    background-color: #f7f7f8;
    color: #5f5f5f;
    border: 1px solid #e5e5e7;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.copy-markdown-btn:hover {
    background-color: #ededef;
    color: #1f1f1f;
}

.copy-markdown-btn:active {
    background-color: #e5e5e7;
}

/* 确保复制按钮在消息内容中正确显示 */
.message.assistant .message-content {
    position: relative;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .copy-markdown-btn {
        font-size: 11px;
        padding: 5px 8px;
    }
    
    .logo-title {
        font-size: 28px;
    }
    
    .welcome-subtitle {
        font-size: 13px;
    }
    
    .search-box-container {
        width: 95%;
        padding: 12px;
    }
    
    .related-content {
        width: 95%;
        flex-direction: column;
        gap: 12px;
    }
    
    .content-card {
        max-width: none;
    }
}