[data-theme="dark"] {
  --__ac-search-button-border: var(--a-border-on-inverted);
  --__ac-search-button-border-hover: var(--a-blue-200);
  --__ac-search-clear-icon: var(--a-white);
  --__ac-search-clear-icon-hover: var(--a-blue-200);
  --__ac-search-error-border: var(--a-red-300);
}

[data-theme="light"] {
  --__ac-search-button-border: initial;
  --__ac-search-button-border-hover: initial;
  --__ac-search-clear-icon: initial;
  --__ac-search-clear-icon-hover: initial;
  --__ac-search-error-border: initial;
}

.navds-search {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.navds-search__wrapper-inner {
  position: relative;
  width: 100%;
}

.navds-search--with-size :where(.navds-search__wrapper-inner) {
  width: inherit;
}

.navds-search__wrapper {
  display: inline-flex;
  align-items: center;
}

.navds-search__input {
  padding-right: var(--a-spacing-10);
}

.navds-form-field--small .navds-search__input {
  padding-right: var(--a-spacing-8);
}

.navds-search__input--simple {
  padding-left: var(--a-spacing-11);
}

.navds-form-field--small .navds-search__input--simple {
  padding-left: var(--a-spacing-7);
}

.navds-search__input:not(.navds-search__input--simple) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.navds-search__search-icon {
  position: absolute;
  left: var(--a-spacing-3);
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 1.5rem;
}

.navds-form-field--small .navds-search__search-icon {
  left: var(--a-spacing-2);
  font-size: 1rem;
}

.navds-search__button-clear {
  position: absolute;
  right: 0.75rem;
  border-radius: var(--a-border-radius-medium);
  color: var(--ac-search-clear-icon, var(--__ac-search-clear-icon, var(--a-text-default)));
  height: 32px;
  width: 32px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 1.25rem;
  padding: 0;
}

.navds-form-field--small .navds-search__button-clear {
  right: 0.5rem;
  height: 24px;
  width: 24px;
}

.navds-search__button-clear:hover {
  color: var(--ac-search-clear-icon-hover, var(--__ac-search-clear-icon-hover, var(--a-text-action-hover)));
}

.navds-search__button-clear:focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--a-shadow-focus);
}

@supports not selector(:focus-visible) {
  .navds-search__button-clear:focus {
    outline: 2px solid transparent;
    box-shadow: var(--a-shadow-focus);
  }
}

.navds-search__button-search {
  flex-shrink: 0;
  min-width: 4rem;
  min-height: 2rem;
  border-radius: 0;
  border-top-right-radius: var(--a-border-radius-medium);
  border-bottom-right-radius: var(--a-border-radius-medium);
}

.navds-form-field--small .navds-search__button-search svg {
  font-size: 1rem;
}

.navds-form-field--small .navds-search__button-search {
  min-width: 2.5rem;
}

.navds-search__button-search.navds-button--secondary {
  box-shadow:
    -1px 0 0 0 var(--ac-search-button-border, var(--__ac-search-button-border, var(--a-border-default))) inset,
    0 1px 0 0 var(--ac-search-button-border, var(--__ac-search-button-border, var(--a-border-default))) inset,
    0 -1px 0 0 var(--ac-search-button-border, var(--__ac-search-button-border, var(--a-border-default))) inset;
}

.navds-search__button-search.navds-button--secondary:where(:hover, :active) {
  box-shadow:
    -1px 0 0 0 var(--ac-search-button-border-hover, var(--__ac-search-button-border-hover, var(--a-border-action-hover))) inset,
    0 1px 0 0 var(--ac-search-button-border-hover, var(--__ac-search-button-border-hover, var(--a-border-action-hover))) inset,
    0 -1px 0 0 var(--ac-search-button-border-hover, var(--__ac-search-button-border-hover, var(--a-border-action-hover))) inset,
    -1px 0 0 0 var(--ac-search-button-border-hover, var(--__ac-search-button-border-hover, var(--a-border-action-hover)));
  z-index: 1;
}

.navds-search__wrapper-inner:focus-within + .navds-search__button-search.navds-button--secondary:hover {
  z-index: auto;
}

.navds-search__button-search.navds-button--secondary:focus-visible {
  box-shadow:
    0 0 0 1px var(--ac-search-button-border, var(--__ac-search-button-border, var(--a-border-default))) inset,
    var(--a-shadow-focus);
}

.navds-search__button-search.navds-button--secondary:focus-visible:hover {
  box-shadow:
    0 0 0 1px var(--ac-search-button-border-hover, var(--__ac-search-button-border-hover, var(--a-border-action-hover))) inset,
    var(--a-shadow-focus);
}

.navds-search__button-search.navds-button--secondary:focus-visible:active {
  box-shadow:
    0 0 0 1px var(--ac-search-button-focus-active-border, var(--a-surface-default)) inset,
    var(--a-shadow-focus);
}

@supports not selector(:focus-visible) {
  .navds-search__button-search.navds-button--secondary:focus {
    box-shadow:
      0 0 0 1px var(--ac-search-button-border, var(--__ac-search-button-border, var(--a-border-default))) inset,
      var(--a-shadow-focus);
  }

  .navds-search__button-search.navds-button--secondary:focus:hover {
    box-shadow:
      0 0 0 1px var(--ac-search-button-border-hover, var(--__ac-search-button-border-hover, var(--a-border-action))) inset,
      var(--a-shadow-focus);
  }

  .navds-search__button-search.navds-button--secondary:focus:active {
    box-shadow:
      0 0 0 1px var(--ac-search-button-focus-active-border, var(--a-surface-default)) inset,
      var(--a-shadow-focus);
  }
}

/* Error-handling */
.navds-search--error .navds-search__input:not(:hover, :disabled) {
  border-color: var(--ac-search-error-border, var(--__ac-search-error-border, var(--a-border-danger)));
  box-shadow: inset 0 0 0 1px var(--ac-search-error-border, var(--__ac-search-error-border, var(--a-border-danger)));
}

.navds-search--error .navds-search__input:focus-visible:not(:hover, :disabled) {
  box-shadow:
    inset 0 0 0 1px var(--ac-search-error-border, var(--__ac-search-error-border, var(--a-border-danger))),
    var(--a-shadow-focus);
}

/* Focus layering */
.navds-search__input:focus-visible,
.navds-search__button-clear,
.navds-search__button-search:focus-visible {
  z-index: 1;
}

@supports not selector(:focus-visible) {
  .navds-search--error .navds-search__input:focus:not(:hover, :disabled) {
    box-shadow:
      inset 0 0 0 1px var(--ac-search-error-border, var(--__ac-search-error-border, var(--a-border-danger))),
      var(--a-shadow-focus);
  }

  .navds-search__input:focus,
  .navds-search__button-search:focus {
    z-index: 1;
  }
}

@media (forced-colors: active) {
  .navds-modal {
    outline: 2px solid transparent;
  }

  .navds-search__button-clear:hover {
    color: highlight;
  }
}
