/* =====================================================================
   브랜드 팝업 표준 엔진 - 프론트 스킨
   디자인 기준 : DESIGN-coinbase (흰 캔버스 / rounded-xl 24px / pill 버튼 / Inter)
   핵심        : 텍스트 불렛 flex 균등 분배(슬라이드 N개 → 각 1/N)
   ===================================================================== */

.bp-popup { display: none; }
.bp-popup.is-open { display: block; }

/* ----- 디바이스 노출 분기 (반응형: 화면 너비 media query 기준) -----
   서버 user-agent 판별 대신, 화면 너비로 어떤 디바이스용 팝업을 보일지 결정한다.
   슬라이드 이미지 분기(<picture media="(max-width:768px)">)와 동일한 768px 기준.
   data-device : pc / mobile / both (both 은 항상 노출)
   specificity 가 .bp-popup.is-open(2) 보다 높으므로(3) is-open 상태도 확실히 숨긴다. */
@media (max-width: 768px) {
  .bp-popup[data-device="pc"].is-open { display: none; }      /* 모바일 화면 → PC 전용 숨김 */
}
@media (min-width: 769px) {
  .bp-popup[data-device="mobile"].is-open { display: none; }  /* PC 화면 → 모바일 전용 숨김 */
}

/* ----- 오버레이 딤 ----- */
.bp-overlay {
  position: fixed; inset: 0;
  background: var(--bp-overlay, rgba(0,0,0,.5));
  z-index: calc(var(--bp-zindex, 9999) - 1);
}

/* ----- 컨테이너 (Coinbase: rounded-xl 24px, soft drop) ----- */
.bp-container {
  position: fixed;
  z-index: var(--bp-zindex, 9999);
  width: 90%;
  max-width: var(--bp-width, 500px);
  background: #ffffff;
  border-radius: var(--bp-radius, 24px);   /* 관리자 4코너 설정 (TL TR BR BL) */
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(10,11,13,.18);
  font-family: 'Inter', -apple-system, system-ui, 'Segoe UI', 'Malgun Gothic', Roboto, sans-serif;
}

/* ----- 노출 위치 (offset 반영) ----- */
.bp-pos-center .bp-container {
  top: 50%; left: 50%;
  transform: translate(calc(-50% + var(--bp-offset-x, 0px)), calc(-50% + var(--bp-offset-y, 0px)));
}
.bp-pos-topleft .bp-container     { top: var(--bp-offset-y, 0px);  left: var(--bp-offset-x, 0px); }
.bp-pos-topright .bp-container    { top: var(--bp-offset-y, 0px);  right: var(--bp-offset-x, 0px); }
.bp-pos-bottomleft .bp-container  { bottom: var(--bp-offset-y, 0px); left: var(--bp-offset-x, 0px); }
.bp-pos-bottomright .bp-container { bottom: var(--bp-offset-y, 0px); right: var(--bp-offset-x, 0px); }

/* ----- 슬라이드 이미지 ----- */
.bp-swiper { display: block; line-height: 0; margin: 0; position: relative; } /* 원형 불렛 오버레이 기준 */
.bp-popup .swiper-slide img { width: 100%; height: auto; display: block; }
.bp-popup .bp-slide-link { display: block; line-height: 0; }

/* ----- 페이지네이션 공통 컨테이너 -----
   swiper 밖 컨테이너 직속 → 풋터와 빈틈 없이 맞붙는다.
   Swiper 가 붙이는 .swiper-pagination-horizontal 의 position/bottom/left/transform
   규칙(높은 specificity)을 !important 로 전부 무력화하여 "위로 밀림/여백"을 제거.
   실제 타입(텍스트/원형) 클래스는 script.js 가 화면폭으로 판단해 부여한다. */
.bp-popup .bp-pagination {
  position: static !important;
  top: auto !important; bottom: auto !important;
  left: auto !important; right: auto !important;
  transform: none !important;
  width: 100% !important;
  margin: 0 !important; padding: 0 !important;
  background: var(--bp-pagination-bg, #0a0b0d);   /* 관리자 지정 불렛 영역 배경 */
  line-height: normal;
}

/* ----- 텍스트 페이지네이션 (가변 균등 분배) ----- */
.bp-popup .bp-text-pagination { display: flex !important; }
.bp-popup .bp-text-pagination .swiper-pagination-bullet {
  /* 슬라이드 N개 → 각 1/N 폭 자동 분배 (px 고정 계산 불필요) */
  flex: 1 1 0 !important;
  display: flex; align-items: center; justify-content: center;  /* 텍스트 수직·수평 중앙 */
  width: auto !important; height: auto !important;
  min-height: 0; margin: 0 !important;
  border-radius: 0; opacity: 1;
  background: transparent;
  color: var(--bp-bullet-color, #888);
  font-size: 13px; line-height: 1.2;
  letter-spacing: -0.2px;
  text-align: center; padding: 13px 6px;
  cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .2s ease;
}
.bp-popup .bp-text-pagination .swiper-pagination-bullet-active {
  color: var(--bp-bullet-active-color, #fff);
  font-weight: 700;
}

/* ----- 원형(점) 페이지네이션 -----
   슬라이드가 많아 텍스트 불렛이 겹칠 때의 대안. 가운데 정렬, 점 사이 간격.
   다크 바(.bp-pagination 영역)는 쓰지 않고, script.js 가 이 요소를 .bp-swiper 안으로
   옮겨 이미지 하단(아래에서 10px 위)에 오버레이한다.
   비활성 점 : 지정 크기/색상/불투명도 / 활성 점 : 가로로 확장되는 pill */
.bp-popup .bp-circle-pagination {
  position: absolute !important;
  left: 0 !important; right: 0 !important;
  bottom: 10px !important; top: auto !important;
  width: 100% !important;
  background: transparent !important;   /* 바 영역 숨김 */
  padding: 0 !important;
  z-index: 2;
  display: flex !important;
  justify-content: center; align-items: center;
  gap: 8px;
}
.bp-popup .bp-circle-pagination .swiper-pagination-bullet {
  flex: 0 0 auto;
  width: var(--bp-circle-size, 10px);
  height: var(--bp-circle-size, 10px);
  margin: 0 !important;
  border-radius: 999px;
  background: var(--bp-circle-color, #ffffff);
  opacity: var(--bp-circle-opacity, 1);
  cursor: pointer;
  transition: width .3s ease, opacity .2s ease;
}
.bp-popup .bp-circle-pagination .swiper-pagination-bullet-active {
  width: calc(var(--bp-circle-size, 10px) * 2.6);   /* 확장되는 원형(pill) */
  opacity: 1;
}

/* ----- 풋터 (Coinbase: 다크 바 + 체크박스 + pill 닫기 버튼) ----- */
.bp-footer {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bp-footer-bg, #0a0b0d); padding: 14px 20px; margin: 0;
}

/* 오늘 하루 보지 않기 : 명확한 체크박스 + 라벨 */
.bp-footer .bp-today-label {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--bp-today-color, #d7d9dd); font-size: 14px; cursor: pointer; user-select: none;
  transition: color .2s ease;
}
.bp-footer .bp-today-check {
  width: 18px; height: 18px; margin: 0;
  accent-color: #0052ff;            /* 체크 시 브랜드 블루 */
  cursor: pointer; flex: 0 0 auto;
}
.bp-footer .bp-today-label:hover { color: var(--bp-today-hover, #ffffff); }

.bp-footer .bp-btn-close {
  border: none; cursor: pointer; font-family: inherit;
  font-size: 14px; font-weight: 600;
  background: var(--bp-close-bg, #16181c); color: var(--bp-close-color, #ffffff);
  border-radius: 100px;                 /* pill */
  padding: 10px 18px;
  transition: background .2s ease, color .2s ease;
}
.bp-footer .bp-btn-close:hover { background: var(--bp-close-bg-hover, #2a2d33); }

/* ----- 모바일 반응형 (가로 768px 이하) -----
   PC와 별개로 모바일 전용 위치(상단/중앙/하단)·가로폭(%)을 적용한다.
   .bp-mpos-* 규칙은 .bp-popup 까지 포함해 specificity(3)를 .bp-pos-*(2)보다
   높여 PC 위치 설정을 확실히 덮어쓴다. */
@media (max-width: 768px) {
  /* 가로폭 : 관리자 지정 % (기본 92%, 100% = 좌우 여백 없이 꽉 채움) */
  .bp-container {
    width: var(--bp-mobile-width, 92%);
    max-width: var(--bp-mobile-width, 92%);
    left: 50%; right: auto;            /* 항상 가로 중앙 정렬 */
  }

  /* 모바일 위치 : 상단 */
  .bp-popup.bp-mpos-top .bp-container {
    top: 16px; bottom: auto;
    transform: translateX(-50%);
  }
  /* 모바일 위치 : 중앙 */
  .bp-popup.bp-mpos-center .bp-container {
    top: 50%; bottom: auto;
    transform: translate(-50%, -50%);
  }
  /* 모바일 위치 : 하단 */
  .bp-popup.bp-mpos-bottom .bp-container {
    top: auto; bottom: 16px;
    transform: translateX(-50%);
  }

  .bp-text-pagination .swiper-pagination-bullet { font-size: 12px; padding: 12px 3px; }
}
