/* Form controls that look like this app, in every console. See fields.js.
 *
 * Two rules from the owner, both given more than once:
 *   "I don't want the native dropdown at all, and all the fields should be
 *    aligned", and no up/down arrows on a number field.
 *
 * Loaded AFTER each console's own styles.css, on purpose. The select rules here
 * are deliberately at the same specificity as a console's `.field select`, so
 * the later sheet wins the ONE property it needs to win — and `!important` on
 * the chevron because plenty of rules set `background: #fff`, and that shorthand
 * silently wipes the arrow off the control.
 *
 * Colours come from each console's own variables, with fallbacks, so one sheet
 * serves the slate consoles, the gold store admin and its dark mode without
 * knowing anything about any of them.
 */

/* ── Number fields: no spinner, anywhere ──────────────────────────────────────
   The steppers are useless for money and quantity entry — nobody counts to 249
   by clicking — they steal the width a figure needs, and in an RTL field they
   sit on the wrong side and look broken. Typing still works, and so does any
   explicit step control a screen draws for itself. */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none; appearance: none; display: none; margin: 0;
}
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* ── A closed <select> looks like the text box beside it ─────────────────────
   No OS arrows: one drawn chevron. `appearance: none` also makes a select
   honour its padding, which is what lets it match the height of the input next
   to it. `.pill-select` is the admin topbar's store picker and keeps its own. */
select:not([multiple]):not(.pill-select) {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='3'><path d='M6 9l6 6 6-6'/></svg>") !important;
  background-repeat: no-repeat !important;
  background-position: right 11px center !important;
  padding-right: 32px !important;
}
[dir="rtl"] select:not([multiple]):not(.pill-select),
.rtl select:not([multiple]):not(.pill-select) {
  background-position: left 11px center !important;
  padding-right: 11px !important; padding-left: 32px !important;
}
/* The store admin has a dark mode; a slate chevron all but vanishes on its
   near-black card, so the drawn arrow follows the theme rather than the OS. */
html.dark select:not([multiple]):not(.pill-select),
html[data-theme="dark"] select:not([multiple]):not(.pill-select) {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='3'><path d='M6 9l6 6 6-6'/></svg>") !important;
}
/* A list box is not a dropdown: it has no OS popup to replace and the multi-pick
   is the point of it. It only needs to look like the rest of the form. */
select[multiple] { appearance: none; -webkit-appearance: none; }

/* ── The themed dropdown itself ──────────────────────────────────────────────
   Fixed and on its own layer, so a card with `overflow: hidden` — which is most
   of them — cannot clip it, and it sits above drawers and modals. */
.csel-pop {
  position: fixed; z-index: 9000;
  background: var(--card, #fff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(15, 23, 42, .22);
  overflow: hidden; max-width: min(360px, 92vw);
}
.csel-search { padding: 8px; border-bottom: 1px solid var(--line, #e2e8f0); }
.csel-search input {
  width: 100%; box-sizing: border-box; padding: 8px 10px; font: inherit;
  border: 1px solid var(--control-border, var(--line, #cbd5e1)); border-radius: 8px;
  color: var(--ink, #0f172a);
  background: var(--accent-soft, rgba(128, 128, 128, .12));
}
.csel-list { max-height: 292px; overflow-y: auto; padding: 5px; }
.csel-group {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted, #64748b); padding: 9px 10px 4px;
}
.csel-opt {
  display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 8px;
  cursor: pointer; font-size: 14px; color: var(--ink, #0f172a); white-space: nowrap;
}
/* A neutral tint rather than a named colour: it has to read as "this row" on a
   white card, on a cream one and on a near-black one, in five consoles that do
   not share a palette. */
.csel-opt:hover, .csel-opt.active {
  background: var(--accent-soft, rgba(128, 128, 128, .16));
  color: var(--accent-ink, var(--ink, #0f172a));
}
.csel-opt.on { font-weight: 700; }
.csel-opt.on::after {
  content: "✓"; margin-inline-start: auto; color: var(--accent, #0f172a); font-weight: 700;
}
.csel-opt.disabled { opacity: .45; cursor: not-allowed; }

@media (prefers-reduced-motion: no-preference) {
  .csel-pop { animation: csel-in .09s ease-out; }
  @keyframes csel-in { from { opacity: 0; transform: translateY(-2px); } }
}
