#outputPanel {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;
    min-height: 32px;
    max-height: 80vh;
    background-color: #1e1e1e;
    border-top: 1px solid #444;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, height, width;
}

/* 亮色主题样式 */
body.theme-light #outputPanel {
    background-color: #f5f5f5;
    border-top: 1px solid #e0e0e0;
}

#outputPanel.vertical {
    width: 520px;
    height: 100vh;
    max-height: none;
    left: auto;
    right: 520px;
    border-top: none;
    border-left: 1px solid #444;
    border-right: 1px solid #444;
}

body.theme-light #outputPanel.vertical {
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
}

/* 移动端调整，不再依赖聊天窗口 */
@media (max-width: 768px) {
    #outputPanel.vertical {
        width: 80%;
        right: 0;
        z-index: 998;
        /* 确保z-index比聊天窗口低，允许聊天窗口覆盖它 */
    }
}

/* 现在这个类不再直接依赖聊天面板是否可见，而是由JavaScript控制 */
#outputPanel.vertical.chat-minimized {
    right: 0;
}

.output-header {
    padding: 10px 14px;
    background-color: #2d2d2d;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ffffff;
    font-size: 15px;
    cursor: default;
    user-select: none;
    position: relative;
    z-index: 1000;
    transition: padding 0.2s;
    flex-wrap: nowrap;
}

body.theme-light .output-header {
    background-color: #e8e8e8;
    color: #333333;
    border-bottom: 1px solid #e0e0e0;
}

#toggleOutput {
    background-color: #444;
    border: none;
    color: #fff;
    padding: 4px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    opacity: 0.7;
    transition: all 0.2s;
    height: 26px;
    min-width: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.theme-light #toggleOutput {
    background-color: #e0e0e0;
    color: #333333;
}

body.theme-light #toggleOutput:hover {
    background-color: #d0d0d0;
    opacity: 1;
}

#toggleOutput::before {
    content: "▼";
    font-size: 10px;
    transition: transform 0.3s;
}

#toggleOutput.collapsed::before {
    transform: rotate(-90deg);
}

#outputPanel.collapsed {
    display: none !important;
}

#outputContent {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    color: #ffffff;
    font-family: Consolas, monospace;
    font-size: 14px;
    line-height: 1.4;
    background-color: #1e1e1e;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

body.theme-light #outputContent {
    background-color: #ffffff;
    color: #333333;
}

body.theme-light .output-success {
    color: #2e7d32;
}

body.theme-light .output-error {
    color: #d32f2f;
}

body.theme-light .output-info {
    color: #1976d2;
}

.output-buttons {
    display: flex;
    gap: 10px;
}

/* 添加输出工具栏的基础样式 */
.output-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
}

#clearOutput,
#copyOutput,
#formatOutput,
#toggleOutputLayout {
    background-color: #444;
    border: none;
    color: #fff;
    padding: 4px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    opacity: 0.7;
    transition: opacity 0.2s;
    height: 26px;
    min-width: 50px;
    /* 确保良好的触摸区域大小 */
    touch-action: manipulation;
    /* 确保按钮内容垂直居中 */
    display: flex;
    align-items: center;
    justify-content: center;
}

body.theme-light #clearOutput,
body.theme-light #copyOutput,
body.theme-light #formatOutput,
body.theme-light #toggleOutputLayout {
    background-color: #e0e0e0;
    color: #333333;
}

body.theme-light #clearOutput:hover,
body.theme-light #copyOutput:hover,
body.theme-light #formatOutput:hover,
body.theme-light #toggleOutputLayout:hover {
    background-color: #d0d0d0;
    opacity: 1;
}

/* 移动端的布局调整 */
@media (max-width: 768px) {

    #clearOutput,
    #copyOutput,
    #formatOutput {
        padding: 4px 8px;
        font-size: 12px;
        min-height: 22px;
        flex-shrink: 0;
    }

    #toggleOutputLayout {
        width: 24px;
        height: 24px;
        flex-shrink: 0;
        display: none;
    }

    #clearOutput:active,
    #copyOutput:active,
    #formatOutput:active,
    #toggleOutputLayout:active {
        transform: scale(0.9);
    }

    /* 确保输出面板在移动设备上不再依赖聊天窗口的位置 */
    #outputPanel.vertical {
        width: 80%;
        right: 0 !important;
        /* 强制覆盖任何JavaScript设置的right值 */
    }

    .output-toolbar {
        gap: 5px;
    }

    /* 调整标题区域的内边距以适应小屏幕 */
    .output-header {
        padding: 8px 10px;
    }

    #outputPanel:not(.vertical) {
        height: 30vh !important;
        min-height: 10vh;
        max-height: 40vh;
    }
}

.minimized-output-button {
    position: fixed;
    bottom: 10px;
    right: 10px;
    z-index: 1000;
    display: none;
}

body.theme-light .minimized-output-button .icon-button {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    color: #333333;
}

body.theme-light .minimized-output-button .icon-button:hover {
    background: #e8e8e8;
}

#outputPanel.collapsed~.minimized-output-button {
    display: block;
}

.minimized-output-button .icon-button {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2d2d2d;
    border: 1px solid #444;
    cursor: pointer;
    color: #fff;
    font-size: 14px;
    opacity: 0.8;
    transition: all 0.2s;
    padding: 0;
}

.minimized-output-button .icon-button:hover {
    background: #404040;
    opacity: 1;
    transform: translateY(-1px);
}

.minimized-output-button .icon-button:active {
    transform: translateY(0);
}

/* 更新针对不同布局方式的容器边距设置 */
#outputPanel:not(.vertical)~#fileList,
#outputPanel:not(.vertical)~#container {
    height: calc(100vh - 200px);
}

/* 当输出面板在垂直位置时，调整编辑器容器的边距 - 移除聊天面板的依赖 */
#outputPanel.vertical~#container {
    margin-right: 520px;
    /* 只考虑输出面板的宽度 */
}

/* 移动设备上覆盖container的margin-right，确保输出面板和编辑器可以适应移动屏幕 */
@media (max-width: 768px) {
    #outputPanel.vertical~#container {
        margin-right: 80% !important;
        /* 使用百分比宽度适应不同的移动设备屏幕 */
    }
}

/* 当聊天面板最小化且输出面板垂直显示时 - 这条规则现在过时了，应当注释掉 */
/*
#outputPanel.vertical.chat-minimized ~ #container {
    margin-right: 520px;
}
*/

/* 调整大小相关样式 */
#outputPanel .resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    cursor: ns-resize;
    opacity: 0.5;
    background-color: #444;
    transition: opacity 0.2s, background-color 0.2s;
    z-index: 1001;
    /* 确保在其他元素之上 */
}

body.theme-light #outputPanel .resize-handle {
    background-color: rgba(150, 150, 150, 0.3);
    opacity: 0.3;
    height: 7px;
}

/* 添加额外的视觉指示器样式 */
#outputPanel .resize-handle-indicator {
    position: absolute;
    top: 1px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* #outputPanel .resize-handle-indicator::before,
#outputPanel .resize-handle-indicator::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 2px;
    background-color: #999;
    margin: 0 2px;
    border-radius: 1px;
} */

body.theme-light #outputPanel .resize-handle-indicator::before,
body.theme-light #outputPanel .resize-handle-indicator::after {
    background-color: #666;
}

#outputPanel .resize-handle:hover,
#outputPanel .resize-handle.active {
    opacity: 0.8;
    background-color: #666;
}

#outputPanel .resize-handle:hover .resize-handle-indicator::before,
#outputPanel .resize-handle:hover .resize-handle-indicator::after,
#outputPanel .resize-handle.active .resize-handle-indicator::before,
#outputPanel .resize-handle.active .resize-handle-indicator::after {
    background-color: #bbb;
}

body.theme-light #outputPanel .resize-handle:hover,
body.theme-light #outputPanel .resize-handle.active {
    background-color: rgba(150, 150, 150, 0.5);
    opacity: 0.5;
}

body.theme-light #outputPanel .resize-handle:hover .resize-handle-indicator::before,
body.theme-light #outputPanel .resize-handle:hover .resize-handle-indicator::after,
body.theme-light #outputPanel .resize-handle.active .resize-handle-indicator::before,
body.theme-light #outputPanel .resize-handle.active .resize-handle-indicator::after {
    background-color: #444;
}

/* 增加移动设备上的调整手柄尺寸和可视性 */
@media (max-width: 768px) {
    #outputPanel .resize-handle {
        height: 12px;
        /* 更大的触摸区域 */
        opacity: 0.7;
        /* 默认更明显 */
    }

    #outputPanel .resize-handle-indicator {
        top: 3px;
        width: 60px;
    }

    #outputPanel .resize-handle-indicator::before,
    #outputPanel .resize-handle-indicator::after {
        width: 25px;
        height: 3px;
    }

    body.theme-light #outputPanel .resize-handle-indicator::before,
    body.theme-light #outputPanel .resize-handle-indicator::after {
        background-color: #666;
    }

    #outputPanel .resize-handle.active .resize-handle-indicator::before,
    #outputPanel .resize-handle.active .resize-handle-indicator::after {
        background-color: #bbb;
    }

    body.theme-light #outputPanel .resize-handle.active .resize-handle-indicator::before,
    body.theme-light #outputPanel .resize-handle.active .resize-handle-indicator::after {
        background-color: #444;
    }
}

/* 垂直布局的调整手柄 */
#outputPanel.vertical .resize-handle {
    top: 0;
    bottom: 0;
    right: auto;
    left: 0;
    width: 10px;
    height: auto;
    cursor: ew-resize;
    z-index: 1001;
    opacity: 0.5;
    background-color: transparent;
    transition: opacity 0.2s, background-color 0.2s;
}

body.theme-light #outputPanel.vertical .resize-handle {
    background-color: transparent;
}

/* 移除垂直布局的视觉指示器，与文件列表保持一致 */
#outputPanel.vertical .resize-handle-indicator {
    display: none;
}

/* 保持与文件列表一致的调整样式 */
#outputPanel.vertical.resizing {
    border-top: none;
    border-left: 2px solid #0078d4;
}

body.theme-light #outputPanel.vertical.resizing {
    border-left: 2px solid #0078d4;
}

/* 移动设备上垂直布局的调整手柄 */
@media (max-width: 768px) {
    #outputPanel.vertical .resize-handle {
        width: 10px;
        opacity: 0.5;
    }

    #outputPanel.vertical .resize-handle-indicator {
        display: none;
    }
}

/* 调整辅助线样式 */
.resize-helper-line {
    position: absolute;
    background-color: rgba(0, 120, 212, 0.7);
    pointer-events: none;
    z-index: 1001;
    box-shadow: 0 0 4px rgba(0, 120, 212, 0.5);
}

.resize-helper-line.horizontal {
    left: 0;
    right: 0;
    height: 2px;
    top: 0;
}

.resize-helper-line.vertical {
    top: 0;
    bottom: 0;
    width: 2px;
    left: 0;
}

body.theme-light .resize-helper-line {
    background-color: rgba(0, 120, 212, 0.7);
    box-shadow: 0 0 4px rgba(0, 120, 212, 0.5);
}

/* 调整中的面板样式 */
#outputPanel.resizing {
    transition: none !important;
    pointer-events: all;
}

/* 移除特殊样式，与文件列表保持一致 */
#outputPanel.vertical.resizing:after {
    display: none;
}

body.theme-light #outputPanel.vertical.resizing:after {
    display: none;
}

/* 设置调整中的面板位置 */
#outputPanel.resizing .resize-handle {
    opacity: 1;
    background-color: transparent;
}

body.theme-light #outputPanel.resizing .resize-handle {
    background-color: transparent;
}

/* 调整时指示器的样式，与文件列表保持一致 */
#outputPanel.resizing .resize-handle-indicator {
    display: none;
}

body.theme-light #outputPanel.resizing .resize-handle-indicator {
    display: none;
}

/* 移动端双击/双触反馈 */
@media (max-width: 768px) {

    /* 显示调整反馈 */
    #outputPanel.size-transition {
        transition: height 0.3s ease-in-out !important;
    }

    #outputPanel.vertical.size-transition {
        transition: width 0.3s ease-in-out !important;
    }

    /* 确保输出面板在移动设备上有足够的最小高度，方便用户调整 */
    #outputPanel:not(.vertical) {
        min-height: 50px;
    }
}

/* 确保调整大小时平滑过渡 */
#outputPanel,
#container,
#fileList,
#chatPanel {
    transition: height 0.2s ease, width 0.2s ease, margin 0.2s ease;
}

/* 拖动时禁用过渡效果 */
#outputPanel.resizing,
#outputPanel.resizing~#container,
#outputPanel.resizing~#fileList,
#outputPanel.resizing~#chatPanel {
    transition: none !important;
}

/* 垂直调整手柄的特殊效果 - 移除，保持与文件列表一致 */
html.ew-resizing {
    cursor: ew-resize !important;
}

html.ew-resizing #outputPanel.vertical .resize-handle {
    opacity: 1;
    background-color: transparent;
}

body.theme-light html.ew-resizing #outputPanel.vertical .resize-handle {
    background-color: transparent;
}

body.theme-dark .output-error {
    color: #ff302a;
}