/**
 * TreeNavigation Styles
 * 
 * Flexible hierarchical navigation with support for:
 * - Dynamic sublevels
 * - Sections and separators
 * - Various visual states (active, disabled, hover)
 */

.treeNavigation {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0 0.5rem;
}

/* ============================================ */
/* SEPARATOR                                    */
/* ============================================ */

.separator {
  height: 1px;
  background: var(--border-color, #e0e0e0);
  margin: 0.75rem 0.5rem;
}

/* ============================================ */
/* SECTION                                      */
/* ============================================ */

.treeSection {
  margin-bottom: 0.5rem;
}

.sectionHeader {
  padding: 0.5rem 0.75rem;
}

.sectionTitle {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-tertiary, #888);
  text-transform: uppercase;
}

.sectionContent {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ============================================ */
/* TREE NODE                                    */
/* ============================================ */

.treeNodeContainer {
  display: flex;
  flex-direction: column;
}

.treeNode {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  text-align: left;
  color: var(--text-secondary, #666);
  font-size: 0.875rem;
  transition: all 0.15s ease;
}

.treeNode:hover {
  background: var(--hover-bg, rgba(0, 0, 0, 0.04));
  color: var(--text-primary, #1a1a1a);
}

.treeNode.active {
  background: var(--primary-light, #e0e7ff);
  color: var(--primary-color, #2563eb);
  font-weight: 500;
}

.treeNode.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================ */
/* LEVEL-SPECIFIC STYLES                        */
/* ============================================ */

/* Root level (level 0) */
.levelRoot {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary, #1a1a1a);
  padding: 0.625rem 0.75rem;
}

.levelRoot .nodeLabel {
  flex: 1;
}

/* Level 1 */
.levelOne {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary, #666);
  padding: 0.5rem 0.75rem;
}

/* Level 2 */
.levelTwo {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary, #666);
  padding: 0.375rem 0.5rem;
}

/* Level 3 */
.levelThree {
  font-size: 0.75rem;
  color: var(--text-secondary, #666);
  padding: 0.375rem 0.5rem;
}

/* Deep levels (4+) */
.levelDeep {
  font-size: 0.6875rem;
  color: var(--text-tertiary, #888);
  padding: 0.25rem 0.5rem;
}

/* ============================================ */
/* NODE CHILDREN (INDENTATION)                  */
/* ============================================ */

.treeNodeChildren {
  margin-left: 0.25rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--border-color, #e0e0e0);
}

/* Active parent highlights the border */
.treeNodeContainer:has(> .treeNode.active) > .treeNodeChildren {
  border-left-color: var(--primary-color, #2563eb);
}

/* Also highlight if any descendant is active */
.treeNodeContainer:has(.treeNode.active) > .treeNodeChildren {
  border-left-color: var(--primary-light, #93c5fd);
}

/* ============================================ */
/* NODE ELEMENTS                                */
/* ============================================ */

.chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  font-size: 0.625rem;
  color: var(--text-tertiary, #888);
  flex-shrink: 0;
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.1s ease;
}

.chevron:hover {
  background: var(--hover-bg, rgba(0, 0, 0, 0.06));
}

.chevronSpacer {
  width: 1rem;
  flex-shrink: 0;
}

.nodeIcon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  color: inherit;
}

.nodeLabel {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nodeBadge {
  font-size: 0.625rem;
  padding: 0.0625rem 0.375rem;
  background: var(--surface-color, #f0f0f0);
  border-radius: 9999px;
  color: var(--text-tertiary, #888);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  flex-shrink: 0;
}

/* Badge variants */
.badgePrimary {
  background: var(--primary-color, #2563eb);
  color: white;
}

.badgeSuccess {
  background: var(--success-color, #22c55e);
  color: white;
}

.badgeWarning {
  background: var(--warning-color, #f59e0b);
  color: white;
}

/* Active node badge */
.treeNode.active .nodeBadge {
  background: var(--primary-color, #2563eb);
  color: white;
}

/* ============================================ */
/* DARK THEME                                   */
/* ============================================ */

:global(.dark-theme) .separator {
  background: var(--border-dark, #333);
}

:global(.dark-theme) .sectionTitle {
  color: var(--text-tertiary-dark, #666);
}

:global(.dark-theme) .treeNode {
  color: var(--text-secondary-dark, #aaa);
}

:global(.dark-theme) .treeNode:hover {
  background: var(--hover-bg-dark, rgba(255, 255, 255, 0.06));
  color: var(--text-primary-dark, #fff);
}

:global(.dark-theme) .treeNode.active {
  background: var(--primary-dark-bg, #1e3a5f);
  color: var(--primary-light, #93c5fd);
}

:global(.dark-theme) .levelRoot {
  color: var(--text-primary-dark, #fff);
}

:global(.dark-theme) .levelOne,
:global(.dark-theme) .levelTwo,
:global(.dark-theme) .levelThree {
  color: var(--text-secondary-dark, #aaa);
}

:global(.dark-theme) .levelDeep {
  color: var(--text-tertiary-dark, #888);
}

:global(.dark-theme) .treeNodeChildren {
  border-left-color: var(--border-dark, #444);
}

:global(.dark-theme) .treeNodeContainer:has(.treeNode.active) > .treeNodeChildren {
  border-left-color: var(--primary-light, #93c5fd);
}

:global(.dark-theme) .nodeBadge {
  background: var(--surface-dark, #2a2a2a);
  color: var(--text-tertiary-dark, #888);
}

:global(.dark-theme) .chevron {
  color: var(--text-tertiary-dark, #666);
}

:global(.dark-theme) .chevron:hover {
  background: var(--hover-bg-dark, rgba(255, 255, 255, 0.1));
}

:global(.dark-theme) .treeNode.active .nodeBadge {
  background: var(--primary-color, #2563eb);
  color: white;
}
