/* ════════════════════════════════════════════
   Select2 tự động (tt-select2-auto.js) — nhìn giống <select> thường
   Viền / bo góc / chiều cao / màu / font lấy từ select gốc (inline); file này lo phần còn lại.
   ════════════════════════════════════════════ */

/* Select gốc bị ẩn (thay cho select2-hidden-accessible khi đang là instance tự động) */
select.tt-s2-hidden:has(+ .select2-container.tt-s2-auto) {
    border: 0 !important;
    clip: rect(0 0 0 0) !important;
    height: 1px !important;
    min-height: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    padding: 0 !important;
    position: absolute !important;
    width: 1px !important;
    min-width: 0 !important;
}

.select2-container.tt-s2-auto[data-tt-s2-hide] {
    display: none !important;
}

.select2-container.tt-s2-auto {
    box-sizing: border-box;
    max-width: 100%;
    vertical-align: middle;
}

.select2-container.tt-s2-auto .select2-selection {
    box-sizing: border-box;
    outline: none;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

.select2-container.tt-s2-auto .select2-selection--single .select2-selection__rendered {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Mũi tên kiểu select thường (chevron xám) */
.select2-container.tt-s2-auto .select2-selection--single .select2-selection__arrow {
    top: 0;
    right: 6px;
    width: 16px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.select2-container.tt-s2-auto .select2-selection--single .select2-selection__arrow b {
    position: static;
    margin: 0;
    width: 7px;
    height: 7px;
    border: solid #64748b;
    border-width: 0 1.6px 1.6px 0;
    transform: translateY(-2px) rotate(45deg);
    transition: transform .2s;
}

.select2-container.tt-s2-auto.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: #64748b;
    border-width: 0 1.6px 1.6px 0;
    transform: translateY(2px) rotate(-135deg);
}

/* Select gốc tự vẽ mũi tên bằng ảnh nền → dùng ảnh đó (đã chép inline), ẩn mũi tên Select2 */
.select2-container.tt-s2-auto.tt-s2-custom-arrow .select2-selection__arrow {
    display: none;
}

/* Focus / đang mở */
.select2-container.tt-s2-auto.select2-container--focus .select2-selection,
.select2-container.tt-s2-auto.select2-container--open .select2-selection {
    border-color: var(--blue, #1a56ff) !important;
    box-shadow: 0 0 0 3px rgba(26, 86, 255, .1) !important;
}

/* Vô hiệu hóa */
.select2-container.tt-s2-auto.select2-container--disabled .select2-selection {
    opacity: .6;
    cursor: not-allowed;
}

/* Chọn nhiều */
.select2-container.tt-s2-auto .select2-selection--multiple {
    display: flex;
    align-items: center;
    padding-top: 2px;
    padding-bottom: 2px;
}

.select2-container.tt-s2-auto .select2-selection--multiple .select2-selection__choice {
    margin-top: 2px;
    border: 1px solid #c7d4f2;
    border-radius: 6px;
    background: #eef3ff;
    color: #1e3a8a;
    font-size: .92em;
}

/* ── Dropdown ── */
.select2-container--open .select2-dropdown.tt-s2-dd {
    border: 1px solid var(--border, #dde4f0);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(26, 35, 64, .14);
    overflow: hidden;
    font-size: 12.5px;
}

.select2-container--open .select2-dropdown--below.tt-s2-dd {
    margin-top: 4px;
}

.select2-container--open .select2-dropdown--above.tt-s2-dd {
    margin-top: -4px;
}

/* Dropdown gắn vào body: luôn trên modal / sheet (z-index modal cao nhất ~12060) */
body > .select2-container--open {
    z-index: 20000;
}

.tt-s2-dd .select2-search--dropdown {
    padding: 6px;
}

.tt-s2-dd .select2-search--dropdown .select2-search__field {
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--border, #dde4f0);
    border-radius: 6px;
    font: inherit;
    outline: none;
}

.tt-s2-dd .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--blue, #1a56ff);
}

.tt-s2-dd .select2-results > .select2-results__options {
    max-height: 260px;
    padding: 4px;
}

.tt-s2-dd .select2-results__option {
    padding: 7px 10px;
    border-radius: 6px;
    color: var(--text, #1a2340);
    line-height: 1.35;
}

.tt-s2-dd .select2-results__option[aria-selected=true] {
    background: #eff3ff;
    color: var(--blue, #1a56ff);
    font-weight: 700;
}

.tt-s2-dd .select2-results__option--highlighted[aria-selected] {
    background: #f0f4fb;
    color: var(--text, #1a2340);
}

.tt-s2-dd .select2-results__option[aria-disabled=true] {
    color: #a0aec0;
}

.tt-s2-dd .select2-results__group {
    padding: 6px 10px 4px;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted, #5a6a85);
}
