/* Entity search behavior only. Visual defaults live in CSSClass rows. */

.entity-search-widget *,
.entity-search-widget *::before,
.entity-search-widget *::after,
.esw-overlay[data-esw-portal-owner],
.esw-overlay[data-esw-portal-owner] *,
.esw-overlay[data-esw-portal-owner] *::before,
.esw-overlay[data-esw-portal-owner] *::after {
  box-sizing: border-box;
}

.esw-form {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.esw-logo {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.esw-logo-image {
  display: block;
  width: auto;
  max-width: 180px;
  max-height: 72px;
  object-fit: contain;
}

.esw-logo-image[data-aqc-empty-media-placeholder="true"] {
  width: 132px;
  height: 96px;
}

.esw-filter-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 12px;
}

.esw-filter-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  color: inherit;
  cursor: pointer;
}

.esw-filter-option > input[type="checkbox"] {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: currentColor;
}

.esw-filter-option-label {
  line-height: 1.2;
}

.esw-sort-slot[hidden],
.esw-suggestions[hidden] {
  display: none !important;
}

.esw-submit-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.entity-search-widget--overlay .esw-overlay,
.esw-overlay[data-esw-portal-owner] {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147482500;
  display: none;
  width: 100vw !important;
  min-width: 100vw;
  height: 100vh !important;
  min-height: 100vh;
  max-width: none;
  max-height: none;
  padding: 0;
  pointer-events: none;
}

.entity-search-widget--overlay.is-open .esw-overlay,
.esw-overlay[data-esw-portal-owner].is-open {
  display: block;
}

.entity-search-widget--overlay .esw-backdrop,
.esw-overlay[data-esw-portal-owner] .esw-backdrop {
  display: block;
  width: 100vw;
  min-height: 100vh;
  pointer-events: auto;
}

.entity-search-widget--overlay .esw-panel,
.esw-overlay[data-esw-portal-owner] .esw-panel {
  pointer-events: auto;
}

.esw-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.entity-search-widget--overlay .esw-connected-results,
.esw-overlay[data-esw-portal-owner] .esw-connected-results {
  margin-top: 18px;
  min-width: 0;
}

.entity-search-widget--overlay.is-design-preview {
  display: inline-flex;
  width: auto;
}

.entity-search-widget--overlay.is-design-preview .esw-overlay,
.esw-overlay[data-esw-design-preview="true"] {
  z-index: 10030;
}

.entity-search-widget--overlay.is-design-preview[data-esw-design-state="inactive"] .esw-overlay,
.esw-overlay[data-esw-design-preview="true"]:not(.is-open) {
  display: none;
}

.entity-search-widget--dropdown .esw-control {
  position: relative;
  min-width: 0;
}

.entity-search-widget--dropdown .esw-submit-text {
  display: none;
}

.entity-search-widget--dropdown .esw-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 1000;
  display: none;
  max-height: 360px;
  overflow: auto;
}

.entity-search-widget--dropdown.has-query .esw-results,
.entity-search-widget--dropdown.has-results .esw-results,
.entity-search-widget--dropdown.has-error .esw-results,
.entity-search-widget--dropdown.is-open .esw-results {
  display: block;
}

.entity-search-widget--bar .esw-bar {
  position: relative;
  display: grid;
  gap: 8px;
  width: 100%;
}

.esw-mode-tabs {
  display: flex;
  align-items: center;
  gap: 14px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.esw-mode-tabs::-webkit-scrollbar {
  display: none;
}

.esw-mode-tab {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.esw-mode-tab[aria-selected="true"] {
  font-weight: 700;
}

.esw-mode-tab[aria-selected="false"] {
  color: color-mix(in srgb, currentColor 42%, transparent);
}

.esw-mode-tab:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.entity-search-widget--bar .esw-status:empty,
.entity-search-widget--bar .esw-suggestions:empty,
.entity-search-widget--bar .esw-results:empty,
.entity-search-widget--bar .esw-master-detail:empty {
  display: none;
}

.entity-search-widget--width-contained {
  width: min(100%, 960px);
  margin-inline: auto;
}

.entity-search-widget--width-column {
  width: min(100%, 720px);
}

.entity-search-widget--label-hidden .esw-label {
  display: none;
}

.entity-search-widget--label-left .esw-bar {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 16px;
}

.entity-search-widget--label-left .esw-form,
.entity-search-widget--label-left .esw-status,
.entity-search-widget--label-left .esw-suggestions,
.entity-search-widget--label-left .esw-results,
.entity-search-widget--label-left .esw-master-detail {
  grid-column: 2;
}

.entity-search-widget--submit-icon .esw-submit-text,
.entity-search-widget--submit-text .esw-submit-icon {
  display: none;
}

.entity-search-widget--inline-large .esw-form {
  gap: 12px;
}

.entity-search-widget--inline-large .esw-input,
.entity-search-widget--inline-large .esw-submit-button {
  min-height: 56px;
}

@media (max-width: 640px) {
  .entity-search-widget--label-left .esw-bar {
    grid-template-columns: minmax(0, 1fr);
  }

  .entity-search-widget--label-left .esw-form,
  .entity-search-widget--label-left .esw-status,
  .entity-search-widget--label-left .esw-suggestions,
  .entity-search-widget--label-left .esw-results,
  .entity-search-widget--label-left .esw-master-detail {
    grid-column: 1;
  }
}

.entity-search-widget--master-detail .esw-bar {
  grid-template-columns: minmax(0, 1fr);
}

.entity-search-widget--master-detail.has-results .esw-results {
  min-width: 0;
}

.entity-search-widget--master-detail .esw-master-detail {
  min-width: 0;
}

.entity-search-widget--master-detail .esw-result-row.is-selected {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}

.esw-master-detail-card {
  display: grid;
  gap: 8px;
}

.esw-master-detail-kicker,
.esw-master-detail-title,
.esw-master-detail-description,
.esw-master-detail-matches {
  margin: 0;
}

.esw-master-detail-action {
  justify-self: start;
}

@media (min-width: 900px) {
  .entity-search-widget--master-detail.has-results .esw-bar {
    grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
    align-items: start;
  }

  .entity-search-widget--master-detail.has-results .esw-label,
  .entity-search-widget--master-detail.has-results .esw-form,
  .entity-search-widget--master-detail.has-results .esw-status,
  .entity-search-widget--master-detail.has-results .esw-suggestions {
    grid-column: 1 / -1;
  }
}
