/* Form controls that the browser used to paint itself.

   Native <select> chevrons, checkboxes and the two buttons added for the sign-in gate were rendered by
   Chromium/WebKit, not by this design system: a grey 13px square inside a 12px-radius glass card, a dark
   chevron from the OS in the wrong corner for RTL, and a `2px outset` grey button for "create account".
   Everything here is additive — it sits after glass.css/style.css and only touches controls, so page
   layout and the design owner's rules stay intact. */

/* ── 1. select: drop the UA chevron, draw our own, correct side per direction ───────────── */
/* glass.css sets `background: … !important` (a shorthand), which resets background-image, and
   `padding: 9px 12px !important` — so the chevron and its gutter must also be !important, and the
   padding has to be spelled out per direction instead of padding-inline-end. */
select {
  -webkit-appearance: none !important;
  appearance: none !important;
  padding: 9px 34px 9px 12px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%239fb6d6' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  cursor: pointer;
  text-overflow: ellipsis;
}
[dir="rtl"] select {
  padding: 9px 12px 9px 34px !important;
  background-position: left 12px center !important;
}
select:hover { border-color: rgba(255, 255, 255, .2) !important; }
/* the popup list itself is the platform widget; at least keep it dark on Chromium */
select option, select optgroup { background: #111a30; color: #eaf2ff; }

/* ── 2. checkbox / radio: a real dark-glass box instead of the OS square ─────────────────── */
input[type="checkbox"]:not(.sr-only):not([aria-hidden="true"]),
#px-subjects input[type="checkbox"],
.px-subj input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  inline-size: 17px;
  block-size: 17px;
  margin: 0;
  flex: 0 0 auto;
  display: inline-grid;
  place-content: center;
  border-radius: 5px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .24);
  transition: background .14s, border-color .14s;
  cursor: pointer;
}
/* The tick must be physical, not logical: `border-inline-end: 0` flips to border-left on RTL pages,
   which drew a mirrored '>' instead of a check mark. */
input[type="checkbox"]:not(.sr-only)::after {
  content: "";
  inline-size: 9px;
  block-size: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px) scale(0);
  transition: transform .12s ease;
}
input[type="checkbox"]:not(.sr-only):checked {
  background: var(--th-1, #3d7bfd);
  border-color: color-mix(in srgb, var(--th-1, #3d7bfd) 72%, #fff 12%);
}
input[type="checkbox"]:not(.sr-only):checked::after { transform: rotate(-45deg) translateY(-1px) scale(1); }
input[type="checkbox"]:not(.sr-only):focus-visible {
  outline: 2px solid var(--th-1, #3d7bfd);
  outline-offset: 2px;
}

/* ── 3. one input surface: email/password/number were falling into the 8px/.82 variant ─── */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="file"]):not([type="image"]),
select, textarea {
  background-color: rgba(0, 0, 0, .35) !important;
  border: 1px solid rgba(255, 255, 255, .10) !important;
  border-radius: 10px !important;
  color: #eaf2ff !important;
}
input::placeholder, textarea::placeholder { color: rgba(234, 242, 255, .42); }

/* ── 4. the gate's own buttons: .ag-b2 had no rule at all (grey 2px outset) ─────────────── */
.ag-b2 {
  flex: 0 0 auto;
  padding: 11px 18px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  color: #dbe8fb;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: background .16s, transform .12s;
}
.ag-b2:hover { background: rgba(255, 255, 255, .12); }
.ag-b2:active { transform: scale(.985); }

/* ── 5. theme-aware focus instead of a hard-coded blue ring ─────────────────────────────── */
input:focus, select:focus, textarea:focus {
  border-color: color-mix(in srgb, var(--th-1, #3d7bfd) 60%, transparent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--th-1, #3d7bfd) 18%, transparent) !important;
  outline: none !important;
}
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--th-1, #3d7bfd);
  outline-offset: 3px;
}

/* ── 6. small drifts the audit measured ─────────────────────────────────────────────────── */
.exam-btn { border-radius: 12px; }          /* was 8px / 10px against 12px siblings */
@media (max-width: 640px) {
  /* 36px sat under the 44px tap target; filters are the most-tapped controls on the phone */
  #question-search,
  #topic-filter,
  .filter-container select,
  .fb-group select { min-height: 44px; }
}

/* Numeric fields: the spinner arrows are OS chrome and break the alignment in RTL */
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
