/* =========================================================
   BASE RESET & VARIABLES
   ========================================================= */
body, html {
    margin: 0;
    padding: 0;
    height: 100vh; /* Viewport height */
    width: 100vw;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background-color: #1a1b26; /* Deep dark background */
    color: #a9b1d6;
    overflow: hidden; /* Prevent full page scrolling */
}

/* =========================================================
   LAYOUT (Desktop First)
   ========================================================= */
.ide-container {
    display: flex;
    flex-direction: row; /* Side-by-side on desktop */
    height: 100%;
    width: 100%;
}

.panel {
    flex: 1; 
    display: flex;
    flex-direction: column;
    min-width: 0; /* Prevents flex children from overflowing */
}

.editor-panel {
    border-right: 2px solid #16161e; 
}

.editor-wrapper, .output-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* =========================================================
   TOOLBARS & CONTROLS
   ========================================================= */
.toolbar {
    min-height: 45px;
    background-color: #24283b;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 15px;
    border-bottom: 1px solid #16161e;
}

h1 {
    margin: 0;
    font-size: 20px;
    color: #9ece6a;
    white-space: nowrap;
}

.tab {
    font-size: 14px;
    font-weight: 600;
    color: #c0caf5;
    background-color: #1a1b26;
    padding: 6px 12px;
    border-radius: 4px;
}

.controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

select {
    background-color: #1a1b26;
    color: #c0caf5;
    border: 1px solid #414868;
    padding: 6px 10px;
    border-radius: 4px;
    outline: none;
    font-size: 14px;
}

.action-btn {
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    color: white;
    transition: background-color 0.2s;
    font-size: 14px;
    white-space: nowrap;
}

.run-btn { background-color: #414868; }
.run-btn:hover { filter: brightness(1.2); }

.clear-btn { background-color: transparent; border: 1px solid #414868; color: #a9b1d6; }
.clear-btn:hover { background-color: #414868; color: white; }

/* =========================================================
   EDITOR OVERRIDES (CodeMirror)
   ========================================================= */
.CodeMirror {
    flex: 1;
    height: 100% !important;
    font-size: 15px;
    font-family: 'Consolas', 'Courier New', monospace;
}

/* =========================================================
   CUSTOM NATIVE TERMINAL
   ========================================================= */
.custom-terminal {
    background-color: #000000;
    padding: 10px;
    flex: 1;
    box-sizing: border-box;
    overflow-y: auto;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 15px;
    cursor: text;
}

#term-output {
    white-space: pre-wrap;
    word-wrap: break-word;
}

#term-input-line {
    display: flex;
    align-items: center;
    margin-top: 2px;
}

#term-prompt {
    color: #9ece6a;
    white-space: pre-wrap;
}

#term-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #ffffff;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 15px;
    outline: none;
    padding: 0;
    margin-left: 5px;
}

/* =========================================================
   📱 MOBILE RESPONSIVE LAYOUT (Screens smaller than 800px)
   ========================================================= */
@media screen and (max-width: 800px) {
    .ide-container {
        flex-direction: column; /* Stack editor on top of terminal */
    }

    .editor-panel {
        flex: 1; /* Editor takes up flexible space */
        min-height: 40vh; /* Ensures it doesn't disappear when keyboard opens */
        border-right: none;
        border-bottom: 2px solid #16161e;
    }

    .output-panel {
        flex: 1; /* Terminal takes remaining space */
        min-height: 30vh;
    }

    /* Shrink toolbars to fit mobile screens */
    .toolbar {
        padding: 5px 10px;
        min-height: 40px;
    }

    h1 {
        font-size: 16px; /* Smaller title */
    }

    .action-btn, select, .tab {
        padding: 6px 10px;
        font-size: 13px; /* Smaller buttons to fit side-by-side */
    }

    /* Hide the text "Docs" and "Tamil/Tanglish" to save space, keep icons if applicable */
    .hide-on-mobile {
        display: none !important;
    }
}
