* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    background-color: #1e1e1e;
    color: #ffffff;
    height: 100vh;
    overflow: hidden;
}

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

.header {
    background-color: #2d2d30;
    padding: 15px 20px;
    border-bottom: 2px solid #007acc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header > div {
    flex: 1;
}

.header h1 {
    font-size: 24px;
    color: #007acc;
    margin-bottom: 5px;
}

.header p {
    font-size: 14px;
    color: #cccccc;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.connection-status {
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 4px;
    white-space: nowrap;
}

.connection-status.checking {
    color: #e5e510;
    background-color: rgba(229, 229, 16, 0.1);
    border: 1px solid rgba(229, 229, 16, 0.3);
}

.connection-status.connected {
    color: #0dbc79;
    background-color: rgba(13, 188, 121, 0.1);
    border: 1px solid rgba(13, 188, 121, 0.3);
}

.connection-status.warning {
    color: #faad14;
    background-color: rgba(250, 173, 20, 0.1);
    border: 1px solid rgba(250, 173, 20, 0.3);
}

.reset-btn {
    background-color: #d97706;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.reset-btn:hover {
    background-color: #f59e0b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.reset-btn:active {
    transform: translateY(0);
}

/* Focus styles for keyboard navigation */
:focus-visible {
    outline: 2px solid #007acc;
    outline-offset: 2px;
}

button:focus-visible {
    outline: 2px solid #007acc;
    outline-offset: 2px;
}

.editor-icon-btn:focus-visible {
    outline: 2px solid #007acc;
    outline-offset: 1px;
    background-color: #094771;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.left-panel {
    width: 300px;
    background-color: #252526;
    border-right: 1px solid #3e3e42;
    overflow-y: auto;
    padding: 10px;
}

.file-tree-container h3,
.file-tree-container .file-tree-heading {
    color: #cccccc;
    font-size: 14px;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #3e3e42;
}

.current-dir {
    background-color: #094771;
    color: #ffffff;
    padding: 8px 10px;
    margin-bottom: 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: bold;
    border-left: 3px solid #007acc;
}

.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.terminal-container {
    flex: 1;
    background-color: #1e1e1e;
    padding: 10px 10px 32px 10px;
}

#terminal {
    height: 100%;
    width: 100%;
}

/* File Tree Styles */
.tree-folder, .tree-file {
    padding: 2px 5px;
    margin: 2px 0;
    border-radius: 3px;
}

.tree-folder:hover, .tree-file:hover {
    background-color: #37373d;
}

.tree-folder {
    color: #c586c0;
    font-weight: bold;
}

.tree-file {
    color: #9cdcfe;
}

.clickable-file {
    cursor: pointer;
    transition: all 0.2s ease;
}

.clickable-file:hover {
    background-color: #094771 !important;
    transform: translateX(2px);
}

.clickable-file:active {
    background-color: #005a9e !important;
}

.clickable-dir {
    cursor: pointer;
    transition: all 0.2s ease;
}

.clickable-dir:hover {
    background-color: #37373d !important;
    transform: translateX(2px);
}

.clickable-dir:active {
    background-color: #4a4a4f !important;
}

.folder-icon::before {
    content: "📁 ";
}

.file-icon::before {
    content: "📄 ";
}

.hidden-folder {
    color: #a0a0a0;
}

.hidden-file {
    color: #a0a0a0;
}

/* Editor Styles */
.editor-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #1e1e1e;
    border: 2px solid #007acc;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.editor-container.hidden {
    display: none;
}

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

.editor-header span {
    color: #ffffff;
    font-weight: bold;
}

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

.editor-icon-btn {
    background-color: transparent;
    color: #ffffff;
    border: 1px solid #3e3e42;
    padding: 6px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.editor-icon-btn svg {
    width: 16px;
    height: 16px;
}

.editor-icon-btn:hover {
    background-color: #094771;
    border-color: #007acc;
}

.editor-icon-btn:active {
    background-color: #005a9e;
}

.editor {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* CodeMirror styling overrides */
.CodeMirror {
    height: 100% !important;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace !important;
    font-size: 14px !important;
    background-color: #1e1e1e;
}

.CodeMirror-gutters {
    background-color: #1e1e1e !important;
    border-right: 1px solid #3e3e42 !important;
    min-width: 40px !important;
}

.CodeMirror-linenumber {
    color: #858585 !important;
    padding: 0 8px 0 5px !important;
    min-width: 30px !important;
}

.CodeMirror-lines {
    padding: 4px 8px 4px 4px !important;
}

.CodeMirror-line {
    padding-left: 10px !important;
}

.editor-footer {
    background-color: #2d2d30;
    padding: 10px 15px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    border-top: 1px solid #3e3e42;
}

.editor-help {
    color: #cccccc;
    font-size: 12px;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 10px;
}

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

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

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

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: #424242 #1e1e1e;
}

/* Fix emoji spacing in xterm - override negative letter-spacing for emoji characters */
.xterm span[style*="letter-spacing"] {
    letter-spacing: 0px !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .left-panel {
        width: 200px;
    }

    .connection-status {
        display: none;
    }
}

@media (max-width: 600px) {
    .main-content {
        flex-direction: column;
    }

    .left-panel {
        width: 100%;
        max-height: 150px;
        border-right: none;
        border-bottom: 1px solid #3e3e42;
    }

    .header {
        flex-direction: column;
        gap: 8px;
        padding: 10px;
    }

    .header h1 {
        font-size: 18px;
    }

    .header-right {
        justify-content: flex-start;
    }

    .reset-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Command Preview Hint Panel */
.command-preview {
    position: absolute;
    bottom: 0;
    left: 10px;
    right: 10px;
    background-color: rgba(30, 30, 30, 0.95);
    border: 1px solid #3e3e42;
    border-left: 3px solid #007acc;
    border-radius: 4px;
    padding: 6px 12px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    color: #9e9e9e;
    z-index: 500;
    pointer-events: none;
    transition: opacity 0.15s ease-in-out;
    max-height: 60px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.command-preview.hidden {
    display: none;
}

.command-preview .preview-cmd {
    color: #569cd6;
    font-weight: bold;
}

.command-preview .preview-syntax {
    color: #8a8a8a;
}

.command-preview .preview-desc {
    color: #b0b0b0;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .reset-btn:hover {
        transform: none;
    }

    .clickable-file:hover,
    .clickable-dir:hover {
        transform: none;
    }
}

/* Heading level normalization for semantic h2 used as tree heading */
.file-tree-heading {
    font-size: 14px;
    font-weight: normal;
}
