@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;700&display=swap");
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

body {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #ecf0f1;
}

nav {
  width: 800px;
  height: 50px;
  background: #b71540;
  border-radius: 4px;
  box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px;
  display: flex;
  position: relative;
}
nav a {
  text-decoration: none;
  color: white;
  text-transform: uppercase;
  line-height: 50px;
  width: 100px;
  text-align: center;
  z-index: 1;
}
nav .animate {
  background-color: #16a085;
  position: absolute;
  height: 100%;
  width: 100px;
  top: 0;
  left: 0;
  border-radius: 5px;
  opacity: 0;
  transition: 0.2s;
}
nav:hover .animate {
  opacity: 1;
}

nav a:nth-child(1):hover ~ .animate {
  left: 0px;
}

nav a:nth-child(2):hover ~ .animate {
  left: 100px;
}

nav a:nth-child(3):hover ~ .animate {
  left: 200px;
}

nav a:nth-child(4):hover ~ .animate {
  left: 300px;
}

nav a:nth-child(5):hover ~ .animate {
  left: 400px;
}
