/* ============================================
   BASE
   ============================================ */
:root {
    --hypr-gap: 6px;
    --hypr-border: 2px;
    --hypr-border-color: rgba(150, 150, 200, 0.4);
    --hypr-border-active: rgba(180, 180, 255, 0.6);
    --hypr-radius: 10px;
    --hypr-bg: #11111b;
}

body, html {
    background-color: var(--hypr-bg);
    color: #e0e0e0;
    font-family: 'Courier New', Courier, monospace;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    -webkit-text-size-adjust: 100%;
}

/* ============================================
   HYPRLAND DESKTOP LAYOUT
   ============================================ */
#desktop {
    display: flex;
    width: 100vw;
    height: 100vh;
    padding: var(--hypr-gap);
    gap: var(--hypr-gap);
    box-sizing: border-box;
}

/* ============================================
   EDITOR PANEL (Notepad++ Style)
   ============================================ */
#editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #1e1e1e;
    min-width: 0;
    box-sizing: border-box;
    border: var(--hypr-border) solid var(--hypr-border-color);
    border-radius: var(--hypr-radius);
    overflow: hidden;
    transition: border-color 0.15s ease;
}

#editor-panel.focused {
    border-color: var(--hypr-border-active);
}

/* Menu Bar */
#editor-menubar {
    display: flex;
    background: #2d2d2d;
    border-bottom: 1px solid #404040;
    padding: 0;
    height: 26px;
    align-items: center;
    flex-shrink: 0;
}

.menu-item {
    padding: 4px 10px;
    font-size: 12px;
    color: #ccc;
    cursor: default;
    font-family: 'Segoe UI', Tahoma, sans-serif;
}

.menu-item:hover {
    background: #094771;
    color: #fff;
}

/* Toolbar */
#editor-toolbar {
    display: flex;
    align-items: center;
    background: #333;
    border-bottom: 1px solid #404040;
    padding: 2px 4px;
    height: 28px;
    gap: 2px;
    flex-shrink: 0;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 14px;
    color: #aaa;
    cursor: default;
    border-radius: 3px;
}

.toolbar-btn:hover {
    background: #4a4a4a;
    color: #fff;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: #555;
    margin: 0 4px;
}

/* Tab Bar */
#editor-tabs {
    display: flex;
    background: #252526;
    border-bottom: 1px solid #404040;
    min-height: 30px;
    overflow-x: auto;
    flex-shrink: 0;
}

#editor-tabs::-webkit-scrollbar {
    height: 3px;
}

#editor-tabs::-webkit-scrollbar-thumb {
    background: #555;
}

.npp-tab {
    display: flex;
    align-items: center;
    padding: 0 12px;
    height: 30px;
    font-size: 12px;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    color: #888;
    background: #2d2d2d;
    border-right: 1px solid #1e1e1e;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.npp-tab:hover {
    color: #ccc;
}

.npp-tab.active {
    background: #1e1e1e;
    color: #fff;
    border-bottom: 2px solid #007acc;
}

.npp-tab-name {
    margin-right: 8px;
}

.npp-tab-close {
    font-size: 14px;
    color: #666;
    cursor: pointer;
    line-height: 1;
}

.npp-tab-close:hover {
    color: #fff;
}

/* Editor Main (explorer + body wrapper) */
#editor-main {
    flex: 1;
    display: flex;
    min-height: 0;
}

/* File Explorer */
#file-explorer {
    width: 180px;
    background: #252526;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    transition: width 0.15s ease;
}

#file-explorer.collapsed {
    width: 0;
    border-right: none;
}

#explorer-header {
    padding: 8px 12px;
    font-size: 11px;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    color: #bbb;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

#explorer-tree {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 0;
}

#explorer-tree::-webkit-scrollbar {
    width: 6px;
}

#explorer-tree::-webkit-scrollbar-thumb {
    background: #424242;
}

.explorer-item {
    display: flex;
    align-items: center;
    padding: 3px 8px;
    cursor: pointer;
    font-size: 12px;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    color: #ccc;
    white-space: nowrap;
    user-select: none;
}

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

.explorer-item.active {
    background: #094771;
    color: #fff;
}

.explorer-icon {
    margin-right: 6px;
    font-size: 13px;
    flex-shrink: 0;
    width: 16px;
    text-align: center;
}

.explorer-dir-icon {
    color: #dcb67a;
}

.explorer-file-icon {
    color: #519aba;
}

.explorer-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.explorer-children {
    display: none;
}

.explorer-children.open {
    display: block;
}

.explorer-chevron {
    margin-right: 4px;
    font-size: 10px;
    flex-shrink: 0;
    width: 12px;
    text-align: center;
    color: #888;
    transition: transform 0.1s ease;
}

.explorer-chevron.open {
    transform: rotate(90deg);
}

#toggle-explorer.active {
    background: #4a4a4a;
    color: #fff;
}

/* Editor Body */
#editor-body {
    flex: 1;
    overflow: auto;
    background: #1e1e1e;
    min-height: 0;
    padding: 8px 0;
}

#editor-body::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

#editor-body::-webkit-scrollbar-thumb {
    background: #424242;
    border-radius: 0;
}

#editor-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Editor Lines (interleaved line numbers + content) */
.editor-line {
    display: flex;
    line-height: 1.5;
    font-size: 13px;
    font-family: 'Consolas', 'Courier New', monospace;
    min-height: 1.5em;
}

.line-num {
    color: #858585;
    padding: 0 12px 0 8px;
    text-align: right;
    user-select: none;
    flex-shrink: 0;
    min-width: 40px;
    border-right: 1px solid #333;
    box-sizing: border-box;
}

.line-text {
    flex: 1;
    padding: 0 16px;
    color: #d4d4d4;
    white-space: pre-wrap;
    word-wrap: break-word;
    min-width: 0;
}

/* Syntax Highlighting Colors (Notepad++ Obsidian Theme) */
.npp-heading {
    color: #569cd6;
    font-weight: bold;
}

.npp-bold {
    color: #ce9178;
    font-weight: bold;
}

.npp-bracket,
.npp-paren {
    color: #808080;
}

.npp-link-text {
    color: #4ec9b0;
}

.npp-link {
    color: #4ec9b0;
    text-decoration: none;
    cursor: pointer;
}

.npp-link:hover {
    text-decoration: underline;
    color: #6edcd0;
}

.npp-url {
    color: #ce9178;
    text-decoration: underline;
    cursor: pointer;
}

.npp-url:hover {
    color: #e8b49e;
}

.npp-list {
    color: #c586c0;
}

.npp-code {
    color: #d7ba7d;
    background: #2a2a2a;
    border-radius: 2px;
    padding: 0 3px;
}

.npp-comment {
    color: #6a9955;
    font-style: italic;
}

/* Status Bar */
#editor-statusbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #007acc;
    color: #fff;
    padding: 2px 10px;
    font-size: 11px;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    height: 22px;
    flex-shrink: 0;
}

#status-right {
    display: flex;
    gap: 16px;
}

#status-readonly {
    background: rgba(255, 255, 255, 0.15);
    padding: 0 6px;
    border-radius: 3px;
    font-size: 10px;
    letter-spacing: 0.5px;
}

/* ============================================
   TERMINAL PANEL
   ============================================ */
#terminal {
    flex: 1;
    background-color: #000;
    padding: 20px;
    overflow-y: auto;
    box-sizing: border-box;
    color: #00FF00;
    font-family: 'Courier New', Courier, monospace;
    min-width: 0;
    border: var(--hypr-border) solid var(--hypr-border-color);
    border-radius: var(--hypr-radius);
    transition: border-color 0.15s ease;
}

#terminal.focused {
    border-color: var(--hypr-border-active);
}

#terminal::-webkit-scrollbar {
    width: 10px;
}

#terminal::-webkit-scrollbar-track {
    background: #111;
}

#terminal::-webkit-scrollbar-thumb {
    background: #333;
}

#output {
    font-size: 1.1em;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.command-line {
    display: flex;
    align-items: center;
    margin: 5px 0;
    width: 100%;
}

.prompt {
    color: #00FF00;
    margin-right: 10px;
    font-size: 1.1em;
    white-space: nowrap;
}

#command {
    background-color: transparent;
    border: none;
    color: #00FF00;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.1em;
    outline: none;
    flex-grow: 1;
    width: 100%;
    padding: 5px 0;
    -webkit-appearance: none;
    border-radius: 0;
}

/* Cursor effect */
#command::after {
    content: '_';
    font-weight: bold;
    animation: blink 1s step-end infinite;
    font-size: 1.1em;
}

@keyframes blink {
    from, to { opacity: 0; }
    50% { opacity: 1; }
}

/* Error message color */
.error {
    color: #FF0000;
}

/* Command history */
.history {
    color: #00FFFF;
}

/* File listing styles */
.directory {
    color: #00FF00;
    font-weight: bold;
    cursor: pointer;
}

.directory:hover {
    text-decoration: underline;
}

.file {
    color: #CCCCCC;
    cursor: pointer;
}

.file:hover {
    text-decoration: underline;
}

/* ASCII Banner */
.banner {
    color: #00FF00;
    font-family: monospace;
    white-space: pre;
    line-height: 1.2;
    margin: 20px 0;
    font-size: 12px;
    text-align: center;
}

/* Markdown content styles */
.markdown-content {
    color: #00FF00;
    padding: 10px;
    margin: 10px 0;
    border-left: 2px solid #00FF00;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    color: #00FF00;
    margin: 10px 0;
}

.markdown-content p {
    margin: 10px 0;
}

.markdown-content a {
    color: #00FFFF;
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content code {
    background-color: #003300;
    padding: 2px 5px;
    border-radius: 3px;
}

.markdown-content pre {
    background-color: #002200;
    padding: 10px;
    border-radius: 3px;
    overflow-x: auto;
}

.markdown-content ul,
.markdown-content ol {
    margin: 10px 0;
    padding-left: 20px;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    #desktop {
        flex-direction: column;
        padding: var(--hypr-gap);
        gap: var(--hypr-gap);
    }

    #editor-panel {
        flex: none;
        width: 100%;
        height: 45%;
    }

    #terminal {
        flex: none;
        width: 100%;
        height: 55%;
        padding: 10px;
    }

    #output, #command, .prompt {
        font-size: 14px;
    }

    .command-line {
        margin: 8px 0;
    }

    #command {
        min-height: 24px;
    }

    .banner {
        font-size: 8px;
    }

    #editor-main {
        position: relative;
    }

    #file-explorer {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 10;
        width: 200px;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.5);
    }

    #file-explorer.collapsed {
        width: 0;
        box-shadow: none;
    }
}

/* Prevent zoom on input focus for iOS */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    #command {
        font-size: 16px;
    }
}
