/*
 * The shared form-control conventions (owner 10-15):
 *   1. the type-to-filter dropdown (type-filter.js): the input and list in front of a <select data-type-filter>;
 *   2. the required / optional label markers (field-markers.js): a red asterisk after a required field's label,
 *      "(Optional)" after an optional one.
 *   3. the live field rules (field-markers.js, rules in field-rules.v1.json): a field that fails is outlined in red with its sentence
 *      under it, and a form's submit button that cannot be pressed yet looks disabled (theme-central.css) and says why.
 * Palette source: central theme module (theme-central.css) only, so light and dark both follow the theme;
 * no local colour value exists here.
 */

/* ---- required / optional markers ---- */
.rasrouting-marker { font-weight: 400; }
.rasrouting-edit-action { max-width: 100%; white-space: normal; }
.rasrouting-missing-hard .field-name { color: var(--rasrouting-theme-danger-ink); }
.rasrouting-marker-required { color: var(--rasrouting-theme-danger-ink); font-weight: 700; margin-inline-start: 0.2em; }
.rasrouting-marker-optional { }   /* the label's own colour: no second grey to keep readable */
/* the words "required" are for a screen reader; the asterisk is what is seen */
.rasrouting-marker-text {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- live field rules ---- */
/* A box that fails its rule is outlined in the theme's danger colour on EVERY page, whatever border colour the page gives its boxes
   (the sign-in, Get started and Settings pages each set their own at a higher specificity), so this one declaration is
   !important; the ring is outside the border so the box does not change size. */
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: var(--rasrouting-theme-danger) !important;
  box-shadow: 0 0 0 1px var(--rasrouting-theme-danger);
}
/* A button the rules hold back is aria-disabled: it takes the theme's one disabled look and cursor (theme-central.css); this sheet styles none. */
.rasrouting-field-message { margin: 0.25rem 0 0; font-size: 0.875rem; font-weight: 600; color: var(--rasrouting-theme-danger-ink); }

/* ---- type-to-filter dropdown ---- */

.rasrouting-typefilter { position: relative; display: block; width: 100%; }

.rasrouting-typefilter-input {
  width: 100%;
  min-height: 2.75rem;
  box-sizing: border-box;
  color: var(--rasrouting-theme-ink);
  background-color: var(--rasrouting-theme-surface);
  border: 1px solid var(--rasrouting-theme-line);
  border-radius: 0.25rem;
  padding: 0.4rem 2rem 0.4rem 0.55rem;
  font: inherit;
  /* a drop-down arrow that follows the text colour in light and dark */
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 1.1rem) 52%, calc(100% - 0.75rem) 52%;
  background-size: 0.35rem 0.35rem, 0.35rem 0.35rem;
  background-repeat: no-repeat;
}
.rasrouting-typefilter-input:focus-visible { outline: 2px solid transparent; box-shadow: var(--rasrouting-theme-focus); }
.rasrouting-typefilter-input[aria-invalid="true"] { border-color: var(--rasrouting-theme-danger); }

/* The native select stays in the document (value, form data, validation) but is not seen or reached by a pointer. */
.rasrouting-typefilter-native {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.rasrouting-typefilter-list {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: 100%;
  margin: 0.2rem 0 0;
  padding: 0.25rem 0;
  list-style: none;
  max-height: min(18rem, 50vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  background-color: var(--rasrouting-theme-surface);
  color: var(--rasrouting-theme-ink);
  border: 1px solid var(--rasrouting-theme-line-strong);
  border-radius: 0.375rem;
  box-shadow: var(--rasrouting-theme-shadow-md);
}
.rasrouting-typefilter-list[hidden] { display: none; }

.rasrouting-typefilter-option {
  min-height: 2.75rem;
  padding: 0.55rem 0.75rem;
  display: flex;
  align-items: center;
  line-height: 1.3;
  overflow-wrap: break-word;
  cursor: pointer;
}
.rasrouting-typefilter-option + .rasrouting-typefilter-option { border-top: 1px solid var(--rasrouting-theme-line-faint); }
.rasrouting-typefilter-option:hover,
.rasrouting-typefilter-option[aria-selected="true"] { background-color: var(--rasrouting-theme-surface-raised); }
.rasrouting-typefilter-option[aria-selected="true"] { box-shadow: inset 3px 0 0 var(--rasrouting-theme-ink); }

.type-filter-detail { display: block; font-size: 13px; color: var(--rasrouting-theme-ink-soft); white-space: normal; overflow-wrap: normal; }
.type-filter-action { color: var(--rasrouting-theme-admin-primary); }
.type-filter-note { padding: 0.75rem; color: var(--rasrouting-theme-ink-soft); }

.rasrouting-typefilter-empty { padding: 0.75rem; color: var(--rasrouting-theme-ink-muted); }

.rasrouting-typefilter-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
