/* Dark mode theme variables */
:root {
  --bg: #1e1e1e;
  --leftbar-bg: #252526;
  --leftbar-hover: #2a2d2e;
  --text: #d4d4d4;
  --text-dim: #8b8b8b;
  --border: #3e3e42;
  --accent: #0e639c;
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
}

/* Explorer fills the entire viewport via flexbox */
.explorer {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100vw;
  height: 100vh;
}

/* Left sidebar: fixed 300px, border-box sizing */
.leftbar {
  width: 300px;
  box-sizing: border-box;
  flex: 0 0 300px;
  background: var(--leftbar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Tools row: fixed 40px, buttons aligned to the right */
.tools {
  flex: 0 0 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 0 8px;
  border-bottom: 1px solid var(--border);
}

.tools-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  line-height: 1;
  padding: 5px 10px;
  border-radius: 3px;
  cursor: pointer;
}

.tools-btn:hover {
  background: var(--leftbar-hover);
}

/* Entries area: fills the remaining leftbar space below the tools row */
.entries {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.leftbar-title {
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.file-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Dynamic file entries (class "entry file") appended directly to .entries */
.entries > .entry.file {
  padding: 5px 16px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entries > .entry.file:hover {
  background: var(--leftbar-hover);
}

/* Dynamic dir entries (class "entry dir") appended directly to .entries */
.entries > .entry.dir {
  padding: 5px 16px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entries > .entry.dir:hover {
  background: var(--leftbar-hover);
}

/* SelectedEntry: selected entries get a highlighted background */
.entry.selected,
.entry.selected:hover,
.entries > .entry.selected,
.entries > .entry.selected:hover {
  background: var(--accent);
}

/* A dir's content is hidden until the "open" class is added to its dir entry */
.entry.dir > .dir-content {
  display: none;
  padding: 4px 0 4px 24px;
  font-size: 13px;
  color: var(--text-dim);
}

.entry.dir.open > .dir-content {
  display: block;
}

.file-list li {
  padding: 5px 16px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-list li:hover {
  background: var(--leftbar-hover);
}

.leftbar-status {
  margin-top: auto;
  padding: 8px 16px;
  font-size: 11px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Editor fills the remaining space next to the leftbar */
.editor {
  flex: 1 1 auto;
  width: auto;
  height: 100%;
  padding: 12px 16px;
  border: none;
  outline: none;
  resize: none;
  background: var(--bg);
  color: var(--text);
  font-family: "SF Mono", "Fira Code", Consolas, "Courier New", monospace;
  font-size: 14px;
  line-height: 1.5;
  caret-color: var(--text);
}

.editor::placeholder {
  color: var(--text-dim);
}

/* Drag & drop states (see common/drag.js) */

/* The entry currently being dragged fades out */
.entry.dragging {
  opacity: 0.4;
}

/* Drop indicator: the dragged entry would be inserted after the target */
.entry.drop-after {
  box-shadow: inset 0 -2px 0 0 var(--accent);
}

/* Drop indicator: the dragged entry would be appended inside the target dir */
.entry.drop-inside {
  outline: 1px dashed var(--accent);
  outline-offset: -1px;
}

/* Drop indicator: the dragged entry would be appended to the panel's end */
.entries.drop-end {
  box-shadow: inset 0 -3px 0 0 var(--accent);
}

/* Context menu for entries (see common/menu.js) */
.menu {
  position: fixed;
  z-index: 1000;
  display: none;
  min-width: 150px;
  padding: 4px 0;
  background: #303031;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  color: var(--text);
  user-select: none;
}

.menu.open {
  display: block;
}

.menu-item {
  padding: 5px 16px;
  cursor: pointer;
  white-space: nowrap;
}

.menu-item:hover {
  background: var(--accent);
}

/* Scrollbar styling for dark theme */
.entries::-webkit-scrollbar,
.editor::-webkit-scrollbar {
  width: 10px;
}

.entries::-webkit-scrollbar-thumb,
.editor::-webkit-scrollbar-thumb {
  background: #424242;
  border-radius: 5px;
}

.entries::-webkit-scrollbar-track,
.editor::-webkit-scrollbar-track {
  background: transparent;
}
