/* SmartCombo component styles. */
.x-smartcombo {
  width: 100%;
  max-width: none;
}

.x-smartcombo .x-input-wrap-el {
  min-height: 32px;
}

.x-smartcombo .x-input-wrap-el > .ts-wrapper,
.x-smartcombo .ts-wrapper.single {
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  align-self: stretch;
  box-sizing: border-box;
}

.x-smartcombo .ts-wrapper.x-input-el {
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.x-smartcombo .ts-control,
.x-smartcombo .ts-wrapper.single .ts-control,
.x-smartcombo .ts-wrapper.single.input-active .ts-control {
  min-height: 32px;
  padding: 0 30px 0 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  color: inherit;
  cursor: text;
  align-items: center;
}

/*
 * Tom Select gives its search input a 7rem minimum and allows flex wrapping.
 * In a narrow dialog that puts the caret on a second row next to a selected
 * item, which makes the ExtJS field grow when the dropdown opens.
 */
.x-smartcombo .ts-wrapper.single .ts-control {
  flex-wrap: nowrap;
}

.x-smartcombo .ts-control > input,
.x-smartcombo .ts-wrapper.single .ts-control input {
  min-height: 24px !important;
  margin: 0 !important;
  padding: 4px 0 !important;
  color: inherit;
  font: 400 13px/16px Roboto, sans-serif;
}

.x-smartcombo .ts-wrapper.single .ts-control > input {
  min-width: 0 !important;
  flex: 1 1 0 !important;
}

.x-smartcombo .ts-wrapper.single .ts-control .item {
  overflow: hidden;
  min-width: 0;
  margin: 0;
  padding: 4px 0;
  color: inherit;
  background: transparent;
  border: 0;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.x-smartcombo .ts-wrapper.single .ts-control::after {
  right: 10px;
  border-top-color: #718096;
}

/* A read-only field remains focusable, but has no actionable combo affordance. */
.x-smartcombo .ts-wrapper.smartcombo-readonly .clear-button,
.x-smartcombo .ts-wrapper.smartcombo-readonly .ts-control::after {
  display: none;
}

/* The dropdown is appended to body by Tom Select to escape ExtJS clipping. */
.smartcombo-dropdown {
  margin-top: 4px;
  border: 1px solid #d7e0eb;
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(35, 58, 90, 0.16);
  color: #26384c;
  /* ExtJS Modern floating dialogs live in #ext-global-floatWrap (z-index: 999999). */
  z-index: 1000000;
}

/* Used when there is not enough room below the field. */
.smartcombo-dropdown--above {
  margin-top: 0;
  margin-bottom: 4px;
}

.smartcombo-dropdown .option {
  padding: 8px 10px;
  line-height: 18px;
}

.smartcombo-dropdown .active {
  background: #e9f2fb;
  color: #124e7d;
}

.x-smartcombo.x-focused .x-underline-el {
  background-color: var(--base-color);
}

.x-smartcombo.x-invalid .x-underline-el {
  background-color: var(--alert-color);
}

.x-smartcombo-touch .x-input-wrap-el {
  cursor: pointer;
}

.x-smartcombo-touch .x-input-el {
  width: 100%;
  min-height: 32px;
  padding: 4px 30px 4px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: 400 13px/16px Roboto, sans-serif;
  pointer-events: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.x-smartcombo-touch .x-input-el:disabled {
  cursor: default;
}

/* The picker is an ExtJS Sheet; this class only styles its small content. */
.smartcombo-touch-picker {
  overflow: visible;
}

.smartcombo-touch-picker__select-host {
  min-height: 0;
  padding: 12px;
  overflow: visible;
}

.smartcombo-touch-picker__select-host > .ts-wrapper {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}

.smartcombo-touch-picker .ts-control {
  flex: 0 0 auto;
  width: 100%;
  min-height: 40px;
}

/*
 * Inside the touch picker the result list is content, not a floating popup.
 * Keep Tom Select's native search/selection lifecycle, but let the list flow
 * directly below the control so it cannot choose an artificial above/below
 * popup position inside the Sheet.
 */
.smartcombo-touch-picker .ts-dropdown {
  position: static !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  flex: 0 1 auto;
  box-sizing: border-box;
  width: 100% !important;
  margin: 6px 0 0;
  max-height: calc(80vh - 120px);
  overflow-x: hidden;
  overflow-y: auto;
  transform: none !important;
}

.x-smartcombo.x-disabled .ts-control,
.x-smartcombo .ts-wrapper.disabled .ts-control {
  background: transparent;
}
