/* /public/assets/css/popup.css — 홈 팝업 모달 스타일 */

.popup-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(23, 22, 20, 0.5);
  z-index: 998;
  opacity: 0;
  transition: opacity .25s ease;
}
.popup-backdrop.is-visible {
  opacity: 1;
}

.popup-modal {
  position: fixed;
  z-index: 999;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
}
.popup-modal.is-visible {
  opacity: 1;
}

/* 위치 modifier — 동일 위치에 다중 팝업이 쌓일 때 stack-index 기반 대각선 오프셋 부여 */
.popup-pos-center {
  top: 50%;
  left: 50%;
  transform: translate(calc(-50% + (var(--popup-stack-index, 0) * 36px)), calc(-50% + (var(--popup-stack-index, 0) * 36px)));
}
.popup-pos-top-left {
  top: calc(48px + (var(--popup-stack-index, 0) * 32px));
  left: calc(48px + (var(--popup-stack-index, 0) * 32px));
}
.popup-pos-top-right {
  top: calc(48px + (var(--popup-stack-index, 0) * 32px));
  right: calc(48px + (var(--popup-stack-index, 0) * 32px));
}
.popup-pos-bottom-left {
  bottom: calc(48px + (var(--popup-stack-index, 0) * 32px));
  left: calc(48px + (var(--popup-stack-index, 0) * 32px));
}
.popup-pos-bottom-right {
  bottom: calc(48px + (var(--popup-stack-index, 0) * 32px));
  right: calc(48px + (var(--popup-stack-index, 0) * 32px));
}

/* 내부 콘텐츠 */
.popup-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px 22px;
}
/* 대표 이미지가 있을 때 — body 패딩 제거 */
.popup-body.has-image {
  padding: 0;
}
.popup-image {
  display: block;
  width: 100%;
}
.popup-image-link {
  display: block;
}
.popup-image-link img {
  display: block;
  width: 100%;
}
.popup-content {
  font-size: 15px;
  line-height: 1.65;
  color: #171614;
  word-break: break-word;
}
.popup-content p { margin: 0 0 10px; }
.popup-content p:last-child { margin-bottom: 0; }
.popup-content img { max-width: 100%; height: auto; display: block; margin: 8px 0; border-radius: 8px; }
.popup-content a { color: #b08a52; }
.popup-content ul,
.popup-content ol { padding-left: 1.5em; margin: 0 0 10px; }
.popup-content li { margin: 0.2em 0; }
/* Quill 2.x 리스트: 불릿/번호를 모두 <ol><li data-list="..."> 로 출력하므로 li 단위로 마커 지정 */
.popup-content li[data-list="bullet"] { list-style-type: disc; }
.popup-content li[data-list="ordered"] { list-style-type: decimal; }
/* Quill 정렬 클래스 (sanitize_notice_html이 ql- 네임스페이스 보존) */
.popup-content .ql-align-center { text-align: center; }
.popup-content .ql-align-right  { text-align: right; }
.popup-content .ql-align-justify { text-align: justify; }
.popup-content .ql-align-center img { margin-left: auto; margin-right: auto; }
.popup-content .ql-align-right img  { margin-left: auto; margin-right: 0; }
/* 기존 CKEditor image2 figure 래퍼 (마이그레이션 콘텐츠 호환) */
.popup-content figure.image { margin: 8px 0; }
.popup-content figure.image img { display: block; max-width: 100%; height: auto; margin: 0; border-radius: 8px; }
.popup-content figure.image figcaption {
  font-size: .88em;
  color: rgba(23, 22, 20, .6);
  text-align: center;
  padding: 4px 0 0;
}
.popup-content figure.image.image-align-left  { float: left;  margin: 0 12px 8px 0; }
.popup-content figure.image.image-align-right { float: right; margin: 0 0 8px 12px; }
.popup-content figure.image.image-align-center { margin-left: auto; margin-right: auto; }
.popup-content figure.image.image-align-center img { margin-left: auto; margin-right: auto; }
/* 기존 CKEditor Table 플러그인 출력 (마이그레이션 콘텐츠 호환) */
.popup-content table {
  border-collapse: collapse;
  width: auto;
  max-width: 100%;
  margin: 8px 0;
}
.popup-content table td,
.popup-content table th {
  border: 1px solid rgba(23, 22, 20, 0.15);
  padding: 5px 7px;
}
.popup-content table th {
  background: var(--bg2, #f3eee6);
  font-weight: 600;
}

/* 하단 액션바 — 스킵 버튼은 좌측, 닫기는 우측 */
.popup-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 12px;
  border-top: 1px solid var(--line, rgba(23, 22, 20, 0.08));
  background: var(--bg2, #f3eee6);
}
.popup-footer button {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  font-size: 13px;
  color: rgba(23, 22, 20, 0.7);
  padding: 0px 4px;
  min-height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.popup-footer button:hover {
  background: rgba(176, 138, 82, 0.08);
  color: #171614;
}
.popup-footer .popup-close-btn {
  margin-left: auto;
  background: #171614;
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  padding: 6px 12px;
  min-height: 30px;
}
.popup-footer .popup-close-btn:hover {
  background: #2c2926;
  color: #fff;
}

/* 모바일 */
@media (max-width: 520px) {
  .popup-modal {
    /* width는 JS 인라인 스타일로 min(width_px, 92vw) 적용 */
    border-radius: 14px;
    max-height: 90vh;
  }
  /* 모바일 중앙 팝업은 좌·우 끝이 화면 밖으로 밀려나지 않도록 stack 오프셋을 축소 */
  .popup-pos-center {
    transform: translate(calc(-50% + (var(--popup-stack-index, 0) * 18px)), calc(-50% + (var(--popup-stack-index, 0) * 18px)));
  }
  .popup-pos-top-left,
  .popup-pos-top-right {
    top: calc(12px + (var(--popup-stack-index, 0) * 18px));
  }
  .popup-pos-top-left,
  .popup-pos-bottom-left {
    left: calc(12px + (var(--popup-stack-index, 0) * 18px));
    right: 12px;
  }
  .popup-pos-top-right,
  .popup-pos-bottom-right {
    right: calc(12px + (var(--popup-stack-index, 0) * 18px));
    left: auto;
  }
  .popup-pos-bottom-left,
  .popup-pos-bottom-right {
    bottom: calc(12px + (var(--popup-stack-index, 0) * 18px));
  }
  .popup-body { padding: 16px 18px; }
  .popup-body.has-image .popup-content { padding: 12px 18px 16px; }
  .popup-footer { padding: 8px 10px; }
  .popup-footer button { font-size: 11px; padding: 6px 8px; min-height: 32px; }
  .popup-footer .popup-close-btn { font-size: 11px; padding: 6px 10px; min-height: 30px; }

  /* CKE image2: 모바일에서 float 해제, 넓은 table 가로 스크롤 */
  .popup-content figure.image.image-align-left,
  .popup-content figure.image.image-align-right {
    float: none;
    margin: 8px auto;
  }
  .popup-content table { display: block; overflow-x: auto; }
}
