/* Tharsol Connect: the advanced ticket search — the form (TicketSearchForm, on the Search tickets page and in the
   title-bar search's filter panel) and the page (Pages/Tickets/Search.razor). Colours are the portal's tokens
   (tms-tokens.css: light, and dark under [data-theme="dark"]); chips are tinted (tint fill, saturated text, 1px border).
   Container queries: the form lays out by the width it is given (a narrow pane, the panel, a phone), never sideways. */

.tsf { container: tsf / inline-size; min-width: 0; }

/* Host-independent basics. The form is drawn inside the portal's .tms root (the Search tickets page, the in-app ticket
   screens) and outside it (the title-bar search's filter panel on every Connect page), where tms-base.css's .tms-scoped
   reset, box sizing and icon size don't reach: an unsized <svg class="tms-i"> is 300x150 and its chevron path filled
   black (a huge triangle), and width:100% inputs with padding overflow the panel. Same values as tms-base.css, so the
   form looks the same in both. Element resets are :where() (zero specificity) like the portal's. */
.tsf, .tsf *, .tsf *::before, .tsf *::after { box-sizing: border-box; }
:where(.tsf) :where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(.tsf) :where(button) { cursor: pointer; background: none; border: none; padding: 0; }
.tsf svg.tms-i {
  width: 1em; height: 1em; max-width: 16px; max-height: 16px;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none;
}
/* Chevrons (the pickers' carets, "More filters"): a small sized icon, never a border triangle or an unsized glyph. */
.tsf .tms-select-caret { display: flex; line-height: 0; }
.tsf .tms-select-caret svg.tms-i, .tsf .tsf-more svg.tms-i { width: 12px; height: 12px; }
.tsf-grid {
  display: grid; gap: 10px 12px; min-width: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.tsf-f { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin: 0; padding: 0; border: 0; }
.tsf-f > label, .tsf-f > legend {
  font-size: 12px; font-weight: 600; color: var(--tms-text-2); padding: 0;
}
.tsf-f .tms-input, .tsf-f .tms-select { width: 100%; box-sizing: border-box; min-width: 0; }
.tsf-wide { grid-column: span 2; }
.tsf-dates { grid-column: span 2; }
/* [which date][from] – [to]; narrow: the field on its own line, from – to under it. */
.tsf-daterow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.tsf-daterow select { flex: 0 1 140px; min-width: 0; }
.tsf-daterow input { flex: 1 1 120px; min-width: 0; }
.tsf-daterow > span { flex: none; color: var(--tms-text-3); }

.tsf-segs { display: inline-flex; border: 1px solid var(--tms-border-strong); border-radius: var(--tms-r); overflow: hidden; align-self: flex-start; }
.tsf-segs label {
  display: inline-flex; align-items: center; padding: 6px 12px; font-size: 13px; cursor: pointer;
  color: var(--tms-text-2); background: var(--tms-surface);
}
.tsf-segs label + label { border-left: 1px solid var(--tms-border); }
.tsf-segs label.on { background: var(--tms-accent-tint); color: var(--tms-accent-dark); font-weight: 600; }
.tsf-segs input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tsf-segs label:focus-within { outline: 2px solid var(--tms-accent); outline-offset: -2px; }

.tsf-check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--tms-text-2); font-weight: 400; }
.tsf-flags { justify-content: flex-end; }

/* A left-aligned disclosure button with a small chevron, as tall as its text. */
.tsf-more {
  display: flex; align-items: center; justify-content: flex-start; gap: 6px; width: fit-content; max-width: 100%;
  margin: 8px 0 0; padding: 4px 2px; line-height: 1.3;
  background: none; border: 0; color: var(--tms-accent-dark); font-weight: 600; font-size: 13px; cursor: pointer;
}
.tsf-more svg.tms-i { transition: transform var(--tms-fast, .12s); }
.tsf-more:focus-visible { outline: 2px solid var(--tms-accent); outline-offset: 2px; border-radius: 4px; }
.tsf-more .tsf-up { transform: rotate(180deg); }
.tsf-more-grid { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--tms-border); }

.tsf-typed, .tsp-chips, .tsp-saved { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; min-width: 0; }
.tsf-typed-h, .tsp-saved-h { font-size: 12px; color: var(--tms-text-3); }

/* Tinted chips: tint fill, saturated text, 1px border. */
.tsf-chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  padding: 2px 4px 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 550;
  background: var(--tms-accent-tint); color: var(--tms-accent-dark); border: 1px solid var(--tms-accent-line);
  overflow-wrap: anywhere;
}
.tsf-chip button {
  display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: inherit; cursor: pointer;
}
.tsf-chip button:hover, .tsf-chip button:focus-visible { background: var(--tms-accent-line); outline: none; }
:is(.tsf, .tsp) .tsf-chip svg.tms-i { width: 12px; height: 12px; }
.tsf-chip.is-saved { background: var(--tms-surface); }
.tsf-chip.is-saved a { color: inherit; text-decoration: none; }
.tsf-chip.is-saved a:hover { text-decoration: underline; }

.tsf-acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 12px; }
.tsf-go { min-width: 96px; }

/* The title-bar panel: fewer columns, tighter. */
.tsf.is-compact .tsf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.tsf.is-compact .tsf-wide, .tsf.is-compact .tsf-dates { grid-column: 1 / -1; }
.tsf.is-compact .tms-input { height: 34px; }
.tsf.is-compact select.tms-input { background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; }
.tsf.is-compact .tms-select-control { min-height: 34px; padding-top: 3px; padding-bottom: 3px; }
.tsf.is-compact .tsf-segs label { padding: 4px 12px; }
.tsf.is-compact .tsf-more-grid { margin-top: 8px; padding-top: 8px; }
.tsf.is-compact .tsf-acts { margin-top: 10px; }

@container tsf (max-width: 760px) {
  .tsf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tsf-wide, .tsf-dates { grid-column: 1 / -1; }
}
@container tsf (max-width: 520px) {
  .tsf-daterow select { flex-basis: 100%; }
}
@container tsf (max-width: 420px) {
  .tsf-grid, .tsf.is-compact .tsf-grid { grid-template-columns: minmax(0, 1fr); }
  .tsf-acts { justify-content: stretch; }
  .tsf-acts > * { flex: 1 1 auto; }
}

/* ---- the page ---- */
.tsp { container: tsp / inline-size; }
.tsp-form { margin-bottom: 14px; }
.tsp-save { display: inline-flex; gap: 6px; align-items: center; min-width: 0; }
.tsp-save .tms-input { width: 180px; max-width: 100%; }
.tsp-progress { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; color: var(--tms-text-2); font-size: 13px; }
.tsp-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 0 0 10px; min-width: 0; }
.tsp-count { margin: 0; font-size: 13.5px; color: var(--tms-text-2); }
.tsp-count b { color: var(--tms-text); }
.tsp-head .tsp-chips { margin-top: 0; }
.tsp-snip { display: block; font-size: 12.5px; color: var(--tms-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; }
p.tsp-snip { white-space: normal; margin-top: 6px; }
.tsp-where {
  display: inline-block; padding: 0 6px; margin-right: 4px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--tms-warn-tint); color: var(--tms-warn); border: 1px solid var(--tms-warn-line);
}
.tsp-pager { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 12px; font-size: 13px; color: var(--tms-text-2); }
.tsp-size { display: inline-flex; gap: 6px; align-items: center; }
.tsp-size .tms-input { width: auto; }
.tms-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@container tsp (max-width: 560px) {
  .tsp-pager { justify-content: center; }
  .tsp-save .tms-input { width: 130px; }
}

@media (prefers-reduced-motion: reduce) {
  .tsf *, .tsp * { transition-duration: 0s !important; animation-duration: 0s !important; }
}
