/* MOBILE */
.mobile-nav__item--dropdown {
  position: relative;
  cursor: pointer;

  &:hover,
  &.is-open {
    .sort__chevron {
      color: $squant;
    }
  }

  .sort__chevron {
    position: absolute;
    right: 22px;
    color: $warm-grey;
    font-size: 12px;
    transition: transform .2s;
  }

  .sort-dd {
    left: auto;
    right: 4px;
  }

  .mobile-nav__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: $white;
    border-radius: 12px;
    box-shadow: 0 0 8px 0 $black-transparent10;
    padding: 8px 0;
    z-index: 30;

    &[hidden] {
      display: none !important;
    }
  }

  .mobile-nav__opt {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: none;
    border: 0;
    text-align: left;
    cursor: pointer;
    font-size: 1rem;
    line-height: 22px;
    color: $blue-dark;

    &:hover {
      background: $gray;
    }
  }

  .mobile-nav__opt-check {
    color: $blue;
    opacity: 0;
    width: 16px;
  }

  .mobile-nav__opt.is-active .mobile-nav__opt-check {
    opacity: 1;
  }
}

/* DESKTOP */
.sort {
  position: relative;

  &--desktop {
    display: none;
    align-items: center;
    gap: 12px;

    .sort__label {
      font-weight: 500;
      color: $gray-dark;
      font-size: 1rem;
      margin-bottom: 0;
    }

    .sort-button {
      position: relative;
      display: flex;
      align-items: center;
      gap: 8px;
      border: 1px solid $gray;
      background: $white;
      color: $gray-dark;
      cursor: pointer;
      border-radius: 3px;
      padding: 8px 8px 8px 16px;
      font-size: 1rem;
      min-width: 210px;

      &:focus {
        outline: none;
      }

      &:focus-visible {
        outline: 2px solid $blue;
        outline-offset: 2px;
      }
    }

    .sort__chevron {
      position: absolute;
      right: 14px;
      color: $blue;
      font-size: 12px;
      transition: transform .2s;
    }
  }
}

/* COMMON */
.sort.is-open .sort__chevron {
  transform: rotate(180deg);
}

.sort-dd {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 210px;
  background: #fff;
  padding: 4px 0;
  z-index: 40;
  box-shadow: 0 0 8px $black-transparent12;
  border-radius: 4px;

  &[hidden] {
    display: none !important;
  }
}

.sort-opt {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 8px 12px;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
  line-height: 24px;
  color: $gray-dark;

  &:hover {
    background: $ma-white;
  }
}

.sort-opt__check {
  color: $blue;
  opacity: 0;
  width: 16px;
}

.sort-opt.is-active .sort-opt__check {
  opacity: 1;
}


@include media-breakpoint-up(md) {
  .sort--desktop {
    display: flex;
  }
}

@include media-breakpoint-up(sm) {
  .mobile-nav__item--dropdown .sort-dd {
    left: 0;
    right: auto;
  }
}

@include media-breakpoint-up(md) {
  .sort-opt {
    font-size: 1rem;
    line-height: 20px;
    padding: 10px 16px 10px 12px;
  }
}
