:root {
    /* Color Palette */
    --bg-dark: #042440;
    /* Editor Background */
    --bg-darker: #021220;
    /* Sidebar/Activity Bar */
    --bg-panel: #0d3656;
    /* Panels/Tabs */

    --text-primary: #F4F6F8;
    /* Default Text */
    --text-secondary: #A2BEDC;
    /* Comments, Line Numbers */

    --accent-purple: #B793C9;
    /* Classes, Functions */
    --accent-royal: #4E499E;
    /* Keywords */
    --accent-teal: #2DD4BF;
    /* Strings, Links */
    --accent-orange: #f97316;
    /* Numbers/Booleans */

    --border-color: #1e4566;
    --hover-bg: rgba(255, 255, 255, 0.05);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 14px;
    height: 100vh;
    overflow: hidden;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 0; }
}

/* Layout */
.ide-container {
    display: grid;
    grid-template-columns: 48px 250px 1fr;
    grid-template-rows: 1fr 22px;
    height: 100vh;
    width: 100vw;
}

/* 1. Activity Bar */
.activity-bar {
    background-color: var(--bg-darker);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 10px;
    border-right: 1px solid var(--border-color);
    grid-row: 1 / 2;
}

.activity-icon {
    width: 48px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s;
}

.activity-icon:hover,
.activity-icon.active {
    opacity: 1;
    color: var(--text-primary);
    border-left: 2px solid var(--accent-teal);
}

.activity-icon .material-symbols-outlined {
    font-size: 24px;
}

.spacer {
    flex-grow: 1;
}

/* 2. Sidebar */
.sidebar {
    background-color: var(--bg-darker);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    grid-row: 1 / 2;
    overflow-y: auto;
}

.sidebar-header {
    padding: 10px 20px;
    font-size: 11px;
    font-weight: bold;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.icon-small {
    font-size: 16px;
    cursor: pointer;
}

.section-header {
    padding: 4px 0;
    display: flex;
    align-items: center;
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.02);
    font-weight: bold;
    padding-left: 5px;
}

.folder-name {
    margin-left: 5px;
}

.arrow-down {
    font-size: 18px;
}

.file-tree {
    margin-left: 10px;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 3px 10px;
    cursor: pointer;
    color: var(--text-secondary);
}

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

.file-item.active {
    background-color: rgba(78, 73, 158, 0.2);
    border-left: 1px solid var(--accent-royal);
}

.file-icon {
    font-size: 16px;
    margin-right: 6px;
    color: #ffd700;
}

.file-icon.python-icon {
    color: #3572A5;
}

.file-icon.css-icon {
    color: #563d7c;
}

/* 3. Main Editor Area */
.editor-area {
    background-color: var(--bg-dark);
    display: flex;
    flex-direction: column;
    grid-column: 3 / 4;
    grid-row: 1 / 2;
    overflow: hidden;
    position: relative;
}

/* Tabs */
.editor-tabs {
    background-color: var(--bg-darker);
    display: flex;
    height: 35px;
    overflow-x: auto;
}

.tab {
    display: flex;
    align-items: center;
    padding: 0 10px;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    border-right: 1px solid var(--border-color);
    border-top: 1px solid var(--accent-teal);
    min-width: 120px;
    cursor: pointer;
    font-size: 13px;
}

.tab .file-icon {
    margin-right: 8px;
}

.close-tab {
    font-size: 14px;
    margin-left: auto;
    opacity: 0;
}

.tab:hover .close-tab {
    opacity: 1;
}

/* Breadcrumbs */
.breadcrumbs {
    padding: 5px 15px;
    font-size: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid transparent;
    display: flex;
    align-items: center;
}

.breadcrumbs .separator {
    margin: 0 5px;
}

/* Code Container (Scroll Window) */
.code-container {
    flex-grow: 1;
    overflow-y: auto;
    width: 100%;
    position: relative;
    /* Removed display: flex from here so wrapper works */
}

/* Wrapper to ensure flex stretch happens on full scrollable height */
.code-wrapper {
    display: flex;
    min-height: 100%;
    /* Important: allows extending border */
    width: 100%;
    padding-top: 10px;
}

/* Line Numbers */
.line-numbers {
    padding: 0 15px 0 10px;
    text-align: right;
    color: #4b6479;
    border-right: 1px solid var(--border-color);
    user-select: none;
    min-width: 50px;
    /* No need for min-height 100% here as the flex parent stretches it */
}

.line-number {
    display: block;
    height: 22.5px;
}

.code-lines {
    padding-left: 15px;
    padding-right: 15px;
    color: var(--text-primary);
    width: 100%;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 15px;
    line-height: 1.5;
}

.line {
    white-space: pre;
    min-height: 22.5px;
}

/* Syntax Highlighting */
.keyword {
    color: var(--accent-royal);
    font-weight: bold;
}

.variable {
    color: var(--text-primary);
}

.module {
    color: var(--text-secondary);
}

.class-name {
    color: var(--accent-purple);
    font-weight: bold;
}

.function {
    color: var(--accent-purple);
}

.property {
    color: var(--text-primary);
}

.string {
    color: var(--accent-teal);
}

.comment {
    color: #6272a4;
    font-style: italic;
}

.self {
    color: #e06c75;
}

.number {
    color: var(--accent-orange);
}

.decorator {
    color: var(--accent-orange);
}

.type {
    color: var(--accent-teal);
}

.indent-1 {
    padding-left: 4ch;
}

.indent-2 {
    padding-left: 8ch;
}

.indent-3 {
    padding-left: 12ch;
}

.indent-4 {
    padding-left: 16ch;
}

/* Links in code */
.link {
    color: var(--accent-teal);
    text-decoration: underline;
    cursor: pointer;
    position: relative;
    z-index: 10;
}

.link:hover {
    color: #5eead4;
}

/* 4. Status Bar */
.status-bar {
    background-color: var(--accent-royal);
    color: white;
    grid-column: 1 / 4;
    grid-row: 2 / 3;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    font-size: 12px;
    z-index: 100;
}

.left-tems,
.right-items {
    display: flex;
    gap: 15px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.icon-xs {
    font-size: 14px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .ide-container {
        grid-template-columns: 0 0 1fr;
    }

    .activity-bar,
    .sidebar {
        display: none;
    }

    .code-lines {
        font-size: 13px;
    }

    .indent-1 {
        padding-left: 2ch;
    }

    .indent-2 {
        padding-left: 4ch;
    }

    .indent-3 {
        padding-left: 6ch;
    }

    .indent-4 {
        padding-left: 8ch;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: #2b4f6d;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a6385;
}