/*! anony-select v1.0.0 — the Anony Labs dropdown (canonical source: /root/anony-design select/; vendored VERBATIM). */
/*
 * AnonyChat's Select (src/components/ui/select.tsx + globals.css), measured from its live CSS on 2026-10-11:
 *   trigger  15 px text, padding 14 × 16, radius 10, 1 px border-control, surface ground, chevron 16 px muted (180° open),
 *            hover border accent/40 %, open border accent, focus-visible border focus + 2 px ring focus/30 %
 *   panel    radius 14, 1 px border-strong, overlay ground, shadow 0 16 48 -12 rgb(0 0 0 / .7), max 320 px high,
 *            min-width = the trigger; list padding 6; rows 44 px, padding 0 10, gap 12, radius 10, text-soft,
 *            the chosen row text + a 16 px accent tick; the active row on surface-raised
 *   search   a 44 px row, 14 px side padding, magnifier 16 px faint, a hairline under it
 *   motion   opacity 150 ms ease-out + translate 4 px, 200 ms cubic-bezier(.22,.61,.36,1); none with reduced motion
 *   sheet    below 640 px: a scrim (graphite 80 %, 4 px blur), the panel full width at the bottom, max 75dvh,
 *            radius 22 at the top, a 40 × 4 handle, the field's label as a title, the home-indicator inset
 *   flags    Flagpack 20 × 15, 1.5 px corners, a border-token ring and Flagpack's overlay hairline
 * Every colour, radius and size is a custom property (--as-*) read with AnonyChat's value as the fallback: a site sets
 * them to its own tokens on any ancestor (html, a theme class, a dialog), so AnonyID, AnonyVPN, AnonyMail and the extension keep their own colours. The defaults are
 * AnonyChat's dark palette. No inline styles anywhere: CSP style-src 'self'.
 */

/* The tokens and their defaults (AnonyChat):
 *   --as-font inherit · --as-font-size 15px · --as-line-height 1.45
 *   --as-text #f3f2ed · --as-text-soft #dad9d4 · --as-text-muted #bbbfc1 · --as-text-faint #959b9f · --as-placeholder #6f7579
 *   --as-accent #f6d83a · --as-check (accent) · --as-focus (accent) · --as-danger #ff8a7a
 *   --as-trigger-bg #1c1f21 · --as-trigger-bg-hover (trigger-bg) · --as-trigger-border #6f7579
 *   --as-trigger-border-hover (accent 40 %) · --as-trigger-border-open (accent) · --as-trigger-radius 10px
 *   --as-trigger-height auto · --as-trigger-padding 14px 16px · --as-trigger-gap 8px · --as-focus-ring 0 0 0 2px focus/30 %
 *   --as-panel-bg #2b2f32 · --as-panel-border #3c4246 · --as-panel-radius 14px · --as-panel-shadow 0 16px 48px -12px rgb(0 0 0/.7)
 *   --as-panel-max-height 320px · --as-row-height 44px · --as-row-radius 10px · --as-row-active #24282b · --as-divider #303538
 *   --as-sheet-radius 22px · --as-scrim rgb(21 23 25/.8) · --as-flag-ring #303538 · --as-z 1000
 */

.anony-select {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  font-family: var(--as-font, inherit);
}
.anony-select,
.anony-select *,
.anony-select *::before,
.anony-select *::after { box-sizing: border-box; }
.anony-select--inline { display: inline-block; width: auto; max-width: 100%; vertical-align: middle; }
.anony-select[hidden] { display: none; }

/* The native select stays in the form, visually hidden at the bottom edge of the control (a validation bubble then
   points at the control). !important: site rules such as `select { height: 52px }` must not bring it back. */
.anony-select > select.anony-select__native {
  position: absolute !important;
  inset-inline: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 1px !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  appearance: none !important;
}
.anony-select__sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---- trigger --------------------------------------------------------------------------------------------------- */
.anony-select > button.anony-select__trigger {
  display: flex;
  align-items: center;
  gap: var(--as-trigger-gap, 8px);
  width: 100%;
  min-width: 0;
  min-height: var(--as-trigger-height, auto);
  margin: 0;
  padding: var(--as-trigger-padding, 14px 16px);
  font: inherit;
  font-family: var(--as-font, inherit);
  font-size: var(--as-font-size, 15px);
  line-height: var(--as-line-height, 1.45);
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  text-align: start;
  color: var(--as-text, #f3f2ed);
  background: var(--as-trigger-bg, #1c1f21);
  border: 1px solid var(--as-trigger-border, #6f7579);
  border-radius: var(--as-trigger-radius, 10px);
  box-shadow: none;
  cursor: pointer;
  transition: border-color 150ms ease-out, background-color 150ms ease-out, box-shadow 150ms ease-out;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}
.anony-select--inline > button.anony-select__trigger { width: auto; max-width: 100%; }
.anony-select > button.anony-select__trigger:hover { border-color: var(--as-trigger-border-hover, color-mix(in srgb, var(--as-accent, #f6d83a) 40%, transparent)); background: var(--as-trigger-bg-hover, var(--as-trigger-bg, #1c1f21)); }
.anony-select > button.anony-select__trigger:focus { outline: none; }
.anony-select > button.anony-select__trigger:focus-visible { border-color: var(--as-focus, var(--as-accent, #f6d83a)); box-shadow: var(--as-focus-ring, 0 0 0 2px color-mix(in srgb, var(--as-focus, var(--as-accent, #f6d83a)) 30%, transparent)); }
.anony-select--open > button.anony-select__trigger { border-color: var(--as-trigger-border-open, var(--as-accent, #f6d83a)); }
.anony-select > button.anony-select__trigger[aria-invalid="true"] { border-color: var(--as-danger, #ff8a7a); }
.anony-select > button.anony-select__trigger:disabled { cursor: default; opacity: 0.5; }
.anony-select > button.anony-select__trigger:disabled:hover { border-color: var(--as-trigger-border, #6f7579); background: var(--as-trigger-bg, #1c1f21); }
.anony-select__lead { display: inline-flex; flex-shrink: 0; align-items: center; }
.anony-select__lead[hidden] { display: none; }
.anony-select__value { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anony-select--placeholder .anony-select__value { color: var(--as-text-faint, #959b9f); }
.anony-select__chevron {
  flex-shrink: 0; width: 16px; height: 16px; color: var(--as-text-muted, #bbbfc1);
  transition: transform 150ms ease-out;
}
.anony-select--open .anony-select__chevron { transform: rotate(180deg); }

/* ---- flags (Flagpack, as AnonyChat's <Flag size="m">) ----------------------------------------------------------- */
.anony-select__flag {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  width: 20px;
  height: 15px;
  overflow: hidden;
  vertical-align: middle;
  border-radius: 1.5px;
  box-shadow: 0 0 0 1px var(--as-flag-ring, #303538);
}
.anony-select__flag img { display: block; width: 100%; height: 100%; object-fit: cover; }
.anony-select__flag::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgb(0 0 0 / 0.5);
  border-radius: inherit;
  mix-blend-mode: overlay;
}
.anony-select__flag--none { box-shadow: none; display: inline-flex; align-items: center; justify-content: center; color: var(--as-text-faint, #959b9f); }
.anony-select__flag--none::after { content: none; }
.anony-select__globe { width: 15px; height: 15px; }

/* ---- panel ------------------------------------------------------------------------------------------------------ */
.anony-select__panel {
  /* undo the UA popover box */
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 0;
  width: auto;
  height: auto;
  overflow: hidden;
  border: 0;
  z-index: var(--as-z, 1000);
  color: var(--as-text, #f3f2ed);
  background: transparent;
  font-family: var(--as-font, inherit);
  font-size: var(--as-font-size, 15px);
  line-height: var(--as-line-height, 1.45);
  text-align: start;
}
.anony-select__panel--anchored {
  display: flex;
  flex-direction: column;
  max-width: calc(100vw - 1rem);
  max-height: var(--as-panel-max-height, 320px);
  background: var(--as-panel-bg, #2b2f32);
  border: 1px solid var(--as-panel-border, #3c4246);
  border-radius: var(--as-panel-radius, 14px);
  box-shadow: var(--as-panel-shadow, 0 16px 48px -12px rgb(0 0 0 / 0.7));
  transition: opacity 150ms ease-out, translate 200ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
@starting-style {
  .anony-select__panel--anchored { opacity: 0; translate: 0 -4px; }
  .anony-select__panel--anchored[data-side="top"] { translate: 0 4px; }
}
.anony-select__panel--sheet {
  inset: 0;
  display: flex;
  align-items: flex-end;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  background: var(--as-scrim, rgb(21 23 25 / 0.8));
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: opacity 180ms ease-out;
}
@starting-style {
  .anony-select__panel--sheet { opacity: 0; }
}
.anony-select__sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 75vh;
  max-height: 75dvh;
  overflow: hidden;
  background: var(--as-panel-bg, #2b2f32);
  border: 1px solid var(--as-panel-border, #3c4246);
  border-bottom: 0;
  border-radius: var(--as-sheet-radius, 22px) var(--as-sheet-radius, 22px) 0 0;
  box-shadow: var(--as-panel-shadow, 0 16px 48px -12px rgb(0 0 0 / 0.7));
}
.anony-select__handle {
  flex-shrink: 0;
  width: 40px;
  height: 4px;
  margin: 8px auto 0;
  border-radius: 999px;
  background: var(--as-panel-border, #3c4246);
}
.anony-select__title {
  flex-shrink: 0;
  margin: 0;
  padding: 12px 16px 4px;
  font-size: 13.5px;
  line-height: 1.4;
  font-weight: 500;
  color: var(--as-text-soft, #dad9d4);
}

.anony-select__search {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--as-divider, #303538);
}
.anony-select__search-icon { flex-shrink: 0; width: 16px; height: 16px; color: var(--as-text-faint, #959b9f); }
.anony-select__panel input.anony-select__search-input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: var(--as-row-height, 44px);
  margin: 0;
  padding: 0;
  font: inherit;
  font-size: var(--as-font-size, 15px);
  line-height: normal;
  color: var(--as-text, #f3f2ed);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.anony-select__panel input.anony-select__search-input:hover,
.anony-select__panel input.anony-select__search-input:focus,
.anony-select__panel input.anony-select__search-input:focus-visible { background: transparent; border: 0; box-shadow: none; outline: none; }
.anony-select__search-input::placeholder { color: var(--as-placeholder, #6f7579); opacity: 1; }

.anony-select__list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  outline: none;
}
.anony-select__panel--sheet .anony-select__list { padding-bottom: max(6px, env(safe-area-inset-bottom)); }
.anony-select__option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--as-row-height, 44px);
  padding: 0 10px;
  border-radius: var(--as-row-radius, 10px);
  color: var(--as-text-soft, #dad9d4);
  cursor: pointer;
  text-align: start;
  user-select: none;
  -webkit-user-select: none;
}
.anony-select__option[data-active] { background: var(--as-row-active, #24282b); }
.anony-select__option[aria-selected="true"] { color: var(--as-text, #f3f2ed); }
.anony-select__option[aria-disabled="true"] { cursor: not-allowed; opacity: 0.4; }
.anony-select__option .anony-select__lead { width: 24px; justify-content: center; }
.anony-select__text { flex: 1 1 auto; min-width: 0; padding: 6px 0; }
.anony-select__label,
.anony-select__description { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anony-select__description { font-size: 12.5px; line-height: 1.35; color: var(--as-text-faint, #959b9f); }
.anony-select__tick { flex-shrink: 0; width: 16px; height: 16px; color: var(--as-check, var(--as-accent, #f6d83a)); visibility: hidden; }
.anony-select__option[aria-selected="true"] .anony-select__tick { visibility: visible; }
.anony-select__group {
  padding: 10px 10px 4px;
  font-size: 12.5px;
  line-height: 1.35;
  font-weight: 500;
  color: var(--as-text-faint, #959b9f);
}
.anony-select__empty {
  margin: 0;
  padding: 16px 12px;
  text-align: center;
  font-size: 13.5px;
  color: var(--as-text-faint, #959b9f);
}

@media (prefers-reduced-motion: reduce) {
  .anony-select > button.anony-select__trigger,
  .anony-select__chevron,
  .anony-select__panel { transition: none; }
}
@media (forced-colors: active) {
  .anony-select > button.anony-select__trigger { border-color: ButtonText; }
  .anony-select__option[data-active] { outline: 2px solid Highlight; outline-offset: -2px; }
  .anony-select__panel--anchored, .anony-select__sheet { border-color: CanvasText; }
}
