:root {
    --bg-color: #1a1b26;
    --sidebar-bg: #1a1b26;
    --text-color: #c0caf5;
    --accent-color: #7aa2f7;
    --hover-bg: #292e42;
    --border-color: #24283b;
}

[data-tooltip] {
    position: relative !important;
}
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 140%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1a1b26;
    color: #c0caf5;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    z-index: 99999 !important;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.8);
    border: 1px solid var(--accent-color);
}
[data-tooltip]::before {
    content: "";
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--accent-color);
    opacity: 0;
    visibility: hidden;
    z-index: 99999 !important;
}
[data-tooltip]:hover::after, [data-tooltip]:hover::before {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Tooltip Down variant */
.tooltip-down::after {
    bottom: auto !important;
    top: 140% !important;
}
.tooltip-down::before {
    bottom: auto !important;
    top: 120% !important;
    border-top-color: transparent !important;
    border-bottom-color: var(--accent-color) !important;
}

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

body, html {
    height: 100%;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', sans-serif;
    overflow: hidden;
}

/* Login Screen */
.login-container {
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-color);
}
.login-container.active { display: flex; }
.login-box {
    background: #16161e;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-align: center;
    width: 300px;
}
.login-box input {
    width: 100%;
    padding: 10px;
    margin: 15px 0;
    background: #1a1b26;
    border: 1px solid var(--border-color);
    color: #fff;
    border-radius: 4px;
}
.login-box button {
    width: 100%;
    padding: 10px;
    background: var(--accent-color);
    border: none;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
}

/* Layout */
.app-container {
    height: 100%;
    display: none;
    flex-direction: column;
}
.app-container.active { display: flex; }

.main-header {
    height: 50px;
    background: #16161e;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    flex-shrink: 0;
}
.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}
.header-right {
    justify-content: flex-end;
}
.main-header h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-color);
    letter-spacing: 0.5px;
}
.version-badge {
    font-size: 11px;
    opacity: 0.5;
    background: var(--hover-bg);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

.workspace-area {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Sidebar / Panes */
.sidebar, .pane-container {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-color);
}

.pane-header {
    height: 40px;
    background: #16161e;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 10px;
    flex-shrink: 0;
    justify-content: space-between;
    overflow: visible !important;
}
.pane-header span {
    font-size: 11px;
    font-weight: bold;
    color: #a9b1d6;
}

.header-actions {
    display: flex;
    gap: 4px;
}

/* Tabs */
.tabs-container {
    display: flex;
    gap: 2px;
    flex: 1;
    overflow-x: auto;
    padding-left: 10px;
}
.tab-btn {
    padding: 6px 15px;
    background: #1a1b26;
    border: 1px solid var(--border-color);
    border-bottom: none;
    color: #565f89;
    border-radius: 6px 6px 0 0;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.tab-btn:hover {
    color: #a9b1d6;
    background: #24283b;
}
.tab-btn.active {
    background: #24283b;
    color: #fff;
    border-color: var(--border-color);
}
.tab-btn.type-terminal.active {
    background: #1a1b26;
    border-bottom: 2px solid var(--accent-color);
    color: var(--accent-color);
}

/* File Tree */
#file-tree {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}
.tree-item {
    font-size: 13px;
    padding: 3px 8px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.5;
    color: #a9b1d6;
}
.tree-item:hover { 
    background: var(--hover-bg); 
    color: #fff;
}
.tree-item.folder { font-weight: 600; color: #7aa2f7; }

/* Breadcrumbs */
.breadcrumbs-bar {
    height: 34px;
    background: #16161e;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 11px;
    gap: 6px;
    overflow-x: auto;
    white-space: nowrap;
}
.breadcrumb-item {
    cursor: pointer;
    color: #565f89;
    transition: color 0.2s;
}
.breadcrumb-item:hover { color: var(--accent-color); }

/* Icons */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #565f89;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: color 0.2s;
}
.icon-btn:hover { color: var(--accent-color); }
.icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }

/* Terminal */
.terminal-wrapper {
    flex: 1;
    background: #000;
    padding: 12px 15px;
}
.xterm-viewport { border-radius: 4px; }

/* Split.js Gutters */
.gutter { 
    background: var(--bg-color); 
    background-image: radial-gradient(var(--border-color) 1px, transparent 0);
    background-size: 4px 4px;
}
.gutter.gutter-horizontal { cursor: col-resize; width: 6px; border-left: 1px solid var(--border-color); border-right: 1px solid var(--border-color); }
.gutter.gutter-vertical { cursor: row-resize; height: 6px; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); }

/* Stats */
.stats-container {
    display: flex;
    gap: 8px;
}
.stat-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #1a1b26;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 11px;
    color: #a9b1d6;
}
.icon-small { width: 14px; height: 14px; stroke: currentColor; fill: none; opacity: 0.7; }

/* Modals */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}
.modal.active { display: flex; }
.modal-content {
    background: #16161e;
    width: 600px;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
.settings-section {
    margin-bottom: 20px;
    padding: 10px;
    background: #1a1b26;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}
.settings-section h3 { font-size: 12px; margin-bottom: 10px; color: var(--accent-color); text-transform: uppercase; }

input[type="text"], input[type="password"] {
    background: #1a1b26;
    border: 1px solid var(--border-color);
    color: #c0caf5;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 13px;
}

.btn-primary { background: var(--accent-color); color: #fff; border: none; padding: 5px 12px; border-radius: 4px; cursor: pointer; transition: opacity 0.2s; }
.btn-primary:hover { opacity: 0.8; }
.btn-secondary { background: #3b4261; color: #fff; border: none; padding: 5px 12px; border-radius: 4px; cursor: pointer; }

/* Management Lists (SSH, Macros) */
.manage-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.manage-item {
    background: #16161e;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}
.manage-item .info {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 10px;
}
.manage-item .actions {
    display: flex;
    gap: 8px;
}
.btn-icon-small {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.btn-icon-small:hover { background: var(--hover-bg); }
.btn-icon-small svg { width: 14px; height: 14px; stroke: currentColor; fill: none; }
.btn-delete { color: #f7768e; }
.btn-edit { color: #7aa2f7; }

/* Status Bar */
.status-bar {
    height: 28px;
    background: #16161e;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    font-size: 11px;
    color: #565f89;
    flex-shrink: 0;
}
.status-left, .status-right { display: flex; gap: 15px; }
#status-mode { color: #9ece6a; font-weight: bold; }

/* Macros */
#macro-list {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.macro-item {
    background: #16161e;
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}
.macro-item:hover {
    border-color: var(--accent-color);
    background: #1a1b26;
    transform: translateY(-1px);
}
.macro-name { font-size: 13px; font-weight: 600; color: #fff; margin-bottom: 4px; display: block; }
.macro-cmd { font-size: 11px; color: #565f89; font-family: monospace; }

/* Placeholder Centering */
.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0; left: 0;
    color: #565f89;
    font-size: 14px;
    text-align: center;
    background: var(--bg-color);
    z-index: 5;
}
.placeholder svg {
    width: 48px;
    height: 48px;
    margin-bottom: 15px;
    opacity: 0.3;
}

/* Dark Scrollbars */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: #16161e;
}
::-webkit-scrollbar-thumb {
    background: #3b4261;
    border-radius: 5px;
    border: 2px solid #16161e;
}
::-webkit-scrollbar-thumb:hover {
    background: #4b5271;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #3b4261 #16161e;
}

/* Drag & Drop Visuals */
#drop-zone-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(26, 27, 38, 0.85);
    backdrop-filter: blur(4px);
    z-index: 20000;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none; /* Critical: allows drop event to pass through if needed, though we catch it on document */
}
#drop-zone-overlay.active {
    display: flex;
}
.drop-zone-content {
    border: 3px dashed var(--accent-color);
    border-radius: 20px;
    padding: 60px;
    text-align: center;
    color: var(--accent-color);
    background: rgba(122, 162, 247, 0.05);
    animation: pulse 2s infinite;
}
.drop-zone-content svg {
    Width: 80px; height: 80px; margin-bottom: 20px;
}
.drop-zone-content p {
    font-size: 20px; font-weight: 600;
}
#drop-target-path {
    color: #9ece6a;
    font-family: monospace;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.02); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

/* Toasts */
#toast-container {
    position: fixed;
    bottom: 40px;
    right: 20px;
    z-index: 30000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: #16161e;
    border-left: 4px solid var(--accent-color);
    color: #fff;
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 13px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    min-width: 250px;
    animation: slideIn 0.3s ease-out;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.toast.success { border-left-color: #9ece6a; }
.toast.error { border-left-color: #f7768e; }
.toast.info { border-left-color: #7aa2f7; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* IDE Overhaul Styles */

/* Sidebar Tabs */
.sidebar-tabs {
    display: flex;
    background: #16161e;
    border-bottom: 1px solid var(--border-color);
    padding: 0 10px;
    height: 40px;
    flex-shrink: 0;
}
.sidebar-tab {
    background: none;
    border: none;
    color: #565f89;
    padding: 0 15px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.sidebar-tab:hover { color: #a9b1d6; }
.sidebar-tab.active { color: var(--accent-color); }
.sidebar-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; width: 100%; height: 2px;
    background: var(--accent-color);
}
.sidebar-tab .lucide { width: 18px; height: 18px; }

/* Search View */
.search-container {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
}
.search-input-wrapper {
    position: relative;
}
.search-input-wrapper input {
    width: 100%;
    padding: 8px 10px 8px 35px;
    background: #16161e;
    border: 1px solid var(--border-color);
    color: #c0caf5;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
}
.search-input-wrapper input:focus { border-color: var(--accent-color); }
.search-input-wrapper .search-icon {
    position: absolute;
    left: 10px; top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    color: #565f89;
    pointer-events: none;
}
.search-stats { font-size: 11px; color: #565f89; margin-bottom: 10px; }
.search-results-list {
    flex: 1;
    overflow-y: auto;
}
.search-result-item {
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(36, 40, 59, 0.5);
}
.search-result-item:hover { background: var(--hover-bg); }
.search-result-file {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 4px;
    display: block;
}
.search-result-content {
    font-size: 11px;
    color: #a9b1d6;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
.search-result-content b { color: #e0af68; font-weight: bold; }

/* Context Menu */
.context-menu {
    position: fixed;
    background: rgba(22, 22, 30, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    padding: 6px;
    z-index: 50000;
    min-width: 180px;
    display: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.menu-item {
    padding: 8px 12px;
    font-size: 13px;
    color: #c0caf5;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 4px;
    transition: background 0.2s;
}
.menu-item:hover { background: var(--accent-color); color: #fff; }
.menu-item .lucide { width: 14px; height: 14px; }
.menu-divider { height: 1px; background: var(--border-color); margin: 4px 0; }

/* Command Palette */
.palette-content {
    width: 600px;
    background: rgba(22, 22, 30, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid var(--accent-color);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    overflow: hidden;
    position: absolute;
    top: 20%;
    animation: slideDown 0.2s ease-out;
}
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.palette-search {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}
.palette-search input {
    flex: 1;
    background: none;
    border: none;
    color: #fff;
    font-size: 16px;
    outline: none;
}
.palette-results { max-height: 400px; overflow-y: auto; padding: 10px; }
.palette-item {
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
}
.palette-item:hover, .palette-item.selected { background: var(--hover-bg); }
.palette-item .name { font-size: 14px; color: #fff; }
.palette-item .shortcut { font-size: 11px; color: #565f89; background: #1a1b26; padding: 2px 6px; border-radius: 3px; }

/* Tab Dirty Indicator */
.tab-btn .dirty-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #e0af68;
    border-radius: 50%;
    margin-left: 8px;
}
.tab-close {
    margin-left: 8px;
    opacity: 0.4;
    transition: opacity 0.2s;
}
.tab-close:hover { opacity: 1; color: #f7768e; }
