/* Improved IDE Layout - Programiz Style */

.ide-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    background: #1e1e1e;
    color: #e0e0e0;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Sidebar */
.ide-sidebar {
    width: 250px;
    background: #252526;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
}

.ide-explorer-header {
    padding: 15px;
    background: #2b2b2b;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #9cdcfe;
    border-bottom: 2px solid #007acc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-tree {
    flex: 1;
    overflow-y: auto;
    padding: 5px 0;
}

.file-item {
    padding: 8px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.file-item:hover {
    background: #2a2d2e;
}

.file-item.active {
    background: #37373d;
    border-left-color: #007acc;
}

/* Workspace Area */
.ide-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ide-toolbar {
    height: 45px;
    background: #2d2d2d;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    border-bottom: 1px solid #1e1e1e;
}

.ide-tab-container {
    display: flex;
    align-items: center;
    height: 100%;
}

.ide-tab {
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    background: #1e1e1e;
    color: #fff;
    font-size: 0.9rem;
    border-top: 2px solid #007acc;
    min-width: 120px;
    justify-content: center;
}

.run-btn {
    background: #007acc;
    color: white;
    border: none;
    padding: 6px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.run-btn:hover {
    background: #005f9e;
}

.save-btn {
    background: transparent;
    color: #ccc;
    border: 1px solid #444;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 10px;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.save-btn:hover {
    background: #333;
    border-color: #666;
}

/* Split Pane */
.ide-split-pane {
    flex: 1;
    display: flex;
    height: calc(100vh - 45px);
    /* Subtract toolbar */
}

.ide-editor-container {
    flex: 6;
    /* 60% width */
    position: relative;
    border-right: 1px solid #333;
}

#aceEditor {
    width: 100%;
    height: 100%;
}

.ide-output-container {
    flex: 4;
    /* 40% width */
    background: #1e1e1e;
    display: flex;
    flex-direction: column;
}

.terminal-header {
    background: #252526;
    padding: 8px 15px;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #bbb;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.clear-term-btn {
    background: none;
    border: 1px solid #444;
    color: #888;
    padding: 2px 8px;
    font-size: 0.75rem;
    border-radius: 3px;
    cursor: pointer;
}

.clear-term-btn:hover {
    color: #fff;
    border-color: #666;
}

.terminal-output {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.5;
    white-space: pre-wrap;
    background: #1e1e1e;
    color: #d4d4d4;
}

.term-welcome {
    color: #555;
    text-align: center;
    margin-top: 50px;
}

.term-dim {
    font-size: 0.8rem;
    color: #444;
}

.term-success {
    color: #89d185;
}

.term-error {
    color: #f48771;
}

.term-info {
    color: #569cd6;
}

/* Responsive Grid for Lang Selection */
.lang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
    max-width: 800px;
    margin: 50px auto;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .ide-sidebar {
        display: none;
        /* Hide sidebar on small screens for maximize space */
    }

    .ide-split-pane {
        flex-direction: column;
    }

    .ide-editor-container {
        flex: 1;
        height: 60%;
        border-right: none;
        border-bottom: 1px solid #333;
    }

    .ide-output-container {
        flex: 1;
        height: 40%;
    }
}