/* 빌링 자체 웹샵 상품 리스트/상세 공통 디자인 (결제수단 무관) */
/* 디자인 토큰(:root)과 body/content 레이아웃은 함께 로드되는 webshop.css 가 정의한다 */

/* ===== Top banner =====
 * - 추후 CDN URL 로 노출. 비율 유지를 위해 width 100% + aspect-ratio 미지정 (이미지 원본 비율 유지).
 * - 모서리는 hero 와 동일 radius 로 디자인 일관성. 박스 그림자도 hero 와 동일.
 */
/* ===== Hero Carousel (기획 §2 키비주얼 · 최대 8슬라이드 · 8초 progress) ===== */
.shop-hero {
  margin: 24px 0 20px;
}
.hero-stage {
  position: relative;
  height: 300px;
  border-radius: var(--ws-radius);
  overflow: hidden;
  background: var(--ws-surface-2);
  box-shadow: var(--ws-shadow);
  cursor: grab;
  user-select: none;
}
.hero-stage:active { cursor: grabbing; }

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.hero-slide.is-active {
  opacity: 1;
  pointer-events: auto;
}
.hero-link {
  display: block;
  width: 100%;
  height: 100%;
}
.hero-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-nav-pill {
  position: absolute;
  right: 16px;
  bottom: 18px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(20, 14, 14, 0.62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
}
.hero-nav-arrow {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.12s ease;
}
.hero-nav-arrow:hover { background: rgba(255, 255, 255, 0.14); }
.hero-nav-arrow:active { transform: scale(0.9); }
.hero-nav-arrow:focus-visible { outline: 2px solid var(--ws-accent); outline-offset: 2px; }
.hero-nav-arrow svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hero-nav-count {
  min-width: 44px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
}
.hero-nav-count b { color: var(--ws-accent); }

.hero-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
}
.hero-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--ws-accent), var(--ws-accent-hover));
}

/* ===== Product grid (list page) =====
 * - 카드 폭은 viewport 폭만으로 결정되어야 함 (페이지마다 데이터 개수가 달라도 동일 폭 유지).
 * - auto-fit 은 데이터 개수가 적은 페이지에서 빈 트랙을 0으로 collapse 시켜 셀이 커지는 부작용이 있으므로 auto-fill 사용.
 * - minmax 의 상한을 1fr 대신 고정값으로 두어 한 줄 마지막 행에서도 카드 폭이 일관되게 유지됨.
 * - 큰 모니터에서 트랙이 카드 max-width 합계를 넘어 남는 공간을 우측에 몰지 않고 가운데 정렬로 좌우 분산.
 */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 260px));
  justify-content: center;
  gap: 20px;
  /* 상단 16px 는 배너·툴바 모두 미노출 시 헤더와의 간격 확보용. 위 블록이 있으면 그 margin-bottom 과 상쇄되어 기존 간격 그대로 */
  margin-top: 16px;
  padding-bottom: 32px;
}

.product-card {
  display: flex;
  flex-direction: column;
  /* grid item의 자식(img 등)이 트랙 폭을 늘리지 못하도록 최소 콘텐츠 폭 해제. */
  min-width: 0;
  background: var(--ws-surface);
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  cursor: pointer;
}
.product-card:hover {
  transform: translateY(-4px);
  border-color: rgba(230, 57, 70, 0.55);
  box-shadow: var(--ws-shadow);
}

.product-card .thumb-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  background-color: var(--ws-surface-2);
  overflow: hidden;
}
.product-card .thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.product-card:hover .thumb {
  transform: scale(1.04);
}
.product-card .badge-stack {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  z-index: 1;
}
/* 배지 공통(리스트 카드 · 상세) */
.product-card .badge,
.detail-body .badge {
  min-width: 56px;
  padding: 4px 10px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  text-align: center;
  border-radius: 999px;
  box-sizing: border-box;
}

.product-card .body {
  padding: 16px 18px 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.product-card .name {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--ws-text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card .desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ws-text-sub);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
}

/* 추가 지급 아이템(코인) 칩: 리스트 카드와 상세 페이지 공용.
   상품명과 다른 레벨의 보조 정보이되 리워드 느낌의 골드 톤으로 강조한다.
   두 화면이 같은 클래스를 공유해야 유저가 리스트에서 본 요소를 상세에서도 같은 것으로 인지한다(스타일을 분기하지 말 것). */
.extra-item {
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(244, 163, 0, 0.12);
  border: 1px solid rgba(244, 163, 0, 0.35);
  font-size: 0.76rem;
  line-height: 1.3;
}
.extra-item .extra-item-value {
  font-weight: 700;
  color: var(--ws-gold);
  letter-spacing: 0.01em;
}
/* 카드는 폭이 좁아 항목별 칩을 세로로 쌓으므로, 칩 폭을 내용에 맞추고 위쪽 간격만 준다 */
.product-card .extra-item {
  margin: 2px 0 0;
  align-self: flex-start;
}

.product-card .footer {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 12px 18px 18px;
  border-top: 1px solid var(--ws-border);
  margin-top: 12px;
}
.product-card .price {
  min-height: 2.4rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ws-text);
}
.product-card .cta {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ws-accent);
}

.empty-state {
  /* .product-grid 와 동일한 이유의 상단 간격 확보 (마진 상쇄) */
  margin-top: 16px;
  padding: 80px 20px;
  text-align: center;
  color: var(--ws-text-muted);
  background: var(--ws-surface);
  border: 1px dashed var(--ws-border);
  border-radius: var(--ws-radius);
}

/* ===== Detail page ===== */
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 20px 0 16px;
  color: var(--ws-text-sub);
  text-decoration: none;
  font-size: 1rem;
}
.detail-back:hover {
  color: var(--ws-text);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 1.1fr;
  gap: 32px;
  background: var(--ws-surface);
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius);
  overflow: hidden;
}
@media (max-width: 760px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}
.detail-thumb-wrap {
  position: relative;
  background-color: var(--ws-surface-2);
  aspect-ratio: 1 / 1;
  /* Chromium 90(인게임 웹뷰)은 늘어난 행 높이로 너비를 역산해 오른쪽 컬럼을 덮으므로 두 축을 모두 고정 */
  align-self: start;
  width: 100%;
}
.detail-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.detail-body {
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
}
.detail-body h1 {
  margin: 0 0 12px;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
}
.detail-body .desc {
  margin: 0 0 20px;
  font-size: 0.95rem;
  color: var(--ws-text-sub);
  line-height: 1.6;
  white-space: pre-line;
}
.detail-body .price {
  margin: 12px 0 24px;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--ws-text);
}
.detail-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 18px;
  margin-bottom: 24px;
  font-size: 0.85rem;
  color: var(--ws-text-sub);
}
.detail-meta dt {
  color: var(--ws-text-muted);
  margin: 0;
}
.detail-meta-tz {
  margin-left: 6px;
  font-size: 0.78rem;
  color: var(--ws-text-muted);
  opacity: 0.8;
}
.detail-meta dd {
  margin: 0;
}
/* 추가 지급 아이템: 리스트 카드와 동일한 .extra-item 칩을 한 줄에 나열한다.
   카드처럼 세로로 쌓지 않고(상세는 값 컬럼 폭이 충분함) 폭이 부족할 때만 줄바꿈한다. */
.detail-meta .detail-extra-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
/* 판매 기간 내 지역 시간: 유저가 실제로 읽는 값이라 이 행만 강조한다. 판매 기간(UTC) 행은 기준값이라 기존 스타일 유지 */
.detail-meta .detail-meta-local {
  color: var(--ws-text);
  font-weight: 700;
}
.detail-meta dd.detail-meta-local {
  font-size: 0.88rem;
}
.detail-meta-local .detail-meta-tz {
  color: var(--ws-text-sub);
  opacity: 1;
}
@media (max-width: 760px) {
  .detail-meta {
    grid-template-columns: 1fr;
    row-gap: 2px;
  }
  .detail-meta dd + dt {
    margin-top: 10px;
  }
}

.detail-buy-btn {
  margin-top: auto;
  padding: 14px 20px;
  border: none;
  border-radius: 10px;
  background: var(--ws-accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s ease;
}
.detail-buy-btn:hover:not(:disabled) {
  background: var(--ws-accent-hover);
}
.detail-buy-btn:disabled {
  background: #3a3f4d;
  color: var(--ws-text-muted);
  cursor: not-allowed;
}

/* ===== Category tabs (list page) ===== */
.shop-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  /* 상단 20px 는 배너 미노출 시 헤더와의 간격 확보용. 배너가 있으면 .shop-hero 의 margin-bottom 20px 와 상쇄되어 기존 간격 그대로 */
  margin: 20px 0 16px;
  flex-wrap: wrap;
}
.shop-toolbar .shop-filter {
  margin-left: auto;
}
.shop-categories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.shop-category-tab {
  padding: 8px 18px;
  border: 1px solid var(--ws-border);
  border-radius: 999px;
  background: var(--ws-surface);
  color: var(--ws-text-sub);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.shop-category-tab:hover {
  color: var(--ws-text);
  border-color: var(--ws-accent);
}
.shop-category-tab.active {
  background: var(--ws-accent);
  border-color: var(--ws-accent);
  color: #fff;
}
.shop-filter-select {
  min-width: 140px;
  height: 36px;
  padding: 0 32px 0 14px;
  border: 1px solid var(--ws-border);
  border-radius: 999px;
  background: var(--ws-surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path fill='%23888' d='M1 1l5 5 5-5'/></svg>") no-repeat right 14px center / 10px 8px;
  color: var(--ws-text);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}
.shop-filter-select:hover {
  border-color: var(--ws-accent);
}
.shop-filter-select:focus {
  outline: none;
  border-color: var(--ws-accent);
}
/* 상품 카드의 카테고리 다국어명 라벨 (상품명 위 작은 보조 텍스트) */
.product-card .body .category {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ws-text-muted);
}

/* ===== Pagination (list page) ===== */
.shop-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 24px 0 40px;
  flex-wrap: wrap;
}
.shop-pagination a,
.shop-pagination span {
  min-width: 36px;
  padding: 8px 12px;
  border: 1px solid var(--ws-border);
  border-radius: 8px;
  background: var(--ws-surface);
  color: var(--ws-text-sub);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}
.shop-pagination a:hover {
  color: var(--ws-text);
  border-color: var(--ws-accent);
}
.shop-pagination .current {
  background: var(--ws-accent);
  border-color: var(--ws-accent);
  color: #fff;
}
.shop-pagination .disabled {
  color: var(--ws-text-muted);
  pointer-events: none;
  opacity: 0.5;
}

/* ===== Detail page: tabs / quantity / agreement ===== */
.detail-quantity {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 16px;
}
.detail-quantity .label {
  font-size: 0.85rem;
  color: var(--ws-text-sub);
  margin-right: 6px;
}
.detail-quantity .qty-range {
  font-size: 0.8rem;
  color: #ff5a67;
}
.qty-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--ws-border);
  border-radius: 8px;
  background: var(--ws-surface-2);
  color: var(--ws-text);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
.qty-btn:hover:not(:disabled) {
  border-color: var(--ws-accent);
}
.qty-btn:disabled {
  color: var(--ws-text-muted);
  cursor: not-allowed;
}
.qty-input {
  width: 64px;
  height: 34px;
  border: 1px solid var(--ws-border);
  border-radius: 8px;
  background: var(--ws-surface-2);
  color: var(--ws-text);
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
}

.detail-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 16px;
  margin: 8px 0 14px;
  background: var(--ws-surface-2);
  border: 1px solid var(--ws-border);
  border-radius: 10px;
}
.detail-total .label {
  font-size: 0.85rem;
  color: var(--ws-text-sub);
}
.detail-total .amount {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ws-accent);
}

.detail-agree {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--ws-surface-2);
  border: 1px solid var(--ws-border);
  border-radius: 10px;
  margin-bottom: 14px;
  cursor: pointer;
}
.detail-agree input[type="checkbox"] {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  accent-color: var(--ws-accent);
  cursor: pointer;
}
.detail-agree .text {
  font-size: 0.86rem;
  color: var(--ws-text-sub);
  line-height: 1.5;
}

/* ===== 상품 상세 텍스트 (web_shop_product_text 의 운영자 입력 HTML) =====
 * 탭 없이 한 화면에 이어서 노출한다. 태그를 제약하지 않으므로 실제 입력에 쓰이는 h3/p/ul/li/strong 에 기본 스타일을 둔다.
 * 상단 상품 영역(.detail-grid)과 같은 카드 표면을 써서 본문 블록임을 드러낸다. 구분선 대신 카드 경계와 제목 앞 accent 바로 계층을 만든다
 * (구분선을 쓰면 섹션 시작선과 제목 밑줄이 같은 색·굵기로 겹쳐 보인다).
 * 개행은 입력 HTML 의 태그가 담당하므로 white-space 는 지정하지 않는다.
 */
.detail-desc {
  /* 하단 margin 은 footer 와 붙지 않도록 띄우는 값 */
  margin: 24px 0 44px;
  padding: 30px 32px;
  background: var(--ws-surface);
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius);
  color: var(--ws-text-sub);
  font-size: 0.95rem;
  line-height: 1.75;
}
/* 섹션 제목. 상품명(h1 1.5rem)보다 작고 본문(0.95rem)보다는 확실히 크게 두어 계층을 만든다 */
.detail-desc h3 {
  position: relative;
  margin: 36px 0 16px;
  padding-left: 15px;
  color: var(--ws-text);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
/* 제목 앞 accent 세로 바. 밑줄 대신 이걸로 섹션 시작을 표시한다 */
.detail-desc h3::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.2em;
  width: 4px;
  height: 1em;
  background: var(--ws-accent);
  border-radius: 2px;
}
.detail-desc h3:first-child {
  margin-top: 0;
}
.detail-desc p {
  margin: 0 0 14px;
}
.detail-desc ul,
.detail-desc ol {
  margin: 0 0 14px;
  padding-left: 18px;
}
.detail-desc li {
  margin-bottom: 10px;
}
.detail-desc li::marker {
  color: var(--ws-text-muted);
}
.detail-desc strong {
  color: var(--ws-text);
  font-weight: 600;
}
.detail-desc a {
  color: var(--ws-accent);
}
.detail-desc img {
  max-width: 100%;
  height: auto;
  border-radius: var(--ws-radius);
}
.detail-desc > *:last-child {
  margin-bottom: 0;
}
@media (max-width: 760px) {
  .detail-desc {
    margin-bottom: 32px;
    padding: 24px 18px;
  }
  .detail-desc h3 {
    margin-top: 30px;
    font-size: 1.12rem;
  }
}

/* ===== Purchase loading overlay (결제 진행 중 풀스크린 차단) ===== */
.purchase-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(8, 10, 14, 0.78);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  color: var(--ws-text);
  text-align: center;
  padding: 32px;
}
.purchase-loading-overlay.is-open {
  display: flex;
}
.purchase-loading-overlay .spinner {
  width: 56px;
  height: 56px;
  border: 4px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--ws-accent);
  border-radius: 50%;
  animation: webshop-spin 0.9s linear infinite;
}
.purchase-loading-overlay .title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 6px 0 0;
}
.purchase-loading-overlay .desc {
  max-width: 480px;
  font-size: 0.9rem;
  color: var(--ws-text-sub);
  line-height: 1.5;
}
@keyframes webshop-spin {
  to { transform: rotate(360deg); }
}

/* ===== Purchase modal 폼 추가 영역 ===== */
.purchase-modal-note {
  font-size: 0.82rem;
  color: var(--ws-text-muted);
  margin-bottom: 12px;
}
.purchase-modal-error {
  display: none;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(230, 57, 70, 0.15);
  border: 1px solid rgba(230, 57, 70, 0.45);
  color: #ffb3b9;
  font-size: 0.86rem;
}
.purchase-modal-error.is-open {
  display: block;
}
/* 추천 크리에이터 고지 카드(유효한 ?ref 일 때만 렌더) */
.purchase-referral-notice {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid rgba(230, 57, 70, 0.5);
  border-radius: 12px;
  background: rgba(230, 57, 70, 0.06);
}
.purchase-referral-text {
  margin: 0;
  font-size: 0.9rem;
}
/* 메시지의 <strong> 이 활동명. 최대 100자라 문장 안에서 2줄로 제한하고, 띄어쓰기 없는 이름도 영역 안에서 줄바꿈 */
.purchase-referral-text strong {
  display: -webkit-inline-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  max-width: 100%;
  vertical-align: top;
}
/* 서버 선택 전 disabled 상태인 캐릭터 select 이 다크 모달에서 밝게 튀지 않도록 활성 select 와 동일 배경 유지 */
#purchaseModal .form-select:disabled {
  background-color: var(--bs-body-bg);
}

/* ===== 뱃지 (할인 라벨 + 전시영역 배지). 전시영역 배지 색은 DB 값을 인라인 style 로 받고, .badge-shop 배경은 인라인 style 이 막힐 때의 기본값 ===== */
.product-card .badge-discount,
.detail-body .badge-discount {
  background: var(--ws-gold);
  color: #1a1a1a;
}
.product-card .badge-shop,
.detail-body .badge-shop {
  background: #6f5de8;
}
.product-card .price .original-price {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ws-text-muted);
  text-decoration: line-through;
  line-height: 1.2;
}
.product-card .price .discount-price {
  display: block;
  color: #ff5a67;
}

.detail-body .badge-group {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.detail-body .badge-group .badge {
  margin-bottom: 0;
  align-self: initial;
}
.detail-body .price .original-price {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 1rem;
  font-weight: 500;
  color: var(--ws-text-muted);
  text-decoration: line-through;
  margin-bottom: 4px;
}
.detail-body .price .discount-price {
  display: flex;
  gap: 8px;
  align-items: baseline;
  color: #ff5a67;
}

