@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500&family=DM+Sans:wght@300;400;500&display=swap');

:root {
    /* Surfaces — very dark, slightly warm */
    --bg-0: #0b0c0e;
    --bg-1: #0f1114;
    --bg-2: #141619;
    --bg-3: #191c20;
    --bg-4: #1e2126;

    /* Borders — subtle */
    --ln-0: #1a1c20;
    --ln-1: #212429;
    --ln-2: #292d34;

    /* Text */
    --t-hi: #dde0e8;
    --t-mid: #7a7f8e;
    --t-lo: #3e4252;
    --t-faint: #252830;

    /* Accent — muted warm amber, not bright */
    --a: #e09c4a;
    --a-soft: rgba(224, 156, 74, 0.08);
    --a-glow: rgba(224, 156, 74, 0.12);
    --a-line: rgba(224, 156, 74, 0.3);

    /* Status */
    --ok: #6db88a;
    --err: #d97070;
    --s: #6b9fd4;

    --r: 5px;
    --mono: 'JetBrains Mono', monospace;
    --ui: 'DM Sans', sans-serif;
}

/* IDE THEME OVERRIDES */
#ideView {
    --bg-0: #0A0F17; /* Dark Slate Background */
    --bg-1: #0A0F17; /* Sidebar */
    --bg-2: #0A0F17; /* Panels/Header */
    --a: #D89B45;    /* Accent */
    --t-hi: #D6DEEB; /* Main Text */
    --ln-1: #161c27;
    --ln-0: #0e141d;
}

#ideView .topbar { background: var(--bg-0); border-bottom: 1px solid var(--ln-1); }
#ideView .sidebar { background: var(--bg-0); border-right: 1px solid var(--ln-1); }
#ideView .main-area { background: var(--bg-0); }
#ideView .terminal-panel { background: var(--bg-0); border-top: 1px solid var(--ln-1); }
#ideView .terminal-header { background: #0a0a0a; border-bottom: 1px solid var(--ln-0); color: var(--t-lo); font-weight: 400; }
#ideView .sidebar-header { background: #0a0a0a; color: var(--t-lo); font-weight: 400; border-bottom: 1px solid var(--ln-0); }
#ideView .sidebar-search { background: var(--bg-0); border-bottom: 1px solid var(--ln-0); }
#ideView .file-search-input { background: #0a0a0a; border-color: var(--ln-1); }
#ideView .topbar-sep { background: var(--ln-1); }
#ideView .resizer { background: var(--ln-1); }

/* CodeMirror Syntax Highlighting Overrides */
#ideView .CodeMirror { background: var(--bg-0) !important; color: var(--t-hi) !important; font-family: var(--mono); }
#ideView .CodeMirror-gutters { background: var(--bg-0) !important; border-right: 1px solid var(--ln-1) !important; }
#ideView .CodeMirror-linenumber { color: #4b5563 !important; }
#ideView .CodeMirror-activeline-background { background: rgba(255, 255, 255, 0.035) !important; }
#ideView .CodeMirror-cursor { border-left: 2px solid var(--a) !important; }

/* Enhanced Selection Visibility */
#ideView .CodeMirror-selected { background: rgba(216, 155, 69, 0.35) !important; }
#ideView .CodeMirror-focused .CodeMirror-selected { background: rgba(216, 155, 69, 0.45) !important; }
#ideView .CodeMirror-line::selection, #ideView .CodeMirror-line > span::selection, #ideView .CodeMirror-line > span > span::selection { background: rgba(216, 155, 69, 0.4) !important; }

/* Active File Premium Highlight */
#ideView .tree-item.active {
    background: rgba(216, 155, 69, 0.12) !important;
    color: var(--t-hi) !important;
    border-left: 2px solid var(--a) !important;
    box-shadow: inset 4px 0 10px rgba(216, 155, 69, 0.05);
}
#ideView .tree-item.active .tree-icon {
    filter: drop-shadow(0 0 5px var(--a));
    opacity: 1;
}
#ideView .cm-keyword { color: #C792EA !important; font-weight: 500; }
#ideView .cm-def, #ideView .cm-function, #ideView .cm-variable-2 { color: #82AAFF !important; }
#ideView .cm-string { color: #C3E88D !important; }
#ideView .cm-number { color: #F78C6C !important; }
#ideView .cm-operator { color: var(--a) !important; }
#ideView .cm-variable, #ideView .cm-property { color: var(--t-hi); }
#ideView .cm-header { color: #ffcb6b; }
#ideView .cm-tag { color: #f07178; }
#ideView .cm-attribute { color: #c792ea; }
#ideView .cm-meta { color: #80cbc4; }
#ideView .cm-bracket { color: var(--t-hi); }

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

html,
body {
    height: 100%;
    background: var(--bg-0);
    color: var(--t-mid);
    font-family: var(--ui);
    font-size: 12px;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

.hidden {
    display: none !important;
}

.m-r-5 {
    margin-right: 5px;
}

.mobile-only {
    display: none !important;
}

/* ══════════════════════════════
   UPLOAD VIEW
══════════════════════════════ */
.view {
    height: 100vh;
    width: 100vw;
}

#uploadView {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: var(--bg-0);
    overflow: hidden;
}

/* very faint grid */
#uploadView::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--ln-0) 1px, transparent 1px),
        linear-gradient(90deg, var(--ln-0) 1px, transparent 1px);
    background-size: 56px 56px;
    opacity: 0.4;
    pointer-events: none;
}

/* soft amber radial from top */
#uploadView::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 45% at 50% -10%, rgba(224, 156, 74, 0.055) 0%, transparent 70%);
    pointer-events: none;
}

/* ── Upload container ── */
.upload-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    padding: 0 16px;
    animation: fadeUp 0.45s ease forwards;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Header ── */
.upload-header {
    text-align: center;
    margin-bottom: 22px;
}

.brand-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-2);
    border: 1px solid var(--ln-2);
    border-radius: 20px;
    padding: 4px 12px;
    margin-bottom: 16px;
}

.brand-tag .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--a);
    opacity: 0.8;
    animation: softpulse 3s ease-in-out infinite;
}

@keyframes softpulse {

    0%,
    100% {
        opacity: 0.8;
    }

    50% {
        opacity: 0.3;
    }
}

.brand-tag span {
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--t-lo);
}

.upload-header h1 {
    font-family: var(--ui);
    font-size: 28px;
    font-weight: 300;
    letter-spacing: -0.01em;
    color: var(--t-hi);
    line-height: 1.2;
}

.upload-header h1 strong {
    font-weight: 500;
    color: var(--t-hi);
}

.upload-header h1 em {
    font-style: normal;
    font-weight: 400;
    color: var(--a);
}

.upload-header .modal-content.error p { margin-top: 10px; opacity: 0.8; font-size: 14px; }



.upload-header .tagline {
    margin-top: 8px;
    color: var(--t-lo);
    line-height: 1.6;
    font-weight: 300;
}

/* ── Card ── */
.upload-card {
    background: var(--bg-1);
    border: 1px solid var(--ln-1);
    border-radius: 8px;
    overflow: hidden;
}

.upload-card-bar {
    height: 1px;
    background: linear-gradient(90deg, transparent 10%, var(--a-line) 50%, transparent 90%);
}

.upload-section {
    padding: 36px 28px;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s;
}

.upload-section:hover {
    background: var(--bg-2);
}

.upload-section.dragover {
    background: var(--a-soft);
    border: 1px dashed var(--a-line);
}

.upload-icon {
    color: var(--a);
    opacity: 0.55;
    margin-bottom: 14px;
}

.upload-section h2 {
    font-size: 14px;
    font-weight: 500;
    color: var(--t-hi);
    margin-bottom: 5px;
    letter-spacing: 0.01em;
}

.upload-section p {
    font-size: 11px;
    color: var(--t-lo);
    margin-bottom: 20px;
    line-height: 1.6;
    font-weight: 300;
}

/* ── Stats strip ── */
.upload-stats {
    display: flex;
    border-top: 1px solid var(--ln-0);
}

.stat-item {
    flex: 1;
    padding: 10px 0;
    text-align: center;
    border-right: 1px solid var(--ln-0);
}

.stat-item:last-child {
    border-right: none;
}

.stat-item .val {
    display: block;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--a);
    opacity: 0.8;
    line-height: 1;
}

.stat-item .lbl {
    display: block;
    font-size: 9px;
    color: var(--t-lo);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 3px;
    font-weight: 300;
}

/* Loader */
.uploading-state {
    padding: 28px;
    text-align: center;
}

.loader {
    width: 20px;
    height: 20px;
    border: 1.5px solid var(--ln-2);
    border-top-color: var(--a);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 10px;
    opacity: 0.8;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

.uploading-state p {
    font-size: 10px;
    color: var(--t-lo);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 300;
}

/* ── Buttons ── */
.btn {
    padding: 10px 22px;
    border-radius: 8px;
    border: 1px solid var(--ln-2);
    font-family: var(--ui);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--bg-3);
    color: var(--t-mid);
    position: relative;
    overflow: hidden;
}

.btn:hover {
    background: var(--bg-4);
    color: var(--t-hi);
    border-color: var(--t-lo);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.btn.primary {
    background: var(--a);
    border-color: var(--a);
    color: #0b0c0e;
}

.btn.primary:hover {
    background: #f0ab5a;
    border-color: #f0ab5a;
    box-shadow: 0 0 20px rgba(224, 156, 74, 0.25);
}

.btn.primary::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    transition: 0.5s;
    pointer-events: none;
    opacity: 0;
}

.btn.primary:hover::after {
    left: 100%;
    opacity: 1;
}

.btn.accent {
    background: var(--a-soft);
    border-color: var(--a-line);
    color: var(--a);
}

.btn.accent:hover {
    background: rgba(224, 156, 74, 0.13);
    border-color: var(--a);
}

.btn.success {
    background: var(--a-soft);
    border-color: var(--a-line);
    color: var(--a);
}

.btn.success:hover {
    background: rgba(224, 156, 74, 0.13);
    border-color: var(--a);
}

.btn.shrink {
    padding: 5px 11px;
    font-size: 11px;
}

.btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* logo icon */
.logo-icon {
    width: 44px;
    height: 44px;
    background: var(--a-soft);
    border: 1px solid var(--a-line);
    border-radius: var(--r);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 500;
    color: var(--a);
    margin: 0 auto 14px;
    font-family: var(--mono);
    opacity: 0.9;
}

/* ══════════════════════════════
   IDE VIEW
══════════════════════════════ */
#ideView {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--bg-0);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* ── Topbar ── */
.topbar {
    height: 38px;
    min-height: 38px;
    background: var(--bg-1);
    border-bottom: 1px solid var(--ln-1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 14px;
    gap: 12px;
    position: relative;
}

/* thin amber left edge */
.topbar::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 2px;
    height: 100%;
    background: var(--a);
    opacity: 0.5;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.logo-icon.small {
    width: 22px;
    height: 22px;
    font-size: 10px;
    border-radius: 3px;
    flex-shrink: 0;
    margin: 0;
    opacity: 0.85;
}

.topbar-sep {
    width: 1px;
    height: 14px;
    background: var(--ln-1);
    flex-shrink: 0;
}

.project-name {
    font-size: 11px;
    font-weight: 400;
    color: var(--t-lo);
    letter-spacing: 0.04em;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    background: rgba(22, 22, 24, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 6px;
    min-width: 220px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    z-index: 500;
    transform-origin: top right;
    animation: dropIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes dropIn {
    0% {
        opacity: 0;
        transform: scale(0.95) translateY(-8px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.dropdown-header {
    padding: 12px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.dh-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--t-lo);
    font-weight: 600;
}

.dh-subtitle {
    font-size: 11px;
    color: var(--t-mid);
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
    margin: 6px 8px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.logout-btn {
    color: var(--t-hi);
}

.logout-btn:hover {
    background: rgba(255, 80, 80, 0.12);
}

.logout-btn:hover .di-icon {
    color: #ff5e5e;
    transform: translateX(3px);
}

.logout-btn:hover .di-main {
    color: #ff5e5e;
}

.di-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--t-mid);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.di-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.di-main {
    font-size: 13px;
    font-weight: 500;
    transition: color 0.2s;
}

.di-sub {
    font-size: 11px;
    color: var(--t-lo);
}

.topbar-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    overflow: hidden;
}

#currentFileName {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--t-mid);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 360px;
}

#unsavedIndicator {
    color: var(--a);
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0.7;
}

/* ── Tabs Bar ── */
.tabs-bar {
    height: 35px;
    background: var(--bg-0);
    border-bottom: 1px solid var(--ln-1);
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none; /* Hide scrollbar for Firefox */
}
.tabs-bar::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Chrome/Safari */
}

.ide-tab {
    height: 100%;
    min-width: 120px;
    max-width: 220px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-right: 1px solid var(--ln-1);
    background: var(--bg-0);
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background 0.2s;
}

.ide-tab:hover {
    background: rgba(255,255,255,0.02);
}

.ide-tab.active {
    background: #121822;
}

.ide-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--a);
}

.tab-icon {
    display: flex;
    align-items: center;
    opacity: 0.7;
}

.tab-name {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--t-mid);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.ide-tab.active .tab-name {
    color: var(--t-hi);
}

.tab-close {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    opacity: 0.3;
    transition: all 0.2s;
    color: var(--t-hi);
}

.tab-close:hover {
    background: rgba(255,255,255,0.1);
    opacity: 1;
}

.tab-unsaved {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--a);
    flex-shrink: 0;
}

.topbar-right {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ── IDE Layout ── */
.ide-container {
    display: flex;
    flex: 1;
    height: calc(100vh - 38px);
    overflow: hidden;
    position: relative;
}

/* ── Sidebar ── */
.sidebar-overlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 99;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0);
    transition: background 0.3s, backdrop-filter 0.3s;
}

.sidebar-overlay.active {
    display: block;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}

.sidebar {
    width: 228px;
    min-width: 228px;
    background: var(--bg-1);
    border-right: 1px solid var(--ln-1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 100;
    transition: margin-left 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s;
}

.sidebar.desktop-closed {
    margin-left: -228px;
    border-right-color: transparent;
}

.sidebar.focused {
    outline: 1.5px solid #007fd4 !important;
    outline-offset: -1.5px;
}

.sidebar-header {
    padding: 0 12px;
    height: 30px;
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 400;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--t-lo);
    border-bottom: 1px solid var(--ln-0);
    flex-shrink: 0;
}

.sidebar-header::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--a);
    opacity: 0.6;
    flex-shrink: 0;
}

.sidebar-search {
    padding: 6px 8px;
    border-bottom: 1px solid var(--ln-0);
    flex-shrink: 0;
}

.file-search-input {
    width: 100%;
    padding: 5px 8px;
    background: var(--bg-0);
    border: 1px solid var(--ln-1);
    color: var(--t-mid);
    border-radius: var(--r);
    font-size: 11px;
    font-family: var(--mono);
    outline: none;
    transition: border-color 0.15s;
    font-weight: 300;
}

.file-search-input::placeholder {
    color: var(--t-faint);
}

.file-search-input:focus {
    border-color: rgba(224, 156, 74, 0.4);
}

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

#ideView .terminal-header .tab {
    color: var(--t-lo);
    border-right: 1px solid var(--ln-1);
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.1em;
}
#ideView .terminal-header .tab.active {
    background: #0a0a0a;
    color: var(--a);
}

.tree-item {
    padding: 4px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--t-mid);
    user-select: none;
    position: relative;
    transition: background 0.12s, color 0.12s;
    font-weight: 300;
}

.tree-item:hover {
    background: var(--bg-3);
    color: var(--t-hi);
}

.tree-item.active {
    background: var(--a-soft);
    color: var(--t-hi);
}

.tree-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--a);
    opacity: 0.7;
}

.tree-icon {
    font-size: 12px;
    opacity: 0.7;
}

.folder-icon {
    display: flex;
    align-items: center;
    opacity: 0.8;
    margin-left: -4px;
}

.folder-svg {
    color: #b08040;
}

.chevron {
    transition: transform 0.18s;
    opacity: 0.4;
}

.folder-children {
    display: block;
}

/* ── Main ── */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-0);
}

.editor-container {
    flex: 1;
    min-height: 0;
    position: relative;
}

/* ── Resizer ── */
.resizer {
    height: 3px;
    background: var(--ln-0);
    cursor: row-resize;
    flex-shrink: 0;
    transition: background 0.15s;
}

.resizer:hover,
.resizer:active {
    background: rgba(224, 156, 74, 0.35);
}

/* ── Terminal ── */
.terminal-panel {
    height: 200px;
    min-height: 80px;
    background: var(--bg-1);
    border-top: 1px solid var(--ln-1);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.terminal-panel.hidden {
    display: none !important;
}

.terminal-header {
    height: 30px;
    min-height: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--ln-0);
    padding: 0 12px;
    flex-shrink: 0;
}

.tabs {
    display: flex;
    height: 100%;
    align-items: flex-end;
}

.tab {
    padding: 0 10px;
    height: 100%;
    display: flex;
    align-items: center;
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--t-lo);
    cursor: pointer;
    border-bottom: 1px solid transparent;
}

.tab.active {
    color: var(--t-mid);
    border-bottom-color: rgba(224, 156, 74, 0.5);
}

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

.btn-icon {
    background: none;
    border: none;
    color: var(--t-lo);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 2px;
    border-radius: 3px;
    transition: color 0.15s;
}

.btn-icon:hover {
    color: var(--err);
}

.download-amx {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--a);
    text-decoration: none;
    opacity: 0.8;
    padding: 3px 8px;
    border: 1px solid var(--a-line);
    border-radius: var(--r);
    transition: all 0.15s;
}

.download-amx:hover {
    opacity: 1;
    border-color: var(--a);
}

.terminal-content {
    flex: 1;
    padding: 10px 14px;
    overflow-y: auto;
    font-family: var(--mono);
    font-size: 11.5px;
    line-height: 1.7;
    color: var(--t-mid);
    white-space: pre-wrap;
    word-break: break-word;
    font-weight: 300;
}

.terminal-content .error {
    color: var(--err);
}

.terminal-content .success {
    color: var(--ok);
}

.terminal-content .info {
    color: var(--s);
}

/* ── Modal ── */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-content {
    background: var(--bg-2);
    border: 1px solid var(--ln-2);
    border-radius: 8px;
    width: 420px;
    max-height: 80vh;
    padding: 22px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    font-size: 14px;
    font-weight: 500;
    color: var(--t-hi);
    margin-bottom: 6px;
}

.modal-content p {
    font-size: 13px;
    color: var(--t-hi);
    margin-bottom: 14px;
    line-height: 1.5;
    font-weight: 400;
}

.modal-tree {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-0);
    min-height: 220px;
    max-height: 360px;
    border: 1px solid var(--ln-1);
    border-radius: var(--r);
    padding: 6px 0;
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.modal-actions button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--ln-2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--t-lo);
}

/* Bigger scrollbar inside CodeMirror on mobile */
@media (max-width: 900px) {
    .CodeMirror-scroll::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }
    .CodeMirror-scroll::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,0.2);
        border-radius: 6px;
    }
}
/* ── CodeMirror Overrides ── */
.CodeMirror {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100% !important;
    font-family: var(--mono);
    font-size: 14px;
    background: var(--bg-1) !important;
}

.CodeMirror-scroll {
    height: 100%;
}

@media (max-width: 900px) {
    .CodeMirror {
        font-size: 15px;
    }
}

.CodeMirror-gutters {
    background: var(--bg-1) !important;
    border-right: 1px solid var(--ln-1) !important;
    z-index: 3;
    will-change: left;
}

.cm-s-material-darker.CodeMirror {
    background-color: var(--bg-1) !important;
    color: var(--t-hi) !important;
}

.cm-error-marker {
    background-color: rgba(255, 0, 0, 0.2);
    border-bottom: 1px dotted red;
}

/* ── Live Search Highlights ── */
.cm-live-search-match {
    background: rgba(224, 156, 74, 0.2);
    border-radius: 2px;
    outline: 1px solid rgba(224, 156, 74, 0.35);
}

.cm-live-search-active {
    background: rgba(224, 156, 74, 0.55);
    border-radius: 2px;
    outline: 1px solid var(--a);
}

/* ── CodeMirror Search Dialog ── */
.CodeMirror-dialog {
    background: var(--bg-2);
    border-bottom: 1px solid var(--ln-2);
    padding: 6px 10px;
    font-family: var(--ui);
    font-size: 13px;
    color: var(--t-mid);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
}

.CodeMirror-dialog input {
    flex: 1;
    background: var(--bg-0);
    border: 1px solid var(--ln-2);
    border-radius: 4px;
    color: var(--t-hi);
    font-family: var(--mono);
    font-size: 13px;
    padding: 5px 10px;
    outline: none;
    min-width: 0;
}

.CodeMirror-dialog input:focus {
    border-color: var(--a);
}

.CodeMirror-dialog label {
    color: var(--t-lo);
    white-space: nowrap;
    font-size: 11px;
}

.CodeMirror-search-hint {
    display: none;
}

@media (max-width: 900px) {
    .CodeMirror-dialog {
        padding: 8px 12px;
        font-size: 14px;
    }
    .CodeMirror-dialog input {
        font-size: 16px; /* prevent mobile zoom */
        padding: 7px 12px;
    }
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .mobile-only {
        display: inline-flex !important;
    }

    .topbar-left {
        gap: 6px;
    }

    .ide-container {
        /* Keep row for default layout to flex the main area fully */
        flex-direction: row;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100%;
        width: 80%;
        max-width: 320px;
        border-right: 1px solid var(--ln-1);
        border-bottom: none;
        transition: left 0.35s cubic-bezier(0.16, 1, 0.3, 1);
        margin-left: 0;
        z-index: 200;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }

    .sidebar.mobile-open {
        left: 0;
    }

    .terminal-panel {
        height: 38px;
        min-height: 38px;
        transition: height 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .terminal-panel.active {
        height: 35%;
        min-height: 150px;
    }

    .terminal-panel .terminal-content {
        display: none;
    }

    .terminal-panel.active .terminal-content {
        display: block;
    }

    #toggleTerminalBtn svg {
        transition: transform 0.25s;
        transform: rotate(180deg);
    }

    .terminal-panel.active #toggleTerminalBtn svg {
        transform: rotate(0deg);
    }

    .upload-container {
        padding: 0 16px;
    }
}

@media (max-width: 600px) {

    .project-name,
    .topbar-sep,
    .topbar-logo,
    .hide-mobile {
        display: none !important;
    }

    #currentFileName {
        max-width: 140px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-weight: 500;
        font-size: 13px;
    }

    .upload-header h1 {
        font-size: 22px;
    }

    .modal-content {
        width: 92%;
        padding: 16px;
    }
}

/* ══════════════════════════════
   DASHBOARD / LOGIN / USERNAME
   (Glassmorphic & Premium)
   ══════════════════════════════ */

#dashboardView,
#loginView,
#usernameView {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-0);
    position: relative;
    overflow-y: auto;
}

#dashboardView::before,
#loginView::before,
#usernameView::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(224, 156, 74, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(109, 184, 138, 0.03) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

.dash-header {
    padding: 0 30px;
    height: 70px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    border-bottom: 1px solid var(--ln-1);
    background: rgba(11, 12, 14, 0.65);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.dash-logo {
    display: flex;
    align-items: center;
    height: 70px;
    justify-self: flex-start;
    overflow: hidden;
}

.dash-logo a {
    display: flex;
    align-items: center;
    height: 100%;
}

.dash-logo img {
    height: 140px;
    object-fit: contain;
    margin-left: -20px;
}

.dash-nav {
    display: flex;
    gap: 30px;
    align-items: center;
    justify-content: center;
}

.burger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--t-hi);
    cursor: pointer;
    padding: 8px;
    transition: transform 0.2s;
}

.burger-btn:active {
    transform: scale(0.9);
}

.mobile-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    height: 100dvh;
    background: rgba(11, 12, 14, 0.95);
    backdrop-filter: blur(20px);
    z-index: 1000;
    padding: 30px 25px 50px 25px;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    border-left: 1px solid var(--ln-1);
    overflow-y: auto;
}

.mobile-drawer.open {
    right: 0;
}

.drawer-links {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mobile-drawer .nav-item {
    font-size: 16px;
    padding: 12px 15px;
    border-radius: 8px;
    transition: background 0.2s;
}

.mobile-drawer .nav-item:hover {
    background: var(--bg-3);
}

.drawer-footer {
    border-top: 1px solid var(--ln-1);
    padding-top: 20px;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.drawer-user-email {
    font-size: 11px;
    color: var(--t-lo);
    word-break: break-all;
    padding: 0 5px;
}

.drawer-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--err);
    font-size: 13px;
    font-weight: 500;
    padding: 12px 15px;
    background: rgba(217, 112, 112, 0.05);
    border-radius: 8px;
    transition: all 0.2s;
}

.drawer-logout:hover {
    background: rgba(217, 112, 112, 0.1);
}

.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

/* Responsive Header Polish */
@media (max-width: 900px) {
    .dash-header {
        padding: 0 16px;
        height: 60px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .dash-logo {
        height: 100%;
        margin-left: -5px;
        flex-shrink: 0;
    }

    .dash-logo img {
        height: 120px !important;
        object-fit: contain;
        display: block;
        filter: drop-shadow(0 0 10px rgba(0,0,0,0.5));
    }

    .dash-nav {
        display: none;
    }

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

    .search-container {
        width: 40px;
        height: 40px;
        padding: 0;
        justify-content: center;
        border-radius: 10px;
        flex-shrink: 0;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(255, 255, 255, 0.08);
        backdrop-filter: blur(10px);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    }

    .search-container svg {
        opacity: 0.8 !important;
        color: var(--a);
        filter: drop-shadow(0 0 5px var(--a-glow));
    }

    .search-container input {
        display: none;
    }

    .search-container:focus-within {
        position: absolute;
        left: 12px;
        right: 12px;
        width: auto;
        height: 44px;
        top: 6px;
        z-index: 200;
        background: var(--bg-1);
        border: 1px solid var(--a);
        padding: 0 16px;
        border-radius: 12px;
        justify-content: flex-start;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px var(--a-glow);
        animation: slideDownFade 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    @keyframes slideDownFade {
        from { opacity: 0; transform: translateY(-10px); }
        to { opacity: 1; transform: translateY(0); }
    }

    .search-container:focus-within input {
        display: block;
        width: 100% !important;
    }

    .user-profile {
        display: flex !important;
        order: 5;
    }

    .burger-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        order: 10;
        padding: 6px;
        flex-shrink: 0;
    }
}

@media (max-width: 600px) {
    .dash-logo img {
        height: 110px !important;
    }
}

.nav-item {
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--t-lo);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    padding: 8px 0;
}

.nav-item:hover {
    color: var(--t-hi);
}

.nav-item.active {
    color: var(--t-hi);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--a);
    box-shadow: 0 0 10px var(--a-glow);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
    justify-self: end;
}

.search-container {
    background: var(--bg-1);
    border: 1px solid var(--ln-1);
    border-radius: 20px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-container:focus-within {
    border-color: var(--a-line);
    background: var(--bg-2);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

.search-container input {
    background: none;
    border: none;
    outline: none;
    color: var(--t-hi);
    font-family: var(--ui);
    font-size: 13px;
    padding: 8px 0;
    width: 180px;
}

.search-container input::placeholder {
    color: var(--t-lo);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--a-line);
    background: var(--bg-2);
    object-fit: cover;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--t-hi);
}

.user-username {
    font-size: 10px;
    color: var(--t-lo);
    font-family: var(--mono);
    opacity: 0.8;
}

.dash-content {
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 20px;
    z-index: 1;
}

.section-title {
    font-size: 18px;
    font-weight: 400;
    color: var(--t-hi);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.project-card {
    background: var(--bg-1);
    border: 1px solid var(--ln-1);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.project-card:hover {
    transform: translateY(-4px);
    border-color: var(--a-line);
    background: var(--bg-2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.project-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--a);
    opacity: 0;
    transition: opacity 0.2s;
}

.project-card:hover::after {
    opacity: 0.6;
}

.project-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--a);
}

.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.project-details h3 {
    font-size: 15px;
    font-weight: 500;
    color: var(--t-hi);
    margin-bottom: 4px;
}

.project-details .zip-name {
    font-size: 10px;
    color: var(--t-lo);
    font-family: var(--mono);
}

.project-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--ln-0);
    font-size: 10px;
    color: var(--t-lo);
}

/* ── Generic Form Box (Login/Username) ── */
.auth-box {
    width: 100%;
    max-width: 400px;
    margin: auto;
    padding: 40px 32px;
    background: var(--bg-1);
    border: 1px solid var(--ln-1);
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.auth-box h1 {
    font-size: 24px;
    font-weight: 300;
    color: var(--t-hi);
    margin-bottom: 8px;
}

.auth-box p {
    font-size: 12px;
    color: var(--t-lo);
    margin-bottom: 30px;
}

.input-group {
    text-align: left;
    margin-bottom: 20px;
}

.input-label {
    display: block;
    font-size: 11px;
    color: var(--t-mid);
    margin-bottom: 8px;
    font-weight: 500;
}

.auth-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-0);
    border: 1px solid var(--ln-1);
    border-radius: var(--r);
    color: var(--t-hi);
    font-size: 14px;
    font-family: var(--ui);
    outline: none;
    transition: border-color 0.2s;
}

.auth-input:focus {
    border-color: var(--a);
}

.google-btn {
    width: 100%;
    padding: 12px;
    background: #1c1d21;
    color: #dde0e8;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
}

.google-btn:hover {
    background: #24262b;
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.google-btn:active {
    transform: translateY(0) scale(0.98);
}

.google-btn img {
    width: 18px;
}

/* Scrollbar on dashboard */
#dashboardView::-webkit-scrollbar {
    width: 6px;
}

#dashboardView::-webkit-scrollbar-thumb {
    background: var(--ln-2);
}

@media (max-width: 600px) {
    .dash-content {
        padding: 24px 16px;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .project-card {
        padding: 14px 16px;
        gap: 10px;
        border-radius: 10px;
    }

    .project-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
        border-radius: 6px;
    }

    .project-details h3 {
        font-size: 14px;
        margin-bottom: 2px;
    }

    .project-meta {
        padding-top: 10px;
        font-size: 9px;
    }
}

/* --- Marketplace Aesthetics & Mobile Tile View --- */
#sellModal .modal-content {
    background: rgba(15, 17, 21, 0.95) !important;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05) inset;
    border-radius: 12px;
}
#sellModal input, #sellModal textarea, #sellModal select {
    background: rgba(0,0,0,0.3) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    transition: all 0.2s;
    outline: none;
}
#sellModal input:focus, #sellModal textarea:focus, #sellModal select:focus {
    border-color: var(--a) !important;
    box-shadow: 0 0 0 2px rgba(224, 156, 74, 0.2);
}

@media (max-width: 768px) {
    .market-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
        padding: 0 10px !important;
        margin-top: 20px !important;
    }
    .asset-card {
        padding: 10px !important;
        border-radius: 8px !important;
    }
    .asset-preview {
        height: 80px !important;
        margin-bottom: 10px !important;
    }
    .asset-info h3 {
        font-size: 12px !important;
        line-height: 1.3 !important;
    }
    .asset-info p {
        display: none !important; /* Hide description to keep tiles compact */
    }
    .asset-info .tag-chip {
        font-size: 9px !important;
        padding: 2px 6px !important;
        margin-bottom: 6px !important;
    }
    .asset-price {
        font-size: 13px !important;
    }
    .asset-author {
        font-size: 9px !important;
    }
    #filterContainer {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px;
        padding: 0 10px !important;
    }
    #marketFilter {
        width: 100%;
        padding: 12px !important;
    }
}
.error-link {
    text-decoration: underline;
    cursor: text;
    color: inherit;
    transition: color 0.1s;
}
body.ctrl-pressed .error-link:hover {
    text-decoration: underline;
    cursor: pointer;
    color: #4daafc !important;
}

.explorer-actions .btn-icon {
    color: var(--t-mid);
    padding: 3px;
    border-radius: 3px;
    transition: all 0.15s ease;
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.explorer-actions .btn-icon:hover {
    color: var(--t-hi) !important;
    background: rgba(255, 255, 255, 0.08);
}

.explorer-actions .btn-icon svg {
    display: block;
}

/* Tree Item Actions Dropdown Context Menu */
.tree-item-dropdown {
    transition: opacity 0.1s ease;
}

.dropdown-menu-item {
    transition: background 0.12s, color 0.12s;
    user-select: none;
}

.dropdown-menu-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}

.dropdown-menu-item#deleteTreeItemBtn:hover {
    background: rgba(255, 95, 95, 0.15) !important;
    color: #ff8080 !important;
}

.tree-item {
    position: relative;
}

.file-actions-btn {
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.tree-item:hover .file-actions-btn {
    opacity: 0.6;
}

.tree-item:hover .file-actions-btn:hover {
    opacity: 1;
    color: var(--t-hi) !important;
}

#deleteNodeConfirmBtn:hover {
    background: #ff8080 !important;
    border-color: #ff8080 !important;
    color: var(--bg-0) !important;
    box-shadow: 0 0 20px rgba(217, 112, 112, 0.25);
}



