/**
 * Workspace Navigator Sidebar
 * ===========================
 * File browser-style navigation for DM Tools and Homebrew Workshop
 */

/* Container */
.panel-workspace-navigator {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: linear-gradient(180deg, #1a1a1a 0%, #121212 100%);
  border-right: 1px solid rgba(255, 215, 0, 0.15);
  transition: width 0.25s ease, opacity 0.25s ease;
  min-width: 200px;
  max-width: 300px;
}

.navigator--collapsed {
  width: 0 !important;
  min-width: 0 !important;
  overflow: hidden;
  border-right: none;
  opacity: 0;
}

/* Header */
.navigator-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 14px;
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.08) 0%, transparent 100%);
  border-bottom: 1px solid rgba(255, 215, 0, 0.12);
  flex-shrink: 0;
}

.navigator-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #ffd700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.navigator-icon {
  display: flex;
  align-items: center;
  opacity: 0.9;
}

.navigator-icon svg {
  width: 18px;
  height: 18px;
}

.navigator-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--text-muted, #888);
  cursor: pointer;
  transition: all 0.15s ease;
}

.navigator-collapse-btn:hover {
  background: rgba(255, 215, 0, 0.15);
  border-color: rgba(255, 215, 0, 0.3);
  color: #ffd700;
}

.navigator-collapse-btn svg {
  width: 14px;
  height: 14px;
}

/* Search */
.navigator-search {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.navigator-search-icon {
  display: flex;
  align-items: center;
  color: var(--text-muted, #666);
  margin-right: 10px;
}

.navigator-search-icon svg {
  width: 14px;
  height: 14px;
}

.navigator-search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary, #e0e0e0);
  font-size: 13px;
  outline: none;
}

.navigator-search-input::placeholder {
  color: var(--text-muted, #555);
  font-style: italic;
}

/* Tree Container */
.navigator-tree {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 8px;
}

.tree-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 16px;
  color: var(--text-muted, #666);
  font-size: 13px;
}

.tree-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted, #555);
  font-size: 13px;
  font-style: italic;
}

/* Tree Nodes */
.tree-node {
  user-select: none;
}

.tree-node-content {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 8px 10px;
  cursor: pointer;
  border-radius: 6px;
  margin: 2px 4px;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.tree-node-content:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

.tree-node--selected > .tree-node-content {
  background: rgba(255, 215, 0, 0.12);
  border-color: rgba(255, 215, 0, 0.25);
}

.tree-node--selected > .tree-node-content .tree-label {
  color: #ffd700;
  font-weight: 500;
}

/* Category nodes have slightly different styling */
.tree-node--category > .tree-node-content {
  padding-top: 10px;
  padding-bottom: 10px;
}

.tree-node--category > .tree-node-content .tree-label {
  font-weight: 500;
  color: var(--text-primary, #e0e0e0);
}

/* Tree expand/collapse icon */
.tree-expand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-muted, #555);
  transition: all 0.15s ease;
  border-radius: 4px;
}

.tree-expand:hover {
  color: #ffd700;
  background: rgba(255, 215, 0, 0.1);
}

.tree-expand-spacer {
  display: inline-block;
  width: 18px;
  height: 18px;
}

/* Tree icon */
.tree-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--text-muted, #777);
  transition: color 0.15s ease;
}

.tree-node--category > .tree-node-content .tree-icon {
  color: #ffd700;
  opacity: 0.85;
}

.tree-node--item > .tree-node-content:hover .tree-icon {
  color: #ffd700;
}

.tree-icon svg {
  width: 16px;
  height: 16px;
}

/* Tree label */
.tree-label {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary, #aaa);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.tree-node--item > .tree-node-content:hover .tree-label {
  color: var(--text-primary, #e0e0e0);
}

/* Tree badge */
.tree-badge {
  padding: 2px 8px;
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  color: #ffd700;
  flex-shrink: 0;
}

/* Tree children container */
.tree-children {
  /* Indent is handled by padding-left on content */
}

/* Loading state for children */
.tree-loading-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  color: var(--text-muted, #666);
  font-size: 12px;
  font-style: italic;
}

.loading-spinner-small {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 215, 0, 0.2);
  border-top-color: #ffd700;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Expand button (shown when collapsed) */
.navigator-expand-btn {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 56px;
  padding: 0;
  background: linear-gradient(90deg, #1a1a1a 0%, #252525 100%);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-left: none;
  border-radius: 0 8px 8px 0;
  color: var(--text-muted, #777);
  cursor: pointer;
  z-index: 10;
  transition: all 0.15s ease;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
}

.navigator-expand-btn:hover {
  background: linear-gradient(90deg, #1a1a1a 0%, #2a2a2a 100%);
  border-color: rgba(255, 215, 0, 0.4);
  color: #ffd700;
}

.navigator-expand-btn svg {
  width: 16px;
  height: 16px;
}

/* Loading spinner */
.loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 215, 0, 0.2);
  border-top-color: #ffd700;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Scrollbar styling */
.navigator-tree::-webkit-scrollbar {
  width: 6px;
}

.navigator-tree::-webkit-scrollbar-track {
  background: transparent;
}

.navigator-tree::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 0, 0.2);
  border-radius: 3px;
}

.navigator-tree::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 215, 0, 0.35);
}

/* Divider between sections */
.tree-node--category:not(:first-child) > .tree-node-content {
  margin-top: 8px;
}

/* First level category styling (Dashboard, World Lore, etc.) */
.tree-node--category[data-node-id="dashboard"] > .tree-node-content,
.tree-node--category[data-node-id="w_dashboard"] > .tree-node-content,
.tree-node--item[data-node-id="dashboard"] > .tree-node-content,
.tree-node--item[data-node-id="w_dashboard"] > .tree-node-content {
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.08) 0%, transparent 100%);
  border-color: rgba(255, 215, 0, 0.12);
}

.tree-node--item[data-node-id="dashboard"] > .tree-node-content .tree-label,
.tree-node--item[data-node-id="w_dashboard"] > .tree-node-content .tree-label {
  font-weight: 600;
  color: #ffd700;
}
