:root {
  --vscode-background: #1e1e1e;
  --vscode-foreground: #d4d4d4;
  --vscode-activityBar-background: #333333;
  --vscode-activityBar-foreground: #ffffff;
  --vscode-activityBar-inactiveForeground: #ffffff80;
  --vscode-sideBar-background: #252526;
  --vscode-sideBar-foreground: #cccccc;
  --vscode-editor-background: #1e1e1e;
  --vscode-statusBar-background: #007acc;
  --vscode-statusBar-foreground: #ffffff;
  --vscode-panel-background: #1e1e1e;
  --vscode-panel-border: #80808059;
  --vscode-tab-activeBackground: #1e1e1e;
  --vscode-tab-inactiveBackground: #2d2d2d;
  --vscode-tab-activeForeground: #ffffff;
  --vscode-tab-inactiveForeground: #ffffff80;
  --vscode-tab-border: #252526;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans",
    "Helvetica Neue", sans-serif;
  overflow: hidden;
}

.App {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* VS Code Container */
.vscode-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background-color: var(--vscode-background);
  color: var(--vscode-foreground);
}

/* Main area layout */
.vscode-main {
  display: flex;
  flex: 1;
  overflow: hidden;
  margin-left: 50px; /* Matches activity bar width */
  position: relative;
  width: calc(100% - 50px);
}

/* Activity Bar */
.activity-bar {
  display: flex;
  flex-direction: column;
  background-color: var(--vscode-activityBar-background);
  z-index: 10;
  width: 50px;
  height: 100%;
  position: fixed; /* Change to fixed to avoid layout issues */
  top: 0;
  left: 0;
}

.activity-bar button {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--vscode-activityBar-inactiveForeground);
  cursor: pointer;
  position: relative;
}

.activity-bar button:hover {
  color: var(--vscode-activityBar-foreground);
}

.activity-bar button.active {
  color: var(--vscode-activityBar-foreground);
}

.activity-bar button.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: var(--vscode-activityBar-foreground);
}

/* Sidebar */
.sidebar-container {
  display: flex;
  height: 100%;
  width: 100%; /* Ensure it takes the full width */
}

.sidebar {
  height: 100%;
  background-color: var(--vscode-sideBar-background);
  color: var(--vscode-sideBar-foreground);
  overflow-y: auto;
  overflow-x: hidden;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 5;
  transition: transform 0.2s ease;
  border-right: 1px solid #1e1e1e;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  padding: 8px 12px;
  color: #888888;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 4px;
}

.sidebar-section {
  padding: 0 0 12px 0;
}

.sidebar-search {
  padding: 0 12px;
}

.sidebar-empty-message {
  padding: 12px;
  text-align: center;
  color: #888888;
}

/* File Tree */
.file-tree {
  padding: 0 8px;
}

.file-tree-item {
  margin: 2px 0;
}

.file-tree-folder,
.file-tree-file {
  display: flex;
  align-items: center;
  padding: 3px 6px;
  border-radius: 3px;
  cursor: pointer;
}

.file-tree-folder:hover,
.file-tree-file:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.folder-icon,
.file-icon {
  margin-right: 6px;
  display: flex;
  align-items: center;
}

.file-tree-children {
  padding-left: 16px;
}

.file-tree-file.active {
  background-color: #37373d;
}

.file-tree-file .rename-input {
  background-color: #3c3c3c;
  border: 1px solid #007acc;
  color: #cccccc;
  font-size: 13px;
  padding: 1px 4px;
  width: calc(100% - 14px);
  outline: none;
}

/* Search Input */
.search-input-container {
  position: relative;
  margin: 8px 0;
}

.search-input {
  width: 100%;
  padding: 6px 8px 6px 30px;
  background-color: #3c3c3c;
  color: #cccccc;
  border: 1px solid transparent;
  border-radius: 2px;
  outline: none;
}

.search-input:focus {
  border-color: #007acc;
}

.search-icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #888888;
}

/* Editor Area */
.editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  width: calc(100% - ${sidebarVisible ? sidebarWidth : 0}px);
  transition: margin-left 0.2s ease, width 0.2s ease;
  box-sizing: border-box;
}

.editor-tabs {
  display: flex;
  background-color: var(--vscode-tab-inactiveBackground);
  border-bottom: 1px solid var(--vscode-tab-border);
  overflow-x: auto;
  flex-grow: 1;
  flex-shrink: 1;
  min-width: 0; /* Important for flexbox to allow shrinking below content size */
  scrollbar-width: thin;
  scrollbar-color: #555555 #2d2d2d;
}

.editor-tab {
  display: flex;
  align-items: center;
  padding: 0 10px;
  height: 35px;
  background-color: var(--vscode-tab-inactiveBackground);
  color: var(--vscode-tab-inactiveForeground);
  border-right: 1px solid var(--vscode-tab-border);
  cursor: pointer;
  flex-shrink: 1;
  min-width: 100px; /* Minimum width before scrolling starts */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editor-tab.active {
  background-color: var(--vscode-tab-activeBackground);
  color: var(--vscode-tab-activeForeground);
}

/* Editor tab new button */
.editor-tab-new {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 35px;
  background-color: var(--vscode-tab-inactiveBackground);
  color: var(--vscode-tab-inactiveForeground);
  cursor: pointer;
  border: none;
  opacity: 0.7;
}

.editor-tab-new:hover {
  opacity: 1;
}

.tab-name {
  margin-right: 8px;
}

.tab-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 16px;
  padding: 0;
  cursor: pointer;
  opacity: 0.7;
}

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

.monaco-container {
  flex: 1;
  overflow: hidden;
  width: 100%;
  transition: height 0.2s ease;
}

/* Empty editor message */
.empty-editor-message {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #888888;
}

.empty-editor-message p {
  max-width: 300px;
  text-align: center;
}

/* Editor actions */
.editor-actions {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 100;
  display: flex;
}

.editor-action-button {
  background-color: #3c3c3c;
  color: #cccccc;
  border: none;
  border-radius: 3px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 5px;
  cursor: pointer;
}

.editor-action-button:hover {
  background-color: #4c4c4c;
}

.editor-action-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Panel */
.panel {
  border-top: 1px solid var(--vscode-panel-border);
  background-color: var(--vscode-panel-background);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-tabs {
  display: flex;
  background-color: #252526;
  border-bottom: 1px solid #1e1e1e;
  height: 36px;
  align-items: center;
  position: relative;
}

.panel-tab {
  display: flex;
  align-items: center;
  padding: 0 10px;
  height: 100%;
  color: #888888;
  cursor: pointer;
  color: var(--vscode-panelTitle-inactiveForeground, #969696);
  border-bottom: 1px solid transparent;
}

.panel-tab.active {
  background-color: var(--vscode-panel-background);
  color: #ffffff;
  color: var(--vscode-panelTitle-activeForeground, #ffffff);
  border-bottom: 1px solid var(--vscode-panelTitle-activeBorder, #007fd4);
}

.panel-tab:hover:not(.active) {
  color: var(--vscode-panelTitle-activeForeground, #ffffff);
}

.tab-icon {
  margin-right: 6px;
  margin-right: 5px;
  display: flex;
  align-items: center;
}

.panel-content {
  flex: 1;
  overflow: auto;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 13px;
  padding: 8px;
  padding: 10px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.4;
}

.panel-terminal,
.panel-problems,
.panel-output {
  height: 100%;
}

.panel-terminal .terminal-line {
  white-space: pre-wrap;
  margin-bottom: 3px;
}

.terminal-line {
  white-space: pre-wrap;
  line-height: 1.5;
}

.terminal-prompt {
  color: #0f0;
  margin-right: 8px;
  color: #569cd6;
  margin-right: 6px;
}

.terminal-output {
  color: #888888;
  color: #cccccc;
}

.terminal-warning {
  color: #ddb100;
}

.output-line {
  white-space: pre-wrap;
  line-height: 1.5;
  color: #888888;
  color: #cccccc;
  margin-bottom: 3px;
}

.terminal-cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background-color: #cccccc;
  animation: blink 1s step-end infinite;
  vertical-align: middle;
  margin-left: 2px;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.panel-empty-message {
  color: #888888;
  font-style: italic;
}

/* Status Bar */
.status-bar {
  height: 22px;
  background-color: var(--vscode-statusBar-background);
  color: var(--vscode-statusBar-foreground);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
  font-size: 12px;
}

.status-bar-left,
.status-bar-right {
  display: flex;
  align-items: center;
}

.status-item {
  display: flex;
  align-items: center;
  margin: 0 8px;
}

.status-item svg {
  margin-right: 4px;
}

.status-button {
  background: transparent;
  border: none;
  color: var(--vscode-statusBar-foreground);
  cursor: pointer;
  padding: 0;
}

.status-button:hover {
  text-decoration: underline;
}

/* Resize Handles */
.resize-handle {
  background-color: transparent;
  transition: background-color 0.2s;
}

.resize-handle:hover {
  background-color: #0078d4;
}

.resize-handle-horizontal {
  width: 5px;
  cursor: col-resize;
  height: 4px;
  background-color: #2d2d30;
  cursor: ns-resize;
  width: 100%;
}

.resize-handle-horizontal:hover {
  background-color: #007fd4;
}

.resize-handle-vertical {
  height: 5px;
  cursor: row-resize;
}

/* Editor Container */
.editor-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  position: relative;
  width: 100%;
}

/* Modal for new file */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.new-file-modal {
  background-color: #252526;
  padding: 30px;
  border-radius: 4px;
  width: 400px;
}

.new-file-modal h3 {
  margin-top: 0;
  color: #cccccc;
}

.new-file-modal input {
  width: 100%;
  padding: 5px 3px;
  background-color: #3c3c3c;
  color: #cccccc;
  border: 1px solid #1e1e1e;
  border-radius: 2px;
  margin-bottom: 15px;
}

.new-file-modal input:focus {
  outline: none;
  border-color: #007acc;
}

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

.modal-actions button {
  padding: 6px 12px;
  margin-left: 10px;
  border: none;
  border-radius: 2px;
  cursor: pointer;
}

.modal-actions button:first-child {
  background-color: transparent;
  color: #cccccc;
}

.modal-actions button:last-child {
  background-color: #007acc;
  color: white;
}

/* Editor container with sidebar */
.editor-container {
  display: flex;
  height: 100%;
  position: relative;
  width: 100%;
  overflow: hidden;
}

/* Explorer sidebar */
.explorer-sidebar {
  width: 250px;
  height: 100%;
  background-color: #252526;
  color: #cccccc;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #1e1e1e;
}

.explorer-sidebar.hidden {
  display: none;
}

.sidebar-header {
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #1e1e1e;
}

.sidebar-header h3 {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.6;
}

.sidebar-actions {
  display: flex;
}

.sidebar-actions button {
  background: transparent;
  border: none;
  color: #cccccc;
  cursor: pointer;
  padding: 2px;
  margin-left: 5px;
  opacity: 0.7;
}

.sidebar-actions button:hover {
  opacity: 1;
}

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

.sidebar-item {
  font-size: 13px;
  margin: 2px 0;
  cursor: pointer;
  border-radius: 3px;
}

.folder-item {
  display: flex;
  align-items: center;
  padding: 3px;
}

.folder-item:hover {
  background-color: #2a2d2e;
}

.folder-contents {
  padding-left: 12px;
}

.file-item {
  padding: 3px;
  display: flex;
  align-items: center;
}

.file-item:hover {
  background-color: #2a2d2e;
}

.file-item.active {
  background-color: #37373d;
}

.unsaved-indicator {
  margin-left: 5px;
  color: #cccccc;
  font-weight: bold;
}

/* Context menu */
.context-menu {
  background-color: #252526;
  border: 1px solid #3c3c3c;
  border-radius: 3px;
  padding: 5px 0;
  width: 150px;
  z-index: 1000;
}

.context-menu-item {
  padding: 5px 10px;
  font-size: 12px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.context-menu-item:hover {
  background-color: #2a2d2e;
}

.context-menu-item.delete {
  color: #ff6666;
}

/* Fixes for editor layout */
.editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Rename input */
.file-item input {
  background-color: #3c3c3c;
  border: 1px solid #007acc;
  color: #cccccc;
  font-size: 13px;
  padding: 1px 4px;
  width: calc(100% - 14px);
  outline: none;
}

.sidebar-action {
  background: transparent;
  border: none;
  color: #cccccc;
  cursor: pointer;
  padding: 2px;
  margin-left: 5px;
  opacity: 0.7;
}

.sidebar-action:hover {
  opacity: 1;
}

.unsaved-indicator {
  color: #cccccc;
}

/* Editor header with tabs and run controls */
.editor-header {
  display: flex;
  justify-content: space-between;
  background-color: var(--vscode-editorGroupHeader-tabsBackground);
  border-bottom: 1px solid var(--vscode-editorGroupHeader-tabsBorder);
  width: 100%;
  overflow: hidden;
}

.editor-tabs {
  display: flex;
  overflow-x: auto;
  flex-grow: 1;
  flex-shrink: 1;
  min-width: 0; /* Important for flexbox to allow shrinking below content size */
  scrollbar-width: thin;
  scrollbar-color: #555555 #2d2d2d;
}

.editor-tab {
  display: flex;
  align-items: center;
  padding: 0 10px;
  height: 35px;
  background-color: var(--vscode-tab-inactiveBackground);
  color: var(--vscode-tab-inactiveForeground);
  border-right: 1px solid var(--vscode-tab-border);
  cursor: pointer;
  flex-shrink: 1;
  min-width: 100px; /* Minimum width before scrolling starts */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editor-tab.active {
  background-color: var(--vscode-tab-activeBackground);
  color: var(--vscode-tab-activeForeground);
}

/* Run controls in the top right */
.editor-run-controls {
  display: flex;
  align-items: center;
  padding-right: 10px;
  flex-shrink: 0; /* Prevent shrinking */
}

.run-button {
  display: flex;
  align-items: center;
  padding: 4px 4px;
  margin-right: 8px;
  background-color: #1e1e1e;
  color: #cccccc;

  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap; /* Prevent wrapping */
  flex-shrink: 0; /* Prevent shrinking */
}

.run-button:hover {
  background-color: #4c4c4c;
}

.run-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.run-button svg {
  margin-right: 4px;
}

.terminal-toggle-button {
  background-color: transparent;
  border: none;
  color: #cccccc;
  cursor: pointer;
  opacity: 0.8;
  padding: 4px;
  display: flex;
  align-items: center;
}

.terminal-toggle-button:hover {
  opacity: 1;
}

/* Terminal panel */
.terminal-panel {
  height: 200px;
  background-color: #1e1e1e;
  border-top: 1px solid #333;
  display: flex;
  flex-direction: column;
}

.terminal-header {
  display: flex;
  justify-content: space-between;
  padding: 4px 8px;
  background-color: #252526;
  font-size: 12px;
}

.terminal-close {
  background: transparent;
  border: none;
  color: #cccccc;
  cursor: pointer;
  opacity: 0.7;
}

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

.terminal-content {
  flex: 1;
  padding: 8px;
  font-family: 'Consolas', monospace;
  font-size: 13px;
  overflow-y: auto;
  color: #cccccc;
}

.terminal-line {
  margin-bottom: 4px;
  white-space: pre-wrap;
}

.terminal-line.command {
  color: #569cd6;
}

.terminal-line.info {
  color: #75beff;
}

.terminal-line.output {
  color: #cccccc;
}

.terminal-line.warning {
  color: #ffcc00;
}

.terminal-line.error {
  color: #f44747;
}

.cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background-color: #cccccc;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* Make sure the monaco container adjusts when terminal is shown */
.monaco-container {
  flex: 1;
  overflow: hidden;
  width: 100%;
}

/* Update editor area to account for terminal panel */
.editor-area {
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: margin-left 0.2s ease;
}

/* Animation for the spinner */
.animate-spin {
  animation: spin 1s linear infinite;
}

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

/* Panel actions (close button) */
.panel-actions {
  margin-left: auto;
  padding-right: 8px;
  display: flex;
}

.panel-close-btn {
  background: transparent;
  border: none;
  color: #cccccc;
  cursor: pointer;
  opacity: 0.7;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel-close-btn:hover {
  opacity: 1;
}