* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0a0a0a; color: #d4d4d4; font-family: system-ui, sans-serif; }

#main-container {
  display: flex;
  height: 100%;
}

/* Sidebar */
#sidebar {
  width: 220px;
  min-width: 220px;
  background: #0f0f0f;
  border-right: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.15s, min-width 0.15s;
}
#sidebar.collapsed {
  width: 0;
  min-width: 0;
  border-right: none;
}
#sidebar-header {
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #9f9f9f;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
#add-file-btn {
  background: none;
  border: none;
  color: #9f9f9f;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
#add-file-btn:hover { color: #ff014f; }
#file-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.file-item {
  display: flex;
  align-items: center;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
  color: rgba(255,255,255,0.7);
  position: relative;
}
.file-item:hover { background: rgba(255,255,255,0.05); }
.file-item.active { background: rgba(255,1,79,0.1); color: #fff; }
.file-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-item-icon {
  margin-right: 6px;
  font-size: 12px;
  color: #ff014f;
}
.file-item-delete {
  background: none;
  border: none;
  color: rgba(255,255,255,0.3);
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
  visibility: hidden;
  line-height: 1;
}
.file-item:hover .file-item-delete { visibility: visible; }
.file-item-delete:hover { color: #ff014f; }

/* Workspace */
#workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Tab bar */
#tab-bar {
  height: 35px;
  min-height: 35px;
  background: #0f0f0f;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
#toggle-sidebar-btn {
  width: 40px;
  min-width: 40px;
  background: none;
  border: none;
  border-right: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.4);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
#toggle-sidebar-btn:hover { color: rgba(255,255,255,0.7); background: rgba(255,255,255,0.05); }
#tabs {
  display: flex;
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
}
#tabs::-webkit-scrollbar { height: 0; }
.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  background: #111;
  border-right: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  white-space: nowrap;
  min-width: 0;
}
.tab:hover { color: rgba(255,255,255,0.8); }
.tab.active {
  color: #fff;
  background: #0a0a0a;
  border-bottom: 2px solid #ff014f;
  margin-bottom: -1px;
}
.tab-close {
  background: none;
  border: none;
  color: transparent;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  border-radius: 3px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tab:hover .tab-close { color: rgba(255,255,255,0.5); }
.tab .tab-close:hover { color: #fff; background: rgba(255,255,255,0.1); }

#editor { width: 100%; flex: 1; min-height: 0; overflow: hidden; }

/* Make the cursor change global and unselectable during resize */
body.resizing {
  cursor: ns-resize !important;
  user-select: none !important;
  -webkit-user-select: none; /* For Safari */
}

/* Add a transparent overlay to capture mouse events everywhere during resize */
body.resizing::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: transparent;
  /* Use a max z-index to ensure it's on top of everything, including Monaco */
  z-index: 2147483647;
}

/* Output panel */
#output-panel {
  width: 100%;
  height: 200px;
  min-height: 60px;
  background: #060606;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
#output-header {
  height: 32px;
  cursor: ns-resize;
  min-height: 32px;
  background: #0f0f0f;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
#output-header button {
  padding: 2px 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
}
#run-btn {
  background: #ff014f;
  color: #fff;
}
#run-btn:hover { background: #ff2068; }
#run-btn:disabled { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.3); cursor: not-allowed; }
#clear-btn {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.7);
}
#clear-btn:hover { background: rgba(255,255,255,0.12); }
#status {
  margin-left: auto;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}
#output {
  flex: 1;
  padding: 8px 12px;
  overflow-y: scroll;
  font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}
#output::-webkit-scrollbar { width: 14px; }
#output::-webkit-scrollbar-track { background: #060606; }
#output::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border: 3px solid #060606; border-radius: 7px; }
#output::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }
.output-error { color: #ff014f; }
.output-success { color: #89d185; }
.output-info { color: rgba(255,255,255,0.4); }
