/*
 * 可搜尋＋點選的下拉選單（/assets/js/searchable-select.js），外觀對齊 mainLayout.css 的 .selectBox select。
 * 不用 .selectBox 包：它的 z-index 與箭頭圖示會蓋住 Choices 的下拉清單。
 */
.searchable-select {
    position: relative;
    width: 100%;
    margin: 0 0 23px 0;
}

/* Choices.js 沒載入時的原生 select */
.searchable-select > select {
    background-color: #fff;
    color: #666;
    padding: 0 10px;
    width: 100%;
    height: 50px;
    font-size: 1em !important;
    border: 1px solid #ccc !important;
    border-radius: 6px;
}

.searchable-select > select:focus {
    outline: 0;
    border: 3px solid #198148 !important;
}

.searchable-select .choices {
    margin: 0;
    font-size: 1em;
}

.searchable-select .choices__inner {
    min-height: 50px;
    padding: 12px 10px 8px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1em;
    color: #333;
}

.searchable-select .choices.is-focused .choices__inner,
.searchable-select .choices.is-open .choices__inner {
    border: 3px solid #198148;
    border-radius: 6px;
}

/* 已有全站的虛線焦點框，外框改用上面的綠色邊框 */
.searchable-select .choices:focus {
    outline: 2px dashed #198148 !important;
    outline-offset: 2px;
}

.searchable-select .choices[aria-invalid="true"] .choices__inner {
    border-color: #dc3545;
}

.searchable-select .choices__list--dropdown,
.searchable-select .choices__list[aria-expanded] {
    z-index: 20;
    border: 1px solid #198148;
}

.searchable-select .choices__list--dropdown .choices__list {
    max-height: 320px;
}

.searchable-select .choices__input {
    font-size: 1em;
    background-color: #fff;
}

.searchable-select .choices__list--dropdown .choices__item {
    font-size: 1em;
    padding: 10px;
}

/* 對比度：預設的淺灰字與半透明在白底上不足 4.5:1 */
.searchable-select .choices__placeholder {
    opacity: 1;
    color: #666;
}

.searchable-select .choices__heading {
    color: #333;
    font-weight: bold;
    border-bottom-color: #ccc;
}

.searchable-select .choices__list--dropdown .choices__item--selectable.is-highlighted,
.searchable-select .choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
    background-color: #e3f1e8;
    color: #000;
}

.searchable-select .choices__list--dropdown .choices__item.has-no-results,
.searchable-select .choices__list--dropdown .choices__item.has-no-choices {
    color: #333;
}

/* 清除按鈕：可用 Tab 移到，Enter 清除 */
.searchable-select .choices[data-type*="select-one"] .choices__button {
    opacity: 0.7;
    margin-right: 30px;
}

.searchable-select .choices[data-type*="select-one"] .choices__button:focus {
    opacity: 1;
    outline: 2px dashed #198148 !important;
    box-shadow: none;
}

/* 多城市：緊密標籤；選取很多城市時在標籤區捲動，輸入框保持可見。 */
.city-select .choices__list--multiple { display: flex; flex-wrap: wrap; gap: 6px; max-height: 120px; overflow-y: auto; }
.city-select .choices__list--multiple .choices__item { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; width: auto !important; margin: 0; padding: 4px 8px; background: #eef7f1; border: 1px solid #c7dfd0; border-radius: 5px; color: #23322b; overflow-wrap: anywhere; max-width: 100%; font-size: 16px; font-weight: 400; }
.city-select .choices__list--multiple .choices__button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 24px; width: 24px; height: 24px; position: static; margin: 0; padding: 0; border: 0; border-radius: 3px; opacity: 1; background: none; font-size: 0; text-indent: 0; }
.city-select .choices__list--multiple .choices__button::after { content: '×'; font-size: 16px; line-height: 1; color: #3d5144; }
.city-select .choices__list--multiple .choices__button:focus-visible { outline: 2px dashed #198148; outline-offset: 2px; }
.city-select .choices__input { display: block; width: 100% !important; margin: 8px 0 0; padding: 4px; }
.city-select .choices__input:focus { outline: 0 !important; }
.city-select .choices__list--dropdown .choices__list { max-height: 220px; }
.city-select .choices__list--dropdown .choices__item { padding: 8px 10px; }
.city-select select[multiple] { height: 120px; }
.searchable-select .choices[data-type*="select-one"]::after { right: 16px; }
