/* --- reset & base --- */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box }
html, body, #app { height:100%; overflow:hidden }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  color: #cccccc;
  background: #1e1e1e;
}
button {
  background: none; border: none; color: inherit; cursor: pointer;
  font-size: inherit; font-family: inherit;
}
input { font-size: inherit; font-family: inherit }

/* --- top bar --- */
#topbar {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: #323233;
  border-bottom: 1px solid #3c3c3c;
  user-select: none;
}
.topbar-left { font-size: 13px; color: #e0e0e0 }
.topbar-right { display: flex; align-items: center; gap: 16px }
#user-count { color: #888; font-size: 12px }

#storage-info {
  display: flex; align-items: center; gap: 8px;
}
#storage-bar-track {
  width: 100px; height: 4px; background: #4a4a4a; border-radius: 2px; overflow: hidden;
}
#storage-bar-fill {
  height: 100%; background: #007acc; border-radius: 2px; transition: width .3s;
}
#storage-text { color: #888; font-size: 12px; white-space: nowrap }

/* --- workspace layout --- */
#workspace { display: flex; height: calc(100% - 36px) }

/* --- sidebar --- */
#sidebar {
  width: 260px; min-width: 180px;
  background: #252526;
  border-right: 1px solid #3c3c3c;
  display: flex; flex-direction: column;
  user-select: none;
}
#sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px;
  height: 32px;
  font-size: 11px; font-weight: 600; letter-spacing: .05em;
  color: #888; text-transform: uppercase;
}
#sidebar-actions { display: flex; gap: 2px }
#sidebar-actions button {
  width: 22px; height: 22px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #ccc;
}
#sidebar-actions button:hover { background: #3c3c3c }

#sidebar-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding-bottom: 12px;
  position: relative;
}
#sidebar-scroll.root-selected {
  background: #37373d;
}
#tree-root {
  min-height: 100%;
}

/* --- tree --- */
.tree-row {
  display: flex; align-items: center;
  height: 22px; padding-left: 0;
  cursor: pointer; white-space: nowrap;
  user-select: none;
}
.tree-row:hover { background: #2a2d2e }
.tree-row.active { background: #37373d }
.tree-row.drag-over { background: #1a3a5c; outline: 1px dashed #007acc; outline-offset: -1px }
.tree-row.dragging { opacity: 0.4 }

.tree-toggle {
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 10px; color: #888;
}
.tree-toggle.codicon {
  font-size: 10px;
}
.tree-toggle.empty { visibility: hidden }

.tree-icon {
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  color: #c5c5c5;
}
.tree-icon.folder-icon     { color: #dcb67a }
.tree-icon.folder-icon.open { color: #dcb67a }
.tree-icon.file-icon       { color: #888 }

.tree-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis;
  padding-left: 2px; line-height: 22px;
}
.tree-name.folder { color: #cccccc }
.tree-name.file   { color: #cccccc }

/* inline rename input */
.tree-inline-input {
  flex: 1;
  height: 20px;
  padding: 0 4px;
  margin-left: 2px;
  background: #3c3c3c;
  border: 1px solid #007acc;
  border-radius: 2px;
  color: #e0e0e0;
  font-family: inherit;
  font-size: 13px;
  line-height: 20px;
  outline: none;
  min-width: 60px;
  width: 100%;
}
.tree-row.editing {
  background: #37373d;
}

/* --- main area --- */
.drag-over-area {
  background: rgba(0, 122, 204, 0.1);
  outline: 2px dashed #007acc;
  outline-offset: -2px;
}

#main {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0;
}
#main-toolbar {
  height: 32px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px;
  background: #252526;
  border-bottom: 1px solid #3c3c3c;
}
#selected-breadcrumb { color: #888; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
#file-actions { display: flex; gap: 4px }
#file-actions button {
  padding: 3px 10px; border-radius: 3px; font-size: 12px;
  color: #ccc;
}
#file-actions button:hover { background: #3c3c3c }
#btn-delete:hover { background: #5a1d1d !important; color: #f44747 }

#main-content { flex: 1; position: relative; overflow: hidden }

/* --- drop zone --- */
#drop-zone {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
#drop-zone.drag-over { background: #1a3a5c }
.drop-inner { text-align: center }
.drop-title { font-size: 15px; color: #888; margin-bottom: 6px }
.drop-hint { font-size: 12px; color: #666 }

/* --- sidebar drop zone --- */
#sidebar-drop-zone {
  border-top: 1px solid #3c3c3c;
  padding: 8px 12px;
  font-size: 11px;
  color: #888;
  cursor: pointer;
  transition: background .15s;
  min-height: 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
#sidebar-drop-zone.drag-over {
  background: #1a3a5c;
  color: #ccc;
}
#sidebar-drop-inner {
  display: flex;
  align-items: center;
  gap: 6px;
}
#sidebar-drop-inner .codicon {
  font-size: 14px;
}

/* --- upload progress --- */
#upload-progress {
  margin-bottom: 6px;
}
#upload-progress-bar {
  width: 100%;
  height: 3px;
  background: #4a4a4a;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 3px;
}
#upload-progress-fill {
  height: 100%;
  width: 0%;
  background: #007acc;
  border-radius: 2px;
  transition: width .15s;
}
#upload-progress-text {
  font-size: 10px;
  color: #888;
  display: block;
  text-align: center;
}

/* --- preview iframe --- */
#preview-frame {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: none; background: #1e1e1e;
}

/* --- context menu --- */
#ctx-menu {
  position: fixed;
  background: #252526;
  border: 1px solid #454545;
  border-radius: 4px;
  padding: 4px 0;
  min-width: 180px;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,.36);
  font-size: 13px;
}
.ctx-item {
  display: flex; align-items: center;
  padding: 4px 16px;
  cursor: pointer;
  color: #cccccc;
  height: 24px;
}
.ctx-item:hover { background: #094771; color: #fff }
.ctx-icon {
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  margin-right: 6px;
  font-size: 14px;
  color: #888;
  flex-shrink: 0;
}
.ctx-item:hover .ctx-icon { color: #fff }
.ctx-shortcut {
  margin-left: auto;
  padding-left: 24px;
  color: #888;
  font-size: 12px;
}
.ctx-item:hover .ctx-shortcut { color: #ccc }
.ctx-sep {
  height: 1px;
  background: #454545;
  margin: 4px 16px;
}
/* --- scrollbar --- */
::-webkit-scrollbar { width: 8px; height: 8px }
::-webkit-scrollbar-track { background: transparent }
::-webkit-scrollbar-thumb { background: #424242; border-radius: 4px }
::-webkit-scrollbar-thumb:hover { background: #555 }
