/* Den — Run Tree Panel */
/* All colors use VS Code theme variables so the panel matches any theme. */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--vscode-font-family);
  font-size: var(--vscode-font-size, 13px);
  color: var(--vscode-foreground);
  background: var(--vscode-editor-background);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header ── */

.header {
  flex-shrink: 0;
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--vscode-panel-border);
  background: var(--vscode-editor-background);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header__title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.header__title h1 {
  font-size: 14px;
  font-weight: 600;
  color: var(--vscode-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

.header__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--vscode-descriptionForeground);
}

/* ── Status dot ── */

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot--running {
  background: var(--vscode-charts-blue);
  animation: pulse 1.5s ease-in-out infinite;
}

.status-dot--succeeded {
  background: var(--vscode-charts-green);
}

.status-dot--failed {
  background: var(--vscode-charts-red);
}

.status-dot--pending {
  background: var(--vscode-charts-yellow);
}

.status-dot--unknown {
  background: var(--vscode-descriptionForeground);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Badges ── */

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--vscode-badge-background);
  color: var(--vscode-badge-foreground);
  white-space: nowrap;
}

.badge--status.badge--running {
  background: color-mix(in srgb, var(--vscode-charts-blue) 20%, transparent);
  color: var(--vscode-charts-blue);
}

.badge--status.badge--succeeded {
  background: color-mix(in srgb, var(--vscode-charts-green) 20%, transparent);
  color: var(--vscode-charts-green);
}

.badge--status.badge--failed {
  background: color-mix(in srgb, var(--vscode-charts-red) 20%, transparent);
  color: var(--vscode-charts-red);
}

.badge--status.badge--pending,
.badge--status.badge--queued {
  background: color-mix(in srgb, var(--vscode-charts-yellow) 20%, transparent);
  color: var(--vscode-charts-yellow);
}

.badge--status.badge--awaiting_approval {
  background: color-mix(in srgb, var(--vscode-charts-orange, var(--vscode-charts-yellow)) 20%, transparent);
  color: var(--vscode-charts-orange, var(--vscode-charts-yellow));
}

.badge--status.badge--escalated {
  background: color-mix(in srgb, var(--vscode-charts-purple, var(--vscode-charts-red)) 20%, transparent);
  color: var(--vscode-charts-purple, var(--vscode-charts-red));
}

/* ── Tree ── */

.tree-container {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.tree__empty {
  padding: 32px 16px;
  color: var(--vscode-descriptionForeground);
  text-align: center;
  font-style: italic;
}

ul.tree-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

ul.tree-list ul.tree-list {
  padding-left: 20px;
  border-left: 1px solid color-mix(in srgb, var(--vscode-panel-border) 50%, transparent);
  margin-left: 8px;
}

.tree-node {
  padding: 4px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--vscode-panel-border) 30%, transparent);
  line-height: 1.5;
}

.tree-node:last-child {
  border-bottom: none;
}

.tree-node .node-state {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.node-state--running {
  background: color-mix(in srgb, var(--vscode-charts-blue) 20%, transparent);
  color: var(--vscode-charts-blue);
}

.node-state--succeeded {
  background: color-mix(in srgb, var(--vscode-charts-green) 20%, transparent);
  color: var(--vscode-charts-green);
}

.node-state--failed {
  background: color-mix(in srgb, var(--vscode-charts-red) 20%, transparent);
  color: var(--vscode-charts-red);
}

.node-state--queued,
.node-state--pending {
  background: color-mix(in srgb, var(--vscode-charts-yellow) 20%, transparent);
  color: var(--vscode-charts-yellow);
}

.node-state--awaiting_approval {
  background: color-mix(in srgb, var(--vscode-charts-orange, var(--vscode-charts-yellow)) 20%, transparent);
  color: var(--vscode-charts-orange, var(--vscode-charts-yellow));
}

.node-state--paused {
  background: color-mix(in srgb, var(--vscode-charts-blue, var(--vscode-charts-yellow)) 20%, transparent);
  color: var(--vscode-charts-blue, var(--vscode-charts-yellow));
}

.node-state--escalated {
  background: color-mix(in srgb, var(--vscode-charts-purple, var(--vscode-charts-red)) 20%, transparent);
  color: var(--vscode-charts-purple, var(--vscode-charts-red));
}

.tree-node .node-name {
  flex: 1;
  color: var(--vscode-foreground);
  font-size: var(--vscode-font-size, 13px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-node .node-elapsed {
  font-size: 11px;
  color: var(--vscode-descriptionForeground);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Footer ── */

.footer {
  flex-shrink: 0;
  padding: 4px 16px;
  border-top: 1px solid var(--vscode-panel-border);
  font-size: 11px;
  color: var(--vscode-descriptionForeground);
  background: var(--vscode-editor-background);
}
