/* カスタムセレクトスタイル */
.custom-select {
  position: relative;
  display: inline-block;
  width: 100%;
}

.custom-select__wrapper {
  position: relative;
  width: 100%;
}

.custom-select__button {
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-radius: 4px;
  background-color: #FFFFFF;
  color: var(--color-black);
  font-family: "Zen Kaku Gothic New", sans-serif;
  font-size: 16px;
  font-weight: var(--font-weight-medium);
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-right: 48px;
  position: relative;
}

.custom-select__button::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background-image: url("/img/angle.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 24px 24px;
  transition: transform 0.2s ease;
}

.custom-select__button:hover {
  background-color: #FFFFFF;
}

.custom-select__button:focus {
  outline: none;
  box-shadow: none;
}

.custom-select__button--open {
  border-radius: 4px 4px 0 0;
}

.custom-select__button--open::after {
  transform: translateY(-50%) rotate(180deg);
}

.custom-select__text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 無効化された選択済みオプションのプレースホルダー色 */
.custom-select__button--placeholder .custom-select__text {
  color: #9C846580;
}

.custom-select__icon {
  display: none;
}

.custom-select__dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: #FFFFFF;
  border: none;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-height: 408px;
  overflow-y: auto;
  display: none;
}

.custom-select__dropdown--open {
  display: block;
}

.custom-select__option {
  padding: 16px 16px 16px 40px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  font-family: "Zen Kaku Gothic New", sans-serif;
  font-size: 16px;
  line-height: 120%;
  font-weight: var(--font-weight-medium);
  color: var(--color-black);
  border-bottom: 1px solid #3333330D;
  max-height: 51px;
}

.custom-select__option:last-child {
  border-bottom: none;
}

.custom-select__option:hover:not(.custom-select__option--disabled) {
  background-color: #F5F5F5;
}

.custom-select__option--selected {
  color: var(--color-black);
  font-weight: var(--font-weight-bold);
}

.custom-select__option--selected:hover {
  background-color: #E8E8DB;
}

.custom-select__option--disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* reservation-search内のセレクトスタイル */
#reservation-search .custom-select {
  max-width: 250px;
  width: 250px;
}

/* 元のselectを非表示にするが、フォーム用に保持 */
#reservation-search .custom-select select {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

#reservation-search .custom-select--alt .custom-select__button {
  border-radius: 0 4px 4px 0;
}

#reservation-search .custom-select--alt .custom-select__button--open {
  border-radius: 0 4px 0 0;
}

#reservation-search .custom-select:not(.custom-select--alt) .custom-select__button {
  border-radius: 4px 0 0 4px;
}

#reservation-search .custom-select:not(.custom-select--alt) .custom-select__button--open {
  border-radius: 4px 0 0 0;
}

#reservation-search .custom-select:not(.custom-select--alt) .custom-select__dropdown {
  border-radius: 8px;
}

#reservation-search .custom-select--alt .custom-select__dropdown {
  border-radius: 8px;
}

/* ドロップダウンメニューのカスタムスクロールバー */
.custom-select__dropdown::-webkit-scrollbar {
  width: 12px;
}

.custom-select__dropdown::-webkit-scrollbar-track {
  background: #FFFFFF;
  border: none;
  border-radius: 8px;
  margin: 8px 0;
}

.custom-select__dropdown::-webkit-scrollbar-thumb {
  background: #3333331A;
  border-radius: 2px;
  border: 4px solid #FFFFFF;
  background-clip: padding-box;
}

.custom-select__dropdown::-webkit-scrollbar-thumb:hover {
  background: #3333331A;
  background-clip: padding-box;
}

/* モバイルスタイル */
@media (max-width: 1024px) {
  #reservation-search .custom-select {
    width: 100%;
    max-width: 100%;
  }

  #reservation-search .custom-select:not(.custom-select--alt) .custom-select__button {
    border-radius: 4px 4px 0 0;
  }

  #reservation-search .custom-select--alt .custom-select__button {
    border-radius: 0 0 4px 4px;
  }

  #reservation-search .custom-select:not(.custom-select--alt) .custom-select__button--open {
    border-radius: 4px 4px 0 0;
  }

  #reservation-search .custom-select--alt .custom-select__button--open {
    border-radius: 0 0 0 0;
  }

  #reservation-search .custom-select:not(.custom-select--alt) .custom-select__dropdown {
    border-radius: 8px;
  }

  #reservation-search .custom-select--alt .custom-select__dropdown {
    border-radius: 8px;
  }
}