.sort-controls {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 16px;
}

.dropdown {
  position: relative;
  display: inline-block;
  justify-self: flex-end;
  font-family: inherit;
  width: fit-content;
}

.dropbtn {
  align-items: center;
  justify-self: flex-end;
  display: flex;
  min-width: 190px;
  height: 46px;
  padding: 0 44px 0 18px;
  border: 1px solid rgba(24, 24, 24, 0.18);
  background: rgba(242, 240, 239, 0.92);
  color: #181818;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  position: relative;
  transition:
    border-color 0.25s ease,
    background-color 0.25s ease,
    box-shadow 0.25s ease;
}

.dropbtn::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid #181818;
  border-bottom: 1.5px solid #181818;
  transform: translateY(-65%) rotate(45deg);
  transition: transform 0.25s ease;
}

.dropdown:hover .dropbtn {
  border-color: rgba(24, 24, 24, 0.45);
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(24, 24, 24, 0.08);
}

.dropdown:hover .dropbtn::after {
  transform: translateY(-35%) rotate(225deg);
}

.dropdown-content {
  position: absolute;
  top: calc(100%);
  right: 0;
  min-width: 190px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(24, 24, 24, 0.12);
  box-shadow: 0 18px 45px rgba(24, 24, 24, 0.12);
  z-index: 20;

  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  pointer-events: none;

  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    visibility 0.22s ease;
}

.dropdown-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 1px;
  background: #181818;
}

.dropdown-content a {
  display: block;
  padding: 15px 18px;
  color: #181818;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(24, 24, 24, 0.08);
  transition:
    background-color 0.22s ease,
    padding-left 0.22s ease,
    color 0.22s ease;
}

.dropdown-content a:last-child {
  border-bottom: none;
}

.dropdown-content a:hover {
  background: #181818;
  color: #f2f0ef;
  padding-left: 24px;
}

.dropdown:hover .dropdown-content {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.dropbtn:focus-visible,
.dropdown-content a:focus-visible {
  outline: 2px solid #181818;
  outline-offset: 3px;
}

@media screen and (max-width: 500px) {
  .sort-controls {
    align-items:  flex-start;
    align-self: flex-start;
    width:100%;
  }
  .dropbtn { 
    width: 100%;
  }
  .dropdown {
    width:100%;
  }
}
