/* ============================================
   hayan_popup5 - 모바일 스타일 선택형 팝업
   - 스타일1 (mo-bottom): 하단 고정, 슬라이드 닫기
   - 스타일2 (mo-center): 센터 모달, PC처럼 80%
   - 모바일 브레이크포인트: 460px
   - PC 반응형: 팝업 width보다 작으면 90% (PHP inline style)
   ============================================ */

.custom-popup {
  position: fixed;
  z-index: 2147483647;
  background: #fff;
  border: 1px solid #000;
  box-shadow: 3px 3px 15px rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  transition: all 0.5s ease;
  overflow: hidden;
  height: auto !important;
  padding-bottom: 0px;
}
.custom-popup.imgum1 {
  position: fixed;
  z-index: 2147483647;
  background: #fff;
  border: 1px solid #000;
  box-shadow: 3px 3px 15px rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  transition: all 0.5s ease;
  overflow: hidden;
  height: auto !important;
  padding-bottom: 0px;
}

/* 슬라이드 아웃 (기본: 아래로) */
.custom-popup.slide-out {
  transform: translateY(100%);
  opacity: 0;
}

/* ============================================
   PC/태블릿 (461px 이상) - 인라인 스타일 그대로 적용
   ============================================ */
@media only all and (min-width: 461px) {
  .popup5-wrap {
    bottom: auto;
    right: auto;
    max-width: 90vw;
    height: auto !important;
    border-radius: 8px;
  }
  /* PC에서는 fade-out으로 닫기 (아래로 슬라이드X) */
  .custom-popup.popup5-wrap.slide-out {
    transform: none;
    opacity: 0;
  }
}

/* ============================================
   모바일 스타일1: 하단 고정 (mo-bottom)
   460px 이하에서 적용
   ============================================ */
@media only all and (max-width: 460px) {
  .popup5-wrap.mo-bottom {
    bottom: 0 !important;
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: auto !important;
    border-radius: 12px 12px 0 0;
    border-left: none;
    border-right: none;
  }
  /* 하단 고정은 아래로 슬라이드 닫기 */
  .popup5-wrap.mo-bottom.slide-out {
    transform: translateY(100%);
    opacity: 0;
  }
}

/* ============================================
   모바일 스타일2: 센터 모달 (mo-center)
   460px 이하에서 적용
   ============================================ */
@media only all and (max-width: 460px) {
  .popup5-wrap.mo-center {
    top: 50% !important;
    left: 50% !important;
    transform: translateX(-50%) translateY(-50%) !important;
    bottom: auto !important;
    right: auto !important;
    width: 80% !important;
    max-height: 90vh;
    height: auto !important;
    border-radius: 8px;
    border: 1px solid #000;
    overflow: hidden;
  }
  /* 센터모달 body 스크롤 */
  .popup5-wrap.mo-center .popup-body {
    max-height: calc(90vh - 130px);
    overflow-y: auto;
  }
  /* 센터 모달은 fade + 축소로 닫기 */
  .popup5-wrap.mo-center.slide-out {
    transform: translateX(-50%) translateY(-50%) scale(0.9) !important;
    opacity: 0;
  }
  /* 센터 모달 배경 오버레이 */
  .popup5-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2147483640;
    transition: opacity 0.3s ease;
  }
  .popup5-overlay.hide {
    opacity: 0;
    pointer-events: none;
  }
  /* 센터모달일 때 팝업이 오버레이 위에 확실히 위치 */
  .popup5-wrap.mo-center {
    z-index: 2147483647 !important;
  }
}

/* 461px 이상에서는 오버레이 숨김 (JS로 생성되어도 표시 안 됨) */
.popup5-overlay {
  display: none;
}
@media only all and (max-width: 460px) {
  .popup5-overlay {
    display: block;
  }
}

/* ============================================
   공통 요소 스타일
   ============================================ */
.popup-header {
  height: 45px;
  padding: 8px 12px;
  background: #222;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  cursor: move;
}
.close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 25px;
  cursor: pointer;
}

.popup-body {
  padding: 0 !important;
  margin-bottom: 0 !important;
}

.popup-footer {
  background: #f9f9f9;
  padding: 0 12px;
  height: 40px;
  font-size: 13px;
  text-align: right;
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  z-index: 10;
}

/* Swiper 페이징 탭 */
.popup-body .swiper-pagination {
  position: absolute;
  bottom: 40px !important;
  left: 0px;
  background-color: #333;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  height: 40px;
  padding: 0px !important;
  color: #fff;
}
.popup-body .swiper-slide {
  padding-bottom: 37px;
}
.popup-body .swiper-pagination span {
  padding: 0px 0px !important;
  margin: 0px !important;
  border-radius: 0px;
  cursor: pointer;
  font-size: 12px;
  width: 100%;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.popup-body .swiper-pagination .swiper-pagination-bullet-active {
  background: var(--primary);
  color: #fff;
}

/* 공통 bullet 스타일 */
.popup-body .swiper-pagination-bullet {
  background: none !important;
  border: none !important;
  color: #fff !important;
  font-size: 13px !important;
  font-weight: normal !important;
  opacity: 1 !important;
  padding: 10px 5px;
  display: inline-block;
  text-align: center;
  cursor: pointer;
}

/* 활성화된 탭 */
.popup-body .swiper-pagination-bullet-active {
  color: #fff !important;
  background: var(--primary) !important;
  font-weight: bold !important;
  border-radius: 3px;
}
.popup-img {
  width: 100%;
  display: block;
}

.hide-swiper-ui {
  display: none !important;
}

/* ============================================
   팝업 다시 열기 버튼 스타일
   ============================================ */
.popup-reopen-btn_out {
  position: fixed;
  left: 0;
  top: 0;
  height: 1px;
  z-index: 999999999 !important;
  width: 100%;
  float: left;
}
.popup-reopen-btn_out .contentContainer {
  position: relative;
}

/* PC 버전 */
@media only all and (min-width: 461px) {
  .popup-reopen-btn {
    position: absolute;
    right: 0;
    top: 10px;
    z-index: 2147483650;
    border: 0;
    background: var(--primary, #2563eb);
    color: #fff;
    cursor: pointer;
    padding: 5px 7px 5px 25px;
    border-radius: 50px;
    font-size: 14px;
  }
}

/* 모바일 버전 */
@media only all and (max-width: 460px) {
  .popup-reopen-btn {
    position: absolute;
    right: 60px;
    top: 12px;
    z-index: 99;
    border: 0;
    background: var(--primary, #2563eb);
    color: #fff;
    cursor: pointer;
    padding: 5px 8px 5px 15px;
    border-radius: 50px;
    font-size: 14px;
  }
}

.popup-reopen-btn em {
  width: 25px;
  height: 25px;
  background-color: #333;
  border-radius: 100%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  color: #fff;
  margin-left: 6px;
}

/* 구글 자동번역 배너 위치 보정 */
html:not([lang="ko"]):not([lang="auto"]) .popup-reopen-btn_out {
  top: 40px;
}
html[lang="ko"] .popup-reopen-btn_out,
html[lang="auto"] .popup-reopen-btn_out {
  top: 0 !important;
}
