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

:root {
    --bg-primary: #1e1e1e;
    --bg-secondary: #252526;
    --bg-tertiary: #2d2d30;
    --bg-quaternary: #3c3c3c;
    --border-color: #3c3c3c;
    --text-primary: #d4d4d4;
    --text-secondary: #cccccc;
    --text-muted: #969696;
    --accent-blue: #007acc;
    --accent-green: #4ec9b0;
    --accent-orange: #ce9178;
    --accent-red: #f44747;
    --accent-purple: #c586c0;
    --accent-yellow: #dcdcaa;
    --line-number-color: #858585;
    --selection-bg: #264f78;
    --hover-bg: #2a2d2e;
    --active-bg: #37373d;
    --drop-zone-bg: #0e4f79;
    --drop-zone-border: #007acc;

    /* New CSS variable for line numbers width */
    --line-number-width-main: 60px;
    --line-number-width-fullscreen: 80px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.ide-container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 300px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.folder-icon {
    font-size: 16px;
}

.sidebar-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.sidebar-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

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

.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    margin: 20px 0;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--drop-zone-border);
    background: var(--drop-zone-bg);
}

.drop-zone-content {
    pointer-events: none;
}

.drop-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.drop-text-small {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.file-item:hover {
    background: var(--hover-bg);
}

.file-item.active {
    background: var(--active-bg);
    color: var(--text-primary);
}

.file-item.folder {
    font-weight: 500;
}

.file-item .file-icon {
    font-size: 16px;
    min-width: 16px;
}

.file-children {
    margin-left: 20px;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.editor-tabs {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 16px;
    display: flex;
    align-items: center;
    min-height: 36px;
}

.tab-placeholder {
    color: var(--text-muted);
    font-size: 14px;
    padding: 8px 0;
}

.editor-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-bottom: none;
    margin-right: 4px;
    transition: all 0.2s ease;
}

.editor-tab:hover {
    background: var(--hover-bg);
}

.editor-tab.active {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.editor-tab .close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    border-radius: 2px;
    font-size: 12px;
    margin-left: 4px;
}

.editor-tab .close-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.editor-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.editor-wrapper {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

.line-numbers {
    background: var(--bg-primary);
    color: var(--line-number-color);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    padding: 20px 16px;
    width: var(--line-number-width-main); /* Changed from min-width */
    text-align: right;
    user-select: none;
    border-right: 1px solid var(--border-color);
    overflow-y: hidden; /* Ensure line numbers don't scroll independently */
    transition: all 0.3s ease; /* For smooth toggle */
}

#code-input {
    flex: 1;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: none;
    outline: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    padding: 20px;
    resize: none;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
    overflow-y: auto; /* Ensure vertical scrolling is controlled here */
}

#code-input::placeholder {
    color: var(--text-muted);
}

.editor-actions {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.action-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-btn:hover {
    background: var(--hover-bg);
    border-color: var(--accent-blue);
}

.action-btn.primary {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

.action-btn.primary:hover {
    background: #005a9e;
}

.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-primary);
    z-index: 1000;
    display: none;
}

.fullscreen-container {
    display: flex;
    height: 100vh;
}

.fullscreen-sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.fullscreen-sidebar-header {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.fullscreen-file-tree {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.fullscreen-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.fullscreen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.file-tabs {
    display: flex;
    gap: 4px;
}

.file-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: 4px 4px 0 0;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-bottom: none;
}

.file-tab.active {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.file-icon {
    font-size: 16px;
}

.fullscreen-controls {
    display: flex;
    gap: 8px;
}

.fullscreen-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

.fullscreen-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.fullscreen-editor {
    flex: 1;
    display: flex;
    position: relative;
    background: var(--bg-primary);
}

.fullscreen-line-numbers {
    background: var(--bg-primary);
    color: var(--line-number-color);
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    line-height: 1.6;
    padding: 24px 20px;
    width: var(--line-number-width-fullscreen); /* Changed from min-width */
    text-align: right;
    user-select: none;
    border-right: 1px solid var(--border-color);
    overflow-y: hidden; /* Ensure line numbers don't scroll independently */
    transition: all 0.3s ease; /* For smooth toggle */
}

.fullscreen-code {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    line-height: 1.6;
    padding: 24px;
    white-space: pre;
    overflow-wrap: normal;
    position: relative;
    overflow-y: auto; /* Enable vertical scrolling for the code content */
    overflow-x: auto;
}

/* New class to hide line numbers */
.line-numbers.hide-line-numbers, 
.fullscreen-line-numbers.hide-line-numbers {
    width: 0;
    padding: 0;
    border-right: none;
}

.cursor {
    position: absolute;
    width: 2px;
    height: 1.6em;
    background: var(--cursor-color);
    animation: blink 1s infinite;
    z-index: 10;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.progress-bar {
    height: 4px;
    background: var(--bg-secondary);
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
    width: 0%;
    transition: width 0.3s ease;
}

/* Syntax highlighting */
.token.keyword { color: var(--accent-blue); font-weight: 500; }
.token.string { color: var(--accent-orange); }
.token.comment { color: var(--text-muted); font-style: italic; }
.token.number { color: var(--accent-green); }
.token.function { color: var(--accent-yellow); }
.token.variable { color: var(--text-primary); }
.token.operator { color: var(--text-secondary); }
.token.punctuation { color: var(--text-secondary); }
.token.property { color: var(--accent-green); }
.token.boolean { color: var(--accent-blue); }
.token.regex { color: var(--accent-red); }
.token.class-name { color: var(--accent-purple); }

/* Mobile responsive */
@media (max-width: 768px) {
    .ide-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .main-content {
        flex: 1;
    }
    
    .fullscreen-container {
        flex-direction: column;
    }
    
    .fullscreen-sidebar {
        width: 100%;
        height: 180px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .editor-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .action-btn {
        padding: 10px 16px;
    }
}