/* /agent — the model picker in the composer header.
 *
 * A trigger carrying the current model's name, and a listbox panel it opens:
 * the zero-data-retention checkbox on top, then a row of column headings, then
 * the models grouped by lab, each with a bar for its per-turn price estimate
 * (agent_model_controller.js scales the bars against the widest estimate on
 * show) and its typical duration. */

.agent-model-controls {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--spacing-8);
  min-width: 0;
}

.agent-model-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-4);
  max-width: 100%;
  padding: var(--spacing-4) var(--spacing-8);
  border: var(--stroke-weight-1) solid transparent;
  border-radius: var(--corner-radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--font-size-14);
  cursor: pointer;

  &:hover { background-color: var(--background-hover); color: var(--text-primary); }
}

.agent-model-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-model-trigger-icon {
  width: var(--spacing-16);
  height: var(--spacing-16);
  flex-shrink: 0;
}

/* A user who has never chosen gets the picker called out once: the model was
   drawn at random, so the selection carries no recommendation from us. */
.agent-model-controls.is-first-choice .agent-model-trigger { border-color: var(--border-brand); }

.agent-model-panel {
  /* The composer is pinned to the bottom of the page and nothing above it
     scrolls, so the panel has to open upward or it falls off the viewport. */
  position: absolute;
  bottom: calc(100% + var(--spacing-4));
  top: auto;
  left: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-8);
  width: 26rem; /* Note: wide enough for a model name, its price bar and its duration */
  max-width: 85vw;
  max-height: 22rem; /* Note: replaced on open by agent_model_controller.js#fitPanel with the space above the trigger */
  overflow-y: auto;
  padding: var(--spacing-12);
  border: var(--stroke-weight-1) solid var(--border-default);
  border-radius: var(--corner-radius-xs);
  background-color: var(--background-surface-1);
}
.agent-model-panel[hidden] { display: none; }

.agent-zdr-label {
  display: flex;
  align-items: center;
  gap: var(--spacing-8);
  color: var(--text-secondary);
  font-size: var(--font-size-14);
}

.agent-model-empty {
  color: var(--text-tertiary);
  font-size: var(--font-size-12);
}
.agent-model-empty[hidden] { display: none; }

.agent-model-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-8);
}

.agent-model-group[hidden] { display: none; }

.agent-model-group-label {
  padding: var(--spacing-4) var(--spacing-8);
  color: var(--text-tertiary);
  font-size: var(--font-size-12);
  font-weight: var(--font-weight-600);
  letter-spacing: var(--font-letter-spacing-wider);
  text-transform: uppercase;
}

/* The columns of .agent-model-option, shared with the heading row so the two
   line up: label, price bar, typical duration ("about 40 s"). */
.agent-model-option,
.agent-model-columns {
  display: grid;
  grid-template-columns: 1fr 5.5rem 5rem;
  gap: var(--spacing-8);
  padding-inline: var(--spacing-8);
}

/* Column headings, styled as the design system's table headings (sentence
   case, weight 500, a rule below) so they read apart from the uppercase lab
   labels. Sticky, so the columns stay named while the list scrolls; the
   negative top offsets the panel's padding. */
.agent-model-columns {
  position: sticky;
  top: calc(-1 * var(--spacing-12));
  z-index: 1;
  padding-block: var(--spacing-4);
  border-bottom: var(--stroke-weight-1) solid var(--border-default);
  background-color: var(--background-surface-1);
  color: var(--text-secondary);
  font-size: var(--font-size-12);
  font-weight: var(--font-weight-500);
  white-space: nowrap;
}
.agent-model-columns[hidden] { display: none; }
.agent-model-columns-time { text-align: right; }

.agent-model-option {
  align-items: center;
  width: 100%;
  padding-block: var(--spacing-4);
  border: 0;
  border-radius: var(--corner-radius-xs);
  background: transparent;
  color: var(--text-primary);
  font-size: var(--font-size-14);
  text-align: left;
  cursor: pointer;

  &:hover, &:focus-visible { background-color: var(--background-hover); }
}
.agent-model-option[hidden] { display: none; }
.agent-model-option[aria-selected="true"] { background-color: var(--background-surface-2); }

.agent-model-option-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The price bar: full width is the most expensive model currently on show. */
.agent-model-option-price {
  height: var(--spacing-4);
  border-radius: var(--corner-radius-full);
  background-color: var(--background-surface-2);
  overflow: hidden;
}
.agent-model-option[aria-selected="true"] .agent-model-option-price { background-color: var(--background-base); }

.agent-model-option-price-fill {
  display: block;
  height: 100%;
  width: var(--agent-model-price-width, 0%);
  border-radius: var(--corner-radius-full);
  background-image: var(--brand-gradient);
}

/* The typical duration of a turn with this model, from est_turn_duration_ms. */
.agent-model-option-duration {
  font-size: var(--font-size-12);
  color: var(--text-tertiary);
  text-align: right;
  white-space: nowrap;
}
