/* Kyara UI kit: komponen kustom. Semua warna lewat token (:root di admin.css, ikut mode gelap). */

/* Sumber nilai native: tetap di DOM, tidak terlihat dan tidak bisa difokus. */
.uk-native {
  position: absolute !important; width: 1px !important; height: 1px !important;
  margin: 0 !important; padding: 0 !important; border: 0 !important; opacity: 0 !important;
  overflow: hidden !important; clip-path: inset(50%) !important; pointer-events: none !important;
}

/* Select: tombol + listbox */
.uk-select {
  position: relative; display: inline-flex; align-items: center; justify-content: space-between;
  gap: 10px; min-width: 0; text-align: left; cursor: pointer; color: var(--text); font: inherit;
}
.uk-select.input { width: 100%; height: 38px; padding: 0 10px 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.uk-select.range-select { width: auto; height: auto; padding: 0; border: 0; background: transparent; }
.uk-select:disabled { opacity: .5; cursor: default; }
.uk-select-val { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uk-select-val.is-empty { color: var(--text-3); font-weight: 500; }
.uk-chev {
  width: 7px; height: 7px; flex: none; margin-right: 2px; color: var(--text-3);
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg); transition: transform .15s ease;
}
.uk-select[aria-expanded="true"] .uk-chev { transform: translateY(1px) rotate(225deg); }
.uk-date-ico { width: 16px; height: 16px; color: var(--text-3); }

/* Popover bersama */
.uk-pop {
  position: fixed; z-index: 70; display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 28px rgb(16 12 24 / .16); overflow: hidden;
}
.uk-pop[hidden] { display: none !important; }
.uk-listbox { padding: 4px; }
.uk-lb { overflow-y: auto; min-height: 0; list-style: none; margin: 0; }
.uk-opt {
  display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 8px 10px; border-radius: 7px;
  color: var(--text-2); font-weight: 600; font-size: 14px; cursor: pointer; user-select: none;
}
.uk-opt-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uk-opt[aria-selected="true"] { color: var(--accent); }
.uk-opt[aria-selected="true"]::after {
  content: ""; flex: none; width: 5px; height: 9px; margin-right: 2px;
  border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(45deg);
}
.uk-opt.uk-on { background: var(--accent-soft); color: var(--text); }
.uk-opt[aria-disabled="true"] { opacity: .45; cursor: default; }

/* Kalender (DatePicker) */
.uk-cal { width: 296px; max-width: calc(100vw - 16px); padding: 12px; gap: 8px; }
.uk-cal-head { display: flex; align-items: center; gap: 6px; }
.uk-cal-title { flex: 1; text-align: center; font-weight: 800; font-size: 14px; }
.uk-cal-nav {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-2); cursor: pointer;
}
.uk-cal-nav:hover { background: var(--line-2); color: var(--text); }
.uk-cal-nav i { width: 7px; height: 7px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; }
.uk-chev-l { transform: translateX(2px) rotate(45deg); }
.uk-chev-r { transform: translateX(-2px) rotate(-135deg); }
.uk-cal-dow, .uk-cal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.uk-cal-dow span { text-align: center; padding: 4px 0; font-size: 11.5px; font-weight: 700; color: var(--text-3); }
.uk-day {
  height: 36px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--text);
  font-family: inherit; font-weight: 600; font-size: 13px; line-height: 1; font-variant-numeric: tabular-nums; cursor: pointer;
}
.uk-day:hover { background: var(--accent-soft); }
.uk-day.uk-today { box-shadow: inset 0 0 0 1px var(--accent); }
.uk-day[aria-selected="true"] { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.uk-cal-foot { display: flex; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--line-2); }
.uk-cal-foot button {
  height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--accent); font-weight: 700; font-size: 13px; cursor: pointer;
}
.uk-cal-foot button:hover { background: var(--accent-soft); }

/* NumberField: [−] [input] [+], spinner native disembunyikan */
.uk-num { display: flex; align-items: stretch; width: 100%; min-width: 0; }
.uk-num > .input { flex: 1 1 auto; min-width: 0; width: auto; border-radius: 0; text-align: center; font-variant-numeric: tabular-nums; }
.uk-num input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.uk-num input[type="number"]::-webkit-inner-spin-button,
.uk-num input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.uk-step {
  flex: none; width: 38px; height: 38px; padding: 0; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  font-family: inherit; font-weight: 700; font-size: 18px; line-height: 1; cursor: pointer;
}
.uk-step:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.uk-step:disabled { opacity: .4; cursor: default; }
.uk-step[data-d="-1"] { order: -1; border-radius: 8px 0 0 8px; border-right: 0; }
.uk-step[data-d="1"] { border-radius: 0 8px 8px 0; border-left: 0; }

/* Slider: track terisi, thumb, bubble nilai */
.uk-range { position: relative; display: block; width: 100%; min-width: 0; }
.uk-range > input[type="range"] {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 20px; margin: 0;
  background: transparent; cursor: pointer; --p: 50%;
}
.uk-range > input[type="range"]:focus { outline: none; }
.uk-range > input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 99px;
  background: linear-gradient(to right, var(--accent) var(--p), var(--line-2) var(--p));
}
.uk-range > input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent); box-shadow: var(--shadow);
}
.uk-range > input[type="range"]::-moz-range-track { height: 6px; border-radius: 99px; background: var(--line-2); }
.uk-range > input[type="range"]::-moz-range-progress { height: 6px; border-radius: 99px; background: var(--accent); }
.uk-range > input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent);
}
.uk-range > input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-soft); }
.uk-range > input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px var(--accent-soft); }
.uk-bub {
  position: absolute; top: -30px; left: calc(9px + (100% - 18px) * var(--f, .5)); transform: translateX(-50%);
  padding: 2px 8px; border-radius: 6px; background: var(--toast-bg); color: var(--toast-fg);
  font-size: 12px; font-weight: 700; white-space: nowrap; pointer-events: none;
  font-variant-numeric: tabular-nums; opacity: 0; transition: opacity .12s ease;
}
.uk-range:hover .uk-bub, .uk-range:focus-within .uk-bub, .uk-range.uk-drag .uk-bub { opacity: 1; }

/* SearchField: tombol hapus sendiri */
.uk-clear {
  position: relative; flex: none; width: 22px; height: 22px; padding: 0; display: grid; place-items: center;
  border: 0; border-radius: 99px; background: transparent; color: var(--text-3); cursor: pointer;
}
.uk-clear:hover { background: var(--line-2); color: var(--text); }
.uk-clear[hidden] { display: none !important; }
.uk-clear i { position: relative; width: 10px; height: 10px; }
.uk-clear i::before, .uk-clear i::after {
  content: ""; position: absolute; left: 0; top: 50%; width: 100%; height: 1.5px; border-radius: 2px;
  background: currentColor; transform: translateY(-50%) rotate(45deg);
}
.uk-clear i::after { transform: translateY(-50%) rotate(-45deg); }

/* Validasi inline (form novalidate) */
.uk-err { margin: 0; font-size: 12.5px; font-weight: 600; line-height: 1.45; color: var(--danger); }
.input[aria-invalid="true"] { border-color: var(--danger); }

/* Tooltip */
.uk-tip {
  position: fixed; z-index: 80; max-width: min(280px, calc(100vw - 16px)); padding: 6px 9px; border-radius: 7px;
  background: var(--toast-bg); color: var(--toast-fg); font-size: 12px; font-weight: 600; line-height: 1.4;
  pointer-events: none; box-shadow: 0 6px 18px rgb(16 12 24 / .2);
}
.uk-tip[hidden] { display: none !important; }

/* Dialog konfirmasi (UI.confirm). Warna lewat token, jadi ikut mode terang/gelap. */
.uk-scrim {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px;
  background: rgb(15 13 19 / .45);
}
.uk-dialog {
  width: 100%; max-width: 420px; max-height: calc(100dvh - 32px); overflow-y: auto; box-sizing: border-box;
  display: grid; gap: 12px; padding: 20px; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgb(0 0 0 / .22);
}
.uk-dialog-title { margin: 0; font-size: 16px; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.uk-dialog.is-danger .uk-dialog-title { color: var(--danger); }
.uk-dialog-body { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-2); overflow-wrap: anywhere; }
.uk-dialog-field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.uk-dialog-field .input { width: 100%; box-sizing: border-box; }
.uk-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.uk-dialog-actions .btn:disabled { opacity: .45; cursor: default; }
@media (prefers-reduced-motion: no-preference) {
  .uk-scrim { animation: uk-fade .14s ease-out; }
  .uk-dialog { animation: uk-pop .18s cubic-bezier(.2, .8, .2, 1); }
}
@keyframes uk-fade { from { opacity: 0; } }
@keyframes uk-pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
