:root {
  --ru-search-text: #16324f;
  --ru-search-hover: #3ca0e7;
  --ru-search-placeholder: #9aabba;
  --ru-search-bg: #ffffff;
  --ru-search-shadow: 0px 3px 5px -1px #ccc;
  --ru-search-radius: 8px;
}

.menu-item-search > a {
  display: none !important;
}

.custom-header-search__input:focus,
.custom-header-search__input:hover,
.custom-header-search__input:active,
.custom-header-search__input[type="search"] {
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  appearance: none !important;
  -webkit-appearance: none !important;
}

.custom-header-search__button:hover,
.custom-header-search__button:focus,
.custom-header-search__button:active {
  background: transparent !important;
  color: var(--ru-search-hover) !important;
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
}

.custom-header-search__icon::before,
.custom-header-search__icon::after {
  content: "";
  position: absolute;
  display: block;
}

.custom-header-search__icon::before {
  left: 1px;
  top: 1px;
  width: 8px;
  height: 8px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.custom-header-search__icon::after {
  left: 9px;
  top: 9px;
  width: 5px;
  height: 1.5px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(45deg);
  transform-origin: left center;
}

@media (min-width: 992px) {
  .menu-item-search {
    position: relative;
    display: flex !important;
    align-items: center !important;
  }

  .custom-header-search {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: 4px;
    z-index: 20;
    top: -4px;
  }

  .custom-header-search__form {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: var(--ru-search-radius);
    background: transparent;
    box-shadow: none;
    overflow: hidden;
    transform: translateY(-3px);
    transition:
      width 240ms ease,
      background-color 180ms ease,
      box-shadow 180ms ease,
      transform 180ms ease;
  }

  .custom-header-search.is-open .custom-header-search__form,
  .custom-header-search:focus-within .custom-header-search__form {
    width: 168px;
    background: var(--ru-search-bg);
    box-shadow: var(--ru-search-shadow);
  }

  .custom-header-search__input {
    order: 2;
    flex: 1 1 auto;
    min-width: 0;
    width: 0;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--ru-search-text);
    font: inherit;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    appearance: none;
    -webkit-appearance: none;
    transition:
      opacity 160ms ease,
      padding 220ms ease;
  }

  .custom-header-search.is-open .custom-header-search__input,
  .custom-header-search:focus-within .custom-header-search__input {
    width: 100%;
    padding: 0 12px 0 10px;
    opacity: 1;
    pointer-events: auto;
  }

  .custom-header-search__input::placeholder {
    color: var(--ru-search-placeholder);
    font-size: 13px;
  }

  .custom-header-search__button {
    order: 1;
    position: relative;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    margin: 0;
    padding: 0;
    border: 0 !important;
    outline: 0 !important;
    border-radius: var(--ru-search-radius);
    background: transparent !important;
    box-shadow: none !important;
    color: var(--ru-search-text);
    cursor: pointer;
    transition: color 160ms ease;
  }

  .custom-header-search__icon {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 14px;
    height: 14px;
    transform: translate(-50%, -50%);
  }
}

@media (min-width: 769px) and (max-width: 991px) {
  .menu-item-search {
    position: relative;
    display: inline-flex !important;
    align-items: center !important;
    width: auto !important;
    margin-top: 0 !important;
    padding-left: 0 !important;
    vertical-align: middle;
  }

  .custom-header-search {
    position: relative;
    display: inline-flex !important;
    align-items: center;
    width: auto !important;
    margin: 0 0 0 6px !important;
    z-index: 20;
    top: 0;
  }

  .custom-header-search__form {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: var(--ru-search-radius);
    background: transparent;
    box-shadow: none;
    overflow: hidden;
    transition:
      width 240ms ease,
      background-color 180ms ease,
      box-shadow 180ms ease;
  }

  .custom-header-search.is-open .custom-header-search__form,
  .custom-header-search:focus-within .custom-header-search__form {
    width: 168px;
    background: var(--ru-search-bg);
    box-shadow: var(--ru-search-shadow);
  }

  .custom-header-search__input {
    order: 2;
    flex: 1 1 auto;
    min-width: 0;
    width: 0;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--ru-search-text);
    font: inherit;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    appearance: none;
    -webkit-appearance: none;
    transition:
      opacity 160ms ease,
      padding 220ms ease;
  }

  .custom-header-search.is-open .custom-header-search__input,
  .custom-header-search:focus-within .custom-header-search__input {
    width: 100%;
    padding: 0 12px 0 10px;
    opacity: 1;
    pointer-events: auto;
  }

  .custom-header-search__input::placeholder {
    color: var(--ru-search-placeholder);
    font-size: 13px;
  }

  .custom-header-search__button {
    order: 1;
    position: relative;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    margin: 0;
    padding: 0;
    border: 0 !important;
    outline: 0 !important;
    border-radius: var(--ru-search-radius);
    background: transparent !important;
    box-shadow: none !important;
    color: var(--ru-search-text);
    cursor: pointer;
    transition: color 160ms ease;
  }

  .custom-header-search__icon {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 14px;
    height: 14px;
    transform: translate(-50%, -50%);
  }
}

@media (max-width: 768px) {
  .menu-item-search {
    display: block !important;
    width: 100%;
    margin-top: 8px;
    padding: 0 !important;
  }

  .custom-header-search {
    display: block;
    width: calc(100% - 24px);
    margin: 8px 12px 0 12px;
    z-index: 20;
  }

  .custom-header-search__form {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 40px;
    border-radius: var(--ru-search-radius);
    background: var(--ru-search-bg);
    box-shadow: var(--ru-search-shadow);
    overflow: hidden;
  }

  .custom-header-search__input {
    order: 2;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    height: 40px;
    margin: 0;
    padding: 0 12px 0 14px;
    border: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--ru-search-text);
    font: inherit;
    font-size: 14px;
    appearance: none;
    -webkit-appearance: none;
  }

  .custom-header-search__input::placeholder {
    color: var(--ru-search-placeholder);
  }

  .custom-header-search__button {
    order: 1;
    position: relative;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    margin: 0 0 0 2px;
    padding: 0;
    border: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--ru-search-text);
    cursor: pointer;
  }

  .custom-header-search__icon {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 14px;
    height: 14px;
    transform: translate(-50%, -50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .custom-header-search__form,
  .custom-header-search__input,
  .custom-header-search__button {
    transition: none !important;
  }
}
