.custom-select-wrapper {
  position: relative;
  user-select: none;
  width: 100%;
}

.custom-select {
  position: relative;
  width: 100%;
  font-family: inherit;
  font-size: 13.5px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.custom-select:hover {
  border-color: var(--sage);
}

.custom-select.open {
  border-color: var(--sage);
  box-shadow: 0 0 0 4px rgba(124,152,133,.15);
}

.custom-select::after {
  content: "";
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8578' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  transition: transform 0.25s ease;
}

.custom-select.open::after {
  transform: rotate(180deg);
}

.custom-dropdown-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.08);
  z-index: 999;
  overflow-y: auto;
  max-height: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.custom-dropdown-list.open {
  max-height: 280px;
  opacity: 1;
  visibility: visible;
}

.custom-option {
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.custom-option:hover {
  background: var(--sand);
  color: var(--sage-dark);
}

.custom-option.selected {
  background: var(--sand-light);
  font-weight: 600;
  color: var(--sage-dark);
}

#subCategoryContainer, #otherFieldGroup {
  display: none;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .25s ease, transform .25s ease;
}
#subCategoryContainer.show, #otherFieldGroup.show {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

@media(prefers-color-scheme:dark){
  .custom-select, .custom-dropdown-list {
    background: #151515;
    border-color: rgba(255,255,255,.12);
    color: #f5f5f5;
  }
  .custom-select::after {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  }
  .custom-option:hover {
    background: #222;
    color: #fff;
  }
  .custom-option.selected {
    background: #1a1a1a;
    color: var(--sage);
  }
  .custom-select.open {
    box-shadow: 0 0 0 4px rgba(124,152,133,.22);
  }
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
