* {
  box-sizing: border-box;
}

:host {
  position: relative;
  display: inline-block;
  width: 10rem;
  max-width: 100%;
  font-size: 0.8rem;
}

.select-button {
  font-size: inherit;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0.675rem 1rem;
  border: none;
  border-radius: 0.25rem;
  background-color: var(--primary-color);
  color: #fff;
  cursor: pointer;
}

.select-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arrow {
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #fff;
  transition: transform ease-in-out 0.3s;
}

.select-dropdown {
  position: absolute;
  left: 0;
  width: 100%;
  border: 1px solid #caced1;
  border-radius: 0.25rem;
  background-color: var(--dropdown-bg-color);
  list-style: none;
  padding: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
}

.select-dropdown::-webkit-scrollbar {
  width: 7px;
}

.select-dropdown::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 25px;
}

.select-dropdown::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 25px;
}

.select-dropdown li {
  padding: 10px;
  cursor: pointer;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-weight: 500;
}

.select-dropdown li.selected {
  background-color: var(--primary-blue);
  color: #fff;
  border-radius: 4px;
  font-weight: 600;
}

.select-dropdown li:hover,
.select-dropdown li:focus {
  background-color: var(--primary-color);
  border-radius: 4px;
  color: #fff;
}

.select-button[aria-expanded='true'] .arrow {
  transform: rotate(180deg);
}

.dropdown-top {
  bottom: 100%;
  margin: 0 0 10px;
}

.dropdown-bottom {
  top: 100%;
  margin: 10px 0 0;
}

@media (width < 48rem) {
  .custom-select {
    width: 8rem;
    font-size: 0.8rem;
  }

  .select-button {
    padding: 0.675rem;
  }
}

@media (width < 40rem) {
  .custom-select {
    width: 5rem;
  }
}
