
/* ============================================================
   UISELECT — DROPDOWN DÙNG CHUNG (thay danh sách <option> của hệ điều hành)
   Xem js/ui-select.js. Select gốc vẫn nằm trong DOM, chỉ ẩn hình ảnh.
   ============================================================ */
.uisel {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

/* Select gốc: ẩn nhưng KHÔNG display:none (giữ được form/validate/label) */
.uisel-native {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    clip: rect(0 0 0 0);
    overflow: hidden;
}

.uisel-btn {
    flex: 1 1 auto;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
    outline: none;
}

.uisel-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.uisel.is-empty .uisel-label { color: #94a3b8; font-weight: 500; }

.uisel-chev {
    font-size: 18px;
    color: #94a3b8;
    flex-shrink: 0;
    transition: transform .18s ease, color .18s ease;
}

.uisel.is-open .uisel-chev { transform: rotate(180deg); color: #bb2649; }
.uisel.is-disabled, .uisel-btn:disabled { cursor: not-allowed; opacity: .6; }

/* Select nằm trong ô nhập liệu chuẩn (đăng nhập, form giáo viên) */
.uisel.input-field,
.uisel.form-control {
    display: flex;
    max-width: 100%;
    overflow: hidden;   /* nhãn dài (tên file ảnh…) không được tràn ra ngoài ô */
}

/* ---- Bảng chọn (gắn vào <body>, position:fixed nên không bị cắt) ---- */
.uisel-panel {
    position: fixed;
    z-index: 100200;
    background: #fff;
    border: 1px solid #f0d9e0;
    border-radius: 12px;
    box-shadow: 0 18px 44px rgba(94, 20, 40, .18), 0 2px 6px rgba(15, 23, 42, .06);
    padding: 6px;
    max-height: 288px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: uiselIn .14s ease-out;
    transform-origin: top center;
}

.uisel-panel.drop-up { transform-origin: bottom center; }

@keyframes uiselIn {
    from { opacity: 0; transform: translateY(-4px) scale(.985); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.uisel-opt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: #334155;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
    transition: background .12s, color .12s;
}

.uisel-opt + .uisel-opt { margin-top: 2px; }

.uisel-opt-txt {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.uisel-opt:hover,
.uisel-opt.hover {
    background: #fff1f2;
    color: #bb2649;
}

.uisel-opt.active {
    background: #bb2649;
    color: #fff;
}

.uisel-opt.active:hover { background: #a81f3f; color: #fff; }

.uisel-opt.is-disabled,
.uisel-opt[disabled] { opacity: .45; cursor: not-allowed; }

.uisel-tick {
    font-size: 17px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity .12s;
}

.uisel-opt.active .uisel-tick { opacity: 1; }

/* Điện thoại: tăng vùng chạm */
@media (max-width: 640px) {
    .uisel-panel { padding: 7px; max-height: 62vh; border-radius: 14px; }
    .uisel-opt { padding: 12px 14px; font-size: 14.5px; border-radius: 10px; }
}

/* ============================================================
   KẾ THỪA STYLE CŨ CỦA <select>
   ------------------------------------------------------------
   Nhiều select trong hệ thống lấy hình thức từ SELECTOR PHẦN TỬ
   (select { … } , .input-wrapper select { … }) chứ không phải class.
   Khung .uisel là thẻ <div> nên không hưởng các rule đó
   -> phải chép lại ở đây. File này nạp SAU CÙNG để luôn thắng.
   .uisel-bare = select gốc không có class nào (chỉ dựa vào selector phần tử).
   ============================================================ */
.uisel-bare {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    transition: all .2s ease;
}

/* Ô nhập liệu có icon bên trái (form đăng nhập, form giáo viên) */
.input-wrapper > .uisel {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 14px 14px 44px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    font-size: 15px;
    color: var(--text-primary);
}

.login-form .input-wrapper > .uisel {
    background: #fdfdfd;
    border: 2px solid #f0f0f0;
    border-radius: 16px;
    padding: 14px 14px 14px 48px;
    font-size: 15px;
}

/* Viền sáng khi đang mở / đang focus — giống select:focus cũ */
.uisel-bare.is-open,
.uisel-bare:focus-within,
.input-wrapper > .uisel.is-open,
.input-wrapper > .uisel:focus-within,
.uisel.input-field.is-open,
.uisel.input-field:focus-within {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(187, 38, 73, .1);
}

/* Ô select trong thanh công cụ soạn thảo (RTE) đã có class .rte-select nên
   khung kế thừa sẵn; chỉ cần canh giữa theo chiều dọc. */
.uisel.rte-select { display: inline-flex; align-items: center; }

/* Điện thoại: ô có icon thu gọn padding cho vừa */
@media (max-width: 640px) {
    .input-wrapper > .uisel { padding: 12px 12px 12px 42px; font-size: 14.5px; }
}
