/* ═══════════════════════════════════════════════════════════════
   UI KIT — Custom Toast, Modal, Dropdown, Datepicker, Radio
   ═══════════════════════════════════════════════════════════════ */

/* ── TOAST ──────────────────────────────────────────────────── */
.ui-toast-container {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.ui-toast {
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  font-family: Inter, Segoe UI, Roboto, system-ui, sans-serif;
  color: #fff;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
  pointer-events: auto;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: uiToastIn .32s cubic-bezier(.34,1.56,.64,1) forwards;
  text-align: center;
  line-height: 1.3;
}
.ui-toast.success { background: #16a34a; }
.ui-toast.error   { background: #ef4444; }
.ui-toast.info    { background: #3E8BFF; }
.ui-toast.warn    { background: #f59e0b; color: #1a1a1a; }

.ui-toast.removing {
  animation: uiToastOut .22s ease forwards;
}

@keyframes uiToastIn {
  0%   { opacity: 0; transform: translateY(14px) scale(.92); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes uiToastOut {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-10px) scale(.92); }
}

/* ── MODAL DIALOG (Confirm & Prompt) ────────────────────────── */
.ui-modal-overlay {
  position: fixed; inset: 0; z-index: 99998;
  background: rgba(0,0,0,.48);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: uiModalFadeIn .22s ease;
}
.ui-modal-overlay.removing { animation: uiModalFadeOut .18s ease forwards; }

.ui-modal-card {
  background: #fff;
  border-radius: 20px;
  padding: 26px 22px 22px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 16px 48px rgba(0,0,0,.28);
  text-align: center;
  animation: uiModalPopIn .3s cubic-bezier(.34,1.56,.64,1);
}
.ui-modal-card.removing { animation: uiModalPopOut .18s ease forwards; }

body.th-malam .ui-modal-card {
  background: #1a1a2c;
  box-shadow: 0 16px 48px rgba(0,0,0,.6);
}

.ui-modal-icon {
  font-size: 40px; margin-bottom: 8px;
}
.ui-modal-title {
  font-size: 17px; font-weight: 800; color: #1a1a1a;
  margin-bottom: 6px;
  font-family: Inter, Segoe UI, Roboto, sans-serif;
}
body.th-malam .ui-modal-title { color: #d0d0e8; }

.ui-modal-message {
  font-size: 14px; color: #555; line-height: 1.5;
  margin-bottom: 18px;
  font-family: Inter, Segoe UI, Roboto, sans-serif;
}
body.th-malam .ui-modal-message { color: #9090b0; }

.ui-modal-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #ddd;
  border-radius: 12px;
  font-size: 15px;
  outline: none;
  box-sizing: border-box;
  margin-bottom: 16px;
  font-family: Inter, Segoe UI, Roboto, sans-serif;
  transition: border-color .18s;
}
.ui-modal-input:focus { border-color: #ff8a00; }
body.th-malam .ui-modal-input {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.15);
  color: #c8c8e0;
}
body.th-malam .ui-modal-input:focus { border-color: #ff8a00; }

.ui-modal-buttons {
  display: flex; gap: 10px;
}
.ui-modal-btn {
  flex: 1; padding: 11px 0;
  border-radius: 14px; border: none;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  font-family: Inter, Segoe UI, Roboto, sans-serif;
  transition: transform .12s, opacity .15s;
}
.ui-modal-btn:active { transform: scale(.95); }

.ui-modal-btn-cancel {
  background: #e8e8e8;
  color: #444;
}
body.th-malam .ui-modal-btn-cancel {
  background: rgba(255,255,255,.08);
  color: #b0b0c8;
}
.ui-modal-btn-confirm {
  background: #ff8a00;
  color: #fff;
}
.ui-modal-btn-confirm.danger {
  background: #ef4444;
}

@keyframes uiModalFadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes uiModalFadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes uiModalPopIn {
  0%   { opacity: 0; transform: translateY(24px) scale(.92); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes uiModalPopOut {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(16px) scale(.92); }
}

/* ── CUSTOM DROPDOWN ─────────────────────────────────────── */
.ui-dropdown {
  position: relative;
  display: inline-block;
  width: 100%;
}
.ui-dropdown-toggle {
  width: 100%;
  padding: 12px 36px 12px 14px;
  border: 2px solid #ddd;
  border-radius: 12px;
  background: #fff;
  font-size: 15px;
  font-family: Inter, Segoe UI, Roboto, sans-serif;
  color: #222;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  outline: none;
  transition: border-color .18s;
}
.ui-dropdown-toggle::after {
  content: '';
  position: absolute;
  right: 14px; top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #888;
  pointer-events: none;
  transition: transform .18s;
}
.ui-dropdown.open .ui-dropdown-toggle::after {
  transform: translateY(-50%) rotate(180deg);
}
.ui-dropdown-toggle:focus { border-color: #ff8a00; }

body.th-malam .ui-dropdown-toggle {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.15);
  color: #c8c8e0;
}
body.th-malam .ui-dropdown-toggle:focus { border-color: #ff8a00; }
body.th-malam .ui-dropdown-toggle::after { border-top-color: #888; }

.ui-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 32px rgba(0,0,0,.18);
  z-index: 9999;
  max-height: 220px;
  overflow-y: auto;
  display: none;
  padding: 6px 0;
}
.ui-dropdown.open .ui-dropdown-menu { display: block; }
.ui-dropdown-menu.show-below { top: calc(100% + 6px); }
.ui-dropdown-menu.show-above {
  top: auto;
  bottom: calc(100% + 6px);
}

body.th-malam .ui-dropdown-menu {
  background: #1a1a2c;
  box-shadow: 0 10px 32px rgba(0,0,0,.55);
}

.ui-dropdown-item {
  padding: 10px 16px;
  font-size: 14px;
  font-family: Inter, Segoe UI, Roboto, sans-serif;
  color: #222;
  cursor: pointer;
  transition: background .12s;
}
.ui-dropdown-item:hover,
.ui-dropdown-item.active { background: rgba(255,138,0,.1); color: #ff8a00; }
body.th-malam .ui-dropdown-item { color: #c8c8e0; }
body.th-malam .ui-dropdown-item:hover,
body.th-malam .ui-dropdown-item.active { background: rgba(255,138,0,.15); color: #ff9f2a; }

/* ── CUSTOM DATE PICKER ──────────────────────────────────── */
.ui-datepicker {
  position: relative;
  display: inline-block;
  width: 100%;
}
.ui-datepicker-display {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #ddd;
  border-radius: 12px;
  background: #fff;
  font-size: 15px;
  font-family: Inter, Segoe UI, Roboto, sans-serif;
  color: #222;
  cursor: pointer;
  text-align: left;
  box-sizing: border-box;
  transition: border-color .18s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ui-datepicker-display:focus-within { border-color: #ff8a00; }
.ui-datepicker-display .ui-date-icon {
  font-size: 18px; flex-shrink: 0;
}
.ui-datepicker-display .ui-date-text {
  flex: 1; color: #888;
}
.ui-datepicker-display .ui-date-text.has-value { color: #222; }

body.th-malam .ui-datepicker-display {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.15);
}
body.th-malam .ui-datepicker-display .ui-date-text { color: #888; }
body.th-malam .ui-datepicker-display .ui-date-text.has-value { color: #c8c8e0; }
body.th-malam .ui-datepicker-display:focus-within { border-color: #ff8a00; }

.ui-datepicker input[type="date"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%; height: 100%;
  cursor: pointer;
}

/* ── CUSTOM RADIO GROUP ──────────────────────────────────── */
.ui-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ui-radio-pill {
  padding: 10px 18px;
  border: 2px solid #ddd;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  font-family: Inter, Segoe UI, Roboto, sans-serif;
  color: #555;
  cursor: pointer;
  background: #fff;
  transition: all .18s ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ui-radio-pill.selected {
  border-color: #ff8a00;
  background: #fff7ed;
  color: #c2410c;
}
.ui-radio-pill:active { transform: scale(.95); }

body.th-malam .ui-radio-pill {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.12);
  color: #9090b0;
}
body.th-malam .ui-radio-pill.selected {
  border-color: #ff9f2a;
  background: rgba(255,138,0,.12);
  color: #ff9f2a;
}

/* Layout helpers */
.ui-radio-group.block { flex-direction: column; }
.ui-radio-group.block .ui-radio-pill { border-radius: 14px; text-align: left; }
