/* File Tree, File Search, Cmd+P Palette */

/* Tree Styles (used by dashboard file browser) */
.tree-item {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  cursor: pointer;
  user-select: none;
}

.tree-item:hover {
  background: var(--bg-secondary);
}

.tree-item.selected {
  background: var(--tab-active);
}

.tree-item-icon {
  width: 16px;
  height: 16px;
  margin-right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
}

.tree-item-icon.folder-toggle {
  cursor: pointer;
}

.tree-item-icon.folder-toggle:hover {
  color: var(--text-secondary);
}

.tree-item-name {
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-item:hover .tree-item-name {
  color: var(--text-primary);
}

.tree-item[data-type="dir"] .tree-item-name {
  color: var(--text-primary);
}

.tree-item[data-type="file"]:hover .tree-item-name {
  color: var(--accent);
}

.tree-children {
  overflow: hidden;
}

.tree-children.collapsed {
  display: none;
}

/* Dashboard Tab Styles (Spec 0057) */
.dashboard-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.dashboard-header {
  display: flex;
  gap: 16px;
  padding: 16px;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .dashboard-header {
    flex-direction: column;
  }
}

/* Collapsible section styles */
.dashboard-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dashboard-section.section-tabs,
.dashboard-section.section-files {
  flex: 1;
  max-height: 280px;
}

.dashboard-section.section-projects {
  flex: 0 0 auto;
  margin: 0 16px 16px 16px;
  max-height: 50%;
  overflow-y: auto;
}

.dashboard-section.section-projects .dashboard-section-content {
  flex: 0 0 auto;
}

/* Tabs/Files expand to fill remaining space above Projects */
.dashboard-header {
  flex: 1;
  min-height: 0;
}

.dashboard-section.section-tabs,
.dashboard-section.section-files {
  max-height: none;
}

.dashboard-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.dashboard-section-header:hover {
  background: var(--bg-tertiary);
}

.dashboard-section-header h3 {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dashboard-section-header .collapse-icon {
  font-size: 10px;
  transition: transform 0.2s;
}

.dashboard-section.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

.dashboard-section.collapsed .dashboard-section-header {
  border-bottom: none;
}

.dashboard-section-header .header-actions {
  display: flex;
  gap: 4px;
}

.dashboard-section-header .header-actions button {
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
}

.dashboard-section-header .header-actions button:hover {
  background: var(--tab-hover);
  color: var(--text-primary);
}

.dashboard-section-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}

.dashboard-section.collapsed .dashboard-section-content {
  display: none;
}

/* Legacy support */
.dashboard-column {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 280px;
}

.dashboard-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.dashboard-column-header h3 {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin: 0;
}

.dashboard-column-header .header-actions {
  display: flex;
  gap: 4px;
}

.dashboard-column-header .header-actions button {
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
}

.dashboard-column-header .header-actions button:hover {
  background: var(--tab-hover);
  color: var(--text-primary);
}

.dashboard-tabs-list {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 8px;
}

.dashboard-tab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
}

.dashboard-tab-item:hover {
  background: var(--bg-tertiary);
}

.dashboard-tab-item.active {
  background: var(--accent);
  color: white;
}

.dashboard-tab-item .tab-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.dashboard-tab-item .tab-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-actions {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
}

.dashboard-actions .btn-action {
  flex: 1;
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.dashboard-actions .btn-action:hover {
  border-style: solid;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}

.dashboard-files-list {
  flex: 1;
  overflow-y: auto;
}

.dashboard-files-list .tree-item {
  padding: 3px 6px;
  font-size: 12px;
}

.dashboard-files-list .tree-item-name {
  font-size: 12px;
}

/* File search styles (Spec 0058) */
.files-search-container {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  gap: 6px;
  border-bottom: 1px solid var(--border);
}

.files-search-input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-primary);
  outline: none;
}

.files-search-input:focus {
  border-color: var(--accent);
}

.files-search-input::placeholder {
  color: var(--text-muted);
}

.files-search-clear {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}

.files-search-clear:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.files-search-clear.hidden {
  display: none;
}

.files-search-results {
  flex: 1;
  overflow-y: auto;
}

.files-search-result {
  padding: 6px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.files-search-result:hover,
.files-search-result.selected {
  background: var(--bg-tertiary);
}

.files-search-result-name {
  font-size: 12px;
  color: var(--text-primary);
}

.files-search-result-path {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.files-search-highlight {
  color: var(--accent);
  font-weight: 500;
}

/* Cmd+P Palette styles (Spec 0058) */
.file-palette {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  padding-top: 80px;
}

.file-palette.hidden {
  display: none;
}

.file-palette-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.file-palette-container {
  position: relative;
  width: 500px;
  max-width: 90vw;
  max-height: 450px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.file-palette-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border: none;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
}

.file-palette-input::placeholder {
  color: var(--text-muted);
}

.file-palette-results {
  flex: 1;
  overflow-y: auto;
  max-height: 380px;
}

.file-palette-result {
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-palette-result:hover,
.file-palette-result.selected {
  background: var(--bg-tertiary);
}

.file-palette-result-name {
  font-size: 13px;
  color: var(--text-primary);
}

.file-palette-result-path {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-palette-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.dashboard-empty-state {
  color: var(--text-muted);
  font-size: 13px;
  padding: 12px;
  text-align: center;
}

/* Action items for creating new shells/worktrees */
.dashboard-tab-action {
  border: 1px dashed var(--border);
  margin-bottom: 4px;
  color: var(--text-muted);
}

.dashboard-tab-action:hover {
  border-style: solid;
  border-color: var(--accent);
  color: var(--text-secondary);
}

.dashboard-tab-action .tab-icon {
  color: var(--accent);
  font-weight: 500;
}

/* Status indicators in dashboard tab list */
.dashboard-status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dashboard-status-working {
  background: var(--status-active);
  animation: status-pulse 2s ease-in-out infinite;
}

.dashboard-status-idle {
  background: var(--status-waiting);
  animation: status-blink-slow 3s ease-in-out infinite;
}

.dashboard-status-blocked {
  background: var(--status-error);
  animation: status-blink-fast 0.8s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-status-working,
  .dashboard-status-idle,
  .dashboard-status-blocked {
    animation: none;
  }
}
