/* EHM UI (10.10.2026) — brauzerin standart elementləri əvəzinə saytın dizaynı, BÜTÜN səhifələrdə
   (includes/tema.php → ehm_tema_head yükləyir; admin səhifələri ayrıca qoşur).
   - açılan siyahı (assets/js/ehm-select.js), təsdiq/xəbərdarlıq/daxiletmə pəncərələri və "sahəni doldurun"
     balonu (assets/js/ehm-ui.js), checkbox/radio, rəqəm sahəsinin oxları, sürüşmə zolaqları, avtodoldurma rəngi.
   Seçicilər :where() ilə — səhifənin öz CSS-i (menbe.css, tema-acik.css …) həmişə üstün qalır. */

:root {
  --eui-acc: #5B3FD1;
  --eui-acc-soft: rgba(91, 63, 209, .12);
  --eui-ink: #1E2638;
  --eui-mid: #5C667D;
  --eui-line: rgba(30, 38, 56, .17);
  --eui-in: #FFFFFF;
  --eui-panel: #FFFFFF;
  --eui-hover: rgba(91, 63, 209, .08);
  --eui-shadow: 0 18px 50px rgba(16, 24, 40, .16), 0 0 0 1px rgba(16, 24, 40, .04);
  --eui-danger: #C2410C;
  --eui-scroll: rgba(30, 38, 56, .24);
}
html[data-theme="dark"] {
  --eui-acc: #A78BFA;
  --eui-acc-soft: rgba(167, 139, 250, .16);
  --eui-ink: #ECE8F7;
  --eui-mid: rgba(236, 232, 247, .62);
  --eui-line: rgba(167, 139, 250, .22);
  --eui-in: rgba(20, 14, 36, .72);
  --eui-panel: #161029;
  --eui-hover: rgba(167, 139, 250, .14);
  --eui-shadow: 0 22px 60px rgba(0, 0, 0, .55), 0 0 0 1px rgba(167, 139, 250, .14);
  --eui-danger: #FB923C;
  --eui-scroll: rgba(167, 139, 250, .32);
}

/* ── Açılan siyahı ── */
:where(.ehs) { position: relative; display: block; width: 100%; min-width: 0; }
:where(.ehs) .ehs-native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
:where(.ehs-btn) {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; cursor: pointer;
  font: inherit; font-size: .95rem; line-height: 1.3; text-align: left; color: var(--eui-mid);
  background: var(--eui-in); border: 1px solid var(--eui-line); transition: border-color .15s, box-shadow .15s;
}
:where(.ehs-btn):hover { border-color: color-mix(in srgb, var(--eui-acc) 55%, transparent); }
:where(.ehs-btn):focus-visible, :where(.ehs.open) .ehs-btn { outline: none; border-color: var(--eui-acc); box-shadow: 0 0 0 3px var(--eui-acc-soft); }
:where(.ehs-btn.ehs-secili) { color: var(--eui-ink); }
:where(.ehs-btn):disabled { opacity: .5; cursor: not-allowed; }
:where(.ehs-val) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:where(.ehs-ox) { width: 16px; height: 16px; flex: none; opacity: .7; transition: transform .18s; }
:where(.ehs.open) .ehs-ox { transform: rotate(180deg); }

/* panel body-yə köçürülür (pəncərə içində kəsilməsin) — mövqe JS-dən */
.ehs-panel.ehs-portal {
  position: absolute; z-index: 9000; display: none; box-sizing: border-box; padding: 6px;
  background: var(--eui-panel); color: var(--eui-ink); border: 1px solid var(--eui-line); border-radius: 12px;
  box-shadow: var(--eui-shadow); font-size: 14px; animation: eui-in .14s ease-out;
}
.ehs-panel.ehs-portal.ehs-acik { display: block; }
@keyframes eui-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.ehs-portal .ehs-search {
  width: 100%; box-sizing: border-box; margin: 2px 0 6px; padding: 9px 12px; border-radius: 9px; font: inherit; font-size: 13px;
  color: var(--eui-ink); background: color-mix(in srgb, var(--eui-ink) 5%, transparent); border: 1px solid var(--eui-line);
}
.ehs-portal .ehs-search:focus { outline: none; border-color: var(--eui-acc); }
.ehs-portal .ehs-list { max-height: min(340px, 52vh); overflow-y: auto; overscroll-behavior: contain; }
.ehs-portal .ehs-grp { padding: 10px 10px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--eui-acc); }
.ehs-portal .ehs-opt { display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; color: var(--eui-ink); line-height: 1.35; }
.ehs-portal .ehs-opt .ehs-t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ehs-portal .ehs-opt .ehs-n { flex: none; margin-top: 1px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-variant-numeric: tabular-nums;
  background: var(--eui-acc-soft); color: var(--eui-acc); }
.ehs-portal .ehs-opt.on { background: var(--eui-hover); }
.ehs-portal .ehs-opt.sel { background: var(--eui-acc-soft); color: var(--eui-ink); font-weight: 600; }
.ehs-portal .ehs-opt.sel .ehs-t::before { content: ""; display: inline-block; width: 5px; height: 10px; margin: 0 9px 0 2px; vertical-align: 1px;
  border: solid var(--eui-acc); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.ehs-portal .ehs-opt.dis { opacity: .45; cursor: not-allowed; }
.ehs-portal .ehs-opt[hidden], .ehs-portal .ehs-grp[hidden] { display: none !important; }
.ehs-portal .ehs-empty { display: none; padding: 14px 10px; text-align: center; font-size: 13px; color: var(--eui-mid); }

/* ── Təsdiq / xəbərdarlıq / daxiletmə pəncərəsi ── */
.eui-ov { position: fixed; inset: 0; z-index: 9500; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(8, 6, 16, .5); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); opacity: 0; transition: opacity .16s; }
.eui-ov.acik { opacity: 1; }
.eui-dlg { width: min(440px, 100%); background: var(--eui-panel); color: var(--eui-ink); border: 1px solid var(--eui-line); border-radius: 18px;
  box-shadow: var(--eui-shadow); padding: 22px 22px 18px; transform: translateY(8px) scale(.98); transition: transform .16s;
  font-family: inherit; }
.eui-ov.acik .eui-dlg { transform: none; }
.eui-dlg h3 { margin: 0 0 8px; font-size: 1.05rem; font-weight: 700; color: var(--eui-ink); }
.eui-dlg p { margin: 0; font-size: .93rem; line-height: 1.55; color: var(--eui-mid); white-space: pre-line; }
.eui-dlg input { width: 100%; box-sizing: border-box; margin-top: 14px; padding: 11px 13px; border-radius: 11px; font: inherit; font-size: .95rem;
  color: var(--eui-ink); background: var(--eui-in); border: 1px solid var(--eui-line); }
.eui-dlg input:focus { outline: none; border-color: var(--eui-acc); box-shadow: 0 0 0 3px var(--eui-acc-soft); }
.eui-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.eui-btns button { font: inherit; font-size: .9rem; font-weight: 600; padding: 10px 18px; border-radius: 11px; cursor: pointer; border: 1px solid var(--eui-line);
  background: transparent; color: var(--eui-ink); }
.eui-btns button:hover { border-color: var(--eui-acc); }
.eui-btns .eui-ok { background: var(--eui-acc); border-color: var(--eui-acc); color: #fff; }
html[data-theme="dark"] .eui-btns .eui-ok { color: #120a24; }
.eui-btns .eui-ok.eui-danger { background: var(--eui-danger); border-color: var(--eui-danger); color: #fff; }
.eui-btns button:focus-visible { outline: 2px solid var(--eui-acc); outline-offset: 2px; }
@media (max-width: 480px) { .eui-btns { flex-direction: column-reverse; } .eui-btns button { width: 100%; } }

/* ── "Bu sahəni doldurun" balonu (brauzerinki əvəzinə) ── */
.eui-tip { position: absolute; z-index: 9600; max-width: 300px; padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; line-height: 1.4;
  background: var(--eui-danger); color: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); pointer-events: none; animation: eui-in .14s ease-out; }
.eui-tip::before { content: ""; position: absolute; top: -5px; left: 18px; width: 10px; height: 10px; background: inherit; transform: rotate(45deg); }
:where(.eui-yanlis) { border-color: var(--eui-danger) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--eui-danger) 18%, transparent) !important; }

/* ── Checkbox / radio ── */
:where(input[type="checkbox"]:not([data-native]), input[type="radio"]:not([data-native])) {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px; margin: 0; flex: none; cursor: pointer; display: inline-grid; place-content: center;
  border: 1.5px solid var(--eui-line); background: var(--eui-in); border-radius: 5px; transition: background .15s, border-color .15s; vertical-align: -3px;
}
:where(input[type="radio"]:not([data-native])) { border-radius: 50%; }
:where(input[type="checkbox"]:not([data-native]))::after { content: ""; width: 5px; height: 9px; margin-top: -2px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0); transition: transform .12s; }
:where(input[type="radio"]:not([data-native]))::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform .12s; }
:where(input[type="checkbox"]:not([data-native]), input[type="radio"]:not([data-native])):checked { background: var(--eui-acc); border-color: var(--eui-acc); }
:where(input[type="checkbox"]:not([data-native])):checked::after { transform: rotate(45deg) scale(1); }
:where(input[type="radio"]:not([data-native])):checked::after { transform: scale(1); }
:where(input[type="checkbox"]:not([data-native]), input[type="radio"]:not([data-native])):focus-visible { outline: 2px solid var(--eui-acc); outline-offset: 2px; }
:where(input[type="checkbox"]:not([data-native]), input[type="radio"]:not([data-native])):disabled { opacity: .5; cursor: not-allowed; }

/* ── Rəqəm sahəsinin oxları, axtarış sahəsinin ✕-i ── */
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }

/* ── Sürüşmə zolaqları ── */
* { scrollbar-width: thin; scrollbar-color: var(--eui-scroll) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--eui-scroll); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--eui-acc) 55%, transparent); }
*::-webkit-scrollbar-corner { background: transparent; }

/* ── Brauzerin avtodoldurma (sarı/mavi) fonu ── */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus, textarea:-webkit-autofill, select:-webkit-autofill {
  -webkit-text-fill-color: var(--eui-ink); caret-color: var(--eui-ink);
  -webkit-box-shadow: 0 0 0 1000px var(--eui-in) inset; box-shadow: 0 0 0 1000px var(--eui-in) inset; transition: background-color 9999s ease-out 0s;
}
html[data-theme="dark"] input:-webkit-autofill { -webkit-box-shadow: 0 0 0 1000px #1a1230 inset; box-shadow: 0 0 0 1000px #1a1230 inset; }

/* ── Seçim rəngi ── */
::selection { background: var(--eui-acc-soft); }

@media (prefers-reduced-motion: reduce) { .ehs-panel.ehs-portal, .eui-ov, .eui-dlg, .eui-tip { animation: none; transition: none; } }
