/* 基础样式 */
body {
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.app-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    padding: 0 20px;
}

.main-container {
    display: flex;
    gap: 20px;
    height: calc(100vh - 120px);
}

/* 侧边栏样式 */
.sidebar-container {
    flex: 1;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    padding: 20px;
    display: flex;
    flex-direction: column;
    max-width: 300px;
}

.chat-container {
    flex: 4;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    position: relative;
}

.toggle-chat-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
}

.sidebar-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* 消息列表样式 */
.message-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.message {
    margin-bottom: 15px;
    display: flex;
}

.system-message {
    justify-content: flex-start;
}

.tool_call-message {
    justify-content: flex-start;
}

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

.assistant-message {
    justify-content: flex-start;
}

/* 消息发送者标识 */
.message-sender {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 14px;
    color: #666;
}

.user-message .message-sender {
    text-align: right;
    color: #FFFFFF;
}

.assistant-message .message-sender {
    color: #E6A23C;
}

.tool_call-message .message-sender {
    color: #909399;
}

.session-message .message-sender {
    color: #67C23A;
}

/* 消息内容样式 */
.message-content {
    max-width: 85%;
    padding: 10px 15px;
    border-radius: 8px;
    word-wrap: break-word;
    line-height: 1.5;
    overflow: hidden;
    position: relative;
}

/* 全屏查看按钮样式 - 右上角 */
.fullscreen-toggle-top {
    color: #409EFF;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 3px;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 10;
}

.fullscreen-toggle-top:hover {
    background-color: #409EFF;
    color: white;
}

.user-message .fullscreen-toggle-top {
    color: #cce6ff;
    background-color: rgba(64, 158, 255, 0.1);
}

.user-message .fullscreen-toggle-top:hover {
    background-color: #409EFF;
    color: white;
}

.user-message .message-content {
    background-color: #409EFF;
    color: white;
    margin-left: auto;
}

.assistant-message .message-content {
    background-color: #f0f0f0;
    margin-right: auto;
}

.tool_call-message .message-content {
    background-color: #f0f0f0;
    margin-right: auto;
}

.session-message .message-content {
    background-color: #f0f9ff;
    border: 1px solid #d9ecff;
    margin-right: auto;
}

.system-message .message-content {
    background-color: #f1f1f1;
    margin-right: auto;
    color: #28a745;
}

/* 消息折叠样式 */
.message-content-inner {
    overflow: hidden;
    position: relative;
    max-width: 50vh;
}

.message-content-inner.collapsed {
    overflow: hidden;
}

.message-content-inner.collapsed::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
}

.user-message .message-content-inner.collapsed::after {
    background: linear-gradient(to bottom, rgba(64, 158, 255, 0), rgba(64, 158, 255, 1));
}

.assistant-message .message-content-inner.collapsed::after {
    background: linear-gradient(to bottom, rgba(240, 240, 240, 0), rgba(240, 240, 240, 1));
}

.system-message .message-content-inner.collapsed::after {
    background: linear-gradient(to bottom, rgba(240, 240, 240, 0), rgba(240, 240, 240, 1));
}

.session-message .message-content-inner.collapsed::after {
    background: linear-gradient(to bottom, rgba(240, 248, 255, 0), rgba(240, 248, 255, 1));
}

/* 操作按钮样式 */
.collapse-toggle {
    color: #409EFF;
    cursor: pointer;
    text-align: center;
    padding: 5px;
    font-size: 12px;
    margin-top: 5px;
}

.user-message .collapse-toggle {
    color: #cce6ff;
}

.collapse-toggle:hover,
.fullscreen-toggle:hover {
    text-decoration: underline;
}

/* 工具调用详情 */
.tool-details {
    margin-top: 10px;
    padding: 10px;
    background-color: #f0f8ff;
    border-radius: 4px;
    border-left: 3px solid #1890ff;
}

.user-message .tool-details {
    background-color: #cce6ff;
    border-left: 3px solid #fff;
}

.tool-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.tool-details-title {
    font-weight: bold;
}

.tool-toggle {
    color: #409EFF;
    cursor: pointer;
    font-size: 12px;
}

.tool-toggle:hover {
    text-decoration: underline;
}

.user-message .tool-toggle {
    color: #1a5fb4;
}

.tool-details-content {
    font-size: 14px;
}

.tool-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.tool-table th,
.tool-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
    vertical-align: top;
}

.tool-table th {
    background-color: #f5f5f5;
    font-weight: bold;
}

.user-message .tool-table th {
    background-color: #a0cfff;
}

.tool-table td pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-width: 300px;
    max-height: 200px;
    overflow: auto;
}

/* 链接样式 */
.message-content a {
    color: #1890ff;
    text-decoration: none;
}

.user-message .message-content a {
    color: #cce6ff;
}

.message-content a:hover {
    text-decoration: underline;
}

/* 工具调用详情 */
.tool-details {
    margin-top: 10px;
    padding: 10px;
    background-color: #f0f8ff;
    border-radius: 4px;
    border-left: 3px solid #1890ff;
}

.tool-details-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.tool-details-content {
    font-size: 14px;
}

.tool-call {
    background-color: #e6f7ff;
    border: 1px solid #91d5ff;
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
}

.tool-name {
    font-weight: bold;
    color: #1890ff;
}

.tool-args {
    font-family: 'Courier New', monospace;
    background-color: #f0f0f0;
    padding: 5px;
    border-radius: 3px;
    margin: 5px 0;
    font-size: 12px;
}

pre {
    white-space: pre-wrap;
    max-width: 600px;
}

/* 文件列表样式 */
.file-tree {
    flex: 1;
    overflow-y: auto;
    margin-top: 10px;
    max-height: 700px;
}

.empty-file-list {
    text-align: center;
    color: #999;
    padding: 20px;
}

.operation-section {
    margin-bottom: 25px;
}

.operation-section:last-child {
    margin-bottom: 0;
}

.operation-title {
    font-weight: bold;
    margin: 10px 0;
    color: #666;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.operation-content {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 4px;
    border-left: 3px solid #409EFF;
    width: 335px;
    overflow-y: auto;
    margin-top: 10px;
    max-height: 500px;
}

/* 抽屉样式 */
.drawer-container {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 40%;
    background-color: white;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.drawer-container.hidden {
    transform: translateX(100%);
}

.drawer-container.visible {
    transform: translateX(0);
}

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

.drawer-title {
    font-size: 18px;
    font-weight: bold;
}

.close-drawer-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.overlay.visible {
    display: block;
}

.refresh-files-btn {
    margin-left: 10px;
}

.el-tree-node__content {
    height: auto !important;
    padding: 4px 0;
}

.custom-tree-node {
    flex: 1;
    display: flex;
    align-items: center;
    font-size: 14px;
    padding-right: 80px; /* 为操作按钮预留空间 */
    min-width: 0; /* 允许 flex 子元素收缩到小于其内容的大小 */
    position: relative;
}

.custom-tree-node .node-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0; /* 允许 flex 子元素收缩到小于其内容的大小 */
    padding: 2px 0;
}

.file-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.3s;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background-color: white;
    padding: 2px 4px;
}

.custom-tree-node:hover .file-actions {
    opacity: 1;
}

.file-actions span {
    cursor: pointer;
    padding: 2px;
    font-size: 14px;
}

.file-actions span:hover {
    color: #409EFF;
}

/* 右键菜单样式 */
.context-menu {
    position: absolute;
    background-color: white;
    border: 1px solid #ebeef5;
    border-radius: 4px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    z-index: 3000;
    padding: 5px 0;
    min-width: 120px;
}

.context-menu-item {
    padding: 8px 15px;
    cursor: pointer;
    font-size: 14px;
}

.context-menu-item:hover {
    background-color: #ecf5ff;
    color: #409eff;
}

.context-menu-divider {
    height: 1px;
    background-color: #ebeef5;
    margin: 5px 0;
}

/* 对话列表样式 */
.conversation-list {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    border: 1px solid #ebeef5;
    border-radius: 4px;
    margin-top: 10px;
    padding: 10px 0;
}

.conversation-items {
    flex: 1;
}

.conversation-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #ebeef5;
    cursor: pointer;
    position: relative;
}

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

.conversation-item.active {
    background-color: #ecf5ff;
    color: #409eff;
}

.conversation-item.backup-item {
    padding-left: 20px;
    background-color: #f9f9f9;
}

.conversation-item.backup-item .file-icon {
    color: #909399;
    font-size: 20px;
}

.conversation-item.backup-item .conversation-name {
    font-weight: normal;
    color: #606266;
}

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

.file-icon {
    font-size: 24px;
    margin-right: 10px;
    color: #409EFF;
}

.conversation-info {
    flex: 1;
    min-width: 0; /* 允许 flex 子元素收缩到小于其内容的大小 */
}

.conversation-name {
    font-weight: bold;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-meta {
    font-size: 12px;
    color: #909399;
}

.conversation-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.3s;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background-color: white;
    padding: 2px 4px;
}

.conversation-item:hover .conversation-actions {
    opacity: 1;
}

.conversation-actions .icon-btn {
    cursor: pointer;
    padding: 2px;
    font-size: 14px;
}

.conversation-actions .icon-btn:hover {
    color: #409EFF;
}

.elapsed-time {
    margin-top: 8px;
    padding: 5px 10px;
    background-color: #f0f8ff;
    border-radius: 4px;
    text-align: right;
    color: #666;
    font-style: italic;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

/* 对话树节点样式 */
.conversation-tree-node {
    flex: 1;
    display: flex;
    align-items: center;
    font-size: 14px;
    padding-right: 80px; /* 为操作按钮预留空间 */
    min-width: 0; /* 允许 flex 子元素收缩到小于其内容的大小 */
    position: relative;
    padding: 5px 0;
}

.conversation-tree-node .conversation-name {
    margin: 0 8px;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0; /* 允许 flex 子元素收缩到小于其内容的大小 */
}

.conversation-tree-node .conversation-meta {
    font-size: 12px;
    color: #909399;
}

.conversation-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.3s;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background-color: white;
    padding: 2px 4px;
}

.conversation-tree-node:hover .conversation-actions {
    opacity: 1;
}

.conversation-actions .icon-btn {
    cursor: pointer;
    padding: 2px;
    font-size: 14px;
}

.conversation-actions .icon-btn:hover {
    color: #409EFF;
}

/* 全屏对话查看器样式 */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.fullscreen-header {
    padding: 15px 20px;
    background-color: #333;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fullscreen-title {
    font-size: 18px;
    font-weight: bold;
}

.close-fullscreen-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

.close-fullscreen-btn:hover {
    color: #ccc;
}

.fullscreen-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    color: white;
}

.fullscreen-message {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 8px;
}

.fullscreen-user-message {
    background-color: #1a5fb4;
}

.fullscreen-assistant-message {
    background-color: #444;
}

.fullscreen-user-message .fullscreen-message-content {
    background-color: #1a5fb4;
    padding: 15px;
    border-radius: 8px;
}

.fullscreen-assistant-message .fullscreen-message-content {
    background-color: #444;
    padding: 15px;
    border-radius: 8px;
}

.fullscreen-message-content {
    line-height: 1.6;
}

/* 全屏模式下的Markdown样式 */
.fullscreen-message-content h1,
.fullscreen-message-content h2,
.fullscreen-message-content h3 {
    color: white;
    margin: 10px 0;
    font-weight: bold;
}

.fullscreen-message-content h1 {
    font-size: 1.5em;
}

.fullscreen-message-content h2 {
    font-size: 1.3em;
}

.fullscreen-message-content h3 {
    font-size: 1.1em;
}

.fullscreen-message-content p {
    margin: 8px 0;
    color: white;
}

.fullscreen-message-content a {
    color: #4da6ff;
}

.fullscreen-message-content pre {
    background-color: #333;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 10px;
    overflow-x: auto;
    margin: 10px 0;
}

.fullscreen-message-content code {
    font-family: 'Courier New', monospace;
    background-color: #333;
    color: #ff6b6b;
    padding: 2px 4px;
    border-radius: 3px;
}

.fullscreen-message-content pre code {
    background-color: transparent;
    padding: 0;
}

.input-wrapper {
    position: relative;
}

.input-wrapper button.is-circle {
    position: absolute;
    right: 25px;
    top: 25px;
}

.input-wrapper .send-btn {
    position: absolute;
    right: 25px;
    bottom: 25px;
}

.textarea-container {
    padding: 20px;
    position: relative;
    border: 2px dashed transparent;
    border-radius: 4px;
    transition: border-color 0.3s;
}

.textarea-container.dragover {
    border-color: #409EFF;
    background-color: #f0f9ff;
}

.el-textarea .el-input__count {
    left: 15px;
}

.typing-indicator {
    text-align: center;
}

.icon-btn {
    cursor: pointer;
}

.icon-btn:hover {
    opacity: 0.8;
    font-size: 18px;
}

.el-drawer__body {
    overflow: auto;
}

.model-info-content{
    display: block;
    margin: 0 auto;
}

.model-info-content{
    display: flex;
}

/* 模型信息卡片样式 */
.model-info-content {
    margin-bottom: 20px;
}

.model-info-card {
    margin-bottom: 20px;
}

.model-info-card .el-card__header {
    padding: 10px 20px;
    background-color: #f5f7fa;
    border-bottom: 1px solid #ebeef5;
}

.model-info-card .el-card__body {
    padding: 15px 20px;
}

.model-details p {
    margin: 8px 0;
    line-height: 1.5;
}

.clearfix:before,
.clearfix:after {
    display: table;
    content: "";
}

.clearfix:after {
    clear: both;
}

.no-model-info {
    text-align: center;
    padding: 40px 0;
    color: #999;
}

/* 消息操作按钮样式 */
.message-header .el-button--text {
    color: #909399;
    font-size: 16px;
    padding: 2px;
    margin-left: 5px;
}

.message-header .el-button--text:hover {
    color: #409EFF;
}

.user-message .message-header .el-button--text {
    color: #cce6ff;
}

.user-message .message-header .el-button--text:hover {
    color: #fff;
}

.tool-call-content pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 8px;
    font-size: 12px;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 200px;
    overflow-y: auto;
}

/* 工具调用消息样式 */
.tool-call-message {
    background-color: #f0f8ff;
    border: 1px solid #409eff;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}

.tool-call-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

/* 附件预览样式 */
.attachments-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 20px 0 20px;
    background-color: #f9f9f9;
    border-bottom: 1px solid #ebeef5;
}

.attachment-item {
    display: flex;
    align-items: center;
    padding: 5px;
    background-color: #ffffff;
    border: 1px solid #ebeef5;
    border-radius: 4px;
    position: relative;
}

.attachment-item .el-image {
    border-radius: 4px;
    margin-right: 8px;
}

.attachment-item .file-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f7fa;
    border-radius: 4px;
    margin-right: 8px;
    font-size: 24px;
    color: #909399;
}

.attachment-info {
    flex: 1;
    min-width: 0;
}

.attachment-name {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.attachment-size {
    font-size: 10px;
    color: #909399;
    margin-top: 2px;
}

.attachment-item .el-icon-close {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: #909399;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
}

/* 附件上传按钮样式 */
.upload-attachment-btn {
    position: absolute;
    left: 25px;
    bottom: 25px;
}

.attachment-uploader .el-upload {
    display: inline-block;
    margin-right: 10px;
}