.header-wrapper {
  position: relative;
  z-index: $header;
  background: $blue-dark;
}

.header {
  @include make-container;
  @include make-container-max-widths;
  position: relative;
}

.header-top-wrapp {
  background-color: $white;
}

.header-top-wrapp__container {
  @include make-container;
  @include make-container-max-widths;
  padding-top: 12px;
  padding-bottom: 12px;
}

.header-inner {
  @include make-row;
  padding: 15px 0;
  align-items: center;
}

.header-logo {
  margin-top: -15px;
  padding-left: 15px;
}

.header-logo--minicart {
  display: none;
}

.header-logo__link,
.header-logo__link-tp,
.header-logo_wickes {
  background: top left no-repeat;
  background-size: contain;
  display: block;
  overflow: hidden;
  text-indent: -100em;
}

.header-hamburg,
.header-mobileicon {
  display:  none;
}

.header-top-line {
  margin: 0;
  text-align: right;
}

.header-top-line__item {
  border-right: 1px solid $white-transparent40;
  color: $white;
  display: inline-block;
  font-size: .75rem;
  line-height: 1rem;
  padding: 0 14px;

  &:last-child {
    border: 0;
    padding-right: 0;
  }

  .truncate {
    @include truncate;
    vertical-align: bottom;
    display: inline-block;
  }
}

.header-top-line_shop-list {
  position: relative;

  .header-top-line__link {
    .header-top-line__link-title {
      padding-left: 10px;
    }
  }

  &:hover {
    .btn {
      color: $blue;
      background-color: $white;
      border-color: $blue;
    }

    & > a {
      text-decoration: underline;
    }
  }

  .btn {

    .svg-inline--fa.fa-w-12.svg-inline--fa.fa-w-12 {
      height: 22px;
      width: 15px;
    }
  }
}

.header-top-line__link {
  display: flex;
  align-items: center;
  color: $blue-dark;
  text-decoration: none;

  &:hover,
  &:focus {
    color: $blue-dark;
  }

  & .btn_text {
    height: 16px;
    width: 18px;
  }
}

.header-search__wrapper {
  flex: 1;
  padding: 0 35px;
}

.search-wrapper--active {
  @include make-col-ready;
  display: block;
}

.header-search__overlay {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  height: 100%;
  opacity: 0.6;
  background: #000;
}

.header-search {
  position: relative;
}

.header-search__input {
  @include inputfield;
  border-color: $white;
  padding-right: 40px;
  border-radius: 25px;

  // ie11, edge remove default clear button
  // sass-lint:disable no-vendor-prefixes
  &::-ms-clear {
    display: none;
  }
}

.header-search__submit {
  position: absolute;
  top: 50%;
  right: 16px;
  padding: 0;
  color: $blue-dark;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5rem;
  border: 0;
  background: none;
  cursor: pointer;

  &:hover {
    color: $blue;
  }
}

.header-search__submit-label {
  position: relative;
  display: none;
  line-height: normal;
}

.header-search__submit-icon {
  position: relative;
  line-height: normal;

  & svg {
    height: 24px;
  }
}

.header-right-wrapp {
  color: #fff;
}

.header-right {
  padding: 0;
  margin: 0;
  list-style: none;
}

.header-right__item {
  position: relative;
  display: inline-block;
  padding: 0 14px;
}

.header-right__link {
  display: flex;
  flex-direction: column;
  color: #fff;
  text-decoration: none;
  text-align: center;

  &:hover,
  &:focus, 
  &:active {
    background-color: transparent;
    color: $blue;
  }

  & .btn__text {
    height: 26px
  }

  & svg {
    height: 24px;
  }

}

.touch-device .header-right__link.header-minicart__btn_link {
  background-color: transparent;
  color: $blue;
}

.header-right__link-title {
  margin-top: 4px;
}

.header-minicart-wrap {
  display: none;
}

.header-minicart {
  text-align: right;
}

.header-minicart__switcher {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.header-shop-list .svg-inline--fa.fa-w-12.svg-inline--fa.fa-w-12 {
  height: 22px;
  width: 15px;
}

.header-hamburger-menu,
.header-shop-list {
  // margin: 0 0 0 12px;
}

.header-minicart__btn,
.header-hamburger-menu,
.header-shop-list {
  padding-left: 0;
  padding-right: 0;
}

// .header-minicart__btn {
//   vertical-align: top;

//   &_link {
//     .touch-device & {
//       // Emulate primary button hover state view
//       color: $blue;
//     }
//   }
// }

.header-minicart__btn-icon {
  vertical-align: top;
}

.header-minicart__counter {
  position: absolute;
  top: -(26px / 2);
  left: -(26px / 2);
  display: inline-block;
  padding: 0 5px;
  height: 26px;
  min-width: 26px;
  border-radius: (26px / 2);
  border: 2px solid $blue-dark;
  background-color: $red;
  color: $white;
  font-size: .625rem;
  font-weight: bold;
  line-height: 24px;
  text-align: center;
}

.header-minicart__counter {
  left: auto;
  right: 7px;
  height: 24px;
  min-width: 24px;
  border: 0;
}

.header-hamburger-menu {
  padding: 8px 5px;
  background-color: transparent;
  border: 0px;

  .fa-times {
    display: none;
  }

  .icon {
    vertical-align: top;
  }

  &_close-visible {
    &,
    &:hover,
    &:focus,
    &:active {
      background: $white;
      color: $blue;
    }

    .fa-bars {
      display: none;
    }

    .icon {
      background: url('../img/ic-menu.svg') left top no-repeat;
      vertical-align: top;
    }
  }
}

.user {
  &_desktop {
    position: relative;
    text-align: left;
  }

  &__popover {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    z-index: $popover;
    padding-top: 6px;

    &::before {
      content: '';
      position: absolute;
      right: 10px;
      top: 0;
      border-right: 6px solid transparent;
      border-left: 6px solid transparent;
      border-bottom: 6px solid $warm-grey;
    }

    .header-top-line__item:hover & {
      display: block;
    }
  }

  &__popover-content {
    min-width: 116px;
    padding: 12px 16px;
    background: $warm-grey;
    box-shadow: 0 1px 2px 0 $black-transparent24;

    &_extended {
      width: 190px;
    }
  }

  &__action {
    @include normal-text;
    display: block;
    position: relative;
    color: $white;
    font-weight: 500;
    text-decoration: none;

    & + & {
      margin-top: 8px;
    }

    &:hover {
      color: #fff;
      text-decoration: underline;
    }
  }

  &__name {
    text-decoration: none;

    .touch-device & {
      pointer-events: none;
    }
  }

  &__logout {
    border-top: 1px solid $gray;
    margin-top: 8px;
    padding-top: 8px;
  }

  .icon-logout {
    font-size: 1rem;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
  }

  &.user_desktop {
    .user__name {
      display: flex;
      color: $blue-dark;
    }

    .icon-logout {
      color: $gray;
    }
  }
}

.touch-device {
  .header {
    .tel-uri {
      color: inherit;
      text-decoration: underline;
    }
  }
}

.header-search__submit-icon--mobile {
  display: none;
}

@include media-breakpoint-up(md) {
  .header-logo__link,
  .header-logo__link-tp,
  .header-logo_wickes {
    background-image: url('../img/wickes-logo.svg');
    height: 92px;
    width: 130px;

    &_small {
      height: 72px;
      width: 109px;
    }
  }

  .header-logo__link-tp {
    background-image: url('../img/tradePro-logo_desk.png');
    background-position-x: right;
    height: 102px;

    &_small {
      height: 78px;
    }
  }

  .header-top-line {
    display: flex;
    height: 22px;
    justify-content: flex-end;
    align-items: center;
  }

  .header-search__submit {
    transform: translateY(-50%);
  }

  .header-search__input {
    height: 48px;
  }

  .header-search__submit-label {
    display: inline;
    padding-left: 6px;
  }
}

@include media-breakpoint-up(lg) {
  .header-top-line__item {
    .truncate {
      max-width: 350px;
    }
  }
}

@include media-breakpoint-down(md) {
  // .header-logo {
  //   @include make-col(5);
  // }
  .header-search__wrapper {
    padding: 0 20px;
  }

  .header-minicart__btn-label {
    display: none;
  }

  .header-inner {
    flex-wrap: unset;
    min-height: 76px;
    padding: 0;
    margin-left: 0;
  }

  .header-hamburg {
    display: flex;
    align-items: center;
  }

  .header-logo,
  .header-logo__link,
  .header-logo_wickes,
  .search-switcher {
    display: none;
  }

  .header-logo--minicart {
    display: block;
    position: relative;
    top: -5px;
    max-width: 100%;
    flex: 1;

    & .header-logo__link-tp,
    & .header-logo__link {
      display: block;
      background-image: url('../img/wickes-logo.svg');
      height: 53px;
      width: 82px;
      margin-left: 10px;
      margin-right: 15px;
    }

    & .header-logo__link-tp {
      margin-top: 12px;
      background-position-x: left;
      background-image: url('../img/tradePro-logo_desk.png');
    }
  }

  .header-right,
  .header-top-wrapp {
    display: none;
  }

  .header-mobileicon {
    width: auto;
    display: flex;
    align-items: center;
  }

  .header-right__link-title {
    display: none;
  }

  .header-minicart-wrap {
    display: block;
  }

  .header-minicart {
    @include make-col-ready;
    width: auto;
    display: flex;
    align-items: center;
    padding-left: 0;
  }

  .header-minicart__counter {
    display: inline-block;
    right: 7px;
    top: -10px;
    left: auto;
  }

  .header-minicart__btn,
  .header-shop-list {
    width: 40px;
    height: 40px;
    background-color: transparent;
    color: #fff;
    border: 0; // TODO: use better solution
  }

  .header-minicart__btn {
    display: flex;
    justify-content: center;

    svg {
      height: 22px;
    }
  }

  .header-hamburger-menu {
    .icon {
      margin-top: -1px;
    }
  }

  .header-minicart .icon {
    width: 32px;
  } 
}

@include media-breakpoint-down(sm) {
  .header-search__wrapper {
    @include make-col(12);
    display: none;

    &.search-wrapper--active {
      display: block;
    }
  }

  .header-hamburg {
    flex: 1;
  }

  .search-switcher,
  .search-wrapper--active {
    display: block;
  }

  .header-search__input {
    padding-right: 56px;
  }

  .header-search__submit {
    top: 0;
    bottom: 0;
    right: 0;
    padding: 0 16px;
  }

  .header-search__submit-icon:not(.header-search__submit-icon--mobile) {
    display: none;
  }

  .header-search__submit-icon--mobile {
    display: block;
  }

  .header-search__wrapper {
    position: absolute;
    bottom: calc(-100% - 45px);
    padding: 0;
    margin-left: -15px;

    .header-search__overlay {
      display: block;
    }

    .header-search__input {
      padding: 60px 56px 60px 15px;
      font-size: 2rem;
      font-weight: 500;
      color: #0a3055;
      border: 0;
      border-radius: 0;

      &:focus {
        &::-webkit-input-placeholder {
          color: transparent;
        }
      }
    }
  }

  .btn-primary.search-switcher {
    transition: none;
    background-color: transparent;
    color: #fff;
  }

  .btn-primary.search--active {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 0;
    background-color: #004E9B;
    color: #fff;
    height: 76px;

    &::before {
      position: absolute;
      content: '';
      bottom: -9px;
      width: 0; 
      height: 0; 
      border-left: 10px solid transparent;
      border-right: 10px solid transparent;
      border-top: 10px solid #004e9b;
    }
  }

  .search-open {
    overflow: hidden;
  }
}

@include media-breakpoint-only(md) {
  .header-top-line__item {
    padding: 0 10px;

    .truncate {
      max-width: 110px;
    }

    &--tel {
      max-width: 120px;
      height: 16px;
      vertical-align: bottom;
      text-align: left;

      &.yCmsComponent {
        @include truncate;
        max-width: 200px;

        .header-top-line__item-number {
          top: 0;
          left: 0;
        }
      }
    }

    &-number {
      position: relative;
      top: -8px;
    }
  }

  // .header-search__wrapper {
  //   @include make-col(7);
  //   @include make-col-offset(3);
  // }
}

@media screen and (max-width: 360px) {
  .header-logo--minicart {
    .header-logo__link,
    .header-logo__link-tp {
      width: 74px;
      margin-left: 0;
      margin-right: 0;
    }
  }
}