@use '../../styles/mixins' as *;

// =============================================================================
// TaskList — global task tree sidebar view
// =============================================================================

.container {
  padding: var(--space-sm) 0;
}

.header {
  @include section-label;
  padding: var(--space-xs) var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.headerActions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.searchInput {
  @include input-field;
  display: block;
  margin: 0 var(--space-md) var(--space-xs);
  font-size: 11px;
  padding: 3px var(--space-sm);
  width: calc(100% - 2 * var(--space-md));
}

.searchHighlight {
  background: none;
  color: var(--accent-green);
  font-weight: 600;
}

.groupToggle {
  @include btn-ghost;
  font-size: var(--font-size-md);
  line-height: 1;
  padding: 1px 5px;
}

.groupToggleActive {
  color: var(--accent-green);
}

.addButton {
  @include btn-ghost;
  font-size: var(--font-size-sm);
  line-height: 1;
  padding: 1px 5px;
}

.taskRow {
  @include hover-accent;
  padding: 3px var(--space-md) 3px var(--task-indent, 16px);
  font-size: var(--font-size-sm);
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  border-radius: var(--radius-sm);
  margin: 0 var(--space-xs);
  animation: fadeIn 200ms ease forwards;

  &.selected {
    background: var(--bg-overlay);
    color: var(--text-primary);
  }

  @include mobile {
    padding-left: calc(var(--task-indent, 16px) * 0.6);
  }
}

.expandArrow {
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  width: 12px;
  display: inline-block;
  transition: transform var(--transition-fast);

  &.expanded {
    transform: rotate(90deg);
  }
}

.leafSpacer {
  width: 12px;
  display: inline-block;
}

.taskStatusIcon {
  font-size: 11px;
}

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

.workspaceBadge {
  @include surface-inset;
  font-size: 10px;
  color: var(--text-tertiary);
  border-radius: var(--radius-full);
  padding: 1px var(--space-xs);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.childCountBadge {
  @include surface-inset;
  font-size: 10px;
  color: var(--text-tertiary);
  border-radius: var(--radius-full);
  padding: 1px var(--space-xs);
}

.dependencyBadge {
  @include surface-inset;
  font-size: 10px;
  color: var(--text-tertiary);
  border-radius: var(--radius-full);
  padding: 1px var(--space-xs);

  &.blockedBadge {
    color: var(--accent-yellow);
    border-color: var(--accent-yellow);
  }
}

.addChildButton {
  @include btn-ghost;
  font-size: var(--font-size-xs);
  line-height: 1;
  padding: 1px var(--space-xs);
  opacity: 0;
  transition: opacity var(--transition-fast);

  .taskRow:hover & {
    opacity: 1;
  }

  .taskRow:focus-within & {
    opacity: 1;
  }

  &:focus-visible {
    opacity: 1;
  }

  @include mobile {
    opacity: 1;
  }
}

.emptyState {
  padding: var(--space-md);
  color: var(--text-tertiary);
  font-size: var(--font-size-sm);
  text-align: center;
}

// ---------------------------------------------------------------------------
// Status group accordion
// ---------------------------------------------------------------------------

.statusGroupHeader {
  @include hover-accent;
  padding: var(--space-sm) var(--space-md) var(--space-sm) 16px;
  font-size: var(--font-size-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  border-radius: var(--radius-sm);
  margin: 0 var(--space-xs);
}

.statusGroupIcon {
  font-size: 11px;
}

.statusGroupLabel {
  flex: 1;
  font-weight: 500;
}

.statusGroupCount {
  @include surface-inset;
  font-size: 10px;
  color: var(--text-tertiary);
  border-radius: var(--radius-full);
  padding: 1px var(--space-xs);
}
