/*
 * SQR search select (see /assets/js/sqr-select.js).
 * Field: same look as the panel's inputs. List: fixed to the window,
 * 36px rows, up to 280px tall.
 */

.sqs,
.sqs *,
.sqs-pop,
.sqs-pop * {
  box-sizing: border-box;
}

.sqs {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}

/* The wrapper never draws a box of its own: the field inside does. */
div.sqs {
  height: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.sqs > input.sqs-input {
  display: block;
  width: 100%;
  height: 43px;
  min-width: 0;
  margin: 0;
  padding: 0 58px 0 12px;
  border: 1px solid #ccd4e0;
  border-radius: 8px;
  background: #fff;
  color: #172b4d;
  font: inherit;
  font-size: 14px;
  line-height: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
}

.sqs:not(.sqs--value) > input.sqs-input,
.sqs.sqs--open > input.sqs-input {
  padding-right: 34px;
}

.sqs > input.sqs-input::placeholder {
  color: #8a94a6;
  opacity: 1;
}

.sqs.sqs--open > input.sqs-input {
  cursor: text;
}

.sqs > input.sqs-input:focus,
.sqs.sqs--open > input.sqs-input {
  border-color: #7738c8;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(119, 56, 200, 0.16);
}

.sqs.sqs--invalid > input.sqs-input {
  border-color: #d14343;
  box-shadow: 0 0 0 3px rgba(209, 67, 67, 0.12);
}

.sqs.sqs--disabled > input.sqs-input {
  background: #f3f5f8;
  color: #8a94a6;
  cursor: not-allowed;
}

/* The real select: invisible, right over the field, so the browser's
   "fill in this field" message points at the right place. */
.sqs > select.sqs-native {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: -1;
  /* When the browser scrolls to an empty required field, keep it clear
     of the fixed top bar. */
  scroll-margin-top: 110px;
}

.sqs-arrow {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 26px;
  height: 26px;
  margin-top: -13px;
  border-radius: 6px;
  cursor: pointer;
}

.sqs-arrow::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 10px;
  width: 7px;
  height: 7px;
  border-right: 2px solid #8a94a6;
  border-bottom: 2px solid #8a94a6;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.sqs.sqs--open .sqs-arrow::before {
  top: 12px;
  transform: rotate(-135deg);
}

.sqs.sqs--disabled .sqs-arrow {
  cursor: not-allowed;
}

.sqs-clear {
  position: absolute;
  top: 50%;
  right: 32px;
  width: 24px;
  height: 24px;
  margin-top: -12px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #8a94a6;
  font-size: 18px;
  line-height: 24px;
  text-align: center;
  cursor: pointer;
}

.sqs-clear:hover {
  background: #f1ecfa;
  color: #7738c8;
}

.sqs-clear[hidden],
.sqs.sqs--open .sqs-clear {
  display: none;
}

/* Dropdown */
.sqs-pop {
  position: fixed;
  /* Above the panel theme's modals (z-index 9999), so a list opened in a modal can be clicked. */
  z-index: 10050;
  overflow: hidden;
  border: 1px solid #e1e5ec;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(23, 43, 77, 0.16);
  font-size: 14px;
  color: #172b4d;
}

.sqs-list {
  max-height: 280px;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  list-style: none;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.sqs-list:empty {
  display: none;
}

.sqs-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 7px;
  cursor: pointer;
  line-height: 1.3;
}

.sqs-opt.sqs--active {
  background: #f1ecfa;
}

.sqs-opt[aria-selected="true"] {
  color: #7738c8;
  font-weight: 600;
}

.sqs-opt[aria-selected="true"]::after {
  content: "";
  flex: 0 0 auto;
  width: 5px;
  height: 9px;
  margin: 0 2px -1px 0;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}

.sqs-opt[aria-disabled="true"] {
  color: #a5adbb;
  cursor: not-allowed;
}

.sqs-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sqs-sub {
  flex: 0 1 auto;
  max-width: 45%;
  overflow: hidden;
  color: #8a94a6;
  font-size: 12px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sqs-hl {
  padding: 0;
  border-radius: 2px;
  background: #fde68a;
  color: inherit;
  font-weight: 700;
}

.sqs-group {
  padding: 8px 10px 4px;
  color: #8a94a6;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sqs-foot {
  padding: 9px 12px;
  border-top: 1px solid #edf0f4;
  color: #64748b;
  font-size: 13px;
}

.sqs-list:empty + .sqs-foot {
  border-top: 0;
}

.sqs-foot[hidden] {
  display: none;
}

/* Tablets and phones: bigger rows for fingers. */
@media (pointer: coarse) {
  .sqs-opt {
    min-height: 42px;
  }
}

/* List search field with suggestions (data-sqr-suggest). */
.sqs-suggest > input.sqs-suggest-input {
  padding-right: 34px;
}

.sqs-suggest > input.sqs-suggest-input::-webkit-search-cancel-button {
  display: none;
}

.sqs-suggest > .sqs-clear {
  right: 7px;
}
