/**
 * Select2 override.
 *
 * WooCommerce enhances the country and state selects on the cart shipping
 * calculator, checkout, and My Account address forms with Select2. Its own
 * stylesheet (assets/css/select2.css, handle `select2`) is left enqueued as a
 * *functional* dependency -- see inc/assets.php -- but it ships as a plain,
 * unlayered stylesheet. Unlayered CSS always outranks every rule inside this
 * theme's @layer system, however specific, so a rule added to
 * 40-woocommerce.css's `woo` layer cannot override it at all. This file is
 * deliberately left outside any @layer for that reason, matching select2's
 * own selectors so it wins on the ordinary cascade instead: enqueued after
 * `select2` (see inc/assets.php), equal-or-higher specificity wins ties by
 * source order.
 *
 * Reskins the widget to match the plain <select> in 10-base.css rather than
 * replacing it, so it stops looking like an unstyled system control dropped
 * into an otherwise branded form.
 */

.select2-container .select2-selection--single,
.select2-container--default .select2-selection--single {
  display: flex;
  align-items: center;
  height: auto;
  min-height: var(--field-height);
  margin: 0;
  padding: 0 40px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--porcelain);
  background-image: linear-gradient(45deg, transparent 50%, currentcolor 50%),
    linear-gradient(135deg, currentcolor 50%, transparent 50%);
  background-position: right 18px center, right 13px center;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}

.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--ink);
}

.select2-container .select2-selection--single .select2-selection__rendered,
.select2-container--default .select2-selection--single .select2-selection__rendered {
  padding: 0;
  color: var(--ink);
  font-size: var(--text-base);
  line-height: normal;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--muted-soft);
}

/* Select2 draws its own arrow as a bordered triangle; the gradient pair above
   replaces it, matching the plain <select> in 10-base.css. */
.select2-container--default .select2-selection--single .select2-selection__arrow {
  display: none;
}

.select2-dropdown {
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background-color: var(--porcelain);
  box-shadow: 0 8px 24px rgb(12 13 12 / 14%);
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  min-height: var(--field-height);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--paper);
  color: var(--ink);
  font: inherit;
}

.select2-container--default .select2-results__option {
  padding: 12px;
  color: var(--ink);
  font-size: var(--text-sm);
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: var(--ink);
  color: var(--on-ink);
}

.select2-container--default .select2-results__option[aria-selected="true"] {
  background-color: var(--bone);
}

.select2-container--default .select2-results__option--highlighted[aria-selected="true"] {
  background-color: var(--ink);
  color: var(--on-ink);
}

.select2-container--default .select2-results__group {
  padding: 12px;
  color: var(--muted-soft);
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
}
