/* Native form controls in the theme: fields, selects, number and date inputs. */

/* Every dashboard select uses this one chevron (the design system's rule). */
:root {
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23bfb8b0' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --search-clear: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23bfb8b0' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E");
}

/* Native controls in the theme. Fields without styles of their own get the
   dark field (zero specificity, so any page rule wins). Every select draws the
   chevron (forms that set their own background repeat it); number fields drop
   the spinners, date and time pickers and the search clear button use the
   theme's colors. */
:where(
  input:not(
    [type="checkbox"],
    [type="radio"],
    [type="hidden"],
    [type="file"],
    [type="range"],
    [type="color"],
    [type="button"],
    [type="submit"],
    [type="reset"],
    [type="image"]
  ),
  select,
  textarea
) {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
}

/* Date and time fields draw a taller box, so they trim the padding to 42px. */
:where(input[type="date"], input[type="time"], input[type="datetime-local"]) {
  padding-block: 9px;
}

:where(input, select, textarea)::placeholder {
  color: var(--text-muted);
}

:where(
  input:not([type="checkbox"], [type="radio"]):focus,
  select:focus,
  textarea:focus
) {
  border-color: var(--accent-border);
  outline: 2px solid var(--focus-ring);
  outline-offset: -1px;
}

select:not([multiple], [size]) {
  appearance: none;
  padding-right: 34px;
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

select:disabled {
  cursor: not-allowed;
}

input[type="number"] {
  appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

input[type="date"],
input[type="time"],
input[type="datetime-local"] {
  color-scheme: dark;
}

::-webkit-calendar-picker-indicator {
  opacity: 0.7;
  cursor: pointer;
}

::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

input[type="search"]::-webkit-search-cancel-button {
  appearance: none;
  width: 12px;
  height: 12px;
  margin-left: 6px;
  background: var(--search-clear) center / 12px no-repeat;
  opacity: 0.7;
  cursor: pointer;
}

input[type="search"]::-webkit-search-cancel-button:hover {
  opacity: 1;
}
