/* Transcript presentation (transcript-ux.js): tool groups, the chat outline
   rail and the subagent pills. */

/* ---- Tool groups: consecutive tool calls as one summary row ---- */

.cc-tool-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.cc-tool-group-head {
  display: flex;
  align-items: baseline;
  gap: 0;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.cc-tool-group-head:hover .cc-tool-group-label {
  color: var(--text);
}

.cc-tool-group-head:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

.cc-tool-group-dot {
  color: var(--ok);
}

.cc-tool-group-dot.is-running {
  color: var(--accent);
  animation: cc-pulse 1.2s ease-in-out infinite;
}

.cc-tool-group-icons {
  display: inline-flex;
  gap: 3px;
  margin-right: 7px;
  align-self: center;
  color: var(--text-faint);
}

.cc-tool-group-icons svg {
  width: 12px;
  height: 12px;
}

.cc-tool-group-label {
  min-width: 0;
  color: var(--text-secondary);
}

.cc-tool-group-failed {
  color: var(--danger, #c4453c);
  white-space: nowrap;
}

.cc-tool-group-head .cc-tool-group-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cc-tool-group-head .cc-chevron {
  margin-left: 8px;
}

.cc-tool-group-items {
  display: flex;
  flex-direction: column;
  gap: 7px;
  /* The group's steps hang under its summary, a step in. */
  padding-left: 14px;
  border-left: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  margin-left: calc(var(--cc-glyph) / 2);
}

.cc-tool-group-items > .cc-entry .cc-bullet {
  width: calc(var(--cc-glyph) / 2);
  margin-right: 8px;
}

.cc-tool-group:not(.is-open) > .cc-tool-group-items {
  display: none;
}

/* The live call slides into a single reserved line, independently of history. */
.cc-tool-ticker {
  box-sizing: border-box;
  height: 25px;
  margin: 4px 0 0 var(--cc-gutter);
  overflow: hidden;
}

.cc-tool-ticker-row {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 100%;
  padding-left: 10px;
  border-left: 1px solid var(--border);
  color: var(--text-secondary);
  animation: cc-ticker-enter 160ms ease-out;
}

.cc-tool-ticker-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}

.cc-tool-ticker-row[data-status='running'] .cc-tool-ticker-dot {
  background: var(--accent);
}

.cc-tool-ticker-row:is([data-status='error'], [data-status='failed']) .cc-tool-ticker-dot {
  background: var(--danger);
}

.cc-tool-ticker-row:is(
    [data-status='stopped'],
    [data-status='cancelled'],
    [data-status='incomplete'],
    [data-status='unknown']
  )
  .cc-tool-ticker-dot {
  background: var(--text-faint);
}

.cc-tool-ticker-label,
.cc-tool-ticker-target {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cc-tool-ticker-target {
  flex-shrink: 1000;
  color: var(--text-muted);
  background: var(--surface-muted);
  border-radius: var(--radius-xs);
  padding-inline: 5px;
}

.cc-tool-ticker-target:empty,
.cc-tool-ticker-outcome:empty {
  display: none;
}

.cc-tool-ticker-outcome {
  flex: none;
  color: var(--text-muted);
  font-size: 11px;
}

@keyframes cc-ticker-enter {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cc-tool-ticker-row {
    animation: none;
  }
}

/* ---- Chat outline: one tick per prompt on the transcript's right edge ---- */

.chat-outline {
  position: absolute;
  right: 18px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 30px;
}

.chat-outline[hidden] {
  display: none;
}

/* A pane without a gutter for the rail gives the column up for one. */
.chat-scroll-outlined > .chat-messages {
  width: min(720px, calc(100% - 56px));
}

.chat-outline-tick {
  --m: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 1 10px;
  min-height: 3px;
  width: 30px;
  padding: 0 2px 0 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.chat-outline-pill {
  display: block;
  /* Grows leftward from one right edge: the magnification reads as a bulge
     travelling with the pointer (Paseo's outline rail, Apache-2.0). */
  width: calc(10px + var(--m) * 14px);
  height: calc(2px + var(--m) * 2px);
  border-radius: 999px;
  background: color-mix(in srgb, var(--text-faint) 45%, transparent);
  transition:
    width 0.14s ease-out,
    height 0.14s ease-out,
    background-color 0.14s ease-out;
}

.chat-outline-tick.is-active .chat-outline-pill {
  width: calc(16px + var(--m) * 8px);
  background: var(--text-muted);
}

.chat-outline-tick.is-attention .chat-outline-pill {
  background: var(--text);
}

.chat-outline-tick:focus-visible {
  outline: none;
}

.chat-outline-tick:focus-visible .chat-outline-pill {
  box-shadow: 0 0 0 2px var(--accent);
}

.chat-outline-preview {
  position: absolute;
  right: 54px;
  z-index: 4;
  max-width: 260px;
  padding: 7px 11px;
  transform: translateY(-50%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2, var(--surface));
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.4;
  pointer-events: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chat-outline-preview[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .chat-outline-pill {
    transition: none;
  }
}

@media (max-width: 860px) {
  .chat-outline,
  .chat-outline-preview {
    display: none;
  }
}

/* ---- Subagent pills above the composer ---- */

.chat-subagent-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  width: min(720px, 100%);
  margin: 0 auto 6px;
}

.chat-subagent-pills[hidden] {
  display: none;
}

.chat-subagent-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 280px;
  min-height: 26px;
  overflow: hidden;
  padding: 2px 10px 2px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  text-decoration: none;
}

.chat-subagent-pill:hover,
.chat-subagent-pill:focus-visible {
  background: var(--hover);
  color: var(--text);
}

.chat-subagent-pill-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
}

.chat-subagent-pill.is-running .chat-subagent-pill-dot {
  background: var(--accent);
  animation: cc-pulse 1.2s ease-in-out infinite;
}

.chat-subagent-pill.is-waiting .chat-subagent-pill-dot {
  background: var(--warn, #d99a1e);
}

.chat-subagent-pill.is-done .chat-subagent-pill-dot {
  background: var(--ok);
}

.chat-subagent-pill.is-failed .chat-subagent-pill-dot {
  background: var(--danger, #c4453c);
}

.chat-subagent-pill-title {
  flex: 0 1 auto;
  min-width: 4ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The status never pushes the pill past its width: a long one is cut, and the
   title keeps its room (a finished subagent's whole answer once sat here, raw,
   and ran across the pills beside it). */
.chat-subagent-pill-meta {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 26ch;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-faint);
  font-size: 11px;
  white-space: nowrap;
}

.chat-subagent-clear {
  padding: 2px 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-faint);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
}

.chat-subagent-clear:hover {
  background: var(--hover);
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  .chat-subagent-pill.is-running .chat-subagent-pill-dot,
  .cc-tool-group-dot.is-running {
    animation: none;
  }
}

/* A working run with its steps folded: its thinking and assistant commentary
   read first, above the "Working" line and the ticker. */
.cc-run.cc-run-live-compact {
  display: flex;
  flex-direction: column;
}

.cc-run.cc-run-live-compact > .cc-body {
  order: -1;
  margin-top: 0;
}

.cc-run.cc-run-live-compact > .cc-body:not(:empty) {
  margin-bottom: 8px;
}

.cc-run.cc-run-live-compact > .cc-body:has(> .cc-entries:empty):not(:has(> :not(.cc-entries))) {
  margin-bottom: 0;
}
