/* Guide walkthrough round 17 (F101, F105; mockup round-17/f101-mockups): the public club search
   (Views/Shared/Sb/_ClubSearch.cshtml, js/sb/club-search.js). Without script (no "js" class on <html>) only the select
   shows; with script only the type-to-search box: the suggestions open under the field, and the chosen club is the
   field's value with a small round x (round 29, F172, below). Every colour is a token of sb/tokens.css; every gap is
   compact (decisions.md F42). */

.club-search { position: relative; min-width: 0; }
.js .club-search__fallback { display: none; }
html:not(.js) .club-search__box { display: none; }

.club-search__field { position: relative; }
.club-search__list { position: absolute; z-index: 15; top: calc(100% + var(--sp-1)); left: 0; right: 0; max-height: min(60vh, 440px); margin: 0; padding: var(--sp-1) 0; overflow-y: auto; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-2); list-style: none; }
.club-search__option { display: flex; align-items: center; gap: var(--sp-2); min-height: 36px; padding: 6px 10px; color: var(--text); font-weight: 600; cursor: pointer; }
.club-search__option:hover, .club-search__option[aria-selected="true"] { background: var(--brand-tint); }
.club-search__option[aria-selected="true"] { box-shadow: inset 3px 0 0 var(--brand-line); }
.club-search__name { min-width: 0; overflow-wrap: anywhere; }
.club-search .mark-hit { padding: 0 1px; border-radius: 2px; background: color-mix(in oklch, var(--brand) 25%, transparent); color: inherit; }
.club-search .flag { flex: none; width: 20px; height: 15px; border-radius: 2px; box-shadow: 0 0 0 1px var(--line-strong); }
.club-search__more { margin: var(--sp-1) 0 0; }
/* Guide walkthrough round 29 (F172): while the line is empty it takes no room, so the empty box lines up with the other
   fields of its row (a filter bar aligns its fields to the bottom). It stays drawn, so its live words are still read. */
.club-search__more:empty { margin: 0; }
@media (pointer: coarse) { .club-search__option { min-height: var(--tap); } }
/* Guide walkthrough round 21 (F126): in the draws PDF menu the panel scrolls (components.css .pdf-menu__panel), so the
   list stays in the panel flow under the box, where a floating list would be cut by the panel edge. */
.pdf-menu .club-search__list { position: static; max-height: 240px; margin-top: var(--sp-1); }

/* Guide walkthrough round 29 (F172, mockup round-29/mockups/f172.html variant A): the chosen club is the field's value.
   The button that opens the search again is the field: it has the frame, fill, height and radius of a field (.input,
   components.css), so it looks like the other fields of its row in both themes, and its own --control-border frame is
   its visible edge (3:1, combined fix round 2; a fill equal to a wrapper's fill was no edge). The chip is only the box
   that holds the field and the x. The flag and the name are normal text, the name cut by width; the right padding keeps
   them clear of the x. The x is a small round button with a solid --btn-bg fill (decisions.md F3) and a 1px
   --control-border ring, so it stands out from the field fill at 3:1 (the --btn-bg fill alone was 1.2:1), laid over the
   right end of the field: 28px. On a touch screen the field and the x are 44px tall; the x then covers the right end of
   the field from edge to edge. */
.club-search__chip { position: relative; display: block; width: 100%; }
.club-search__reopen { display: flex; align-items: center; gap: var(--sp-2); width: 100%; min-width: 0; min-height: var(--control-h); padding: 0 calc(28px + 8px + var(--sp-2)) 0 var(--sp-3); border: 1px solid var(--control-border); border-radius: var(--r-md); background-color: var(--field-bg); color: var(--text); font: inherit; font-size: var(--fs-md); font-weight: 500; text-align: left; cursor: text; }
.club-search__chip:hover .club-search__reopen { border-color: var(--muted); }
.club-search__chip-flag { display: inline-flex; flex: none; }
.club-search__chip-flag:empty { display: none; }
.club-search__chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.club-search__clear { position: absolute; top: 0; right: 8px; bottom: 0; display: inline-grid; place-items: center; width: 28px; height: 28px; margin: auto 0; padding: 0; border: 1px solid var(--control-border); border-radius: 50%; background: var(--btn-bg); color: var(--text-2); cursor: pointer; }
.club-search__clear:hover { background: var(--btn-bg-hover); color: var(--text); }
.club-search__clear svg { display: block; width: 12px; height: 12px; }
@media (pointer: coarse) {
  .club-search__reopen { min-height: var(--tap); padding-right: calc(var(--tap) + var(--sp-1)); }
  .club-search__clear { right: 0; width: var(--tap); height: var(--tap); margin: 0; }
}

@media (forced-colors: active) {
  .club-search__option[aria-selected="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
  .club-search__reopen { border-color: CanvasText; }
  .club-search__clear { border-color: ButtonText; }
}
