        .header-nav-button {
            padding: 0.5em 1em;
            margin-left: 1em;
            background-color: #8A2BE2; /* Purple from Galatron rules */
            color: white;
            border: none;
            border-radius: 15px; /* Prominently rounded corners */
            cursor: pointer;
            transition: background-color 0.3s ease;
            flex: 0 1 auto;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .header-nav-button:hover:not(:disabled) {
            background-color: #7B24CB; /* Darker purple on hover */
        }
        .header-nav-button:disabled {
            background-color: #5a5a5a; /* Grey out when disabled */
            color: #999999;
            cursor: not-allowed;
        }
        .header-nav-button.active {
            background-color: #9370DB; /* MediumPurple - clearly active */
            box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
        }

        /* Specific styles for the File Tree button state */
        #fileTreeButton:not(:disabled):not(.active) {
            background-color: #5a5a5a; /* Gray, similar to disabled state */
            color: #e0e0e0; /* Light gray text for readability on dark gray */
        }

        #fileTreeButton:not(:disabled):not(.active):hover {
            background-color: #6b6b6b; /* Slightly lighter gray on hover */
        }

        #fileTreeButton.active {
            background-color: #8A2BE2; /* Main purple for active state */
            color: white;
            /* box-shadow is already applied by .header-nav-button.active, or can be added here if that rule is removed */
        }

        /* Specific styles for the FILE button */
        #fileButton:not(.menu-active) {
            background-color: #5a5a5a; /* Default gray */
            color: #e0e0e0;
        }

        #fileButton:not(.menu-active):hover {
            background-color: #6b6b6b; /* Lighter gray on hover */
        }

        #fileButton.menu-active {
            background-color: #777777; /* Light gray when menu is open (pressed state) */
            color: #ffffff;
        }

        /* Context Menu Styles */
        .file-context-menu {
            display: none; /* Hidden by default */
            position: absolute;
            top: 60px; /* Adjust as needed, below the header */
            left: 150px; /* Adjust as needed, near the FILE button */
            background-color: #3c3c3c; /* Darker than page background, but not black */
            border: 1px solid #505050;
            border-radius: 10px; /* Rounded corners */
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
            z-index: 1000;
            min-width: 180px;
            padding: 5px 0;
        }
        .file-context-menu button {
            display: block;
            width: calc(100% - 10px); /* Full width minus padding */
            padding: 10px 15px;
            margin: 5px;
            background-color: transparent;
            color: #E0E0E0;
            border: none;
            text-align: left;
            cursor: pointer;
            border-radius: 8px; /* Rounded corners for items */
            font-size: 0.95em;
        }
        .file-context-menu button:hover {
            background-color: #8A2BE2; /* Purple accent on hover */
            color: white;
        }
        .context-menu-divider {
            height: 1px;
            background-color: #505050;
            margin: 5px 0;
        }

        /* Ensure the main page container takes full height and manages its children vertically */
        .create-page-container {
            display: flex;
            flex-direction: column;
            height: 100vh; /* Assumes this container is the primary viewport filler */
            box-sizing: border-box; /* ADDED */
            transition: padding-right 0.3s ease-in-out, padding-bottom 0.3s ease-in-out; /* MODIFIED */
            position: relative; /* ADDED to make it a positioning context */
            /* overflow: hidden; /* Optional: consider if child elements manage their own scroll */
        }

        /* ADD new rule for when file tree is visible */
        .create-page-container.file-tree-visible {
            padding-right: 300px;
        }

        /* ADD new rule for when console is visible */
        .create-page-container.console-visible {
            padding-bottom: 250px; /* Adjust as needed for console height */
        }

        /* File Tree Panel Styles */
        .file-tree-panel {
            position: fixed;
            top: 60px; /* Position below site-header (30px) and secondary-menu-ribbon (30px) */
            right: -300px; /* Start off-screen */
            width: 300px;
            /* height: calc(100vh - 60px); */ /* MODIFIED - height will be affected by console */
            bottom: 0; /* Anchor to bottom */
            background-color: #383838; /* Slightly lighter than background for differentiation */
            border-left: 1px solid #505050;
            box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
            z-index: 900; /* Below context menu, above most content */
            transition: right 0.3s ease-in-out;
            display: flex;
            flex-direction: column;
            overflow-y: auto;
            padding-top: 0; /* Panel content starts from its top */
            border-radius: 15px 0 0 15px; /* Rounded corners on the left */
            flex-shrink: 0; /* Prevent header from shrinking if content is too long */
        }

        .file-tree-panel.visible {
            right: 0; /* Slide in */
        }

        .file-tree-header {
            padding: 10px 15px;
            font-size: 1.1em;
            color: #E0E0E0;
            background-color: #444444;
            border-bottom: 1px solid #505050;
            border-radius: 15px 0 0 0; /* Match top-left rounding */
            margin-top: 0; /* Panel header is part of normal flow now */
            height: 50px; /* Reduced height for the panel's own header */
            display: flex;
            align-items: center;
            box-sizing: border-box;
            flex-shrink: 0; /* Prevent header from shrinking if content is too long */
        }

        .file-tree-content {
            padding: 10px;
            color: #D0D0D0;
            flex-grow: 1; /* Allow content to fill available space */
            overflow-y: auto; /* Scroll content if it overflows */
        }

        .file-tree-content ul {
            list-style-type: none;
            padding-left: 15px;
        }

        .file-tree-content li {
            padding: 5px 0;
            cursor: pointer;
        }
        /* 
        .file-tree-content li:hover {
            color: #8A2BE2; /* Purple on hover */
        /* } */
        */

        /* New hover styles for file tree items */
        .file-tree-content li > span, /* Applied to direct span children */
        .file-tree-content li > .file-item-display-container > .item-name-span /* Applied to the new name span */ {
          /* Default color for text, ensuring it matches the tree's base text color */
          color: #D0D0D0; 
          transition: color 0.1s ease-in-out; /* Smooth color transition */
        }

        .file-tree-content li.tree-item-hover-active > .file-item-display-container > .item-name-span,
        .file-tree-content li.tree-item-hover-descendant > .file-item-display-container > .item-name-span {
          color: #8A2BE2; /* Purple highlight for active hover and descendants */
        }

        /* Style for focused (selected via click/keyboard) file tree item */
        .file-tree-content li.tree-item-focused > .file-item-display-container > .item-name-span {
            background-color: #555555; /* Dark gray background */
            color: #E0E0E0; /* Light gray text for readability */
            padding: 2px 4px;
            border-radius: 5px;
            display: inline-block; /* Ensure background covers only the span */
        }

        /* Style for file tree item open in editor (takes precedence over focused) */
        .file-tree-content li.tree-item-open-in-editor > .file-item-display-container > .item-name-span {
            background-color: #8A2BE2; /* Purple background */
            color: white; /* White text */
            padding: 2px 4px; /* Add some padding */
            border-radius: 5px; /* Rounded corners for the selection highlight */
            display: inline-block; /* Ensure background covers only the span */
        }

        /* Style for item selected for a "move" operation */
        .file-tree-content li.tree-item-move-selected {
            /* opacity: 0.4; */ /* Removed opacity */
            background: #4a4a4a; /* Distinct background for selection, text remains clear */
            /* color: #999999; */ /* Removed color change */
        }

        /* Styles for the "+" button next to folders */
        .file-tree-content li.folder > .folder-item-container {
            display: flex;
            align-items: center;
            justify-content: space-between; /* Pushes button to the right */
            width: 100%; /* Ensure it takes full width of the li's content area */
        }

        .file-tree-content li.folder > .folder-item-container > span {
            flex-grow: 1; /* Allows the name span to take available space */
        }

        .add-item-button {
            background-color: transparent;
            color: #b0b0b0;
            border: 1px solid #606060;
            border-radius: 50%; /* Circular button */
            cursor: pointer;
            font-size: 0.8em; /* Smaller font for "+" */
            line-height: 1; /* Ensure "+" is centered */
            width: 18px;
            height: 18px;
            display: flex; /* Keep for layout when visible */
            align-items: center;
            justify-content: center;
            margin-left: 8px; /* Space from the folder name */
            padding: 0;
            flex-shrink: 0; /* Prevent button from shrinking */

            /* --- Styles for visibility control --- */
            opacity: 0;
            visibility: hidden;
            transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, opacity 0.15s ease-in-out;
            /* --- End styles for visibility control --- */
        }

        .add-item-button:hover {
            background-color: #8A2BE2; /* Purple accent on hover */
            color: white;
            border-color: #8A2BE2;
        }

        /* Delete Item Button Styles */
        .delete-item-button {
            background-color: transparent;
            color: #b0b0b0;
            border: 1px solid #606060;
            border-radius: 50%;
            cursor: pointer;
            font-size: 0.8em; /* Adjusted for emoji */
            line-height: 1;
            width: 18px;
            height: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-left: 5px; /* Spacing from add button or name */
            padding: 0;
            flex-shrink: 0;
            opacity: 0;
            visibility: hidden;
            transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, opacity 0.15s ease-in-out;
        }

        .delete-item-button:hover {
            background-color: #E53935; /* Red accent on hover for delete */
            color: white;
            border-color: #E53935;
        }

        /* Rename Item Button Styles */
        .rename-item-button {
            background-color: transparent;
            color: #b0b0b0;
            border: 1px solid #606060;
            border-radius: 50%;
            cursor: pointer;
            font-size: 0.8em; /* Adjusted for emoji */
            line-height: 1;
            width: 18px;
            height: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-left: 5px; /* Spacing from other buttons or name */
            padding: 0;
            flex-shrink: 0;
            opacity: 0;
            visibility: hidden;
            transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, opacity 0.15s ease-in-out;
        }

        .rename-item-button:hover {
            background-color: #4CAF50; /* Green accent on hover for rename */
            color: white;
            border-color: #4CAF50;
        }

        /* General File Item Display and Controls Styling */
        .file-item-display-container {
            display: flex;
            align-items: center;
            justify-content: space-between;
            width: 100%;
        }

        .item-name-span {
            flex-grow: 1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .item-controls {
            display: flex;
            align-items: center;
            flex-shrink: 0; /* Prevent controls from shrinking */
        }

        /* Visibility for Controls (Add and Delete buttons) */
        /* Show add-item-button on specific folder hover, or when the folder item is focused or selected */
        .file-tree-content li.folder.folder-directly-targeted-by-hover-for-add-btn > .file-item-display-container > .item-controls > .add-item-button,
        .file-tree-content li.folder.tree-item-focused > .file-item-display-container > .item-controls > .add-item-button,
        .file-tree-content li.folder.tree-item-selected > .file-item-display-container > .item-controls > .add-item-button {
            opacity: 1;
            visibility: visible;
        }

        /* Show delete-item-button on any item hover (file or folder), or when focused/selected */
        .file-tree-content li.tree-item-hover-active > .file-item-display-container > .item-controls > .delete-item-button,
        .file-tree-content li.tree-item-focused > .file-item-display-container > .item-controls > .delete-item-button,
        .file-tree-content li.tree-item-selected > .file-item-display-container > .item-controls > .delete-item-button,
        .file-tree-content li.tree-item-hover-active > .file-item-display-container > .item-controls > .rename-item-button,
        .file-tree-content li.tree-item-focused > .file-item-display-container > .item-controls > .rename-item-button,
        .file-tree-content li.tree-item-selected > .file-item-display-container > .item-controls > .rename-item-button {
            opacity: 1;
            visibility: visible;
        }

        /* Create Item Context Menu Styles */
        .create-item-context-menu {
            display: none; /* Hidden by default */
            position: absolute;
            background-color: #3c3c3c;
            border: 1px solid #505050;
            border-radius: 10px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
            z-index: 1050; /* Above other elements */
            min-width: 220px;
            padding: 10px;
        }

        .create-item-context-menu h4 {
            margin-top: 0;
            margin-bottom: 10px;
            color: #E0E0E0;
            font-size: 1em;
        }

        .create-item-context-menu label {
            display: block;
            color: #D0D0D0;
            margin-bottom: 3px;
            font-size: 0.9em;
        }

        .create-item-context-menu input[type="text"],
        .create-item-context-menu select {
            width: calc(100% - 12px);
            padding: 6px;
            margin-bottom: 10px;
            background-color: #2C2C2C;
            border: 1px solid #505050;
            color: #E0E0E0;
            border-radius: 5px;
            font-size: 0.9em;
        }

        .create-item-context-menu .file-type-list {
            list-style: none;
            padding: 0;
            margin: 0 0 10px 0;
            max-height: 150px; /* Scrollable list */
            overflow-y: auto;
            border: 1px solid #505050;
            border-radius: 5px;
            background-color: #2C2C2C;
        }

        .create-item-context-menu .file-type-list li {
            padding: 8px 10px;
            color: #D0D0D0;
            cursor: pointer;
            border-bottom: 1px solid #444444; /* Separator */
        }
         .create-item-context-menu .file-type-list li:last-child {
            border-bottom: none;
        }

        .create-item-context-menu .file-type-list li:hover,
        .create-item-context-menu .file-type-list li.selected {
            background-color: #8A2BE2;
            color: white;
        }

        /* Show add-item-button on hover, or when the folder item is focused or selected */
        /* This rule is now more specific and uses the new structure */
        .file-tree-content li.folder.folder-directly-targeted-by-hover > .folder-item-container > .add-item-button,
        .file-tree-content li.folder.tree-item-focused > .folder-item-container > .add-item-button,
        .file-tree-content li.folder.tree-item-selected > .folder-item-container > .add-item-button {
            opacity: 1;
            visibility: visible;
        }

        /* Adjust main content when file tree is visible */
        .create-main-content,
        .preview-main-content,
        .editor-tab-content-container { /* Added .editor-tab-content-container here */
            flex-grow: 1; /* Ensure these containers can grow */
            min-height: 0; /* Critical for flex children that might contain scrolling content or have fixed-size children */
            width: 100%; /* ENSURED/ADDED */
            box-sizing: border-box; /* ENSURED/ADDED */
            display: flex; /* ADDED for preview-main-content to allow iframe to fill space */
            flex-direction: column; /* ADDED for preview-main-content */
            /* display: flex/none is handled by JS; editor-tab-content-container also needs flex-direction: column */
        }

        /* Adjust main content and editor container height when console is visible */
        .create-page-container.console-visible .create-main-content,
        .create-page-container.console-visible .preview-main-content,
        .create-page-container.console-visible .editor-tab-content-container {
            /* Their height will be reduced by the console panel's height + padding */
            /* No specific rule needed here if they are flex-grow:1 and create-page-container has padding-bottom */
        }

        /* Adjust file tree panel height when console is visible */
        .create-page-container.console-visible .file-tree-panel {
            height: calc(100vh - 60px - 250px); /* site-header + secondary-menu-ribbon + console height */
        }

        /* Drag and Drop Styles for File Tree */
        .file-tree-content li.dragging {
            opacity: 0.4;
            background: #555;
            color: #999999; /* Gray text color for dragging item */
        }
        .file-tree-content li.folder.drag-over {
            background-color: #7B24CB; /* Darker purple to indicate active drop target */
            outline: 1px dashed #E0E0E0;
        }
        .file-tree-content li[draggable="true"] {
            cursor: grab;
        }
        .file-tree-content li.dragging {
            cursor: grabbing;
        }
        /* Ensure non-draggable items don't show grab cursor */
        .file-tree-content li[draggable="false"] {
            cursor: default;
        }

        /* Editor Tab Content Container */
        .editor-tab-content-container {
            display: none; /* Hidden by default, shown when an editor tab is active */
            flex-direction: column; /* Ensures children can use percentage heights properly */
            /* width: 100%; */ /* This is now handled by the common rule above */
            /* background-color: #1e1e1e; /* Monaco default dark theme background */
            /* margin-right needs to adjust if file tree is open, similar to .create-main-content */
            /* transition: margin-right 0.3s ease-in-out; /* Moved to grouped selector */
        }

        /* .create-page-container.file-tree-visible .editor-tab-content-container { */
            /* margin-right: 300px; /* Moved to grouped selector */
        /* } */

        /* Individual Monaco Editor Instance Container */
        .monaco-editor-instance {
            width: 100%;
            height: 100%; /* Fill the .editor-tab-content-container */
            display: none; /* Only the active editor is shown */
        }

        .monaco-editor-instance.active-editor {
            display: block;
        }

        /* Styles for dynamically added file tabs in the secondary menu ribbon */
        .secondary-menu-ribbon .file-tab-button {
            padding: 0.5em 0.75em;
            margin-left: 0.3em;
            background-color: #5a5a5a; /* Default inactive tab color (gray) */
            color: #e0e0e0;
            border: none;
            border-radius: 10px 10px 0 0; /* Rounded top corners */
            cursor: pointer;
            font-size: 0.9em;
            transition: background-color 0.2s ease, color 0.2s ease;
            position: relative; /* For close button positioning */
            white-space: nowrap; /* Prevent tab text from wrapping */
            overflow: hidden; /* Hide overflowed text */
            text-overflow: ellipsis; /* Show ellipsis for overflowed text */
            flex-shrink: 0; /* Prevent tabs from shrinking initially */
        }

        .secondary-menu-ribbon {
            display: flex;
            align-items: center;
            overflow: hidden; /* Hide overflowing tabs */
            position: relative; /* For positioning the more-tabs-button */
        }

        .secondary-menu-ribbon .menu-ribbon-button:not(.more-tabs-button) {
            flex-shrink: 0; /* Prevent main buttons from shrinking */
        }

        .secondary-menu-ribbon .file-tab-button {
            /* Styles from above are mostly fine, ensure flex-shrink allows them to be hidden if needed */
            /* No flex-grow, they should take their content size */
        }

        .more-tabs-button {
            margin-left: auto; /* Pushes it to the far right */
            padding: 0.5em 0.75em;
            border-radius: 10px; /* Fully rounded */
            /* Ensure it's visually distinct or part of the group */
        }

        /* Context Menu for More Tabs */
        .more-tabs-context-menu {
            display: none; /* Hidden by default */
            position: absolute;
            /* Position it near the moreTabsButton. JS will help fine-tune. */
            background-color: #3c3c3c;
            border: 1px solid #505050;
            border-radius: 10px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
            z-index: 1100; /* Above other menus */
            min-width: 200px;
            max-height: 300px; /* Scrollable */
            overflow-y: auto;
            padding: 5px 0;
        }

        .more-tabs-context-menu button {
            display: block;
            width: calc(100% - 10px); /* Full width minus padding */
            padding: 10px 15px;
            margin: 5px;
            background-color: transparent;
            color: #E0E0E0;
            border: none;
            text-align: left;
            cursor: pointer;
            border-radius: 8px;
            font-size: 0.9em;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .more-tabs-context-menu button:hover {
            background-color: #8A2BE2; /* Purple accent on hover */
            color: white;
        }
        .more-tabs-context-menu button.active {
            background-color: #7B24CB; /* Darker purple for active tab in dropdown */
            color: white;
        }

        .secondary-menu-ribbon .file-tab-button:hover {
            background-color: #6b6b6b;
        }

        .secondary-menu-ribbon .file-tab-button.active {
            background-color: #8A2BE2; /* Purple for active tab */
            color: white;
            /* Bring active tab slightly forward if needed, or use border-bottom to connect to content */
            /* border-bottom: 2px solid #1e1e1e; /* Example: if editor bg is #1e1e1e */
        }

        .secondary-menu-ribbon .file-tab-button .close-tab-button {
            margin-left: 8px;
            padding: 0 4px;
            background: transparent;
            border: none;
            color: #cccccc;
            cursor: pointer;
            font-size: 0.9em;
            border-radius: 50%;
        }
        .secondary-menu-ribbon .file-tab-button.active .close-tab-button {
            color: white;
        }

        .secondary-menu-ribbon .file-tab-button .close-tab-button:hover {
            background-color: rgba(255, 255, 255, 0.2);
            color: white;
        }

        .preview-sandbox-iframe {
            flex-grow: 1; /* ADDED: allow iframe to grow and fill space */
            width: 100%; /* ADDED: ensure iframe takes full width */
            height: 100%; /* ADDED: ensure iframe takes full height */
            border: none; /* REMOVED: border for the iframe */
        }

        /* Markdown Preview Display Styles */
        .markdown-preview-display {
            width: 100%;
            height: 100%;
            padding: 20px;
            box-sizing: border-box;
            background-color: #2C2C2C; /* Same as other content areas */
            color: #E0E0E0; /* Light text for readability */
            overflow-y: auto;
            border-radius: 0 0 15px 15px; /* Rounded bottom corners if it's the last visible element */
        }

        /* Styles for code blocks within markdown preview */
        .markdown-preview-display pre {
            background-color: #1e1e1e; /* Darker background for code blocks */
            border: 1px solid #444444;
            border-radius: 8px; /* Rounded corners for code blocks */
            padding: 15px;
            overflow-x: auto; /* Allow horizontal scrolling for long code lines */
        }

        .markdown-preview-display pre code {
            font-family: 'Courier New', Courier, monospace; /* Monospaced font for code */
            color: #d4d4d4; /* Light color for code text, common in dark themes */
        }

        /* Adjustments for headings, blockquotes, etc. can be added here for consistency */
        .markdown-preview-display h1,
        .markdown-preview-display h2,
        .markdown-preview-display h3,
        .markdown-preview-display h4,
        .markdown-preview-display h5,
        .markdown-preview-display h6 {
            color: #9370DB; /* Purple for headings */
            margin-top: 1.5em;
            margin-bottom: 0.5em;
        }

        .markdown-preview-display p {
            line-height: 1.6;
            margin-bottom: 1em;
        }

        .markdown-preview-display a {
            color: #8A2BE2; /* Purple for links */
            text-decoration: none;
        }
        .markdown-preview-display a:hover {
            text-decoration: underline;
        }

        .markdown-preview-display blockquote {
            border-left: 4px solid #9370DB; /* Purple left border */
            padding-left: 15px;
            margin-left: 0;
            color: #b0b0b0; /* Slightly dimmer text for quotes */
            font-style: italic;
        }

        .markdown-preview-display ul,
        .markdown-preview-display ol {
            margin-left: 20px;
            margin-bottom: 1em;
        }

        .markdown-preview-display code:not(pre code) {
            background-color: #444444;
            padding: 0.2em 0.4em;
            margin: 0;
            font-size: 85%;
            border-radius: 3px;
        }

        /* Style for the Markdown View Toggle Button */
        #markdownViewToggleBtn {
            /* Similar to other ribbon buttons but can have unique aspects */
            /* For example, if it's more of a toggle, its active state might be different */
        }
        #markdownViewToggleBtn.active {
            background-color: #9370DB; /* MediumPurple for active state */
            color: white;
        }

        #markdownViewToggleBtn {
            width: 150px; /* Or a width that comfortably fits both '✏️ Edit Markdown' and '👁️ View Markdown' */
            text-align: center;
            justify-content: center;
        }

        /* Added for loading animation enhancements */
        .loading-status-line {
            display: flex;
            align-items: center;
            transition: transform 0.5s ease-in-out, opacity 0.3s ease-in-out;
            opacity: 0; /* Initially transparent */
            transform: translateY(50px); /* Start 50px lower, adjust as needed */
        }

        @keyframes spin {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }

        .loading-logo {
            /* Ensure no conflicting direct animation property is set here */
        }

        .loading-logo.spinning-slow {
            animation: spin 2s linear infinite; /* Slow spinning */
        }

        .loading-logo.spinning-fast {
            animation: spin 0.5s linear infinite; /* 2x faster */
        }

        .loading-logo.stopped {
            animation: none;
            transform: rotate(0deg); /* Ensure it resets to a non-rotated state */
        }
        /* End of added styles for loading animation */

        /* Sandbox Fullscreen Mode Styles */
        .create-page-container.sandbox-fullscreen-active .site-header,
        .create-page-container.sandbox-fullscreen-active .secondary-menu-ribbon,
        .create-page-container.sandbox-fullscreen-active #fileTreePanel {
            display: none !important; /* Force hide */
        }

        .create-page-container.sandbox-fullscreen-active .preview-main-content {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw; /* Full viewport width */
            height: 100vh; /* Full viewport height */
            z-index: 2000; /* Ensure it's above other page elements if any remain */
            padding: 0; /* Remove any padding */
            margin: 0; /* Remove any margin */
        }

        .create-page-container.sandbox-fullscreen-active #previewSandbox {
            width: 100%;
            height: 100%;
        }

        /* Ensure the main preview content area is visible and takes up space when fullscreen is active */
        .create-page-container.sandbox-fullscreen-active #aiMainContent,
        .create-page-container.sandbox-fullscreen-active #editorTabContentContainer {
            display: none !important; /* Hide AI and Editor views */
        }

        .create-page-container.sandbox-fullscreen-active #previewMainContent {
            display: flex !important; /* Ensure preview is visible */
            padding-right: 0 !important; /* Override padding-right from .file-tree-visible */
        }

        .create-page-container.sandbox-fullscreen-active {
            padding-right: 0 !important; /* Override padding-right from .file-tree-visible */
        }

        /* Styles for the flashing thinking emoji */
        .thinking-emoji {
            display: inline-block; /* Allows for better control if needed */
            animation: flash 1s infinite;
            font-size: 1.5em; /* Make it a bit larger, adjust as needed */
            margin-left: 8px; /* Space from any preceding text */
        }

        @keyframes flash {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.2; }
        }

#streamingResponse {
    background: transparent;
    border: none;
}

/* MODIFIED: Style for paragraphs within the streaming response area */
#streamingResponse p {
    margin-top: 0;
    margin-bottom: 4px; /* Further reduced fixed pixel value */
    line-height: 1.3;  /* Tighter line height */
}

/* ADDED: Collapse empty paragraphs (Ensure this rule is effective) */
#streamingResponse p:empty {
    margin: 0 !important; /* Add !important to ensure override */
    padding: 0 !important;
    height: 0 !important;
    font-size: 0 !important;
    line-height: 0 !important; /* Ensure line-height is also zeroed out */
    display: block; /* Ensure it's treated as a block to apply height:0 */
}
/* END MODIFIED / ADDED */

/* Styles for code blocks and inline code within the streaming response area */
#streamingResponse pre {
    background-color: #1e1e1e; /* Atom One Dark editor background color, or similar dark shade */
    border: 1px solid #444444; /* Subtle border, consistent with header */
    border-radius: 8px;       /* Rounded corners for the entire pre block */
    padding: 0; /* ADDED - Header will be flush, code element gets padding */
    overflow-x: auto;         /* Allow horizontal scrolling for long code lines */
    margin-top: 1em;          /* Space above the code block */
    margin-bottom: 1em;       /* Space below the code block */
    line-height: 1.45;        /* Adjust line height for readability */
    font-size: 0.9em;         /* Slightly smaller font size for code blocks */
    position: relative;
}

#streamingResponse pre code.hljs { /* Target specifically highlight.js processed code */
    padding: 15px; /* ADDED - Code content padding */
    display: block; /* ADDED - To ensure padding and layout are respected */
    background: none; /* Ensure no overriding background */
    color: #abb2bf; /* Default text color for atom-one-dark, can be overridden by hljs spans */
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; /* Common monospaced font stack */
    border-radius: 0 0 8px 8px; /* ADDED - Bottom rounded corners for the code content area */
}

/* Styles for inline code within the streaming response area */
#streamingResponse code:not(pre code) {
    background-color: #3a3a3a; /* Slightly lighter dark gray background for inline code */
    color: #E0E0E0;            /* Light text color */
    padding: 0.2em 0.4em;
    margin: 0 0.1em;
    font-size: 85%;
    border-radius: 5px;       /* Rounded corners */
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; /* Consistent monospaced font */
}

/* Ensure pre tags are positioned relatively for absolute positioning of copy button */
#streamingResponse pre {
    position: relative;
}

/* New Code Block Header Styles */
.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #333333; /* Darker than pre, but lighter than main bg */
    color: #E0E0E0;
    padding: 6px 10px;
    border-bottom: 1px solid #444444;
    border-radius: 8px 8px 0 0; /* Rounded top corners, matching pre */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Consistent UI font */
    font-size: 0.85em;
}

.code-block-header .file-info {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px; /* Space before buttons */
}

.code-block-header .code-block-buttons {
    display: flex;
    align-items: center;
}
/* End New Code Block Header Styles */

/* Copy Code Button Styles */
.copy-code-button {
    position: relative; /* CHANGED */
    background-color: #4F4F4F; /* Darker gray, less prominent than purple */
    color: #E0E0E0;
    border: 1px solid #666666;
    border-radius: 8px; /* Rounded corners */
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.85em;
    opacity: 1; /* Slightly transparent by default, more visible on hover */
    transition: opacity 0.2s ease-in-out, background-color 0.2s ease-in-out, color 0.2s ease-in-out;
    font-family: inherit; /* Inherit font from body */
    /* Added to better accommodate the icon and temporary text */
    min-width: 30px; /* Ensure button has a minimum width */
    min-height: 30px; /* Ensure button has a minimum height */
    display: inline-flex; /* Helps center content if needed */
    align-items: center;
    justify-content: center;
    margin-left: 5px; /* ADDED for spacing between buttons in the header */
}

.copy-code-button:hover {
    background-color: #8A2BE2; /* Galatron Purple on hover */
    color: white;
    opacity: 1;
    border-color: #8A2BE2;
}

.copy-code-button.copied {
    background-color: #4CAF50; /* Green for success */
    color: white;
    border-color: #4CAF50;
    opacity: 1;
}

/* Apply Code Button Styles (new) */
.apply-code-button {
    position: relative; /* CHANGED */
    background-color: #4F4F4F; /* Match copy button's default */
    color: #E0E0E0;
    border: 1px solid #666666;
    border-radius: 8px; /* Rounded corners */
    padding: 5px 10px; /* Match copy button's padding */
    cursor: pointer;
    font-size: 0.85em; /* Match copy button's font size */
    opacity: 1;
    transition: opacity 0.2s ease-in-out, background-color 0.2s ease-in-out, color 0.2s ease-in-out, border-color 0.2s ease-in-out;
    font-family: inherit;
    min-width: 30px; /* Ensure similar minimum size */
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1; /* For better icon centering */
    margin-left: 5px; /* ADDED for spacing between buttons in the header */
}

.apply-code-button:hover {
    background-color: #8A2BE2; /* Galatron Purple on hover */
    color: white;
    border-color: #8A2BE2;
    opacity: 1;
}

/* States for the apply button */
/* Default/Pending state (when it's about to be auto-applied or if manual click was an option) */
.apply-code-button.pending-application {
    background-color: #6c757d; /* A neutral pending color, e.g., secondary gray */
    color: white;
    border-color: #606060; /* Slightly darker border than default button */
}
.apply-code-button.pending-application:hover {
    background-color: #5a6268; /* Darker gray on hover */
    border-color: #545b62;
}

.apply-code-button.applied-success {
    background-color: #4CAF50; /* Green for success */
    color: white;
    border-color: #4CAF50;
}
.apply-code-button.applied-success:hover {
    background-color: #45a049; /* Darker green on hover */
    border-color: #3e8e41;
}

.apply-code-button.applied-failure {
    background-color: #E53935; /* Red for failure */
    color: white;
    border-color: #E53935;
}
.apply-code-button.applied-failure:hover {
    background-color: #d32f2f; /* Darker red on hover */
    border-color: #c62828;
}

/* Focus style for the AI prompt input textarea */
.prompt-textarea:focus {
    outline: 2px solid #8A2BE2; /* Galatron Purple (BlueViolet) */
}

/* New styles for random prompt button */
.random-prompt-button {
    background-color: transparent;
    border: none;
    color: #E0E0E0;
    cursor: pointer;
    font-size: 1.5rem; /* Larger emoji */
    padding: 0 15px;
    transition: transform 0.2s ease-in-out;
    align-self: stretch; /* Make button same height as textarea */
}

.random-prompt-button:hover {
    transform: scale(1.1);
}

/* New styles for send/stop button */
.send-prompt-button {
    background-color: transparent;
    border: none;
    color: #E0E0E0;
    cursor: pointer;
    font-size: 1.5rem; /* Larger emoji */
    padding: 0 15px;
    transition: transform 0.2s ease-in-out;
    align-self: stretch; /* Make button same height as textarea */
}

.send-prompt-button:hover {
    transform: scale(1.1);
}

.send-prompt-button.stop-mode {
    /* Styles for when it's a stop button */
    /* Transparent background is default, can add specific styles if needed */
}

/* Console Panel Styles */
.console-panel {
    position: fixed;
    bottom: -250px; /* Start off-screen, assuming 250px height */
    left: 0;
    width: 100%;
    height: 250px; /* Adjust as needed */
    background-color: #252526; /* Darker than file tree, similar to VS Code terminal */
    border-top: 1px solid #505050;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    z-index: 950; /* Above content, below file tree if they could overlap (though they wont much) */
    transition: bottom 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    border-radius: 15px 15px 0 0; /* Rounded top corners */
}

.console-panel.visible {
    bottom: 0; /* Slide in */
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background-color: #333333; /* Slightly different header color */
    border-bottom: 1px solid #505050;
    border-radius: 15px 15px 0 0; /* Match panel rounding */
    height: 40px; /* Fixed height for header */
    box-sizing: border-box;
    flex-shrink: 0;
}

.console-title {
    font-size: 1em;
    color: #E0E0E0;
}

.console-controls button {
    background-color: transparent;
    color: #b0b0b0;
    border: 1px solid #606060;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    padding: 3px 6px;
    margin-left: 8px;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.console-controls button:hover {
    background-color: #8A2BE2;
    color: white;
    border-color: #8A2BE2;
}

.console-content {
    flex-grow: 1;
    padding: 10px;
    color: #D0D0D0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    overflow-y: auto;
    line-height: 1.5;
}

.console-content .console-message {
    padding: 2px 0;
    white-space: pre-wrap; /* Preserve whitespace and wrap lines */
    border-bottom: 1px dotted #444; /* Subtle separator */
}
.console-content .console-message:last-child {
    border-bottom: none;
}

.console-content .console-message.error {
    color: #FF6B6B; /* Red for errors */
}

.console-content .console-message.warning {
    color: #FFD166; /* Yellow/Orange for warnings */
}

.console-content .console-message.log {
    color: #D0D0D0; /* Default log color */
}

.console-content .console-message.info {
    color: #72A1E5; /* Blue for info */
}

.console-content .console-message.debug {
    color: #9E9E9E; /* A muted gray, or choose another color */
    /* Example: font-style: italic; */
}

/* Style for the CONSOLE button state */
#consoleButton:not(.active) {
    background-color: #5a5a5a; /* Default gray for inactive state */
    color: #e0e0e0; /* Light gray text for readability on dark gray */
}

#consoleButton:not(.active):hover {
    background-color: #6b6b6b; /* Slightly lighter gray on hover */
}

#consoleButton.active {
    background-color: #8A2BE2; /* Main purple for active state */
    color: white;
}

#consoleButton.active:hover {
    background-color: #7B24CB; /* Darker purple on hover for active state */
}

/* New styles for console tabs */
.console-tabs {
    display: flex;
    align-items: center;
}

.console-icon {
    margin-right: 10px;
}

.console-tab-button {
    background-color: transparent;
    border: none;
    color: #b0b0b0;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 1em;
    border-bottom: 2px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
    margin-right: 10px;
}

.console-tab-button:hover {
    color: #E0E0E0;
}

.console-tab-button.active {
    color: #E0E0E0;
    border-bottom: 2px solid #8A2BE2;
}

.console-content {
    /* Existing styles are fine, but it needs to be hidden/shown */
    display: none; /* Hide by default */
    flex-grow: 1;
    padding: 10px;
    color: #D0D0D0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    overflow-y: auto;
    line-height: 1.5;
}

.console-content.active {
    display: block; /* Show active tab content */
}
/* END New styles for console tabs */

/* New CSS for Problems Tab */
.problem-file-container {
    margin-bottom: 10px;
}

.problem-file-header {
    font-weight: bold;
    color: #E0E0E0;
    background-color: #333333;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: default;
}

.problem-list {
    list-style-type: none;
    padding-left: 10px;
    margin-top: 5px;
}

.problem-item {
    display: flex;
    align-items: center;
    padding: 4px 5px;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.problem-item:hover {
    background-color: #4a4a4a;
}

.problem-item .problem-icon {
    margin-right: 8px;
    flex-shrink: 0;
}

.problem-text-container {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
    display: inline; /* Keep message and location on the same line */
}

.problem-item .problem-message {
    margin-right: 8px;
}

.problem-item.error .problem-message {
    color: #FF6B6B;
}

.problem-item.warning .problem-message {
    color: #FFD166;
}

.problem-item .problem-location {
    color: #82caff;
    font-family: 'Courier New', Courier, monospace;
    margin-left: 4px; /* ADDED for spacing */
}

.problem-fix-button {
    background: transparent;
    border: 1px solid #606060;
    color: #b0b0b0;
    border-radius: 5px;
    cursor: pointer;
    margin-left: auto; /* Pushes the button to the far right */
    padding: 2px 5px;
    font-size: 0.9em;
    line-height: 1;
    flex-shrink: 0;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.problem-fix-button:hover {
    background-color: #8A2BE2;
    color: white;
}

/* New styles for console message count badge */
.message-count-badge {
    background-color: #6a6a6a;
    color: #e0e0e0;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 8px;
    display: inline-block;
    vertical-align: middle;
}

/* Styles for AI Thinking Blocks */
.thinking-block {
    background-color: #3a3a3a;
    border: 1px solid #505050;
    border-radius: 8px;
    margin-top: 10px;
    margin-bottom: 15px;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.thinking-block-title {
    font-weight: bold;
    color: #FFFFFF; /* White text for title */
    margin-bottom: 8px;
    font-size: 1.1em;
}

.thinking-block-summary {
    color: #E0E0E0; /* Light gray for summary text */
    padding: 8px 0px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease-in-out;
    margin-bottom: 5px; /* Space before content if expanded */
}

.thinking-block-summary:hover {
    background-color: #4a4a4a; /* Subtle hover effect */
}

.thinking-block-summary.expanded {
    /* Optional: add an indicator like a down arrow or change text */
    /* For example, add a small triangle or modify padding */
}

.thinking-block-content {
    color: #CCCCCC; /* Lighter gray for content text */
    padding: 10px;
    background-color: #2C2C2C; /* Match main background or a very dark gray */
    border-radius: 6px; /* Rounded corners for the content area itself */
    line-height: 1.6;
}

/* Ensure content within the thinking block respects the theme */
.thinking-block-content p,
.thinking-block-content div,
.thinking-block-content pre {
    color: #CCCCCC; /* Default text color */
}

.thinking-block-content pre {
    background-color: #1e1e1e; /* Darker background for code blocks */
    border: 1px solid #444;
    border-radius: 4px;
    padding: 10px;
    white-space: pre-wrap; /* Wrap long lines */
    word-wrap: break-word; /* Break words if necessary */
}

.thinking-block-content code {
    color: #d4d4d4; /* Standard code color */
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
}

.site-header {
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: 60px; /* Fixed height for the header */
    background-color: #333333; /* Dark gray background */
    color: white;
    position: relative; /* For animated-header-pop if it uses absolute positioning */
    z-index: 1000; /* Ensure header is above other content */
    border-bottom: 1px solid #505050; /* Subtle separator */
    flex-shrink: 0; /* Prevent header from shrinking if content is too long */
}

.header-navigation {
    display: flex; /* Keeps nav buttons in a row */
    align-items: center;
    flex-grow: 1; /* Allows navigation to take available space and push right controls */
    justify-content: flex-start; /* Align nav buttons to the start of their container */
    margin-left: 20px; /* Add some space between logo and nav buttons */
    min-width: 0;
}

.header-controls-right {
    display: flex;
    align-items: center;
    margin-left: auto; /* Pushes this div to the far right of the header */
}

.fullscreen-button {
    background-color: transparent !important; /* Override default button styles if necessary */
    border: none !important;
    padding: 0.5em !important; /* Adjust padding as needed */
    margin-left: 1em !important;
    cursor: pointer;
}

.fullscreen-button img {
    width: 24px; /* Adjust size as needed */
    height: 24px; /* Adjust size as needed */
    filter: brightness(0) invert(1); /* Simpler filter for white */
    display: block; /* Remove extra space below img */
}

.fullscreen-button:hover img {
    filter: brightness(0) saturate(100%) invert(48%) sepia(59%) saturate(2475%) hue-rotate(242deg) brightness(89%) contrast(93%);
}

.console-source-link {
    color: #82caff; /* A light blue, easily readable */
    text-decoration: underline;
    cursor: pointer;
    margin-left: 10px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.console-source-link:hover {
    color: #a2daff;
}

/* Editor Line Highlighting */
.line-highlight-from-console {
    background-color: rgba(138, 43, 226, 0.3); /* Semi-transparent purple */
    transition: background-color 1s ease-out;
}

.line-highlight-glyph-from-console {
    background: #9370DB; /* A solid purple for the glyph margin */
}

/* New: Editor Squiggle Styles for Linting */
.editor-squiggle-error {
    background: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20height%3D'3'%20width%3D'6'%3E%3Cg%20fill%3D'%23FF6B6B'%3E%3Cpolygon%20points%3D'5.5%2C0%202.5%2C3%201.1%2C3%204.1%2C0'%2F%3E%3Cpolygon%20points%3D'4%2C0%206%2C2%206%2C0.6%205.4%2C0'%2F%3E%3Cpolygon%20points%3D'0%2C2%201%2C3%202.5%2C3%201.5%2C2'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") repeat-x bottom left;
}
.editor-squiggle-warning {
    background: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20height%3D'3'%20width%3D'6'%3E%3Cg%20fill%3D'%23FFD166'%3E%3Cpolygon%20points%3D'5.5%2C0%202.5%2C3%201.1%2C3%204.1%2C0'%2F%3E%3Cpolygon%20points%3D'4%2C0%206%2C2%206%2C0.6%205.4%2C0'%2F%3E%3Cpolygon%20points%3D'0%2C2%201%2C3%202.5%2C3%201.5%2C2'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") repeat-x bottom left;
}

/* New: Glyph Margin Icons for Linting */
.editor-glyph-error {
    background: #FF6B6B;
}
.editor-glyph-warning {
    background: #FFD166;
}

/* Loading Overlay Controls */
.overlay-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    z-index: 10;
}

.overlay-control-button {
    background-color: #4F4F4F;
    color: #E0E0E0;
    border: 1px solid #666666;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em; /* Larger for better visibility */
    line-height: 1;
    width: 32px;
    height: 32px;
    margin-left: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.overlay-control-button:hover {
    background-color: #8A2BE2;
    color: white;
    border-color: #8A2BE2;
}

.overlay-control-button.stop-button:hover {
    background-color: #c62828; /* Darker red on hover */
    border-color: #7a7a7a;
}

.overlay-control-button.undo-button:hover:not(:disabled) {
    background-color: #f5a623; /* An orange for undo hover */
    border-color: #f5a623;
}

.overlay-control-button:disabled {
    background-color: #4f4f4f;
    color: #888888;
    cursor: not-allowed;
    border-color: #666666;
}

.file-info {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
    color: #cccccc;
    padding: 2px 8px;
}

.file-info.clickable-file-link {
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

.file-info.clickable-file-link:hover {
    color: #8A2BE2; /* Main platform purple for hover */
}

.code-block-buttons {
    display: flex;
    gap: 4px;
}

/* NEW: Styles for displaying the user's prompt */
.user-prompt-message {
    background-color: #3c3c3c; /* A slightly darker gray to differentiate from thinking blocks */
    color: #E0E0E0;
    padding: 15px;
    border-radius: 15px; /* Prominently rounded corners */
    margin-bottom: 20px; /* Space before AI response */
    line-height: 1.6;
    display: flex;
    align-items: flex-start; /* Align icon with the start of the text block */
}

.user-prompt-message .prompt-icon {
    margin-right: 12px;
    font-size: 1.2em; /* Make the icon slightly larger */
    padding-top: 2px; /* Small adjustment for vertical alignment */
}

.user-prompt-message .prompt-text {
    white-space: pre-wrap; /* Preserve user's line breaks in the prompt */
}