/* ============================================================
   FILES / NAUTILUS WINDOW
   ============================================================ */
#files-window {
  top: 50px;
  left: 120px;
  width: 780px;
  height: 500px;
  min-width: 480px;
  min-height: 320px;
  z-index: 15;
  background: #1e1e1e;
  font-family: 'Ubuntu', 'Segoe UI', sans-serif;
  color: #eee;
}

/* --- Files Header Bar --- */
#files-header {
  display: flex;
  align-items: center;
  background: #2d2d2d;
  padding: 0 8px;
  height: 38px;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  border-bottom: 1px solid #3a3a3a;
  gap: 6px;
}
#files-header:active { cursor: grabbing; }

/* Nav buttons (back / forward / up) */
.files-nav-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  color: #aaa;
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}
.files-nav-btn:hover { background: rgba(255,255,255,0.10); color: #fff; }
.files-nav-btn.disabled { opacity: 0.3; pointer-events: none; }
.files-nav-btn svg { width: 16px; height: 16px; fill: currentColor; }

/* Breadcrumb / path bar */
#files-pathbar {
  flex: 1;
  display: flex;
  align-items: center;
  background: #252525;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  padding: 0 4px;
  height: 28px;
  min-width: 0;
  overflow: hidden;
}
.files-crumb {
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12.5px;
  color: #bbb;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
  flex-shrink: 0;
}
.files-crumb:hover { background: rgba(255,255,255,0.08); color: #fff; }
.files-crumb.active { color: #fff; font-weight: 500; }
.files-crumb-sep {
  color: #555;
  font-size: 11px;
  flex-shrink: 0;
  padding: 0 1px;
}

/* View toggle */
.files-view-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  color: #888;
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}
.files-view-btn:hover { background: rgba(255,255,255,0.10); color: #fff; }
.files-view-btn.active { color: var(--accent-color); }
.files-view-btn svg { width: 16px; height: 16px; fill: currentColor; }

/* --- Files Body (sidebar + content) --- */
#files-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* --- Files Sidebar --- */
#files-sidebar {
  width: 170px;
  flex-shrink: 0;
  background: #252525;
  border-right: 1px solid #3a3a3a;
  overflow-y: auto;
  padding: 8px 0;
}
#files-sidebar::-webkit-scrollbar { width: 4px; }
#files-sidebar::-webkit-scrollbar-thumb { background: #444; border-radius: 2px; }

.files-sidebar-label {
  font-size: 10px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 8px 14px 4px;
}

.files-place {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 12.5px;
  color: #ccc;
  transition: background 0.12s, color 0.12s;
  border-radius: 6px;
  margin: 1px 6px;
}
.files-place:hover { background: rgba(255,255,255,0.07); color: #fff; }
.files-place.active { background: color-mix(in srgb, var(--accent-color) 15%, transparent); color: var(--accent-color); }
.files-place svg { width: 16px; height: 16px; fill: currentColor; flex-shrink: 0; }

/* --- Files Content Area --- */
#files-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #1e1e1e;
  min-width: 0;
}
#files-content::-webkit-scrollbar { width: 6px; }
#files-content::-webkit-scrollbar-track { background: transparent; }
#files-content::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }

/* --- Status Bar --- */
#files-statusbar {
  background: #252525;
  border-top: 1px solid #3a3a3a;
  padding: 4px 14px;
  font-size: 11px;
  color: #888;
  flex-shrink: 0;
}

/* --- Grid View --- */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 4px;
}

.files-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
  user-select: none;
}
.files-grid-item:hover { background: rgba(255,255,255,0.06); }
.files-grid-item.selected { background: color-mix(in srgb, var(--accent-color) 20%, transparent); }
.files-grid-item .files-icon { width: 48px; height: 48px; margin-bottom: 6px; }
.files-grid-item .files-icon svg { width: 100%; height: 100%; }
.files-grid-item .files-name {
  font-size: 11.5px;
  color: #ddd;
  text-align: center;
  word-break: break-word;
  line-height: 1.3;
  max-width: 88px;
}
.files-grid-item .files-name.hidden-file { color: #777; }

/* --- List View --- */
.files-list {
  display: flex;
  flex-direction: column;
}

.files-list-header {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #333;
}
.files-list-header span:nth-child(1) { flex: 1; }
.files-list-header span:nth-child(2) { width: 80px; text-align: right; }
.files-list-header span:nth-child(3) { width: 100px; text-align: right; padding-right: 4px; }

.files-list-item {
  display: flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}
.files-list-item:hover { background: rgba(255,255,255,0.06); }
.files-list-item.selected { background: color-mix(in srgb, var(--accent-color) 20%, transparent); }
.files-list-item .files-icon { width: 24px; height: 24px; margin-right: 10px; flex-shrink: 0; }
.files-list-item .files-icon svg { width: 100%; height: 100%; }
.files-list-item .files-name { flex: 1; font-size: 13px; color: #ddd; }
.files-list-item .files-name.hidden-file { color: #777; }
.files-list-item .files-size { width: 80px; text-align: right; font-size: 12px; color: #888; }
.files-list-item .files-perm { width: 100px; text-align: right; font-size: 11px; color: #666; font-family: 'Ubuntu Mono', monospace; padding-right: 4px; }

/* --- File Preview Overlay --- */
#files-preview {
  display: none;
  position: absolute;
  top: 38px;
  left: 0;
  right: 0;
  bottom: 0;
  background: #1e1e1e;
  z-index: 50;
  flex-direction: column;
}
#files-preview.active { display: flex; }

#files-preview-header {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  gap: 10px;
  border-bottom: 1px solid #3a3a3a;
  background: #252525;
}
#files-preview-header .files-preview-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
}
#files-preview-close {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  color: #aaa;
  font-size: 15px;
  transition: background 0.12s, color 0.12s;
}
#files-preview-close:hover { background: var(--accent-color); color: #fff; }

#files-preview-body {
  flex: 1;
  overflow: auto;
  padding: 16px 20px;
  font-family: 'Ubuntu Mono', 'Fira Code', monospace;
  font-size: 13px;
  color: #ccc;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* --- Empty state --- */
.files-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #555;
  font-size: 14px;
  gap: 8px;
}
.files-empty svg { width: 48px; height: 48px; fill: #444; }
