/* popup.css — 팝업 시스템 (Phase 5 Figma Revision) */

/* ── 오버레이 ── */
.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(24px, 5vw, 100px);
}

.popup-overlay[hidden] {
  display: none;
}

/* ── 데스크탑 닫기 (overlay 레벨, 우상단) ── */
.popup-close-desktop {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

/* ── 모달 공통 ── */
.popup {
  position: relative;
  z-index: var(--z-popup);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.popup[hidden] {
  display: none;
}

/* ═══════════════════════════════════════
   PDF 팝업 — 데스크탑
   Figma: 1008×752, bg #F5F5F5, radius 24px, stroke 1px #999999
   ═══════════════════════════════════════ */
.popup-pdf {
  width: 1008px;
  max-width: 90vw;
  background: #F5F5F5;
  border-radius: var(--radius-popup);
  border: 1px solid var(--grey-99);
  display: flex;
  flex-direction: column; /* 좌: PDF뷰어, 우: 메타패널 */
}

.popup-header-desktop {
  color: var(--black);
  padding: 16px 20px;
  border-bottom: 1px solid var(--grey-2);  
}

.popup-header-desktop h3{
  font-family: var(--font-pretendard);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
}

.popup-body {
  display: flex;
  flex: 1;
  flex-direction: row; /* 좌: PDF뷰어, 우: 메타패널 */
  height: 752px;
  max-height: 75vh;
  max-height: 75dvh;
}

/* PDF 뷰어 좌측 영역 */
.pdf-viewer-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  overflow: hidden;
  min-height: 630px;
}

/* PDF dark 렌더링 영역 */
.pdf-canvas-wrap {
  flex: 1;
  width: 100%;
  background: var(--bg-pdf-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  overflow-y: auto;
  padding: 5%;
}

.pdf-canvas-wrap.loading{
  justify-content: center;
}

.pdf-canvas {
  max-width: 100%;
  height: auto;
  flex-shrink: 0;
}

/* PDF 페이지 네비게이션 */
.pdf-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-pretendard);
  padding: 8px 0;
}

.pdf-nav button {
  width: 24px;
  height: 24px;
  border: 1px solid var(--grey-b4);
  border-radius: 50%;
  background: var(--white);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--grey-4);
  padding: 0;
}

.pdf-nav button:hover {
  border-color: var(--grey-4);
  color: var(--black);
}

.pdf-nav button:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

/* 페이지 카운터: "1 / 45" */
.pdf-counter {
  font-family: var(--font-pretendard);
  font-size: 12px;
  line-height: 24px;
}

.pdf-counter .pdf-cur {
  font-weight: 700;
  color: var(--black);
}

.pdf-counter .pdf-sep {
  font-weight: 400;
  color: var(--grey-3);
}

/* PDF 문서정보 우측 패널 */
.pdf-meta-panel {
  width: 248px;
  flex-shrink: 0;
  background: var(--white);
  border-radius: 0 8px 8px 0;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-left: 1px solid var(--grey-2);
}

.pdf-meta-panel .title{
  display: flex;
  align-items: center;
  gap: 8px;
}

.pdf-meta-panel .meta-title {
  font-family: var(--font-pretendard);
  font-size: 16px;
  font-weight: 700;
  line-height: 24px;
  color: var(--black);
  margin: 0 0 8px;
  word-break: break-word;
}

.pdf-meta-panel h4 {
  font-family: var(--font-pretendard);
  font-size: 16px;
  font-weight: 700;
  color: var(--black);
  margin: 0;
}

.pdf-meta-panel dl {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--font-pretendard);
  font-size: 13px;
  margin: 0;
  flex:1;
}

.pdf-meta-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pdf-meta-field dt {
  color: var(--grey-3);
  font-size: 14px;
}

.pdf-meta-field dd {
  color: var(--black);
  margin: 0;
  word-break: break-word;
  font-size: 14px;
}

/* PDF 풋터 (메타패널 하단) */
.pdf-footer-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
  padding: 6px;
  background: var(--white);
  width: 100%;
  flex-direction: column;

}

.popup-pill {
  font-family: var(--font-pretendard);
  height: 32px;
  padding: 16px;
  border-radius: 80px;
  border: 1px solid var(--grey-b4);
  background: var(--white);
  color: var(--grey-4);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  
  color: var(--Color-Primary-Black, #000);
  text-align: center;
  font-size: 14px;
  font-style: normal;
  font-weight: 700;
  line-height: 24px; /* 171.429% */

  gap: 4px;
}

.popup-pill:hover {
  border-color: var(--grey-4);
  color: var(--black);
}



/* ═══════════════════════════════════════
   이미지 팝업 — 데스크탑
   Figma: 모달 800px wide, overlay에 좌우 chevron
   ═══════════════════════════════════════ */
.popup-image {
  width: 800px;
  max-width: 90vw;
  background: transparent;
  border-radius: 0;
}

/* 이미지 헤더 제거됨 (BUG-3) */

/* 이미지 영역 */
.img-main-wrap {
  position: relative;
  width: 100%;
  height: 464px;
  background: #000000;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.popup-main-img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 0;
  display: block;
  transition: opacity 0.2s ease;
}

/* 세로형: 너비에 맞춰 꽉 차게 */
.popup-main-img.portrait {
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* 가로형: 높이에 맞추고 좌우 블랙 배경 */
.popup-main-img.landscape {
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* 이미지 하단 정보 패널 */
.img-info-panel {
  background: var(--white);
  border-radius: 0 0 24px 24px;
  display: flex;
  flex-direction: column;
}

.img-info-panel .info-title {
  font-family: var(--font-pretendard);
  font-size: 24px;
  font-weight: 700;
  color: var(--black);
  margin: 0;
  padding: 12px 24px;
  padding-top: 32px;
}

.img-info-panel dl {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--font-pretendard);
  font-size: 13px;
  margin: 0;
  padding: 12px 24px;
  padding-bottom: 32px;
}

.img-meta-field {
  display: flex;
  gap: 12px;
}

.img-meta-field dt {
  font-size: 14px;
  color: var(--grey-3);
  white-space: nowrap;
  min-width: 70px;
}

.img-meta-field dd {
  font-size: 14px;
  color: var(--black);
  margin: 0;
  word-break: break-word;
}

.img-footer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 24px 32px;
  gap: 12px;
}

#popup-image-wrapper{
  display: flex;
  gap: 16px;
}

/* 이미지 캐러셀 좌우 chevron (overlay 레벨 배치) */
.img-prev,
.img-next {
  width: 48px;
  max-height: 468px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;


}

/* chevron SVG: 12×24, stroke #FFFFFF 4px */
.img-prev svg,
.img-next svg {
  width: 48px;
  height: 48px;
}

/* 이미지 카운터 (이미지 영역 상단 좌측) */
.img-counter {
  font-family: var(--font-pretendard);
  font-size: 12px;
  line-height: 24px;
  padding: 4px 16px;
  border-radius: 100px;
  border: 1px solid var(--grey-cb);
  background: var(--white);
  position: absolute;
  top: 16px;
  left: 16px;
}

.img-counter .img-cur {
  font-weight: 700;
  color: var(--black);
}

.img-counter .img-sep {
  font-weight: 400;
  color: var(--grey-3);
}

/* ── 로딩 프로그레스 바 ── */
.popup-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  width: 100%;
}

.popup-loading-text {
  font-family: var(--font-pretendard);
  font-size: 13px;
  color: var(--grey-3);
}

.popup-progress-bar {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
}

.popup-progress-fill {
  height: 100%;
  background: var(--white);
  border-radius: 2px;
  width: 0%;
  transition: width 0.2s ease;
}

.popup-loading.done {
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* 이미지 로딩 스피너 */
.img-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.img-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: popup-spin 0.8s linear infinite;
}

@keyframes popup-spin {
  to { transform: rotate(360deg); }
}

/* ── 모바일 전용 요소 (데스크탑에서 숨김) ── */
.popup-header-mobile { display: none; }
.popup-toolbar-mobile { display: none; }
.popup-counter-pill { display: none; }
.popup-bottomsheet { display: none; }