/*
 * Shared SelectWoo location component.
 *
 * The country selectors in checkout and cart use the same visual contract.
 * Context files may still control layout around the component, but must not
 * redefine its SelectWoo geometry or dropdown states.
 */

:root {
  --umatatea-location-select-height: 54px;
  --umatatea-location-select-value-padding: 29px 40px 0 14px;
  --umatatea-location-select-text: var(--checkout-brown, var(--summary-text, #5a342b));
  --umatatea-location-select-muted: rgba(90, 52, 43, 0.40);
  --umatatea-location-select-border: rgba(90, 52, 43, 0.12);
  --umatatea-location-select-border-active: rgba(90, 52, 43, 0.42);
}

.umatatea-location-select {
  box-sizing: border-box !important;
  width: 100% !important;
  height: var(--umatatea-location-select-height) !important;
  min-height: var(--umatatea-location-select-height) !important;
  margin: 0 !important;
  padding: 22px 14px 4px !important;
  border: 1px solid var(--umatatea-location-select-border) !important;
  border-radius: 6px !important;
  background: #fff !important;
  color: var(--umatatea-location-select-text) !important;
  font-family: var(--font-body, sans-serif) !important;
  font-size: 13.9px !important;
  font-weight: 400 !important;
  line-height: 1.15 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

select.umatatea-location-select {
  padding: var(--umatatea-location-select-value-padding) !important;
}

/* SelectWoo keeps the native select in the DOM. Hide it accessibly without
 * relying on checkout-specific rules or display:none. */
.umatatea-location-select.select2-hidden-accessible {
  position: absolute !important;
  width: 1px !important;
  min-width: 1px !important;
  height: 1px !important;
  min-height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.umatatea-location-select + .select2-container {
  width: 100% !important;
}

.umatatea-location-select + .select2-container--default .select2-selection--single {
  box-sizing: border-box !important;
  width: 100% !important;
  height: var(--umatatea-location-select-height) !important;
  min-height: var(--umatatea-location-select-height) !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid var(--umatatea-location-select-border) !important;
  border-radius: 6px !important;
  background: #fff !important;
  color: var(--umatatea-location-select-text) !important;
  font-family: var(--font-body, sans-serif) !important;
  font-size: 13.9px !important;
  font-weight: 400 !important;
  line-height: 1.15 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

.umatatea-location-select + .select2-container--default .select2-selection--single:hover,
.umatatea-location-select + .select2-container--default.select2-container--focus .select2-selection--single,
.umatatea-location-select + .select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--umatatea-location-select-border-active) !important;
  outline: 0 !important;
  box-shadow: none !important;
}

.umatatea-location-select + .select2-container .select2-selection__rendered {
  box-sizing: border-box !important;
  display: block !important;
  height: var(--umatatea-location-select-height) !important;
  margin: 0 !important;
  padding: var(--umatatea-location-select-value-padding) !important;
  overflow: visible !important;
  color: var(--umatatea-location-select-text) !important;
  font-family: var(--font-body, sans-serif) !important;
  font-size: 13.9px !important;
  font-weight: 400 !important;
  line-height: 1.15 !important;
  white-space: nowrap !important;
}

.umatatea-location-select + .select2-container .select2-selection__placeholder {
  margin: 0 !important;
  padding: 0 !important;
  color: var(--umatatea-location-select-muted) !important;
  line-height: 1.15 !important;
}

/* SelectWoo may render the empty option directly in the rendered value rather
 * than inside a placeholder span. The selected native option is authoritative. */
select.umatatea-location-select:has(> option:checked[value=""]) {
  color: var(--umatatea-location-select-muted) !important;
}

select.umatatea-location-select:has(> option:checked[value=""])
+ .select2-container .select2-selection__rendered {
  color: var(--umatatea-location-select-muted) !important;
}

.umatatea-location-select + .select2-container .select2-selection__arrow {
  top: 0 !important;
  right: 8px !important;
  height: var(--umatatea-location-select-height) !important;
}

/* The result-list IDs provide a lifecycle-independent fallback. The decorative
 * class remains useful in other contexts, but checkout styling does not depend
 * on its presence. */
:is(.umatatea-location-select-dropdown, .select2-dropdown:has(.select2-results__options:is([id*="_country-results"], [id*="_state-results"]))) {
  z-index: 999999 !important;
  overflow: hidden !important;
  border: 1px solid var(--umatatea-location-select-border) !important;
  border-radius: 8px !important;
  background: #fff !important;
  box-shadow: none !important;
}

:is(.umatatea-location-select-dropdown, .select2-dropdown:has(.select2-results__options:is([id*="_country-results"], [id*="_state-results"]))) .select2-search--dropdown {
  padding: 7px 12px 6px !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(90, 52, 43, 0.08) !important;
  background: #fff !important;
}

:is(.umatatea-location-select-dropdown, .select2-dropdown:has(.select2-results__options:is([id*="_country-results"], [id*="_state-results"]))) .select2-search__field {
  box-sizing: border-box !important;
  height: 34px !important;
  min-height: 34px !important;
  margin: 0 !important;
  padding: 0 2px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--umatatea-location-select-text) !important;
  font-family: var(--font-body, sans-serif) !important;
  font-size: 12.8px !important;
  line-height: 34px !important;
  outline: 0 !important;
  box-shadow: none !important;
}

:is(.umatatea-location-select-dropdown, .select2-dropdown:has(.select2-results__options:is([id*="_country-results"], [id*="_state-results"]))) .select2-search__field::placeholder {
  color: rgba(90, 52, 43, 0.36) !important;
  opacity: 1 !important;
}

:is(.umatatea-location-select-dropdown, .select2-dropdown:has(.select2-results__options:is([id*="_country-results"], [id*="_state-results"]))) .select2-search__field:is(:focus, :focus-visible) {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

:is(.umatatea-location-select-dropdown, .select2-dropdown:has(.select2-results__options:is([id*="_country-results"], [id*="_state-results"]))) .select2-results__option {
  padding: 9px 13px !important;
  border: 0 !important;
  background: #fff !important;
  color: var(--umatatea-location-select-text) !important;
  font-family: var(--font-body, sans-serif) !important;
  font-size: 13px !important;
  line-height: 1.35 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

:is(.umatatea-location-select-dropdown, .select2-dropdown:has(.select2-results__options:is([id*="_country-results"], [id*="_state-results"]))) .select2-results__option:is([aria-selected="true"], [data-selected="true"]) {
  background: rgba(90, 52, 43, 0.035) !important;
}

:is(.umatatea-location-select-dropdown, .select2-dropdown:has(.select2-results__options:is([id*="_country-results"], [id*="_state-results"]))) .select2-results__option--highlighted {
  border: 0 !important;
  background: rgba(90, 52, 43, 0.075) !important;
  color: var(--umatatea-location-select-text) !important;
  outline: 0 !important;
  box-shadow: none !important;
}

:is(.umatatea-location-select-dropdown, .select2-dropdown:has(.select2-results__options:is([id*="_country-results"], [id*="_state-results"]))) .select2-results__options {
  max-height: 240px !important;
}

@media (max-width: 680px) {
  .umatatea-location-select,
  .umatatea-location-select + .select2-container--default .select2-selection--single {
    border-radius: 5px !important;
  }

  .umatatea-location-select + .select2-container .select2-selection__arrow {
    right: 8px !important;
    width: 24px !important;
  }

  .umatatea-location-select + .select2-container .select2-selection__arrow b {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 8px !important;
    height: 8px !important;
    margin: -5px 0 0 -4px !important;
    border: 0 !important;
    border-right: 1.5px solid rgba(90, 52, 43, 0.78) !important;
    border-bottom: 1.5px solid rgba(90, 52, 43, 0.78) !important;
    background: transparent !important;
    transform: rotate(45deg) !important;
  }
}
