/* W&W Dropdown-Struktur 1.0.4. Gestaltung ueber Variablen an .ww-form. */
.wwf-select-group {
  position: relative;
  --wwf-select-height: var(--ww-form-field-height, 55px);
  --wwf-select-font: var(--ww-form-dropdown-font-size, var(--wwf-native-select-font, 18px));
  --wwf-option-font: var(--ww-form-dropdown-option-size, 16px);
  --wwf-option-padding: var(--ww-form-dropdown-item-padding, 12px);
}

/* Den bisherigen, am Gruppencontainer gezeichneten Pfeil abschalten. */
.ww-form .form-group.wwf-select-group::after { content: none !important; display: none !important; }

/* Die native Auswahl bleibt fuer FormData und Pflichtfeldpruefung erhalten. */
.wwf-select-group > select.select2-hidden-accessible {
  position: absolute !important;
  width: 1px !important; min-width: 0 !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important;
  border: 0 !important; overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important; clip-path: inset(50%) !important;
}
.wwf-select-group > .select2-container--wwf { display: block; width: 100% !important; max-width: 100%; }
.wwf-select-group .select2-container--wwf .select2-selection--single {
  display: flex; align-items: center;
  position: relative; height: var(--wwf-select-height);
  margin: 0; padding: 0 48px 0 14px;
  border: 0; border-bottom: 2px solid var(--ww-darkgrey, #777);
  border-radius: 0; background: var(--ww-white, #fff);
  color: var(--ww-black, #000); font-family: inherit;
  font-size: var(--wwf-select-font); font-weight: 400;
  box-sizing: border-box; cursor: pointer; outline: none;
  transition: border-color .2s ease;
}
.wwf-select-group .select2-container--wwf .select2-selection__rendered {
  display: block; width: 100%; padding: 0;
  color: inherit; font: inherit; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wwf-select-group .select2-selection__placeholder { color: transparent; }
.wwf-select-group.wwf-select-valid:not(:focus-within):not(.wwf-select-open) .select2-selection--single {
  border-bottom-color: var(--ww-green, #27823d);
}
.wwf-select-group:is(:focus-within, .wwf-select-open) .select2-selection--single {
  border-bottom-color: var(--ww-yellow, #fc0);
}
/* Tastatur und Maus verwenden dieselbe gelbe Unterlinie. */
.wwf-select-group .select2-selection--single:focus-visible {
  outline: none !important;
  box-shadow: none !important;
  border-bottom-color: var(--ww-yellow, #fc0);
}
/* Platz fuer Loeschen und Chevron; das native Feld bleibt unveraendert. */
.wwf-select-group .select2-selection--single:has(.select2-selection__clear) { padding-right: 88px; }
.wwf-select-group .select2-selection__clear {
  position: absolute; top: 0; right: 44px;
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 100%; float: none;
  margin: 0; padding: 0; border: 0; border-radius: 0;
  background: transparent; color: var(--ww-blue, #12273c);
  font-family: inherit; font-size: 26px; font-weight: 400; line-height: 1;
  cursor: pointer; z-index: 1;
}
.wwf-select-group .select2-selection__clear:hover { color: var(--ww-yellow-hover, #fb0); }
.wwf-select-group .select2-selection__arrow {
  position: absolute; right: 0; top: 0; width: 48px; height: 100%; pointer-events: none;
}
.wwf-select-group .select2-selection__arrow b {
  position: absolute; top: 50%; left: 50%; width: 12px; height: 12px;
  margin: 0; border: 0; border-right: 2px solid var(--ww-blue, #12273c); border-bottom: 2px solid var(--ww-blue, #12273c);
  transform: translate(-50%, -70%) rotate(45deg);
}
.wwf-select-group.wwf-select-open .select2-selection__arrow b { transform: translate(-50%, -30%) rotate(225deg); }
.wwf-select-group .select2-container--disabled .select2-selection--single { opacity: .6; cursor: default; }

/* Die Zusatzklassen decken auch Fokus im ausgeklappten Suchfeld ab. */
.ww-form .form-group.wwf-select-group > label {
  position: absolute; top: calc(var(--wwf-select-height) / 2); left: 14px;
  margin: 0; z-index: 2; transform: translateY(-50%);
  color: var(--ww-text-grey, #777); font-size: var(--ww-form-font-size, 18px);
  line-height: 1; font-weight: 400; pointer-events: none;
}
.ww-form .form-group.wwf-select-group:is(.wwf-select-filled, .wwf-select-open, :focus-within) > label {
  top: -4px; left: 0; transform: translateY(-100%);
  color: var(--ww-text, #333); font-size: var(--ww-form-label-small, 14px);
}

/* Geoeffnete Liste liegt innerhalb der Formularklasse und erbt deren Variablen. */
.wwf-select-group > .select2-container--open { z-index: 1051; }
.wwf-select-group .wwf-select-dropdown {
  overflow: hidden; border: 1px solid var(--ww-darkgrey, #777);
  border-radius: 0; background: var(--ww-white, #fff);
  color: var(--ww-black, #000); font-family: inherit; font-size: var(--wwf-option-font);
  box-shadow: 0 5px 14px rgb(0 0 0 / 18%);
}
.wwf-select-group .wwf-select-dropdown .select2-results__options {
  max-height: 260px; overflow-y: auto; margin: 0; padding: 0; list-style: none;
}
.wwf-select-group .wwf-select-dropdown .select2-results__option {
  margin: 0; padding: var(--wwf-option-padding); border: 0;
  font: inherit; font-weight: 400; line-height: 1.3;
  color: var(--ww-black, #000); background: var(--ww-white, #fff);
  cursor: pointer; overflow-wrap: anywhere;
}
.wwf-select-group .wwf-select-dropdown .select2-results__option::before { content: none; }
.wwf-select-group .wwf-select-dropdown .select2-results__option[aria-selected="true"] { background: var(--ww-lightgrey, #eee); }
.wwf-select-group .wwf-select-dropdown .select2-results__option--highlighted[aria-selected] {
  background: var(--ww-yellow-hover, #fb0); color: var(--ww-black, #000);
}
.wwf-select-group .wwf-select-dropdown .select2-results__option[aria-disabled="true"] { color: #777; cursor: default; }
/* Lupe und Suchtext bleiben trotz ausgeblendeter Floating-Platzhalter sichtbar. */
.wwf-select-group .wwf-select-dropdown .select2-search--dropdown {
  position: relative;
  padding: 8px;
}
.wwf-select-group .wwf-select-dropdown .select2-search--dropdown::before {
  content: "";
  position: absolute; left: 20px; top: 19px;
  width: 12px; height: 12px; box-sizing: border-box;
  border: 2px solid var(--ww-text-grey, #777); border-radius: 50%;
  pointer-events: none; z-index: 1;
}
.wwf-select-group .wwf-select-dropdown .select2-search--dropdown::after {
  content: "";
  position: absolute; left: 30px; top: 30px;
  width: 7px; height: 2px;
  background: var(--ww-text-grey, #777);
  transform: rotate(45deg); transform-origin: left center;
  pointer-events: none; z-index: 1;
}
.wwf-select-group .wwf-select-dropdown input.select2-search__field {
  width: 100%; height: 38px; min-height: 0; padding: 6px 10px 6px 34px;
  background: var(--ww-white, #fff); border: 1px solid var(--ww-darkgrey, #777) !important;
  border-radius: 0; color: var(--ww-black, #000); font: inherit;
}
.wwf-select-group .wwf-select-dropdown input.select2-search__field:focus {
  outline: 2px solid var(--ww-yellow, #fc0) !important; outline-offset: 0;
}

.wwf-select-group .wwf-select-dropdown input.select2-search__field::placeholder {
  color: var(--ww-text-grey, #777) !important;
  opacity: 1 !important;
}

/* Gewerkeauswahl: sichtbarer Platzhalter statt Floating Label.
   Das echte Label bleibt fuer Screenreader verfuegbar. */
.wwf-select-group.wwf-select-placeholder-only > label {
  position: absolute !important;
  width: 1px !important; height: 1px !important;
  margin: -1px !important; padding: 0 !important;
  overflow: hidden !important; white-space: nowrap !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
}
.wwf-select-group.wwf-select-placeholder-only .select2-selection__placeholder {
  color: var(--ww-text-grey, #777);
}
