/* Aether Editor - Main Stylesheet */
/* Theme colors and layout styles */

:root {
    /* Catppuccin Mocha Defaults */
    --bg: #1e1e2e;
    --sidebar-bg: #181825;
    --header-bg: #11111b;
    --tab-bg: #11111b;
    --tab-active-bg: #1e1e2e;

    --text: #cdd6f4;
    --text-dim: #9399b2;
    --text-dark: #6c7086;

    --accent: #89b4fa;
    --accent-sec: #b4befe;
    --border: #313244;
    --highlight: #313244;

    --cursor: #f5e0dc;
    --status-bg: #89b4fa;
    --status-fg: #1e1e2e;

    --font-code: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
    --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

    --header-h: 36px;
    --footer-h: 28px;
    --sidebar-w: 240px;
    --outline-w: 200px;
    /* Width of symbol bar */
    --tab-h: 32px;
    /* Console log semantic colors (can be overridden per theme) */
    --log-error: #ff8888;
    --log-warn: #ffd700;
    --log-info: #8fd3ff;
}

[data-theme="macchiato"] {
    --bg: #24273a;
    --sidebar-bg: #1e2030;
    --header-bg: #181926;
    --tab-bg: #181926;
    --tab-active-bg: #24273a;
    --text: #cad3f5;
    --text-dim: #939ab7;
    --text-dark: #6e738d;
    --accent: #8aadf4;
    --accent-sec: #b7bdf8;
    --border: #363a4f;
    --highlight: #363a4f;
    --cursor: #f4dbd6;
    --status-bg: #8aadf4;
    --status-fg: #24273a;
}

[data-theme="frappe"] {
    --bg: #303446;
    --sidebar-bg: #292c3c;
    --header-bg: #232634;
    --tab-bg: #232634;
    --tab-active-bg: #303446;
    --text: #c6d0f5;
    --text-dim: #949cbb;
    --text-dark: #737994;
    --accent: #8caaee;
    --accent-sec: #babbf1;
    --border: #414559;
    --highlight: #414559;
    --cursor: #f2d5cf;
    --status-bg: #8caaee;
    --status-fg: #303446;
}

[data-theme="latte"] {
    --bg: #eff1f5;
    --sidebar-bg: #e6e9ef;
    --header-bg: #dce0e8;
    --tab-bg: #dce0e8;
    --tab-active-bg: #eff1f5;
    --text: #4c4f69;
    --text-dim: #9ca0b0;
    --text-dark: #acb0be;
    --accent: #1e66f5;
    --accent-sec: #7287fd;
    --border: #bcc0cc;
    --highlight: #ccd0da;
    --cursor: #dc8a78;
    --status-bg: #1e66f5;
    --status-fg: #eff1f5;
}

*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
}

* {
    box-sizing: border-box;
    /* outline: none; */
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
    font-family: var(--font-ui);
    display: flex;
    flex-direction: column;
    font-size: 13px;
    letter-spacing: -0.01em;
    transition: background 0.2s, color 0.2s;
}

::selection {
    background: rgba(137, 180, 250, 0.3);
    color: var(--text);
}

::-moz-selection {
    background: rgba(137, 180, 250, 0.3);
    color: var(--text);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--highlight) transparent;
}

/* Dragging state */
body.resizing,
body.resizing * {
    cursor: col-resize !important;
    user-select: none !important;
}

body.resizing iframe {
    pointer-events: none;
}

body.dragging-preview,
body.dragging-preview * {
    cursor: move !important;
    user-select: none !important;
}

body.dragging-preview iframe {
    pointer-events: none;
}

body.drag-over::after {
    content: 'DROP FILE TO OPEN';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-weight: 800;
    font-size: 24px;
    z-index: 999;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

svg.icon {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

button > svg {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

button:hover svg.icon,
button:hover > svg {
    transform: scale(1.1);
}

button:active svg.icon,
button:active > svg {
    transform: scale(0.95);
}

/* --- Layout --- */
#app-shell {
    display: flex;
    flex: 1;
    overflow: hidden;
}

aside {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 10;
    flex-shrink: 0;
    transition: margin-left 0.2s cubic-bezier(0.4, 0, 0.2, 1), margin-right 0.2s;
}

#sidebar-left {
    width: var(--sidebar-w);
    overflow-y: auto;
    overflow-x: hidden;
}

#sidebar-left.collapsed {
    margin-left: calc(var(--sidebar-w) * -1);
}

#sidebar-right {
    width: var(--outline-w);
    border-right: none;
    border-left: 1px solid var(--border);
    transition: margin-right 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#sidebar-right.collapsed {
    margin-right: calc(var(--outline-w) * -1);
}

/* Sidebar Sections */
.sidebar-section {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Workspace section takes most space */
#section-workspace {
    flex: 1 1 auto;
    min-height: 80px;
}

/* OPFS and System sections are fixed-ish but can grow */
#section-opfs,
#section-system {
    flex: 0 1 auto;
    max-height: 35%;
}

/* When collapsed, section shrinks to just header */
.sidebar-section.collapsed {
    flex: 0 0 auto !important;
    min-height: 0 !important;
    max-height: none !important;
}

.sidebar-section.collapsed .section-content {
    display: none !important;
}

.sidebar-section.collapsed .tree-search-container {
    display: none !important;
}

.sidebar-section.collapsed .project-bar {
    display: none !important;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.section-chevron {
    display: inline-block;
    width: 12px;
    height: 12px;
    transition: transform 0.15s ease;
}

.section-chevron::before {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-left: 5px solid currentColor;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    margin-left: 2px;
}

.sidebar-section:not(.collapsed) .section-chevron {
    transform: rotate(90deg);
}

.section-actions {
    display: flex;
    gap: 2px;
}

.section-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.side-header {
    flex-shrink: 0;
    padding: 0 12px 0 8px;
    font-weight: 700;
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 32px;
    transition: color 0.15s;
    cursor: pointer;
}

.side-header:hover {
    color: var(--text-dark);
}

.file-tree {
    overflow-y: auto;
    padding: 4px 0;
}

/* When file-tree is also section-content, the section-content rules apply */
.file-tree.section-content {
    flex: 1 1 auto;
    min-height: 0;
}

.tree-search-container {
    flex-shrink: 0;
    padding: 4px 8px 6px;
    background: var(--sidebar-bg);
}

.tree-search-container.collapsed {
    display: none;
}

.tree-search {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-family: var(--font-ui);
    transition: all 0.15s;
}

.tree-search::placeholder {
    color: var(--text-dark);
}

.tree-search:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(137, 180, 250, 0.05);
    box-shadow: 0 0 8px rgba(137, 180, 250, 0.1);
}

/* Project bar in OPFS section */
.project-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    min-height: 28px;
}

.project-bar .project-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background 0.15s;
}

.project-bar .project-name:hover {
    background: var(--highlight);
}

.project-bar .project-name.no-project {
    color: var(--text-dim);
    font-weight: 400;
    font-style: italic;
    cursor: default;
}

.project-bar .project-name.no-project:hover {
    background: transparent;
}

.project-bar .project-actions {
    display: flex;
    gap: 2px;
}

.project-bar .project-actions .btn {
    width: 22px;
    height: 22px;
    padding: 0;
}

.tree-item {
    padding: 4px 16px;
    font-size: 13px;
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    height: 26px;
    margin: 0 8px;
    border-radius: 6px;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    contain: layout style paint;
    user-select: none;
    -webkit-user-select: none;
}

.tree-item-content {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.tree-item .tree-actions {
    margin-left: auto;
}

.tree-item.is-directory {
    font-weight: 500;
}

.tree-item.is-file {
    padding-left: 32px;
}

.tree-item-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-right: 4px;
    margin-left: -16px;
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    flex-shrink: 0;
}

.tree-item.collapsed .tree-item-toggle {
    transform: rotate(-90deg);
}

.tree-item.hidden {
    display: none;
}

.tree-item.hidden-by-parent {
    display: none;
}

/* Tree structure styling */
.tree-item[style*="paddingLeft"] ~ .tree-item[style*="paddingLeft"] {
    /* Child items styling is handled by level */
}

.tree-item-content {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.tree-item-label {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-ui);
    transition: all 0.15s;
}

.tree-item:hover .tree-item-label,
.tree-item:hover .tree-item-content {
    transform: translateX(2px);
}

.tree-item:hover {
    background: rgba(137, 180, 250, 0.12);
    color: var(--text);
    padding-left: 20px;
}

.tree-item.active {
    background: rgba(137, 180, 250, 0.15);
    border-left: 3px solid var(--accent);
    color: var(--accent);
    font-weight: 500;
    padding-left: 15px;
}

/* Symbol List Styling */
.symbol-item {
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-left: 2px solid transparent;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    contain: layout style paint;
}

.symbol-item:hover {
    color: var(--text);
    background: rgba(137, 180, 250, 0.1);
    border-left-color: var(--accent);
    padding-left: 16px;
}

.symbol-kind {
    opacity: 0.5;
    font-size: 10px;
    width: 14px;
    text-align: center;
}

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

.tree-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.tree-item:hover .tree-actions {
    opacity: 1;
}

.action-btn {
    padding: 4px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    opacity: 0.6;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
    opacity: 1;
    transform: scale(1.1);
}

.action-btn:active {
    transform: scale(0.95);
}

.action-delete:hover {
    background: rgba(255, 100, 100, 0.2);
    color: rgb(255, 136, 136);
    opacity: 1;
}

/* Main file toggle */
.action-main {
    color: var(--text-dim);
}

.action-main:hover {
    background: rgba(250, 200, 100, 0.2);
    color: rgb(250, 200, 100);
}

.action-main.is-main {
    color: rgb(250, 200, 100);
    opacity: 1;
}

/* Always show the main file toggle when it's set */
.tree-item.is-main-file .action-main {
    opacity: 1;
}

.tree-item.is-main-file > .tree-item-content {
    color: var(--accent);
    font-weight: 500;
}

.reconnect-btn {
    margin: 10px 16px;
    padding: 10px 12px;
    background: rgba(137, 180, 250, 0.12);
    border: 1px solid rgba(137, 180, 250, 0.3);
    color: var(--accent);
    text-align: center;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.reconnect-btn:hover {
    background: rgba(137, 180, 250, 0.2);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 12px rgba(137, 180, 250, 0.15);
    transform: translateY(-1px);
}

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

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
    background: var(--bg);
}

/* Tabs */
#tabs-scroll {
    height: var(--tab-h);
    background: var(--header-bg);
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 1px;
    padding: 0;
}

#tabs-scroll::-webkit-scrollbar {
    display: none;
}

.tab {
    height: 100%;
    padding: 0 12px;
    display: flex;
    align-items: center;
    color: var(--text-dim);
    font-size: 12px;
    cursor: pointer;
    min-width: 100px;
    max-width: 200px;
    position: relative;
    background: transparent;
    gap: 6px;
    border-right: 1px solid var(--border);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-ui);
    border-top: 2px solid transparent;
    contain: layout style paint;
}

.tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 12px;
    right: 12px;
    height: 1px;
    background: linear-gradient(90deg, transparent, currentColor, transparent);
    opacity: 0;
    transition: opacity 0.15s;
}

.tab:hover {
    background: var(--highlight);
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.tab.active {
    background: var(--bg);
    color: var(--accent);
    border-top: 2px solid var(--accent);
    font-weight: 500;
    box-shadow: inset 0 -2px 0 rgba(137, 180, 250, 0.3);
}

.tab.active::after {
    opacity: 1;
}

.tab-close {
    opacity: 0;
    padding: 2px;
    font-size: 14px;
    margin-left: 8px;
    line-height: 1;
    border-radius: 4px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.tab:hover .tab-close,
.tab.active .tab-close {
    opacity: 0.6;
}

.tab-close:hover {
    background: rgba(255, 100, 100, 0.2);
    color: rgb(255, 136, 136);
    opacity: 1 !important;
    transform: scale(1.1);
}

.tab-close:active {
    transform: scale(0.95);
}

/* Tab filename */
.tab-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Dirty/Unsaved Indicator */
.unsaved-dot {
    width: 8px;
    height: 8px;
    background: var(--text-dim);
    border-radius: 50%;
    display: none;
    flex-shrink: 0;
    animation: dirty-pulse 2s ease-in-out infinite;
}

@keyframes dirty-pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* When dirty: show dot, hide close */
.tab.dirty .unsaved-dot {
    display: block;
}

.tab.dirty .tab-close {
    display: none;
}

/* On hover: hide dot, show close */
.tab.dirty:hover .unsaved-dot {
    display: none;
}

.tab.dirty:hover .tab-close {
    display: flex;
}

/* Active tab: accent color for dot */
.tab.active .unsaved-dot {
    background: var(--accent);
}

/* Tab type badges */
.tab-badge {
    font-size: 8px;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
    vertical-align: middle;
    opacity: 0.8;
}

.tab-badge-opfs {
    background: #89b4fa20;
    color: #89b4fa;
}

.tab-badge-disk {
    background: #a6e3a120;
    color: #a6e3a1;
}

.tab-badge-memory {
    background: #f9e2af20;
    color: #f9e2af;
}

.tab-badge-config {
    background: #cba6f720;
    color: #cba6f7;
}

.tab-badge-system {
    background: #94e2d520;
    color: #94e2d5;
}

.tab-lock {
    font-size: 9px;
    margin-left: 3px;
    opacity: 0.6;
}

.tab-readonly .tab-name {
    opacity: 0.7;
}

/* Make dirty tabs more noticeable */
.tab.dirty {
    font-style: italic;
}

.tab.dirty::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--text-dim);
    opacity: 0.5;
}

.tab.dirty.active::before {
    background: var(--accent);
    opacity: 0.8;
}

.breadcrumbs {
    height: 28px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 8px;
    font-size: 11px;
    color: var(--text-dark);
}

#editor-row {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

#editor-split {
    flex: 1;
    display: flex;
    position: relative;
    min-width: 0;
}

#code-stage {
    flex: 1;
    position: relative;
}

/* Preview Pane Styles */
#preview-pane {
    background: var(--bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid var(--border);
    /* Defaults for split mode handled by JS/CSS classes */
}

#preview-frame {
    flex: 1;
    border: none;
    background: var(--bg);
}

/* Split Mode (Default) */
#editor-split:not(.mode-float) #preview-pane {
    width: 0;
    transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
}

.preview-active #editor-split:not(.mode-float) #preview-pane {
    width: 50%;
}

/* Float Mode */
#editor-split.mode-float #preview-pane {
    position: absolute;
    width: 400px;
    height: 300px;
    top: 20px;
    right: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    border-radius: 8px;
    z-index: 100;
    display: none;
}

.preview-active #editor-split.mode-float #preview-pane {
    display: flex;
}

.preview-header {
    height: 28px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    cursor: default;
}

/* Only draggable header in float mode */
#editor-split.mode-float .preview-header {
    cursor: move;
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
    flex: 1;
}

/* Resize Handles */
#resizer {
    width: 6px;
    background: transparent;
    cursor: col-resize;
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    z-index: 50;
    display: none;
    transition: background 0.2s;
}

#resizer:hover,
#resizer.active {
    background: var(--accent);
}

.preview-active #editor-split:not(.mode-float) #resizer {
    display: block;
}

#float-resizer {
    width: 16px;
    height: 16px;
    position: absolute;
    bottom: 0;
    right: 0;
    cursor: se-resize;
    z-index: 101;
    display: none;
    background: transparent;
    opacity: 0.7;
    border-bottom-right-radius: 7px;
}

/* Resize grip dots */
#float-resizer::before {
    content: '';
    position: absolute;
    bottom: 3px;
    right: 3px;
    width: 8px;
    height: 8px;
    background-image: radial-gradient(circle, var(--text-dim) 1.5px, transparent 1.5px);
    background-size: 4px 4px;
    background-position: bottom right;
}

#editor-split.mode-float #float-resizer {
    display: block;
}

#float-resizer:hover,
.resizing-float #float-resizer {
    opacity: 1;
}

#float-resizer:hover::before,
.resizing-float #float-resizer::before {
    background-image: radial-gradient(circle, var(--accent) 1.5px, transparent 1.5px);
}

/* Cursor lock during float resize */
body.resizing-float,
body.resizing-float * {
    cursor: se-resize !important;
    user-select: none !important;
}

body.resizing-float iframe {
    pointer-events: none;
}

header {
    height: var(--header-h);
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 12px;
}

.logo {
    font-weight: 800;
    color: var(--accent);
    font-size: 14px;
    margin-right: 12px;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.theme-swatches {
    display: flex;
    gap: 6px;
    margin-right: 12px;
}

.theme-swatch {
    width: 12px;
    height: 12px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-swatch:hover {
    transform: scale(1.15);
    border-color: var(--text);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
}

.swatch-latte {
    background: #eff1f5;
}

.swatch-frappe {
    background: #303446;
}

.swatch-macchiato {
    background: #24273a;
}

.swatch-mocha {
    background: #1e1e2e;
}

/* New Footer Style */
footer {
    height: var(--footer-h);
    background: var(--header-bg);
    border-top: 2px solid var(--accent);
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    font-size: 11px;
    font-weight: 500;
    user-select: none;
    z-index: 50;
    position: relative;
}

.stat-group {
    display: flex;
    height: 100%;
    gap: 16px;
    align-items: center;
}

.stat-box {
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.8;
    transition: all 0.15s;
}

.stat-box:hover {
    opacity: 1;
    color: var(--text);
    transform: translateY(-1px);
}

.stat-highlight {
    color: var(--accent);
    font-weight: 700;
    transition: color 0.15s;
}

.btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-dim);
    padding: 4px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.1), transparent 60%);
    opacity: 0;
    transition: opacity 0.15s;
}

.btn:hover {
    background: var(--highlight);
    color: var(--text);
    box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.05);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
    box-shadow: inset 0 0 4px rgba(255, 255, 255, 0.03);
}

.btn.primary {
    color: var(--accent);
    background: rgba(137, 180, 250, 0.15);
    border: 1px solid rgba(137, 180, 250, 0.25);
}

.btn.primary:hover {
    background: rgba(137, 180, 250, 0.25);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 16px rgba(137, 180, 250, 0.2), inset 0 0 8px rgba(255, 255, 255, 0.05);
    transform: translateY(-1px);
}

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

.overlay-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
    backdrop-filter: blur(6px);
    animation: fadeIn 0.3s; 
}

@keyframes fadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(6px);
    }
}

.dialog {
    background: var(--bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: 480px;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    animation: dialogSlideIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dialogSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
        filter: blur(2px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.dialog input {
    background: var(--header-bg);
    border: 1px solid transparent;
    color: var(--text);
    padding: 14px 20px;
    font-size: 14px;
    width: 100%;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-code);
    transition: all 0.15s;
}

.dialog input:focus {
    background: rgba(255, 255, 255, 0.05);
    outline: none;
    border-bottom-color: var(--accent);
}

.dialog input::placeholder {
    color: var(--text-dark);
}

/* Template list styles for new file dialog */
.template-list {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--header-bg);
}

.template-hint {
    padding: 16px;
    text-align: center;
    color: var(--text-dark);
    font-size: 12px;
    font-style: italic;
}

.template-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dim);
    transition: all 0.15s;
    border-bottom: 1px solid var(--border);
}

.template-item:last-child {
    border-bottom: none;
}

.template-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.template-item.selected {
    background: var(--accent);
    color: var(--status-fg);
}

.template-item.selected .template-ext {
    color: var(--status-fg);
    opacity: 0.7;
}

.template-name {
    font-weight: 500;
}

.template-ext {
    font-size: 11px;
    color: var(--text-dark);
    font-family: var(--font-code);
}

.template-actions {
    margin-left: auto;
    opacity: 0;
    transition: opacity 0.15s;
}

.template-item:hover .template-actions {
    opacity: 1;
}

.template-edit-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    font-size: 12px;
    border-radius: 3px;
    transition: all 0.15s;
}

.template-edit-btn:hover {
    background: var(--accent);
    color: var(--bg);
}

.template-item.selected .template-actions {
    opacity: 1;
}

.template-item.selected .template-edit-btn {
    color: var(--status-fg);
}

.template-item.selected .template-edit-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--status-fg);
}

.cmd-item {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-dim);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.cmd-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent);
    transform: scaleY(0);
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cmd-item:hover,
.cmd-item.selected {
    background: var(--highlight);
    color: var(--accent);
    padding-left: 24px;
}

.cmd-item.selected::before {
    transform: scaleY(1);
}

.cmd-shortcut {
    font-size: 11px;
    opacity: 0.5;
    font-family: var(--font-ui);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.15s;
}

.cmd-item:hover .cmd-shortcut,
.cmd-item.selected .cmd-shortcut {
    background: rgba(137, 180, 250, 0.15);
    border-color: rgba(137, 180, 250, 0.3);
    opacity: 0.8;
}

#toast {
    position: fixed;
    bottom: 36px;
    right: 20px;
    background: var(--sidebar-bg);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 3px solid var(--accent);
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateY(20px) scale(0.9);
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 200;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 1px rgba(255, 255, 255, 0.1);
}

#toast.visible {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

#toast svg {
    color: var(--accent);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#toast.visible svg {
    animation: toastIconBounce 0.5s;
}

@keyframes toastIconBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

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

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 5px;
    border: 2px solid var(--bg);
    transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

::-webkit-scrollbar-track {
    background: transparent;
}

/* Ace Tweaks */
.ace_editor {
    font-family: var(--font-code) !important;
    line-height: 1.6 !important;
}

.ace_gutter {
    background: var(--bg) !important;
    color: var(--text-dark) !important;
    border-right: 1px solid var(--border);
}

.ace_content {
    background: var(--bg) !important;
}

.ace_active-line {
    background: rgba(255, 255, 255, 0.03) !important;
}

.ace_gutter-active-line {
    background: rgba(255, 255, 255, 0.03) !important;
}

/* Outline styles */
.outline-search {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--sidebar-bg);
}

.outline-search input {
    flex: 1;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 12px;
    transition: all 0.15s;
}

.outline-search input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(137, 180, 250, 0.05);
    box-shadow: 0 0 12px rgba(137, 180, 250, 0.1);
}

.symbol-group {
    border-top: 1px solid transparent;
}

.symbol-group .group-header {
    display:flex; align-items:center; justify-content:space-between; padding:6px 12px; cursor: pointer; color:var(--text-dim); font-weight:700; font-size:12px;
}

.symbol-group.collapsed .group-items { display: none; }

.symbol-item { padding: 6px 12px; font-size:12px; color:var(--text-dim); display:flex; gap:8px; align-items:center; }

.symbol-item:hover { background: var(--highlight); color: var(--text); }

.symbol-kind { width:18px; text-align:center; opacity:0.8; font-size:11px; }

.symbol-line { margin-left:auto; opacity:0.6; font-size:11px; }

/* Console collapse styles */
#console-pane {
    transition: height 0.18s ease, opacity 0.18s ease;
}

#console-pane.collapsed {
    height: 34px !important;
}
