/* =========================[ FEX LOOKUP - BASE ]========================= */
.fex-lookup {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  font-size: var(--font-size-small);
  font-family: var(--font-primary);
  width: 100%;
}

.fex-lookup-wrapper {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  border: 1px solid #d8e1ee;
  border-radius: var(--radius-tiny);
  background: var(--white);
  transition: all 0.25s ease;
  min-height: 42px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  overflow: hidden;
}

.fex-lookup-wrapper:hover {
  border-color: var(--color-border-default-focus);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.08);
}

.fex-lookup-search-group {
  display: flex;
  align-items: stretch;
  flex: 0 0 72px;
  min-width: 72px;
  max-width: 72px;
  border-right: 1px solid #d8e1ee;
  background: #f8fafc;
  overflow: hidden;
}

.fex-lookup-display-group {
  display: flex;
  align-items: stretch;
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
}

form .fex-lookup-search,
.fex-lookup .fex-lookup-search,
.fex-lookup input.fex-lookup-search,
form input.fex-lookup-search[type="text"] {
  flex: 1;
  min-width: 0;
  border: none !important;
  background: #f8fafc !important;
  color: var(--color-gray);
  font-size: 11px;
  font-family: var(--font-primary);
  font-weight: 600;
  padding: 0 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: none !important;
  outline: none !important;
  border-radius: 0 !important;
  min-height: 40px !important;
  text-align: left;
}

.fex-lookup:not(.has-search-field) .fex-lookup-search-group {
  display: none;
}

form .fex-lookup-display,
.fex-lookup .fex-lookup-display,
.fex-lookup input.fex-lookup-display,
form input.fex-lookup-display[type="text"] {
  flex: 1;
  min-width: 0;
  border: none !important;
  background: transparent !important;
  color: var(--color-text);
  font-size: var(--font-size-small);
  font-family: var(--font-primary);
  font-weight: 500;
  padding: 0 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: none !important;
  outline: none !important;
  border-radius: 0 !important;
  min-height: 40px !important;
}

.fex-lookup-manual .fex-lookup-display,
form .fex-lookup-manual .fex-lookup-display,
.fex-lookup-manual input.fex-lookup-display,
form input.fex-lookup-display[type="text"].fex-lookup-manual {
  cursor: text;
}

.fex-lookup.has-search-field .fex-lookup-search {
  cursor: text;
}

form .fex-lookup-search:focus,
.fex-lookup .fex-lookup-search:focus,
.fex-lookup input.fex-lookup-search:focus,
form input.fex-lookup-search[type="text"]:focus,
form .fex-lookup-display:focus,
.fex-lookup .fex-lookup-display:focus,
.fex-lookup input.fex-lookup-display:focus,
form input.fex-lookup-display[type="text"]:focus {
  border-top: none !important;
  border-bottom: none !important;
  box-shadow: none !important;
  outline: none !important;
}

.fex-lookup-actions {
  display: flex;
  align-items: stretch;
  flex: 0 0 auto;
  height: 100%;
  border-left: 1px solid #d8e1ee;
}

.fex-lookup-btn {
  width: 42px;
  min-width: 42px;
  border: none;
  border-left: 1px solid #d8e1ee;
  background: var(--white);
  color: var(--color-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: none;
  border-radius: 0;
  transition: all 0.2s ease;
}

.fex-lookup-search-group .fex-lookup-btn,
.fex-lookup-display-group .fex-lookup-btn {
  border-left: 1px solid #d8e1ee;
}

.fex-lookup-actions .fex-lookup-btn:first-child {
  border-left: none;
}

.fex-lookup-btn:hover {
  width: 42px;
  min-width: 42px;
  background: #f8fafc;
  color: var(--color-blue-primary);
  padding: 0;
  border: none;
  border-left: 1px solid #d8e1ee;
  box-shadow: none;
  border-radius: 0;
}

.fex-lookup-actions .fex-lookup-btn:first-child:hover {
  border-left: none;
}

.fex-lookup-btn i {
  margin-right: 0;
  font-size: 12px;
}

.fex-lookup-search-toggle,
.fex-lookup-manual-toggle {
  display: none;
}

.fex-lookup.open .fex-lookup-wrapper,
.fex-lookup-wrapper:focus-within {
  border-color: var(--color-border-default-focus);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.08);
}

/* =========================[ STATES ]========================= */
.fex-lookup.disabled {
  opacity: 0.6;
  pointer-events: none;
}

.fex-lookup.input-error .fex-lookup-wrapper {
  border: 1px solid var(--color-error, #e11d48) !important;
  box-shadow: 0 0 4px rgba(225, 29, 72, 0.5);
}

/* =========================[ LOOKUP MODAL ]========================= */
.fex-lookup-modal-box {
  max-width: 980px;
  width: min(980px, calc(100vw - 32px));
}

.fex-lookup-modal-content {
  overflow: auto;
}

.fex-lookup-datalist .data-list-header .data-list-col,
.fex-lookup-datalist .data-list-row .data-list-col {
  align-items: center;
}

.fex-lookup-datalist .data-list-col-actions {
  justify-content: flex-end;
}

/* =========================[ MOBILE ]========================= */
@media (max-width: 768px) {
  .fex-lookup-modal-box {
    width: calc(100vw - 16px);
  }

  .fex-lookup-search-group {
    flex: 0 1 96px;
    min-width: 72px;
    max-width: 96px;
  }

  form .fex-lookup-search,
  .fex-lookup .fex-lookup-search,
  .fex-lookup input.fex-lookup-search,
  form input.fex-lookup-search[type="text"] {
    padding: 10px 8px;
    font-size: 10px;
    min-height: 44px !important;
  }

  .fex-lookup.has-search-field .fex-lookup-search-toggle {
    display: flex;
  }

  .fex-lookup.fex-lookup-manual .fex-lookup-manual-toggle {
    display: flex;
  }

  .fex-lookup-btn {
    width: 34px;
    min-width: 34px;
  }

  form .fex-lookup-display,
  .fex-lookup .fex-lookup-display,
  .fex-lookup input.fex-lookup-display,
  form input.fex-lookup-display[type="text"] {
    padding: 10px 12px;
    min-height: 44px !important;
  }

  .fex-lookup-wrapper {
    min-width: 0;
  }

  .fex-lookup-display-group {
    flex: 1 1 0;
    min-width: 0;
  }

  form .fex-lookup-display,
  .fex-lookup .fex-lookup-display,
  .fex-lookup input.fex-lookup-display,
  form input.fex-lookup-display[type="text"] {
    padding: 10px 8px;
  }

}
