/*
 * 공용 Modal(중앙 다이얼로그) 스타일 — Nifty 모달 패턴(DESIGN_SYSTEM_NIFTY §2.6).
 * 전역 디자인 토큰(--color-*·--space-*·--radius-*·--fs-*·--fw-*)만 사용. kx-modal2__* 네임스페이스.
 */
.kx-modal2 {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

/* 백드롭 — 페이드 인/아웃 */
.kx-modal2__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.kx-modal2.is-open .kx-modal2__backdrop {
  opacity: 1;
}

/* 패널 — 페이드 + 살짝 스케일 인 */
.kx-modal2__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-height: calc(100vh - 2 * var(--space-4));
  display: flex;
  flex-direction: column;
  background: var(--color-white);
  border: var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal, 0 20px 48px rgba(15, 23, 42, 0.24));
  outline: none;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform, opacity;
}
.kx-modal2.is-open .kx-modal2__panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.kx-modal2__panel--sm { max-width: 420px; }
.kx-modal2__panel--md { max-width: 560px; }
.kx-modal2__panel--lg { max-width: 820px; }
.kx-modal2__panel--xl { max-width: min(1160px, 96vw); }

/* 헤더 */
.kx-modal2__head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  border-bottom: var(--border-card);
  flex: 0 0 auto;
}
.kx-modal2__title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--fs-h3, var(--fs-body));
  font-weight: var(--fw-semibold);
  color: var(--color-neutral-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kx-modal2__headextra {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.kx-modal2__close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-neutral-500);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.kx-modal2__close:hover {
  background: var(--color-neutral-100);
  color: var(--color-neutral-900);
}
.kx-modal2__close:focus-visible {
  outline: 2px solid var(--color-brand-500, #1f29fc);
  outline-offset: 1px;
}

/* 바디(스크롤) */
.kx-modal2__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--space-5);
}
.kx-modal2__body.is-flush {
  padding: 0;
}

/* 푸터(고정, 액션 우측) */
.kx-modal2__foot {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: var(--border-card);
}

/* 모션 최소화 존중 */
@media (prefers-reduced-motion: reduce) {
  .kx-modal2__backdrop,
  .kx-modal2__panel {
    transition: none;
  }
  .kx-modal2__panel {
    transform: none;
  }
}
