/*
 * 공통 레이어 팝업(모달) 스타일.
 *
 * 관리자 사이트(starbill_manager_v3)의 css/common.css에서 검증된 .modal-overlay/.modal-panel
 * 패턴을 사용자 사이트(starbill_main_v3)용으로 이관. 기존 window.open() 팝업을 대체하는 용도로,
 * 신규/기존 페이지 모두 이 클래스를 재사용해서 레이어 팝업을 구현한다(CLAUDE.md 지시:
 * "기존 일반 팝업은 모두 레이어 팝업으로 수정").
 *
 * 사용법: js/layerPopup.js의 LayerPopup.open(url, data)로 서버에서 fragment(레이아웃 없는 JSP)를
 * 받아와 #layer-popup-root에 주입한다. 그 fragment 최상위 요소가 .modal-overlay이어야 한다.
 */

#layer-popup-root:empty {
  display: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 30, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4vh;
  z-index: 1000;
}

.modal-panel {
  width: 900px;
  max-width: 96vw;
  max-height: 88vh;
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e5ea;
  flex-shrink: 0;
}

.modal-header h2,
.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #222;
}

.modal-close {
  font-size: 18px;
  color: #888;
  padding: 4px 8px;
  cursor: pointer;
  background: none;
  border: none;
}

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px 20px;
  overflow-y: auto;
}

/* 확인/안내처럼 폭이 좁고 화면 중앙에 뜨는 소형 레이어 팝업(기존 root 위에 겹쳐 표시할 때 사용) */
.send-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 30, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
}

.send-modal-panel {
  width: 420px;
  max-width: 92vw;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.send-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #e2e5ea;
}

.send-modal-body {
  padding: 18px;
}

/* ------------------------------------------------------------------
   페이지(iframe) 레이어 - LayerPopup.openFrame (2026-10 추가)
   기존 window.open 팝업 페이지를 고치지 않고 레이어 안에 연다.
   ------------------------------------------------------------------ */
html.lp-frame-open, html.lp-frame-open body { overflow: hidden; }
.lp-frame-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 18, 28, 0.58);
  animation: lpFadeIn .15s ease-out;
}
.lp-frame-panel {
  max-width: 96vw;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  animation: lpRise .18s ease-out;
}
.lp-frame-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 52px;
  padding: 0 10px 0 20px;
  border-bottom: 1px solid #e3e7ed;
}
.lp-frame-title {
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
  color: #18212e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lp-frame-tools { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.lp-frame-tools .lp-frame-new,
.lp-frame-tools .lp-frame-btn {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 8px;
  border: 1px solid #e3e7ed; background: #fff; color: #5b6676; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.lp-frame-tools .lp-frame-new:hover, .lp-frame-tools .lp-frame-btn:hover { color: #18212e; border-color: #c7cfda; }
.lp-frame-close {
  width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent;
  font-size: 26px; line-height: 1; color: #5b6676; cursor: pointer;
}
.lp-frame-close:hover { background: #f1f3f6; color: #18212e; }
.lp-frame-body { position: relative; flex: 1 1 auto; min-height: 0; background: #f4f6f9; }
.lp-frame-iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.lp-frame-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #8590a0; font-size: 14px; }
@keyframes lpFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes lpRise { from { transform: translateY(8px); opacity: .6; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------------------
   v3 레이어 디자인 통일(2026-10-19): fragment 레이어(.modal-panel, .send-modal-panel)도
   페이지 레이어(.lp-frame-*)와 같은 둥근 상자·머리글·닫기(×)로 맞춘다.
   ------------------------------------------------------------------ */
.modal-overlay, .send-modal-overlay { background: rgba(12, 18, 28, 0.58); }
.modal-overlay { align-items: center; padding-top: 0; }
.modal-panel, .send-modal-panel { border-radius: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3); }
.modal-header, .send-modal-header { min-height: 52px; padding: 0 10px 0 20px; border-bottom-color: #e3e7ed; box-sizing: border-box; }
.modal-header h2, .modal-header h3, .send-modal-header h2, .send-modal-header h3 { margin: 0; font-size: 16px; font-weight: 700; color: #18212e; }
.modal-close {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0;
  border-radius: 10px; font-size: 26px; line-height: 1; color: #5b6676;
}
.modal-close:hover { background: #f1f3f6; color: #18212e; }
.modal-body { padding: 20px 22px; }
