/* public/assets/css/ui-select.css — themeable dropdown (see ui-select.js) */
.ui-select { position: relative; display: inline-block; min-width: 230px; max-width: 100%; }
.ui-select-native {
    position: absolute; inset: 0; width: 100%; height: 100%;
    opacity: 0; pointer-events: none; border: 0; padding: 0;
}
.ui-select-trigger {
    width: 100%; display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; min-height: 42px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: 999px;
    font: inherit; font-size: 0.88rem; font-weight: 600; text-align: left;
    cursor: pointer; box-shadow: var(--shadow-contact);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.ui-select-trigger:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.ui-select-trigger:focus-visible,
.ui-select.is-open .ui-select-trigger {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.ui-select-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 50%; flex: 0 0 auto;
    color: var(--text-muted); background: var(--surface-alt);
    transition: background .15s ease, color .15s ease;
}
.ui-select-icon svg { width: 13px; height: 13px; }
.ui-select.has-value .ui-select-trigger {
    border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
    background: color-mix(in srgb, var(--primary) 7%, var(--surface));
}
.ui-select.has-value .ui-select-icon { background: var(--primary); color: #fff; }
.ui-select-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.5; }
.ui-select-chevron { display: inline-flex; color: var(--text-muted); transition: transform .2s ease; }
.ui-select-chevron svg { width: 16px; height: 16px; }
.ui-select.is-open .ui-select-chevron { transform: rotate(180deg); color: var(--primary); }

.ui-select-panel {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; min-width: 240px;
    z-index: 80; max-height: 320px; overflow-y: auto; padding: 6px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .16), 0 2px 8px rgba(15, 23, 42, .06);
    animation: uiSelectIn .14s ease-out;
}
.ui-select-panel[hidden] { display: none; }
@keyframes uiSelectIn { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.ui-select-option {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 9px 12px; border-radius: 9px; cursor: pointer;
    font-size: 0.87rem; font-weight: 500; line-height: 1.5; color: var(--text);
    transition: background .1s ease;
}
.ui-select-option + .ui-select-option { margin-top: 2px; }
.ui-select-option.is-active { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.ui-select-option.is-selected { color: var(--primary); font-weight: 700; background: color-mix(in srgb, var(--primary) 13%, transparent); }
.ui-select-check { display: none; color: var(--primary); }
.ui-select-check svg { width: 16px; height: 16px; display: block; }
.ui-select-option.is-selected .ui-select-check { display: inline-flex; }

/* Notifications page: keep the toggle left, type filter right; let the panel escape the filter box */
.filter-bar:has(.ui-select), .filter-panel:has(.ui-select) { overflow: visible !important; }
.notif-filter-bar { align-items: center; }
.notif-filter-bar .ui-select { margin-left: auto; }
@media (max-width: 640px) {
    .notif-filter-bar .ui-select { margin-left: 0; width: 100%; }
    .ui-select-panel { max-height: 260px; }
}
@media (prefers-reduced-motion: reduce) {
    .ui-select-panel { animation: none; }
    .ui-select-chevron, .ui-select-trigger { transition: none; }
}

/* ── Khmer font for native <select> / <option> lists (all pages) ───────────
   The open list of a native <select> is drawn by the browser. It only uses
   the site's Khmer web font when font-family is set EXPLICITLY on the select
   AND on <option>/<optgroup> (inherit alone is not honoured by the popup in
   Chrome/Edge/Firefox on Windows, which then falls back to a tiny OS font).
   The stack mirrors body{} in themes.css: Latin first (Barlow/Inter), then the
   Khmer font the user picked, so Khmer glyphs never fall to a system font. */
select,
select option,
select optgroup,
datalist option {
    font-family: var(--font-en, 'Barlow'), var(--font-kh, 'Battambang'),
                 'NotoSansKhmer', 'Khmer UI', 'Leelawadee UI', 'Noto Sans Khmer', sans-serif !important;
    font-size: max(1em, 14px);
    line-height: 1.6;
}
select option,
select optgroup { padding: 6px 10px; }

/* ── Custom list used for every native <select> (s54-native-select-khmer.js) ──
   Appended to <body> so it inherits the site Khmer font and the active theme. */
.kh-select-panel {
    position: fixed; z-index: 100000; overflow-y: auto; padding: 6px;
    background: var(--surface, #fff); color: var(--text, #0f172a);
    border: 1px solid var(--border, #e2e8f0); border-radius: 12px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .18), 0 2px 8px rgba(15, 23, 42, .08);
    font-family: var(--font-en, 'Barlow'), var(--font-kh, 'Battambang'), 'NotoSansKhmer', sans-serif;
    font-size: 0.92rem; line-height: 1.6;
}
.kh-select-panel[hidden] { display: none; }
.kh-select-option { padding: 8px 12px; border-radius: 8px; cursor: pointer; white-space: normal; }
.kh-select-option + .kh-select-option { margin-top: 2px; }
.kh-select-option.is-active { background: color-mix(in srgb, var(--primary, #2563eb) 10%, transparent); }
.kh-select-option.is-selected { color: var(--primary, #2563eb); font-weight: 700; background: color-mix(in srgb, var(--primary, #2563eb) 14%, transparent); }
.kh-select-option.is-disabled { opacity: .45; cursor: not-allowed; }
.kh-select-group { padding: 6px 12px 2px; font-size: .78rem; font-weight: 700; color: var(--text-muted, #64748b); }
