/* ==========================================================================
   Person picker option (people/picker.py)
   ==========================================================================
   The shared card every person picker dropdown renders (`PersonSelect2`,
   and the group and Safe from Harm pickers that reuse the classes): avatar,
   visible name, "Centru Local · Unitate", and the programs age-group chip.

   Its own file, not a section of design_system.css, because two places
   render these cards: the app (base.html, the published-site and game
   bases link it after the design system) and the Wagtail editor at /cms/
   (`publishing/wagtail_hooks.py`), which must not load the design system.
   So every token below has a fallback: in /cms/ no `--vh-*` or `--bs-*`
   is defined, and `publishing/static/publishing/admin_select2.css` gives
   the dropdown Wagtail's own colours there.

   Only the dropdown row is a card. A *selected* option stays a plain name
   (see `picker.render_selected_text`), so nothing here targets
   `.select2-selection__rendered` — a multi-select on the participant add form
   routinely holds seventeen chips and three-line chips would bury the form.

   The highlighted-row rule in design_system.css paints `--oncr-bleumarin`,
   so the muted text inside a highlighted card has to lift to stay legible. */

.vh-picker-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.vh-picker-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--bs-secondary-bg, #e9ecef);
}

.vh-picker-avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

/* `min-width: 0` is what lets the ellipsis below actually engage — a flex item
   defaults to `min-width: auto`, which refuses to shrink below its content and
   makes a long unit name push the chip off the row instead of truncating. */
.vh-picker-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}

.vh-picker-name {
  font-size: var(--vh-font-sm, 0.875rem);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vh-picker-meta {
  font-size: 0.75rem;
  line-height: 1.25;
  color: var(--vh-text-muted, var(--bs-secondary-color, #6c757d));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vh-picker-chip {
  flex: 0 0 auto;
  font-size: 0.6875rem;
  line-height: 1;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  color: #fff;
  background: var(--vh-picker-chip-color, var(--oncr-secondary, #6c757d));
  white-space: nowrap;
}

.select2-container--default .select2-results__option--highlighted .vh-picker-meta {
  color: rgba(255, 255, 255, 0.85);
}

/* Phone: the context line is the part that overflows first, so let it wrap to
   a second line rather than truncating a unit name to nothing. */
@media (max-width: 400px) {
  .vh-picker-meta { white-space: normal; }
  .vh-picker-chip { display: none; }
}
