/*
 * Выпадающий список вида партии (templates/common/game_form/_kind_select.php, js/game_form/kind_select.js).
 * Свои классы kind-select*: .btn / .label объявлены и в bootstrap.css, и в twclasses.css, поэтому не используются.
 *
 * Тёмная тема: css/versions/v3.css (подключается только по prefers-color-scheme: dark в дизайне v4) определяет
 * переменные --bg0-light, --text-color, --border-color, --input-bg, --link-color. Без неё работают значения
 * по умолчанию (светлые) — отдельного media-запроса здесь нет, чтобы не потемнеть на светлой странице.
 */
.kind-select {
    position: relative;
    display: block;
    width: 100%;
    max-width: 380px;
    box-sizing: border-box;
    text-align: left;
    font-size: 14px;
    --ks-accent: var(--link-color, #2f6fd0);
    --ks-border: var(--border-color, #b8b8b8);
}
.kind-select *, .kind-select *:before, .kind-select *:after { box-sizing: border-box; }

.kind-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 6px 12px;
    border: 1px solid var(--ks-border);
    border-radius: 4px;
    background: var(--input-bg, #fff);
    color: #222;
    font: inherit;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none;
}
.kind-select-trigger:focus { outline: none; border-color: var(--ks-accent); box-shadow: 0 0 0 2px rgba(47, 111, 208, .35); }
.kind-select-trigger:focus-visible { outline: 2px solid var(--ks-accent); outline-offset: 1px; }
.kind-select-trigger[disabled] { opacity: .55; cursor: not-allowed; }

/* вид показан без выбора (правка назначения): тот же текст, что у кнопки, без рамки и стрелки */
.kind-select-static { display: flex; flex-direction: column; padding: 4px 0; }

.kind-select-current { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }

.kind-select-name { display: block; font-weight: 600; font-size: 15px; line-height: 1.3; }
.kind-select-caption { display: block; font-size: 12.5px; line-height: 1.3; opacity: .78; color: inherit; font-weight: 400; }

.kind-select-arrow {
    flex: 0 0 auto;
    width: 0;
    height: 0;
    margin-left: 10px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor;
    transition: transform .15s;
}
.kind-select.is-open .kind-select-arrow { transform: rotate(180deg); }

.kind-select-list {
    position: absolute;
    z-index: 1060;
    left: 0;
    right: 0;
    top: 100%;
    margin: 2px 0 0;
    padding: 4px 0;
    max-height: min(60vh, 340px);
    overflow-y: auto;
    list-style: none;
    border: 1px solid var(--ks-border);
    border-radius: 4px;
    background: var(--bg0-light, #fff);
    color: var(--text-color, #222);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
    outline: none;
}
.kind-select-list[hidden] { display: none; }

.kind-select-option {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 44px;
    margin: 0;
    padding: 6px 12px 6px 9px;
    border-left: 3px solid transparent;
    line-height: 1.3;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.kind-select-option.is-active { background: rgba(47, 111, 208, .16); }
.kind-select-option.is-selected { border-left-color: var(--ks-accent); }

@media (max-width: 480px) {
    .kind-select { max-width: none; }
    .kind-select-option { min-height: 52px; }
}
@media (prefers-reduced-motion: reduce) {
    .kind-select-arrow { transition: none; }
}

/* список не помещается снизу — раскрывается вверх (класс ставит JS) */
.kind-select.is-up .kind-select-list { top: auto; bottom: 100%; margin: 0 0 2px; }

/* предок обрезает список (форма в .modal-body с прокруткой) — список по координатам кнопки поверх всего (ставит JS) */
.kind-select.is-fixed .kind-select-list { position: fixed; right: auto; margin: 0; }

/* Ссылка «Правила видов шахмат» под списком (вне корня .kind-select: внутри listbox интерактивных элементов быть не должно) */
.kind-select-rules {
    margin: 4px 0 0;
    font-size: 13px;
}
