/* Shared Deluxe Homes styling for Select2 fields. Add dhh-select2 to the original select before initializing Select2. */

:root {
  --dhh-select2-control-height: 42px;
  --dhh-select2-control-radius: 6px;
  --dhh-select2-control-border: #d9e1ec;
  --dhh-select2-control-bg: #ffffff;
  --dhh-select2-control-color: #1f2333;
  --dhh-select2-control-muted: #6b7290;
  --dhh-select2-control-focus: #0e1a3a;
  --dhh-select2-control-ring: rgba(14, 26, 58, 0.12);
  --dhh-select2-control-padding-x: 12px;
  --dhh-select2-font-size: 14px;
  --dhh-select2-dropdown-shadow: 0 12px 28px rgba(20, 25, 50, 0.1), 0 2px 8px rgba(20, 25, 50, 0.05);
}

.admin-body {
  --dhh-select2-control-height: 2.35rem;
  --dhh-select2-control-radius: var(--admin-radius-control, 6px);
  --dhh-select2-control-border: var(--admin-border, #e4e7ee);
  --dhh-select2-control-bg: var(--admin-card, #ffffff);
  --dhh-select2-control-color: var(--admin-foreground, #1f2333);
  --dhh-select2-control-muted: var(--admin-muted-foreground, #6b7290);
  --dhh-select2-control-focus: var(--admin-foreground, #1f2333);
  --dhh-select2-control-ring: var(--admin-ring, rgba(31, 35, 51, 0.14));
  --dhh-select2-control-padding-x: 0.75rem;
  --dhh-select2-font-size: 0.82rem;
}

.user-body {
  --dhh-select2-control-height: 46px;
  --dhh-select2-control-radius: var(--r-sm, 6px);
  --dhh-select2-control-border: var(--border, #e6e8ee);
  --dhh-select2-control-bg: var(--surface, #ffffff);
  --dhh-select2-control-color: var(--ink-900, #1f2333);
  --dhh-select2-control-muted: var(--ink-500, #6b7290);
  --dhh-select2-control-focus: var(--primary, #0e1a3a);
  --dhh-select2-control-ring: rgba(14, 26, 58, 0.08);
  --dhh-select2-control-padding-x: 12px;
  --dhh-select2-font-size: 14px;
}

.dhh-select2 + .select2-container {
  display: block;
  width: 100% !important;
  min-width: 0;
  font: inherit;
}

.dhh-select2 + .select2-container .select2-selection--single,
.dhh-select2 + .select2-container .select2-selection--multiple {
  min-height: var(--dhh-select2-control-height);
  border: 1px solid var(--dhh-select2-control-border);
  border-radius: var(--dhh-select2-control-radius);
  background: var(--dhh-select2-control-bg);
  color: var(--dhh-select2-control-color);
  font-size: var(--dhh-select2-font-size);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.dhh-select2 + .select2-container .select2-selection--single {
  display: flex;
  align-items: center;
  height: var(--dhh-select2-control-height);
}

.dhh-select2 + .select2-container .select2-selection--single .select2-selection__rendered {
  flex: 1 1 auto;
  width: 100%;
  padding: 0 calc(var(--dhh-select2-control-padding-x) + 24px) 0 var(--dhh-select2-control-padding-x);
  color: var(--dhh-select2-control-color);
  font-size: var(--dhh-select2-font-size);
  font-weight: 400;
  line-height: normal;
}

.dhh-select2 + .select2-container .select2-selection--single .select2-selection__placeholder {
  color: var(--dhh-select2-control-muted);
}

.dhh-select2 + .select2-container .select2-selection--single .select2-selection__arrow {
  top: 0;
  right: 9px;
  width: 22px;
  height: 100%;
}

.dhh-select2 + .select2-container.select2-container--focus .select2-selection--single,
.dhh-select2 + .select2-container.select2-container--open .select2-selection--single,
.dhh-select2 + .select2-container.select2-container--focus .select2-selection--multiple,
.dhh-select2 + .select2-container.select2-container--open .select2-selection--multiple {
  border-color: var(--dhh-select2-control-focus);
  box-shadow: 0 0 0 3px var(--dhh-select2-control-ring);
}

.dhh-select2.is-invalid + .select2-container .select2-selection--single,
.dhh-select2.is-invalid + .select2-container .select2-selection--multiple {
  border-color: var(--danger, var(--admin-danger, #b42318));
}

.dhh-select2 + .select2-container .select2-selection--multiple {
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding: 4px 8px;
  cursor: pointer;
}

.dhh-select2 + .select2-container .select2-selection--multiple .select2-selection__rendered {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dhh-select2 + .select2-container .select2-selection--multiple .select2-selection__choice {
  margin: 0;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 2px 5px 2px 3px;
  border: 1px solid color-mix(in srgb, var(--dhh-select2-control-focus) 18%, var(--dhh-select2-control-border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--dhh-select2-control-focus) 9%, var(--dhh-select2-control-bg));
  color: var(--dhh-select2-control-color);
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}

.dhh-select2 + .select2-container .select2-selection--multiple .select2-selection__choice__display {
  min-width: 0;
  overflow: hidden;
  padding: 0 2px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dhh-select2 + .select2-container .select2-selection--multiple .select2-selection__choice__remove {
  position: static;
  display: inline-grid;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--dhh-select2-control-muted);
  background: transparent;
  font-size: 13px;
  line-height: 1;
  transition: color 140ms ease, background 140ms ease;
}

.dhh-select2 + .select2-container .select2-selection--multiple .select2-selection__choice__remove:hover,
.dhh-select2 + .select2-container .select2-selection--multiple .select2-selection__choice__remove:focus {
  color: var(--dhh-select2-control-color);
  background: color-mix(in srgb, var(--dhh-select2-control-focus) 12%, transparent);
  outline: none;
}

.dhh-select2 + .select2-container .select2-selection--multiple.dhh-select2-selection--summarized .select2-selection__choice {
  display: none;
}

.dhh-select2 + .select2-container .dhh-select2-selection-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  align-self: center;
  color: var(--dhh-select2-control-color);
  font-weight: 600;
  line-height: 1.45;
}

.dhh-select2 + .select2-container .dhh-select2-selection-summary::before {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: var(--dhh-select2-control-focus);
  content: "";
}

.dhh-select2 + .select2-container .select2-search--inline {
  display: flex;
  flex: 1 1 4rem;
  align-items: center;
  min-width: 1rem;
  margin: 0;
}

.dhh-select2 + .select2-container .select2-search--inline .select2-search__field {
  height: 28px;
  margin: 0;
  min-width: 1rem;
  padding: 0;
  color: var(--dhh-select2-control-color);
  font: inherit;
}

.dhh-select2-dropdown {
  overflow: hidden;
  border-color: var(--dhh-select2-control-border);
  border-radius: var(--dhh-select2-control-radius);
  box-shadow: var(--dhh-select2-dropdown-shadow);
  color: var(--dhh-select2-control-color);
  font-size: var(--dhh-select2-font-size);
}

.dhh-select2-dropdown .select2-results__options {
  max-height: var(--dhh-select2-results-max-height, min(320px, calc(100vh - 32px)));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.dhh-select2-dropdown .select2-search--dropdown {
  padding: 8px;
}

.dhh-select2-dropdown .select2-search--dropdown .select2-search__field {
  min-height: 38px;
  border: 1px solid var(--dhh-select2-control-border);
  border-radius: var(--dhh-select2-control-radius);
  color: var(--dhh-select2-control-color);
  font: inherit;
  outline: none;
  padding: 8px 10px;
}

.dhh-select2-dropdown .select2-search--dropdown .select2-search__field:focus {
  border-color: var(--dhh-select2-control-focus);
  box-shadow: 0 0 0 3px var(--dhh-select2-control-ring);
}

.dhh-select2-dropdown .select2-results__option {
  position: relative;
  padding: 9px 12px;
}

.dhh-select2-dropdown .select2-results__option--selected {
  color: var(--dhh-select2-control-focus);
  background: color-mix(in srgb, var(--dhh-select2-control-focus) 8%, #ffffff);
  font-weight: 600;
}

.dhh-select2-dropdown .select2-results__option--highlighted.select2-results__option--selectable {
  background: var(--dhh-select2-control-focus);
  color: #ffffff;
}

/* Reusable compact multiselect for filter workspaces. */
.dhh-select2[data-dhh-select2-variant="filter-multi"] + .select2-container {
  --dhh-filter-multi-action-width: 2.5rem;
}

.dhh-select2-selection--filter-multi {
  position: relative;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(32, 39, 58, 0.04);
}

.dhh-select2-selection--filter-multi:hover {
  border-color: color-mix(in srgb, var(--dhh-select2-control-focus) 38%, var(--dhh-select2-control-border));
  background: color-mix(in srgb, var(--dhh-select2-control-bg) 96%, var(--dhh-select2-control-focus));
}

.select2-container--focus .dhh-select2-selection--filter-multi,
.select2-container--open .dhh-select2-selection--filter-multi {
  border-color: var(--dhh-select2-control-focus);
  background: var(--dhh-select2-control-bg);
  box-shadow: 0 0 0 3px var(--dhh-select2-control-ring);
}

.dhh-select2-selection--filter-multi.select2-selection--multiple {
  height: var(--dhh-select2-control-height);
  max-height: var(--dhh-select2-control-height);
  padding: 0 calc(var(--dhh-filter-multi-action-width) + 0.45rem) 0 0.75rem;
}

.dhh-select2-selection--filter-multi.select2-selection--multiple::before {
  position: absolute;
  z-index: 1;
  top: 0.62rem;
  right: var(--dhh-filter-multi-action-width);
  bottom: 0.62rem;
  border-left: 1px solid var(--dhh-select2-control-border);
  content: "";
  opacity: 0.72;
  pointer-events: none;
}

.dhh-select2-selection--filter-multi.select2-selection--multiple::after {
  position: absolute;
  top: 50%;
  right: 0.96rem;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--dhh-select2-control-muted);
  border-bottom: 1.5px solid var(--dhh-select2-control-muted);
  content: "";
  pointer-events: none;
  transform: translateY(-65%) rotate(45deg);
  transition: transform 160ms ease, border-color 160ms ease;
}

.select2-container--open .dhh-select2-selection--filter-multi.select2-selection--multiple::after {
  border-color: var(--dhh-select2-control-focus);
  transform: translateY(-30%) rotate(225deg);
}

.dhh-select2-selection--filter-multi.select2-selection--multiple .select2-selection__rendered {
  justify-content: flex-start;
  flex-wrap: nowrap;
  align-items: center;
  width: 100%;
  max-width: 100%;
  height: 100%;
  overflow: hidden;
  gap: 0.25rem;
}

.dhh-select2-selection--filter-multi.dhh-select2-selection--empty .select2-search--inline {
  position: absolute;
  top: 50%;
  right: var(--dhh-filter-multi-action-width);
  left: 0;
  display: block;
  width: auto;
  min-width: 0;
  height: 1.25rem;
  padding: 0 0.75rem;
  box-sizing: border-box;
  pointer-events: none;
  transform: translateY(-50%);
}

.dhh-select2-selection--filter-multi.dhh-select2-selection--empty .select2-search__field {
  display: block;
  width: 100% !important;
  min-width: 0;
  max-width: none;
  height: 1.25rem;
  margin: 0;
  padding: 0;
  overflow: hidden;
  color: var(--dhh-select2-control-muted);
  font-size: var(--dhh-select2-font-size);
  font-weight: 500;
  line-height: 1.25rem;
  text-align: left !important;
  text-overflow: clip;
  white-space: nowrap;
}

.dhh-select2 + .select2-container .dhh-select2-selection--filter-multi.select2-selection--multiple .select2-selection__choice {
  flex: 0 1 auto;
  min-height: 0;
  max-width: calc(50% - 0.14rem);
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--dhh-select2-control-color);
  background: transparent;
  box-shadow: none;
  font-size: var(--dhh-select2-font-size);
  font-weight: 600;
  line-height: 1.25rem;
}

.dhh-select2 + .select2-container .dhh-select2-selection--filter-multi.dhh-select2-selection--one-value .select2-selection__choice {
  flex: 0 1 auto;
  max-width: 100%;
}

.dhh-select2 + .select2-container .dhh-select2-selection--filter-multi.select2-selection--multiple .select2-selection__choice__display {
  padding: 0;
}

.dhh-select2 + .select2-container .dhh-select2-selection--filter-multi.select2-selection--multiple .select2-selection__choice__remove {
  display: inline-grid;
}

.dhh-select2 + .select2-container .dhh-select2-selection--filter-multi.dhh-select2-selection--two-values .select2-selection__choice:first-of-type .select2-selection__choice__display::after {
  content: ",";
}

.dhh-select2 + .select2-container .dhh-select2-selection--filter-multi .dhh-select2-selection-summary {
  flex: 0 0 auto;
  max-width: 100%;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--dhh-select2-control-color);
  background: transparent;
  font-size: var(--dhh-select2-font-size);
  font-weight: 600;
  line-height: 1.25rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dhh-select2 + .select2-container .dhh-select2-selection--filter-multi .dhh-select2-selection-summary::before {
  content: none;
}

.dhh-select2-selection--filter-multi.dhh-select2-selection--has-value .select2-search--inline {
  position: absolute;
  flex: 0 0 1px;
  width: 1px;
  min-width: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.dhh-select2-dropdown--filter-multi {
  margin-top: 0.38rem;
  padding: 0.42rem;
  border: 1px solid var(--dhh-select2-control-border);
  border-radius: calc(var(--dhh-select2-control-radius) + 4px);
  background: var(--dhh-select2-control-bg);
  box-shadow: 0 18px 42px rgba(20, 25, 50, 0.15), 0 4px 12px rgba(20, 25, 50, 0.07);
}

.dhh-select2-dropdown--filter-multi .select2-search--dropdown {
  position: relative;
  display: block;
  padding: 0.32rem 0.32rem 0.58rem;
}

.dhh-select2-dropdown--filter-multi .select2-search--dropdown::before {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 0.94rem;
  width: 0.56rem;
  height: 0.56rem;
  border: 1.5px solid var(--dhh-select2-control-muted);
  border-radius: 50%;
  content: "";
  opacity: 1;
  pointer-events: none;
  transform: translateY(-68%);
  transition: opacity 120ms ease;
}

.dhh-select2-dropdown--filter-multi .select2-search--dropdown::after {
  position: absolute;
  z-index: 1;
  top: calc(50% + 0.1rem);
  left: 1.46rem;
  width: 0.3rem;
  border-top: 1.5px solid var(--dhh-select2-control-muted);
  content: "";
  opacity: 1;
  pointer-events: none;
  transform: rotate(45deg);
  transform-origin: left center;
  transition: opacity 120ms ease;
}

.dhh-select2-dropdown--filter-multi .select2-search--dropdown:focus-within::before,
.dhh-select2-dropdown--filter-multi .select2-search--dropdown:focus-within::after {
  opacity: 0;
}

.dhh-select2-dropdown--filter-multi .select2-search--dropdown .select2-search__field {
  min-height: 2.5rem;
  padding: 0.52rem 0.7rem 0.52rem 2.15rem;
  border-color: var(--dhh-select2-control-border);
  border-radius: calc(var(--dhh-select2-control-radius) + 2px);
  background: var(--dhh-select2-control-bg);
  transition: padding 120ms ease;
}

.dhh-select2-dropdown--filter-multi .select2-search--dropdown:focus-within .select2-search__field {
  padding-left: 0.7rem;
}

.dhh-select2-dropdown--filter-multi .select2-results__options {
  padding: 0.1rem;
  scrollbar-color: var(--dhh-select2-control-border) transparent;
  scrollbar-width: thin;
}

.dhh-select2-dropdown--filter-multi .select2-results__option {
  min-height: 2.4rem;
  margin: 0.08rem 0;
  padding: 0.6rem 2.35rem 0.6rem 0.72rem;
  border-radius: calc(var(--dhh-select2-control-radius) + 1px);
  color: var(--dhh-select2-control-color);
  line-height: 1.35;
}

.dhh-select2-dropdown--filter-multi .dhh-select2-result {
  display: flex;
  align-items: center;
  min-width: 0;
}

.dhh-select2-dropdown--filter-multi .dhh-select2-result__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dhh-select2-dropdown--filter-multi .select2-results__option--selected::after {
  position: absolute;
  top: 50%;
  right: 0.62rem;
  display: grid;
  width: 1.1rem;
  height: 1.1rem;
  place-items: center;
  border-radius: 5px;
  color: #fff;
  background: var(--dhh-select2-control-focus);
  content: "\2713";
  font-size: 0.62rem;
  font-weight: 800;
  transform: translateY(-50%);
}

.dhh-select2-dropdown--filter-multi .select2-results__option--highlighted.select2-results__option--selectable {
  color: var(--dhh-select2-control-color);
  background: color-mix(in srgb, var(--dhh-select2-control-focus) 7%, var(--dhh-select2-control-bg));
}

.dhh-select2-dropdown--filter-multi .select2-results__option--selected.select2-results__option--highlighted {
  background: color-mix(in srgb, var(--dhh-select2-control-focus) 12%, var(--dhh-select2-control-bg));
}

.dhh-select2-dropdown--above.dhh-select2-dropdown--filter-multi {
  margin-top: -0.38rem;
  margin-bottom: 0.38rem;
}
