:root {
    --bg-editor: #1e1e1e;
    --bg-sidebar: #252526;
    --bg-activity: #333333;
    --bg-header: #2d2d2d;
    --bg-tab: #2d2d2d;
    --bg-tab-active: #1e1e1e;
    --border: #3c3c3c;
    --text-main: #d4d4d4;
    --text-muted: #858585;
    --text-gutter: #858585;
    --accent: #e11d48;
    --accent-green: #10b981;
    --highlight-line: rgba(255, 255, 255, 0.07);
    --highlight-pulse: #4c1d28;
}

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

html, body {
    height: 100%;
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-editor);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#appContainer {
    height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header Navbar */
header {
    height: 44px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    user-select: none;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.nav-link {
    color: #9cdcfe;
    text-decoration: none;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-badge, .badge-radis, .badge-lkm {
    background: #e11d48;
    color: white;
    font-size: 0.72rem;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
}

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

.btn-header {
    background: #3c3c3c;
    border: 1px solid #555;
    color: #ccc;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-header:hover {
    background: #4a4a4a;
    color: #fff;
    border-color: #666;
}

kbd {
    background: #252526;
    border: 1px solid #555;
    border-radius: 3px;
    padding: 1px 4px;
    font-size: 0.7rem;
    font-family: monospace;
    color: #aaa;
}

/* Workspace Shell */
.workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    min-width: 160px;
    max-width: 650px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    user-select: none;
    position: relative;
    transition: width 0.18s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.15s ease;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    border-right: none !important;
    opacity: 0;
    pointer-events: none;
}

.sidebar-header {
    padding: 10px 14px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-box {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.search-box input {
    width: 100%;
    background: #3c3c3c;
    border: 1px solid transparent;
    color: #fff;
    padding: 5px 8px;
    border-radius: 3px;
    font-size: 0.82rem;
    outline: none;
}

.search-box input:focus {
    border-color: var(--accent);
}

.explorer {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.explorer-section {
    margin-bottom: 6px;
}

.section-title {
    padding: 6px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #bbb;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.section-title:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
}

.folder-arrow {
    font-size: 0.65rem;
    transition: transform 0.15s;
    display: inline-block;
    width: 10px;
}

.folder-files.collapsed {
    display: none;
}

.badge-count {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 5px;
    border-radius: 8px;
}

.file-item {
    padding: 5px 14px 5px 28px;
    font-size: 0.83rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    color: #cccccc;
    transition: background 0.1s;
}

.file-item:hover {
    background: #2a2d2e;
    color: #ffffff;
}

.file-item.active {
    background: #37373d;
    color: #ffffff;
    font-weight: 500;
}

.file-item-left {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-icon {
    font-size: 0.68rem;
    font-weight: bold;
    font-family: monospace;
    padding: 1px 4px;
    border-radius: 2px;
}

.file-badge {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.icon-c   { color: #519aba; background: rgba(81, 154, 186, 0.15); }
.icon-cpp { color: #519aba; background: rgba(81, 154, 186, 0.15); }
.icon-h   { color: #a074c4; background: rgba(160, 116, 196, 0.15); }
.icon-py  { color: #3572A5; background: rgba(53, 114, 165, 0.15); }
.icon-md  { color: #e37933; background: rgba(227, 121, 51, 0.15); }
.icon-sh  { color: #4eaa25; background: rgba(78, 170, 37, 0.15); }
.icon-txt { color: #858585; background: rgba(133, 133, 133, 0.15); }

/* Main Editor Section */
.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-editor);
    position: relative;
}

/* Tab Strip */
.tab-strip {
    height: 35px;
    background: #252526;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    flex-shrink: 0;
}

.tab {
    padding: 0 14px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: #969696;
    background: #2d2d2d;
    border-right: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.tab:hover {
    background: #333333;
    color: #cccccc;
}

.tab.active {
    background: var(--bg-editor);
    color: #ffffff;
    border-top: 2px solid var(--accent);
}

.tab-close {
    font-size: 0.85rem;
    border-radius: 3px;
    padding: 0 3px;
    color: #888;
}

.tab-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Breadcrumb Bar */
.breadcrumbs {
    height: 26px;
    padding: 0 16px;
    background: var(--bg-editor);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    gap: 6px;
    flex-shrink: 0;
}

.breadcrumbs span.crumb {
    color: #cccccc;
}

/* Code View Scroll Area */
.code-view {
    flex: 1;
    overflow: auto;
    position: relative;
}

.code-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    font-size: 13px;
    line-height: 20px;
}

.code-line {
    scroll-margin-top: 50px;
}

.code-line:hover {
    background-color: var(--highlight-line);
}

/* GitHub-style Yellow Marker Highlights */
.code-line.active-line,
.code-line.range-highlight {
    background-color: rgba(234, 179, 8, 0.22) !important;
}

.code-line.range-highlight-start {
    border-top: 1px solid rgba(234, 179, 8, 0.6) !important;
}

.code-line.range-highlight-end {
    border-bottom: 1px solid rgba(234, 179, 8, 0.6) !important;
}

.code-line.active-line .ln,
.code-line.range-highlight .ln {
    color: #facc15 !important;
    background-color: rgba(234, 179, 8, 0.15) !important;
    border-right: 2px solid #eab308 !important;
    font-weight: 600;
}

.code-line.pulse-line {
    animation: pulse-flash 1.6s ease-out;
}

@keyframes pulse-flash {
    0% { background-color: rgba(234, 179, 8, 0.7); }
    100% { background-color: rgba(234, 179, 8, 0.22); }
}

.ln {
    width: 54px;
    min-width: 54px;
    text-align: right;
    padding-right: 14px;
    color: var(--text-gutter);
    user-select: none;
    vertical-align: top;
    cursor: pointer;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.ln a {
    color: inherit;
    text-decoration: none;
}

.ln:hover {
    color: #c6c6c6;
}

.code {
    padding-left: 16px;
    white-space: pre;
    color: var(--text-main);
    vertical-align: top;
}

/* Syntax Highlight Colors (VS Code Dark+) */
.tok-keyword { color: #569cd6; font-weight: 500; }
.tok-comment { color: #6a9955; font-style: italic; }
.tok-string  { color: #ce9178; }
.tok-preproc { color: #c586c0; font-weight: 500; }
.tok-number  { color: #b5cea8; }
.tok-var     { color: #9cdcfe; }

.tok-def {
    color: #dcdcaa;
    font-weight: 600;
    border-bottom: 1px dashed rgba(220, 220, 170, 0.4);
}

.tok-sym {
    color: #4ec9b0;
    cursor: pointer;
    text-decoration: none;
    border-bottom: 1px dotted rgba(78, 201, 176, 0.5);
    transition: color 0.15s, border-color 0.15s;
}

.tok-sym:hover {
    color: #9cdcfe;
    border-bottom-color: #9cdcfe;
    background: rgba(156, 220, 254, 0.1);
}

/* Right Outline Panel */
.outline-panel {
    width: 240px;
    min-width: 160px;
    max-width: 550px;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    user-select: none;
    position: relative;
    transition: width 0.18s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.15s ease;
    overflow: hidden;
}

.outline-panel.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    border-left: none !important;
    opacity: 0;
    pointer-events: none;
}

/* Sashes (VS Code Resizers / Splitters) */
.sash {
    width: 4px;
    background: transparent;
    cursor: col-resize;
    position: relative;
    flex-shrink: 0;
    z-index: 10;
    transition: background 0.12s ease;
}

.sash:hover,
.sash.resizing {
    background: #007acc;
}

.sash::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -3px;
    right: -3px;
}

/* Retract handles when panes are collapsed */
.collapsed-pane-handle {
    display: none;
    width: 18px;
    background: #1e1e1e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: none;
    border-bottom: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: #858585;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    user-select: none;
    transition: background 0.15s, color 0.15s, width 0.15s;
    z-index: 9;
}

.collapsed-pane-handle:hover {
    background: #2d2d30;
    color: #ffffff;
    width: 22px;
}

.collapsed-left.visible {
    display: flex;
}

.collapsed-right.visible {
    display: flex;
}

/* Resizing state: disable transitions during drag */
.workspace.is-resizing {
    cursor: col-resize !important;
}

.workspace.is-resizing .sidebar,
.workspace.is-resizing .outline-panel {
    transition: none !important;
}

/* Header buttons & pane action buttons */
.btn-pane-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #999;
}

.btn-pane-toggle.active {
    color: #ffffff;
    background: #37373d;
    border-color: #007acc;
}

.pane-action-btn {
    background: transparent;
    border: none;
    color: #858585;
    font-size: 13px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.12s, color 0.12s;
}

.pane-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.outline-header {
    padding: 10px 14px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.outline-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.outline-item {
    padding: 4px 14px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #cccccc;
}

.outline-item:hover {
    background: #2a2d2e;
    color: #fff;
}

.outline-kind {
    font-size: 0.68rem;
    padding: 1px 4px;
    border-radius: 2px;
    font-weight: bold;
}

.kind-fn { color: #dcdcaa; }
.kind-struct { color: #4ec9b0; }
.kind-macro { color: #c586c0; }
.kind-var { color: #9cdcfe; }

/* Hover Tooltip Widget */
#hoverWidget {
    position: fixed;
    display: none;
    background: #252526;
    border: 1px solid #454545;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    border-radius: 4px;
    padding: 8px 12px;
    z-index: 9999;
    max-width: 480px;
    pointer-events: auto;
}

.hover-badge {
    display: inline-block;
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.badge-fn { background: #3c3218; color: #dcdcaa; border: 1px solid #5a4b24; }
.badge-struct { background: #13332c; color: #4ec9b0; border: 1px solid #1c4d43; }
.badge-macro { background: #341f39; color: #c586c0; border: 1px solid #52315a; }

.hover-sig {
    font-family: monospace;
    font-size: 0.85rem;
    color: #9cdcfe;
    background: #1e1e1e;
    padding: 4px 8px;
    border-radius: 3px;
    margin: 4px 0;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.hover-loc {
    font-size: 0.75rem;
    color: #858585;
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
}

.hover-hint {
    color: #569cd6;
    font-size: 0.72rem;
}

/* Quick Open Modal */
#quickOpenModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: flex-start;
    padding-top: 80px;
    z-index: 10000;
}

.quick-open-box {
    width: 580px;
    background: #252526;
    border: 1px solid #454545;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.quick-open-box input {
    width: 100%;
    background: #1e1e1e;
    border: none;
    border-bottom: 1px solid #3c3c3c;
    color: #fff;
    padding: 12px 16px;
    font-size: 0.95rem;
    outline: none;
}

.quick-open-results {
    max-height: 380px;
    overflow-y: auto;
}

.quick-item {
    padding: 8px 16px;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.quick-item:hover, .quick-item.selected {
    background: #04395e;
    color: #fff;
}

.quick-item-sub {
    font-size: 0.75rem;
    color: #858585;
}

/* In-File Search Bar */
.file-search-bar {
    position: absolute;
    top: 42px;
    right: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 6px;
    background: #252526;
    border: 1px solid #454545;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    border-radius: 4px;
    padding: 4px 8px;
}

.search-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1e1e1e;
    border: 1px solid #3c3c3c;
    border-radius: 3px;
    padding: 2px 8px;
}

.search-input-group input {
    background: transparent;
    border: none;
    color: #d4d4d4;
    font-size: 0.82rem;
    width: 220px;
    outline: none;
}

.match-count {
    font-size: 0.75rem;
    color: #858585;
    white-space: nowrap;
}

.search-btn-group {
    display: flex;
    align-items: center;
    gap: 2px;
}

.search-btn-group button {
    background: transparent;
    border: none;
    color: #cccccc;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 0.8rem;
    transition: background 0.1s;
}

.search-btn-group button:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* Search Match Highlights */
.search-match {
    background-color: rgba(234, 179, 8, 0.4);
    color: inherit;
    border-radius: 2px;
    outline: 1px solid rgba(234, 179, 8, 0.6);
}

.search-match-current {
    background-color: #f97316 !important;
    color: #ffffff !important;
    outline: 2px solid #ea580c !important;
}
