/* Select de shadcn, con los tokens de estandares.md. La lista es un popover. */

html body .select {
  display: inline-flex;
  max-width: 100%;
  min-width: 0;
  font-size: 14px;
}

html body .select.campo-control {
  width: fit-content;
  max-width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

html body .select-disparador {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--trio-edge, var(--line));
  border-radius: 8px;
  background: var(--trio-tint, var(--field));
  color: var(--trio-ink, var(--text));
  box-shadow: 0 1px 2px rgb(0 0 0 / 6%);
  font: inherit;
  font-size: inherit;
  line-height: 1.2;
  text-align: start;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

html body .select-disparador:hover { border-color: var(--anillo, var(--accion)); }

html body .select-disparador:focus-visible {
  outline: 2px solid var(--anillo, var(--accion));
  outline-offset: -3px;
}

html body .select-disparador[aria-expanded='true'] { border-color: var(--anillo, var(--accion)); }

html body .select-disparador:disabled { opacity: 0.5; cursor: not-allowed; }

html body .select-valor {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html body .select-chevron {
  display: inline-flex;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  color: var(--trio-muted, var(--muted));
}

html body .select-lista {
  position: fixed;
  inset: auto;
  z-index: 1;
  box-sizing: border-box;
  width: max-content;
  height: auto;
  max-width: calc(100vw - 16px);
  max-height: min(240px, calc(100dvh - 16px));
  margin: 0;
  padding: 4px;
  overflow: hidden;
  border: 1px solid var(--trio-edge, var(--line));
  border-radius: 8px;
  background: var(--trio-surface, var(--card));
  color: var(--trio-ink, var(--text));
  box-shadow: 0 8px 24px rgb(0 0 0 / 16%);
}

html body .select-lista:popover-open { display: flex; flex-direction: column; }

html body .select-viewport {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

html body .select-opcion {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 32px;
  margin: 0;
  padding: 6px 32px 6px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  line-height: 1.2;
  text-align: start;
  cursor: pointer;
  transition: background-color 150ms ease;
}

html body .select-opcion:is(:hover, [data-activa]) {
  background: color-mix(in srgb, var(--accion) 12%, transparent);
}

html body .select-opcion:focus { outline: none; }

html body .select-marca {
  position: absolute;
  right: 8px;
  display: inline-flex;
  width: 16px;
  height: 16px;
  color: var(--accion);
}

html body .select-scroll {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--trio-muted, var(--muted));
  cursor: pointer;
}

html body .select-scroll[hidden] { display: none; }
