/*
 * Norgesprofil Search Autocomplete styles.
 *
 * Lifted from Storefront/app/components/SearchAutocomplete.vue. Selectors
 * are scoped under `np-search-autocomplete` instead of `.fl-header` so the
 * styles apply wherever the custom element is placed, regardless of WP
 * theme. If the surrounding theme uses Flatsome (.fl-*) classes the form
 * inputs will still look native to the theme; otherwise the rules below
 * supply sensible defaults.
 */

np-search-autocomplete {
  display: block;
  position: relative;
  width: 100%;
}

.search-autocomplete-wrapper {
  position: relative;
}

.search-autocomplete-wrapper .searchform {
  margin: 0;
}

.search-autocomplete-wrapper .fl-flex-row {
  display: flex;
  align-items: stretch;
  width: 100%;
}
.search-autocomplete-wrapper .fl-flex-col {
  display: flex;
}
.search-autocomplete-wrapper .fl-flex-grow {
  flex: 1 1 auto;
  min-width: 0;
}

.search-autocomplete-wrapper input[type="search"]::-webkit-search-cancel-button,
.search-autocomplete-wrapper input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}
.search-autocomplete-wrapper input[type="search"] {
  -moz-appearance: textfield;
}

.search-autocomplete-wrapper input[type="search"].fl-search-field {
  width: 100%;
  height: 48px;
  padding: 0 56px 0 20px;
  line-height: 48px;
  font-size: 15px;
  border-radius: 24px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: #fff;
  color: #000;
  box-sizing: border-box;
  outline: none;
  transition: border-radius 140ms ease,
              box-shadow 140ms ease,
              border-color 140ms ease;
}

.search-autocomplete-wrapper input[type="search"].fl-search-field:focus,
.search-autocomplete-wrapper input[type="search"].fl-search-field:focus-visible {
  border-color: rgba(0, 0, 0, 0.35);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.search-autocomplete-wrapper.is-open input[type="search"].fl-search-field {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-top-color: rgba(0, 0, 0, 0.2);
  border-left-color: rgba(0, 0, 0, 0.2);
  border-right-color: rgba(0, 0, 0, 0.2);
  border-bottom-color: transparent;
  box-shadow: none;
}

.search-autocomplete-wrapper button[type="submit"].fl-submit-button {
  width: 48px;
  height: 48px;
  min-height: 48px;
  min-width: 48px;
  line-height: 48px;
  /* margin-left pulls the button over the right edge of the input (the
     button column is 48px wide and would otherwise sit beside it).
     margin-right: 0 overrides Flatsome's default form-button right margin
     (~15px) which would otherwise extend the wrapper past the visible
     edge of the magnifier, causing the absolutely-positioned dropdown
     (left:0/right:0 of the wrapper) to overshoot the input on the right. */
  margin-left: -48px;
  margin-right: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #000;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}
.search-autocomplete-wrapper .fl-submit-button svg {
  margin: 0;
  display: block;
}

.search-autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 60;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-top: 0;
  border-radius: 0 0 24px 24px;
  margin-top: -1px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.search-autocomplete-dropdown[hidden] {
  display: none;
}

.search-autocomplete-dropdown-inner {
  max-height: 70vh;
  overflow-y: auto;
  border-top: 1px solid #efefef;
  border-radius: 0 0 24px 24px;
  padding-bottom: 10px;
}

.search-autocomplete-rewrite {
  padding: 10px 16px 6px;
  font-size: 13px;
  color: #555;
}
.search-autocomplete-rewrite strong {
  color: #000;
}

.search-autocomplete-loading,
.search-autocomplete-empty {
  padding: 14px 16px;
  color: #555;
  font-size: 14px;
}
.search-autocomplete-empty-title {
  color: #000;
  font-weight: 500;
  margin-bottom: 2px;
}
.search-autocomplete-empty-hint {
  font-size: 13px;
  color: #777;
}

.search-autocomplete-columns {
  display: flex;
  flex-direction: column;
}
.search-autocomplete-section + .search-autocomplete-section {
  border-top: 1px solid #efefef;
}

@media (min-width: 640px) {
  .search-autocomplete-columns {
    flex-direction: row;
    align-items: stretch;
  }
  .search-autocomplete-section {
    flex: 1 1 0;
    min-width: 0;
  }
  .search-autocomplete-section + .search-autocomplete-section {
    border-top: 0;
    border-left: 1px solid #efefef;
  }
}

.search-autocomplete-section {
  padding: 8px 0 10px;
}

.search-autocomplete-section-title {
  padding: 4px 16px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #888;
}

.search-autocomplete-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 16px;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.search-autocomplete-item.is-highlighted,
.search-autocomplete-item:hover {
  background: #f5f5f5;
}

.search-autocomplete-thumb {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  overflow: hidden;
  /* No default background: most category PNGs are transparent and were
     showing a gray square through the alpha. The acronym fallback below
     re-introduces a tint only when there's no image to render. */
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #666;
}
.search-autocomplete-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.search-autocomplete-thumb.is-acronym {
  background: #f0f0f0;
}

.search-autocomplete-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.search-autocomplete-name {
  font-size: 14px;
  line-height: 1.25;
  color: #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-autocomplete-meta {
  font-size: 12px;
  color: #777;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
