/* ==========================================================================
   Heart to Kiss — 인기상품 + 함께구매 섹션
   fromtome 877 진짜 CSS 100% 동일 재현 (2026-05-19)
   ========================================================================== */

/* ── 공통 리셋 / 폰트 ─────────────────────────────────────────────────────── */
/* :where() 로 감싸 specificity 0 — 아래 .pb-* 클래스의 padding/margin 이
   ID 선택자(#pbPopularSection *)에 덮이던 버그 차단 */
:where(#pbPopularSection, #pbBundleSection) * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Pretendard', 'Pretendard Variable', sans-serif;
  letter-spacing: -0.6px;
  line-height: 1.2;
}

/* ==========================================================================
   1. 인기상품 섹션 — fromtome #upsell-widget-description-top
   ========================================================================== */

#pbPopularSection {
  max-width: 800px;
  padding: 15px 0;
  margin: 0 auto;
}

/* 헤더 영역 */
.pb-popular__header {
  padding: 0 0 0 0;
}

/* 헤더 제목 — cta-text */
.pb-popular__title {
  font-size: 20px;
  font-weight: 700;
  color: #2e2e31;
  margin: 0 0 12px 23px;
  line-height: 1.2;
}

/* 캐러셀 wrapper */
.pb-carousel {
  position: relative;
}

.pb-carousel__btn {
  display: none; /* fromtome는 swiper 내장 네비게이션, 여기선 pagination으로 처리 */
}

/* product-list-wrap — margin-left 제거: viewport 폭을 23px 키워 2열 트랙이 411.5px 로 어긋나던 버그 차단 */
.pb-carousel__viewport {
  position: relative;
  overflow: hidden;
}

/* grid-container — 2열. minmax(0,1fr) 로 트랙 고정 (1fr 단독은 콘텐츠 최소폭만큼 늘어남) */
.pb-carousel__track {
  display: flex;
  align-items: flex-start; /* 카드가 같은 높이로 늘어나 가격이 잘리던 문제 차단 — 각자 내용만큼 */
  gap: 14px;
  width: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 4px 2px 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;        /* 스크롤바 숨김 — 화살표로만 넘김 */
  -ms-overflow-style: none;
}
.pb-carousel__track::-webkit-scrollbar { display: none; height: 0; }

/* 모델컷 세로 카드 (가로 슬라이드) — .pb-card.pb-card--model 로 기존 가로행 .pb-card 보다 우선 */
.pb-card.pb-card--model {
  flex: 0 0 auto;
  width: 170px;
  scroll-snap-align: start;
  display: block;
  gap: 0;
  align-items: stretch;
  background: #fff;
  border: 1px solid #eef0f1;
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  min-height: 0;
  padding: 0;
  transition: box-shadow .15s ease, transform .15s ease;
}
.pb-card.pb-card--model:hover { box-shadow: 0 8px 20px rgba(0,0,0,.09); transform: translateY(-2px); background:#fff; }
.pb-card.pb-card--model .pb-card__media {
  width: 100%;
  height: auto;
  max-width: none;
  aspect-ratio: 3 / 4;
  border-radius: 0;
  flex: none;
}
.pb-card.pb-card--model .pb-card__info {
  padding: 10px 12px 14px;
  display: block;
}
.pb-card.pb-card--model .pb-card__name {
  -webkit-line-clamp: 2;
  line-clamp: 2;
  margin: 0 0 6px;
}
@media (max-width: 760px) {
  .pb-card.pb-card--model { width: 150px; }
}

/* 인기상품 카드 — .product */
.pb-card {
  position: relative;
  background: #fff;
  display: flex;
  gap: 14px;
  min-height: 124px;
  padding: 16px 22px;
  border-bottom: 1px solid #eef0f1;
  border-right: 1px solid #eef0f1;
  align-items: center;
  /* grid 셀(400px) 안에 가두기 — min-width auto 면 콘텐츠만큼 커져 옆 칸 침범 */
  min-width: 0;
  overflow: hidden;
  transition: background 0.15s ease;
}
.pb-card:hover { background: #fafafa; }
.pb-card:nth-child(2n) {
  border-right: none;
}

/* 번호 배지 — thumbnail-numbering */
.pb-card__rank {
  position: absolute;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  background-color: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 0 6px 0;
  z-index: 10;
  line-height: 1;
}

/* 상품 이미지 — product-image */
.pb-card__media {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  position: relative;
  max-width: 110px;
  width: 92px;
  height: 92px;
  flex-shrink: 0;
  border-radius: 10px;
}
.pb-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pb-card__media-placeholder {
  width: 100%;
  height: 100%;
}

/* 상품 정보 — product-info */
.pb-card__info {
  text-align: left;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

/* 상품명 — product-name */
.pb-card__name {
  font-size: 14px;
  line-height: 1.4;
  color: #33353a;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: keep-all;
  margin: 0 0 6px;
}

/* 가격 — normal-price */
.pb-card__price {
  font-size: 16px;
  font-weight: 700;
  color: #2e2e31;
  margin: 0;
  line-height: 1.2;
  text-decoration: none;
}

/* 버튼 영역 — product-buttons */
.pb-card__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  align-self: center;
}

.pb-card__btn {
  height: 34px;
  width: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.43;
  transition: opacity 0.2s ease;
  border: none;
  outline: none;
  white-space: nowrap;
}
.pb-card__btn:hover {
  opacity: 0.7;
}

/* 자세히 보기 — .detail */
.pb-card__btn--outline {
  border: 1px solid #cbcdd2;
  background-color: transparent;
  color: #2e2e31;
}

/* 상품 선택 — .add */
.pb-card__btn--fill {
  background-color: #2e2e31;
  color: #fff;
  border: none;
}

/* 페이지네이션 */
.pb-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 17px;
  padding-top: 16px;
}

.pb-pagination__btn {
  display: inline-flex;
  cursor: pointer;
  width: 40px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: #fff;
  font-size: 18px;
  color: #2e2e31;
  transition: opacity 0.2s ease;
}
.pb-pagination__btn:disabled {
  opacity: 0.2;
  cursor: default;
}

.pb-pagination__text {
  font-size: 12px;
  color: #6e6e72;
  font-weight: 700;
  line-height: 1;
}

/* ==========================================================================
   2. 함께구매 섹션 — fromtome #upsell-widget-description-bottom
   ========================================================================== */

#pbBundleSection {
  max-width: 800px;
  margin: 0 auto var(--margin-bottom, 15px);
  padding: 24px 0 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  border-top: 1px solid #e9ecee;
  border-bottom: 1px solid #e9ecee;
}

/* 헤더 제목 */
.pb-bundle__title {
  text-align: center;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.31;
  color: #2e2e31;
  margin: 0;
}
.pb-bundle__title strong {
  color: #2e2e31;
  font-weight: 700;
}
.pb-bundle__subtitle {
  text-align: center;
  font-size: 14px;
  color: #6b6b6f;
  margin: 8px 0 0;
}
.pb-bundle__subtitle strong {
  color: #d6336c;
  font-weight: 700;
}

/* main 박스 — .main */
.pb-bundle__box {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 40px;
  padding: 30px !important;
  background-color: #f6f7f8;
  position: relative;
}

/* 이미지 배지 위치 wrapper */
.pb-bundle__main-image-badge {
  position: relative;
}

/* 우측 right 컬럼 */
.pb-bundle__right {
  display: flex;
  flex-direction: column;
  gap: 33px;
  flex: 1;
}

/* 좌측 stand-product */
.pb-bundle__main {
  background-color: #fff;
  border-radius: 20px;
  box-shadow: 0px 4px 20px 0px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  width: 220px;
  min-width: 180px;
  max-width: 319px;
  flex-shrink: 0;
  position: relative;
}

/* 이미지 + 배지 wrapper */
.pb-bundle__main-media-wrap {
  position: relative;
  width: 100%;
}

/* 이미지 영역 */
.pb-bundle__main-media {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}
.pb-bundle__main-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  vertical-align: middle;
  display: block;
}
.pb-bundle__main-media-placeholder {
  width: 100%;
  height: 100%;
}

/* "현재 보고있는 상품" 배지 — 이미지 우하단 */
.pb-bundle__current-badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 5px 16px;
  border-radius: 150px;
  background-color: #464648;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  z-index: 2;
}

/* 정보 영역 — stand-product-info */
.pb-bundle__main-info {
  padding: 34px 20px;
}

/* label 스타일 */
.pb-bundle__main-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  gap: 16px;
}

/* 상품명 — stand-product-name */
.pb-bundle__main-name {
  font-size: 18px;
  color: #464648;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 0 8px;
}

/* 가격 — product-price */
.pb-bundle__main-price {
  font-size: 24px;
  font-weight: 700;
  color: #2e2e31;
  margin: 0;
}

/* 체크박스 아이콘 */
.pb-bundle__main-check {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  outline: 1px solid #838589;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: outline 0.15s ease-in-out, background-color 0.15s ease-in-out;
  flex-shrink: 0;
  cursor: pointer;
  background: #fff;
}
.pb-bundle__main-check.is-checked {
  outline: 1px solid #2e2e31;
  background-color: #2e2e31;
}
.pb-bundle__main-check .check-mark {
  stroke: #e9ecee;
  transition: stroke 0.15s ease-in-out;
}
.pb-bundle__main-check.is-checked .check-mark {
  stroke: #fff;
}

/* 중앙 + 아이콘 — plus-icon SVG */
.pb-bundle__plus {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: calc(150px + 1px);
}
.pb-bundle__plus svg {
  width: 35px;
  height: 34px;
}

/* 우측 right 영역 */
.pb-bundle__recs {
  display: flex;
  flex-direction: column;
  gap: 33px;
  flex: 1;
}

/* 추천 상품 카드 — recommend-product */
.pb-rec-card {
  display: flex;
  gap: 16px;
  position: relative;
}

/* 이미지 — recommend-product-image */
.pb-rec-card__media {
  width: 150px;
  aspect-ratio: 1 / 1;
  position: relative;
  flex-shrink: 0;
}
.pb-rec-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  vertical-align: middle;
  border-radius: 16px;
}
.pb-rec-card__media-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 16px;
}

/* rank 배지 — .rank */
.pb-rec-card__rank {
  position: absolute;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #4a4a4a;
  font-size: 16px;
  font-weight: 700;
  z-index: 2;
  line-height: 1;
}

/* 정보 영역 — recommend-product-info */
.pb-rec-card__info {
  width: 100%;
  flex: 1;
}

/* label 스타일 */
.pb-rec-card__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  height: 100%;
  gap: 16px;
}

/* 정보 내부 */
.pb-rec-card__info-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-align: left;
}

/* 상품명 */
.pb-rec-card__name {
  font-size: 16px;
  color: #464648;
  margin: 0 0 4px;
}

/* 가격 */
.pb-rec-card__price {
  font-size: 20px;
  font-weight: 700;
  color: #2e2e31;
  margin: 0 0 auto;
}

/* 함께 구매된 횟수 — recommend-product-rank */
.pb-rec-card__together {
  margin-top: auto;
  font-size: 14px;
  color: #838589;
  margin: 0;
}
.pb-rec-card__together-value {
  font-weight: 700;
  color: #2e2e31;
}

/* 체크박스 */
.pb-rec-card__check {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  outline: 1px solid #838589;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: outline 0.15s ease-in-out, background-color 0.15s ease-in-out;
  flex-shrink: 0;
  cursor: pointer;
  background: #fff;
}
.pb-rec-card__check.is-checked {
  outline: 1px solid #2e2e31;
  background-color: #2e2e31;
}
.pb-rec-card__check .check-mark {
  stroke: #e9ecee;
  transition: stroke 0.15s ease-in-out;
}
.pb-rec-card__check.is-checked .check-mark {
  stroke: #fff;
}

/* selected-products CTA 박스 */
.pb-bundle__cta-wrap {
  width: 100%;
}

/* CTA 버튼 — .submit */
.pb-bundle__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 50px;
  background-color: #2e2e31;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.pb-bundle__cta:hover {
  opacity: 0.7;
}
.pb-bundle__cta.is-empty {
  background-color: #2e2e31;
  cursor: default;
  opacity: 1;
}
.pb-bundle__cta:disabled {
  cursor: default;
}

/* ==========================================================================
   모달 — 상품 상세 팝업
   ========================================================================== */

.pb-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.pb-modal-overlay[hidden] {
  display: none;
}

.pb-modal {
  background: #fff;
  border-radius: 12px;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0px 2px 15px 0px rgba(0, 0, 0, 0.05), 0px 12px 20px 0px rgba(0, 0, 0, 0.2);
}

.pb-modal__header {
  display: flex;
  justify-content: flex-end;
  padding: 14px 14px 0;
}
.pb-modal__close {
  width: 36px;
  height: 36px;
  border: none;
  background: #f5f5f5;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #2e2e31;
  transition: background 0.15s;
  line-height: 1;
}
.pb-modal__close:hover {
  background: #e0e0e0;
}

.pb-modal__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow-y: auto;
  flex: 1;
}

.pb-modal__image {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #f5f5f5;
  overflow: hidden;
}
.pb-modal__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pb-modal__info {
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pb-modal__name {
  font-size: 18px;
  font-weight: 700;
  color: #2e2e31;
  margin: 0;
  line-height: 1.4;
}
.pb-modal__price {
  font-size: 22px;
  font-weight: 700;
  color: #2e2e31;
  margin: 0;
}
.pb-modal__label {
  font-size: 12px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 6px;
}
.pb-modal__option-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pb-modal__option-btn {
  padding: 6px 14px;
  border: 1px solid #cbcdd2;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  cursor: pointer;
  color: #2e2e31;
  transition: all 0.15s;
}
.pb-modal__option-btn.is-active,
.pb-modal__option-btn:hover {
  border-color: #2e2e31;
  background: #2e2e31;
  color: #fff;
}
.pb-modal__add-btn {
  margin-top: auto;
  height: 50px;
  background: #2e2e31;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  transition: opacity 0.2s ease;
}
.pb-modal__add-btn:hover {
  opacity: 0.7;
}

/* ==========================================================================
   반응형
   ========================================================================== */
@media (max-width: 820px) {
  #pbBundleSection {
    padding: 32px 0;
    gap: 16px;
    align-items: flex-start;
  }
  .pb-bundle__title {
    text-align: left;
    font-size: 24px;
  }
  .pb-bundle__box {
    display: block;
    background-color: #fff;
    border: 1px solid #e9ecee;
    padding: 8px 0;
    border-radius: 12px;
  }
  .pb-bundle__plus {
    margin: 0 0 0 41px;
  }
  .pb-rec-card__media {
    width: 88px;
  }
}

@media (max-width: 768px) {
  #pbPopularSection {
    padding-left: 0;
    padding-right: 0;
  }
  .pb-popular__title {
    padding: 0 23px;
  }
  .pb-carousel__viewport {
    margin-left: 0;
    margin-right: 0;
  }
  .pb-modal__body {
    grid-template-columns: 1fr;
  }
  .pb-modal__image {
    aspect-ratio: 4 / 3;
  }
}
