/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1e1e1e;
    color: #d4d4d4;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 工具栏样式 */
.toolbar {
    background: #2d2d30;
    border-bottom: 1px solid #3e3e42;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    gap: 15px;
    flex-wrap: wrap;
}

.file-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
}

/* 下拉菜单样式 */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    background: #007acc;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    min-width: 60px;
    transition: background-color 0.2s;
}

.dropdown-btn:hover {
    background: #005a9e;
}

.dropdown-content {
    display: none;
    position: absolute;
    background: #2d2d30;
    min-width: 120px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 4px;
    border: 1px solid #3e3e42;
    top: 100%;
    left: 0;
    margin-top: 2px;
}

.dropdown-content a {
    color: #d4d4d4;
    padding: 8px 12px;
    text-decoration: none;
    display: block;
    font-size: 13px;
    transition: background-color 0.2s;
}

.dropdown-content a:hover {
    background: #094771;
    color: white;
}

.dropdown-divider {
    height: 1px;
    background: #3e3e42;
    margin: 4px 0;
}

.font-size-control-menu {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    color: #d4d4d4;
    font-size: 13px;
    white-space: nowrap;
    gap: 8px;
}

.font-size-control-menu span {
    color: #cccccc;
    flex-shrink: 0;
}

.font-size-control-menu .select {
    background: #3c3c3c;
    color: #d4d4d4;
    border: 1px solid #464647;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    height: 24px;
    min-width: 60px;
    flex-shrink: 0;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown:hover .dropdown-btn {
    background: #005a9e;
}

.btn {
    background: #007acc;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    min-width: auto;
    transition: background-color 0.2s;
}

.btn:hover {
    background: #005a9e;
}

.btn.active {
    background: #005a9e;
}

.btn.inactive {
    background: #555555;
    opacity: 0.7;
}

.run-btn {
    background: #4caf50;
}

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

.select {
    background: #3c3c3c;
    color: #d4d4d4;
    border: 1px solid #464647;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 13px;
    height: 32px;
    min-width: 100px;
}

.font-size-control {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #d4d4d4;
    font-size: 13px;
    white-space: nowrap;
}

.font-size-control span {
    color: #cccccc;
}

.font-size-label {
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.font-size-label:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.font-size-input {
    background: #3c3c3c;
    color: #d4d4d4;
    border: 1px solid #464647;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
    width: 60px;
    text-align: center;
    outline: none;
}

.font-size-input:focus {
    border-color: #007acc;
    box-shadow: 0 0 0 1px rgba(0, 122, 204, 0.3);
}

.btn-icon {
    background: transparent;
    color: #d4d4d4;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 16px;
    border-radius: 3px;
}

.btn-icon:hover {
    background: #3e3e42;
}

/* 主内容区域 */
.main-content {
    display: grid;
    grid-template-columns: 250px 4px 1fr 4px 300px;
    grid-template-areas: "sidebar resizer editor output-resizer output";
    flex: 1;
    overflow: hidden;
}

/* 侧边栏拖动手柄样式 */
.sidebar-resizer {
    grid-area: resizer;
    background: #3e3e42;
    cursor: col-resize;
    user-select: none;
    transition: background-color 0.2s;
}

.sidebar-resizer:hover {
    background: #007acc;
}

.sidebar-resizer:active {
    background: #005a9e;
    cursor: col-resize;
}

/* 输出面板拖动手柄样式 */
.output-resizer {
    grid-area: output-resizer;
    background: #3e3e42;
    cursor: col-resize;
    user-select: none;
    transition: background-color 0.2s;
}

.output-resizer:hover {
    background: #007acc;
}

.output-resizer:active {
    background: #005a9e;
    cursor: col-resize;
}

/* 侧边栏样式 */
.sidebar {
    grid-area: sidebar;
    background: #252526;
    border-right: 1px solid #3e3e42;
    overflow-y: auto;
}

/* 编辑器面板 */
.editor-panel {
    grid-area: editor;
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
}

/* 输出面板 */
.output-panel {
    grid-area: output;
    background: #1e1e1e;
    border-left: 1px solid #3e3e42;
    display: flex;
    flex-direction: column;
}
/* 文件树样式 */
.file-tree {
    padding: 15px;
}

/* 面板头部样式 */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.file-tree h3 {
    color: #cccccc;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

/* 面板关闭按钮样式 */
.panel-close-btn {
    background: none;
    border: none;
    color: #d4d4d4;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.panel-close-btn:hover {
    background: #3e3e42;
    color: #ffffff;
}

/* 输出面板头部操作区域 */
.output-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 模态对话框样式 */
.modal-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 0;
    min-width: 400px;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0;
    border-bottom: none;
}

.modal-body {
    padding: 4px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    padding: 4px;
    border-top: none;
}

/* 新建文件对话框按钮左边对齐 */
#newFileDialog .modal-footer {
    justify-content: flex-start;
}

/* 新建文件对话框宽度缩小到200px */
#newFileDialog .modal-content {
    min-width: 200px;
    max-width: 200px;
}

.modal-input {
    padding: 4px;
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    box-sizing: border-box;
    flex: 1;
    margin: 0 4px;
    height: 26px;
}

.modal-input:focus {
    outline: none;
    border-color: #007acc;
}

.input-group {
    margin-bottom: 4px;
}

.input-group label {
    display: block;
    margin-bottom: 4px;
    color: #ccc;
    font-size: 14px;
}

/* 替换对话框输入组样式 */
.replace-input-group {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.replace-input-group label {
    display: inline-block;
    margin-bottom: 0;
    white-space: nowrap;
    margin-right: 4px;
    width: 60px;
}

/* 查找输入组样式 */
.find-input-group {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.find-input-group label {
    display: inline-block;
    margin-bottom: 0;
    white-space: nowrap;
    margin-right: 4px;
}

.find-input-group .find-results {
    margin-top: 0;
    margin-left: 4px;
    padding: 4px;
    background: #1a1a1a;
    border-radius: 4px;
    border: 1px solid #444;
    min-width: 80px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 26px;
    box-sizing: border-box;
}

/* 查找对话框特定样式 */
.find-options-container {
    margin-bottom: 4px;
    padding: 4px;
}

.find-options {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #ccc;
    font-size: 14px;
    cursor: pointer;
    margin-right: 8px;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 查找按钮容器样式 */
.find-buttons {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.find-results span {
    color: #ccc;
    font-size: 13px;
}

/* 查找高亮样式 */
.find-highlight {
    background-color: #ffeb3b;
    color: #000;
    border-radius: 2px;
    padding: 1px 2px;
}

.btn {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
    height: 26px;
    box-sizing: border-box;
    margin-left: 4px;
    min-width: 60px;
    text-align: center;
}

.btn.primary {
    background: #007acc;
    color: white;
}

.btn.primary:hover {
    background: #005a9e;
}

.btn.secondary {
    background: #555;
    color: white;
}

.btn.secondary:hover {
    background: #666;
}

/* 滚动动画 */
.CodeMirror-scroll {
    scroll-behavior: smooth;
}

.file-item {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    margin-bottom: 4px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
}

.file-item:before {
    content: "📄";
    margin-right: 8px;
    font-size: 14px;
}

.file-item:hover {
    background: #2a2d2e;
}

.file-item.active {
    background: #094771;
    color: #ffffff;
}



.editor-header {
    background: #2d2d30;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #3e3e42;
}

.editor-actions {
    display: flex;
    gap: 5px;
}

/* CodeMirror 编辑器样式定制 */
.CodeMirror {
    flex: 1;
    height: 100% !important;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    overflow-y: auto;
}

/* 确保编辑器面板有固定高度，以便滚动条正常工作 */
.editor-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.CodeMirror-gutters {
    background: #1e1e1e;
    border-right: 1px solid #3e3e42;
}

.CodeMirror-linenumber {
    color: #6e7681;
}

.CodeMirror-cursor {
    border-left: 2px solid #ffffff;
}



.output-header {
    background: #2d2d30;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #3e3e42;
}

.output-content {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
}

.output-content .log {
    color: #d4d4d4;
    margin-bottom: 5px;
}

.output-content .error {
    color: #f44747;
    margin-bottom: 5px;
}

.output-content .warning {
    color: #ffcc02;
    margin-bottom: 5px;
}

/* 状态栏 */
.status-bar {
    background: #007acc;
    color: white;
    padding: 5px 15px;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    flex-shrink: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 150px;
    }
    
    .output-panel {
        width: 100%;
        height: 200px;
    }
    
    .toolbar {
        flex-direction: column;
        gap: 8px;
        padding: 6px 10px;
    }
    
    .file-controls {
        gap: 3px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .btn {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .select {
        padding: 4px 8px;
        font-size: 12px;
        height: 28px;
        min-width: 80px;
    }
}

@media (max-width: 480px) {
    .toolbar {
        gap: 5px;
    }
    
    .file-controls {
        gap: 2px;
    }
    
    .btn {
        padding: 3px 6px;
        font-size: 11px;
    }
    
    .select {
        padding: 3px 6px;
        font-size: 11px;
        height: 26px;
        min-width: 70px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1e1e1e;
}

::-webkit-scrollbar-thumb {
    background: #424242;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4f4f4f;
}

/* 文件输入样式 */
#fileInput {
    display: none;
}

/* 代码高亮主题 */
.cm-s-monokai .CodeMirror-gutters {
    background: #272822 !important;
}

.cm-s-default .CodeMirror-gutters {
    background: #f5f5f5 !important;
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.file-item {
    animation: fadeIn 0.3s ease-out;
}