/* Glue for the assistant picker of the live page (/static/chat/assistants.js) on top of the
   approved design (chat-ui/personas.css, .asst-*). Loaded after live.css.
   The live markup differs from the preview in two places: each card is a <button> inside an
   <li> (the preview used role="option"), and the card in use carries aria-current="true". */

/* Header chip: after "Trò chuyện mới", shrinks before anything else in the bar. */
.top .assistant-picker.asst { flex: 0 1 auto; min-width: 0; margin-left: -2px; }  /* 10px after the button, as in the design */
.top .assistant-picker.asst[hidden] { display: none; }
.asst-btn { min-width: 0; max-width: min(280px, 100%); border: 2px solid transparent; }
.asst-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.asst-btn .caret { flex: none; }
.asst-mark[hidden] { display: none; }
.asst-initial { font-family: var(--font-heading); font-size: 14px; line-height: 1; font-weight: 800; color: var(--tdtu-blue-800); }

/* Dialog: centred, never taller than the window (the page is zoomed on large screens), the list scrolls. */
.asst-back { overscroll-behavior: contain; }
.asst-pop { max-height: calc(100dvh / var(--z, 1) - 48px); overflow: hidden; }
.asst-title { margin: 0; }
.asst-x { border: 2px solid transparent; }
.asst-x:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.asst-list { margin: 0; list-style: none; overscroll-behavior: contain; }
.asst-sub { margin-bottom: 0; }

/* Cards are buttons: fill the grid cell, left-aligned text. */
.asst-item { display: flex; min-width: 0; }
.asst-opt { width: 100%; min-width: 0; text-align: left; color: var(--v-ink); font: inherit; }
.asst-opt:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.asst-opt .asst-desc { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
/* Dark theme: the design's ink and grey tokens do not flip; use the theme's text colours
   (yellow states below keep the dark brand blue). */
:root[data-theme="dark"] .asst-desc, :root[data-theme="dark"] .asst-sub { color: var(--text-2); }
:root[data-theme="dark"] .asst-btn, :root[data-theme="dark"] .asst-x, :root[data-theme="dark"] .asst-initial { color: var(--heading); }
:root[data-theme="dark"] .asst-btn:hover, :root[data-theme="dark"] .asst-btn[aria-expanded="true"], :root[data-theme="dark"] .asst-x:hover { color: var(--tdtu-blue-800); }
:root[data-theme="dark"] .asst-mark { border-color: var(--heading); box-shadow: 1.5px 1.5px 0 var(--heading); }
:root[data-theme="dark"] .asst-opt[aria-current="true"] .asst-mark, :root[data-theme="dark"] .asst-opt:hover .asst-mark,
:root[data-theme="dark"] .asst-btn:hover .asst-mark, :root[data-theme="dark"] .asst-btn[aria-expanded="true"] .asst-mark { border-color: var(--tdtu-blue-800); box-shadow: 1.5px 1.5px 0 var(--tdtu-blue-800); }

/* Hover is yellow like every other control; the card in use keeps its heavier border and blue shadow. */
/* Hover stays cream as in the design, so it never looks like the selected (yellow) card. */
.asst-opt:hover { border-color: var(--v-ink); background: var(--v-cream); box-shadow: 2px 2px 0 var(--v-ink); }
.asst-opt[aria-current="true"],
.asst-opt[aria-current="true"]:hover { padding: 10.5px 11.5px; border: 2px solid var(--v-ink); background: var(--v-yellow); box-shadow: 3px 3px 0 var(--primary); transform: none; }
/* Text on yellow stays the dark brand blue in both themes (contrast on #FFD84D). */
.asst-opt[aria-current="true"] .asst-opt-name { color: var(--tdtu-blue-800); }
:root .asst-opt[aria-current="true"] .asst-desc { color: var(--tdtu-blue-800); }

/* Narrow windows: one column, less margin around the dialog. */
@media (max-width: 640px) {
  .asst-back { padding: 12px; }
  .asst-pop { max-height: calc(100dvh - 24px); padding: 14px 12px 12px; }
  .asst-list { grid-template-columns: minmax(0, 1fr); }
  .asst-title { font-size: 19px; line-height: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .asst-opt, .asst-opt:hover { transition: none; transform: none; }
}
