/*
 * Juicebox storefront overrides — loaded after master-styles.css.
 *
 * Small delta between the crawled cafe24 skin and the native Next.js port.
 */

/* ── Juicebox 홈 팝업 (#jb-popup) ────────────────────────────── */
#jb-popup {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 520px;
  width: 90%;
  height: 280px;
  opacity: 0;
  transform: translateY(5%);
  visibility: hidden;
  box-sizing: border-box;
  border-radius: 8px;
  background-color: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  transition: all .4s ease-in-out;
  z-index: 9999;
  overflow: hidden;
}
#jb-popup.show { transform: translateY(0); opacity: 1; visibility: visible; }
#jb-popup > ul { display: flex; height: 100%; width: 100%; margin: 0; padding: 0; list-style: none; }
#jb-popup > ul > .left { flex: 1; overflow: hidden; }
#jb-popup > ul > .left a { display: block; height: 100%; }
#jb-popup > ul > .left img { width: 100%; height: 100%; object-fit: cover; display: block; }
#jb-popup > ul > .right { width: 200px; padding: 20px 16px; display: flex; flex-direction: column; justify-content: space-between; font-size: 13px; line-height: 1.6; flex-shrink: 0; }
#jb-popup > ul > .right .content p { font-size: 13px; }
#jb-popup .jb-btn-close { display: flex; align-items: center; justify-content: space-between; padding-top: 10px; border-top: 1px solid #eee; font-size: 12px; }
#jb-popup .jb-btn-close a { cursor: pointer; color: #333; text-decoration: underline; }
#jb-popup .jb-close { position: absolute; top: 0; right: 0; padding: 10px 12px; font-size: 16px; text-decoration: none !important; }
@media (max-width: 768px) {
  #jb-popup { width: calc(100% - 40px); height: auto; }
  #jb-popup > ul { flex-direction: column; }
  #jb-popup > ul > .left { height: 160px; }
  #jb-popup > ul > .right { width: 100%; }
}

/* 모바일에서 검색 오버레이가 화면 전체를 덮도록 높이 보정.
 * 크롤된 규칙이 top/left/right/position:fixed 만 지정하고 height 를 생략해
 * 컨텐츠 높이만큼만 열린다. 1024px 이하에서 height:100% 로 전체 덮음. */
@media (max-width: 1024px) {
  #header .xans-layout-searchheader {
    height: 100%;
  }
}

/* Action buttons (cart/buy) — moved out of globals.css so vaporwave keeps
 * its crawled module-bundle.css rules untouched. */
.xans-product-action .ec-base-button.gColumn {
  display: flex;
  justify-content: center;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}
.xans-product-action .ec-base-button.gColumn [class^='btn'] {
  flex: 1;
  width: auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 4.2rem;
  line-height: 4.2rem;
  padding: 0;
  font-size: 1.2rem;
  font-weight: 500;
  border-radius: 0.8rem;
  box-shadow: 0 3px 13px 0 rgb(169 169 169 / 30%);
  margin: 0 0 0 9px;
}
.xans-product-action .ec-base-button.gColumn [class^='btn']:first-child {
  margin-left: 0;
}
.xans-product-action .ec-base-button.gColumn [class^='btn'] > img {
  width: 20px;
  margin-right: 8px;
}
.xans-product-action .ec-base-button.gColumn [class^='btnSubmit'] {
  flex: 1.3;
}

/* 게시판 탭 서브메뉴 좌우 패딩 */
.xans-layout-boardinfo.ec-base-tab.typeMenu {
  padding: 0 20px;
}

/* 이벤트 게시판 카드 — 2열 그리드, 이미지 전체 표시 + 하단 참여하기 바 */
.board-event-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 30px 0;
}

.board-event-grid .event-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  background: #fff;
}

.board-event-grid .event-card img {
  display: block;
  width: 100%;
  transition: opacity 0.2s;
}

.board-event-grid .event-card:hover img {
  opacity: 0.85;
}

.board-event-grid .event-card-footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0 4px;
}

.board-event-grid .event-card-footer .event-title {
  color: #222;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-event-grid .event-card-footer .event-author {
  color: #888;
  font-size: 13px;
}

@media (max-width: 767px) {
  .board-event-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 20px 4%;
  }
  .board-event-grid .event-card img {
    max-width: 100%;
  }

  /* 게시판 탭 메뉴 — 모바일 가로 스크롤, 탭 간격 % 단위로 최적화 */
  .xans-layout-boardinfo.ec-base-tab.typeMenu {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    justify-content: flex-start;
    padding: 0; /* ul에 padding 적용하므로 컨테이너 패딩 리셋 */
  }
  .xans-layout-boardinfo.ec-base-tab.typeMenu::-webkit-scrollbar {
    display: none;
  }
  .xans-layout-boardinfo.ec-base-tab.typeMenu ul {
    flex-wrap: nowrap;
    min-width: max-content;
    margin: 0;
    padding: 0 20px;
  }
  .xans-layout-boardinfo.ec-base-tab.typeMenu .button {
    margin: 0 4% 0 2%;
    white-space: nowrap;
  }
}

@media (max-width: 768px) {
  .xans-board-listpackage .ec-base-table.typeList th:not(:nth-child(2)),
  .xans-board-listpackage .ec-base-table.typeList td:not(:nth-child(2)) {
    display: none !important;
  }
  .xans-board-listpackage .ec-base-table.typeList td.subject {
    padding-left: 12px;
    padding-right: 12px;
    max-width: 0;
  }
  .xans-board-listpackage .ec-base-table.typeList td.subject a {
    display: block !important;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .xans-board-listpackage .ec-base-table.typeList td.subject a img {
    vertical-align: middle;
  }
}

/* 상품 상세 추가정보 영역 너비 제한 */
.xans-element-.xans-product.xans-product-additional {
  max-width: 1230px;
  margin: auto;
}


/* 홈 공지사항 섹션 border 1px 통일 — 기존 section-title이 2px solid #111이어서
 * 게시판 행 구분선(1px)과 두께가 달라 보이는 문제 수정 */
.index_board_notice .section-title {
  border-bottom-width: 1px;
  border-bottom-color: #ddd;
}

/* 이용약관·개인정보처리방침 PC 좌측 여백 — 래퍼에 max-width/centering 없어 콘텐츠가 좌측 끝에 붙음 */
.xans-mall-term.gInnerMargin,
.xans-mall-privacy.gInnerMargin {
  max-width: var(--base-width, 1380px);
  margin: 2rem auto;
  padding: 0 20px;
  box-sizing: border-box;
}

/* 주문서 적립금 입력 영역 — input + 버튼 2개가 줄바꿈 없이 한 줄에 나오도록 */
.discountDetail .control {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}
.discountDetail .control .inputTypeText {
  flex: 1;
  min-width: 0;
}
.discountDetail .control .btnNormal {
  flex-shrink: 0;
  white-space: nowrap;
}

/* 상품 상세 탭 — 모바일에서 4탭 + 리뷰수 4자리로 줄바꿈 발생 방지 */
@media (max-width: 767px) {
  .ec-base-tab.gFlex {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .ec-base-tab.gFlex::-webkit-scrollbar {
    display: none;
  }
  .ec-base-tab.gFlex .menu-inner {
    min-width: max-content;
  }
  .ec-base-tab.gFlex .menu {
    flex-wrap: nowrap;
    white-space: nowrap;
  }
  .ec-base-tab.gFlex .menu li a {
    font-size: 12px;
    padding: 0 10px;
  }
}

/* 이벤트 게시판 — 모바일 콘텐츠 좌우 넘침 방지 */
@media (max-width: 767px) {
  .boardList {
    max-width: 100%;
    overflow-x: hidden;
  }
  .board-event-grid .event-card {
    max-width: 100%;
    overflow: hidden;
  }
}

.ec-base-tab.typeMenu .button { margin: 0 30px 0 10px; }
