/* =========================================================
   Toast Root Layer
========================================================= */
.toast-root {
  position: fixed;
  inset: 0;

  /* Bootstrap modal / custom modal / grid layer보다 위 */
  z-index: 30000;

  display: none;

  /* 숨김 상태에서는 클릭 이벤트 차단 */
  pointer-events: none;
}

.toast-root.show {
  display: block;

  /* 표시 상태에서는 클릭 가능 */
  pointer-events: auto;
}


/* =========================================================
   Toast Backdrop
========================================================= */
.toast-backdrop {
  position: absolute;
  inset: 0;

  z-index: 1;

  background: rgba(0,0,0,0.35);

  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}


/* =========================================================
   Toast Box (완전 중앙 정렬)
========================================================= */
.toast-box {
  position: absolute;

  z-index: 2;

  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  width: min(360px, calc(100vw - 40px));
  min-height: 124px;

  background: #fff;
  border: 1px solid #d8dde5;
  border-radius: 6px;

  padding: 22px 28px 20px;

  box-shadow: 0 14px 34px rgba(15,23,42,0.24);

  animation: toastFadeIn 0.18s ease;

  text-align: center;

  /* Toast 박스 내부 클릭 가능 */
  pointer-events: auto;
}

.toast-box::before {
  content: "i";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: #eef6ff;
  color: #279fd3;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.toast-box.success::before {
  content: "✓";
  background: #eefaf2;
  color: #198754;
}

.toast-box.warning::before {
  content: "!";
  background: #fff7df;
  color: #b7791f;
}

.toast-box.error::before {
  content: "!";
  background: #fff0f0;
  color: #dc3545;
}

.toast-box.is-confirm {
  width: min(390px, calc(100vw - 40px));
  min-height: 156px;
}


/* =========================================================
   Toast Message
========================================================= */
.toast-message {
  font-size: 14px;
  line-height: 1.55;
  color: #1e2124;

  margin: 0;

  white-space: pre-line;
  word-break: keep-all;
}

.toast-box.is-alert .toast-message {
  margin-bottom: 0;
}

.toast-box.is-confirm .toast-message {
  margin-bottom: 18px;
}

/* =========================================================
   Toast Actions / Buttons
========================================================= */
.toast-actions {
  display: flex;
  justify-content: center;
  align-items: center;

  gap: 8px;
  margin-top: 0;

  position: relative;
  z-index: 3;
}

/* hidden 속성일 때는 숨김 유지 */
.toast-actions[hidden] {
  display: none !important;
}

.toast-actions .btn[hidden] {
  display: none !important;
}

.toast-actions .btn {
  min-width: 78px;
  height: 32px;
  padding: 0 18px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  line-height: 30px;

  cursor: pointer;

  position: relative;
  z-index: 4;

  pointer-events: auto;
}

.toast-actions .btn:focus {
  outline: none;
  box-shadow: 0 0 0 0.2rem rgba(13,110,253,.25);
}


/* =========================================================
   Toast Animation
========================================================= */
@keyframes toastFadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -48%) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}


/* =========================================================
   TUI Grid dropdown 잘림 방지
========================================================= */
.tui-grid-layer-editing {
  z-index: 9999 !important;
}

.tui-grid-editor-container {
  overflow: visible !important;
}


/* =========================================================
   TUI Grid Row Status Colors
========================================================= */
.tui-grid-cell.row-inserted {
  background-color: #e6ffed !important;
}

.tui-grid-cell.row-updated {
  background-color: #fff7cc !important;
}

.tui-grid-cell.row-deleted {
  background-color: #ffe6e6 !important;
}

/* =========================================================
   Toast 표시 중 이벤트 보정
========================================================= */
body.toast-open #toast-root {
  z-index: 30000 !important;
  pointer-events: auto !important;
}

body.toast-open #toast-root .toast-backdrop,
body.toast-open #toast-root .toast-box,
body.toast-open #toast-root .toast-actions,
body.toast-open #toast-root .toast-actions .btn {
  pointer-events: auto !important;
}
