/* /account/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 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). */

.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: 22rem; /* Note: wide enough for a model name and its price bar */
  max-width: 85vw;
  max-height: 22rem;
  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;
}

.agent-model-option {
  display: grid;
  grid-template-columns: 1fr 4rem;
  align-items: center;
  gap: var(--spacing-8);
  width: 100%;
  padding: var(--spacing-4) var(--spacing-8);
  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);
}
