/* 고객용 공개 페이지 — 모바일 우선 (detailSheet 뷰모드 토큰과 동기화) */
:root {
  --pp-bg: #f5f6f8;
  --pp-card: #fff;
  --pp-text: #1a1a1a;
  --pp-muted: #777;
  --pp-accent: #2563eb;
  --pp-accent-bg: #eff6ff;
  --pp-border: #e5e7eb;
  --pp-radius: 12px;
  --pp-radius-sm: 10px;
  --pp-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --pp-label-w: 100px;
}

/* 삼성 인터넷·크롬 등: 시스템 다크모드여도 이 페이지는 라이트 테마로 렌더 */
html {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body.pp-body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
  background: var(--pp-bg);
  color: var(--pp-text);
  line-height: 1.45;
  padding-bottom: 88px;
  color-scheme: light;
}

/* 중개사 앱 미리보기 iframe: 전화/문자는 미리보기에서 숨김 (편집은 모달에서만) */
body.pp-body.pp-body--embed {
  padding-bottom: 24px;
  background: #f5f6f8;
}
body.pp-body--embed .pp-fab {
  display: none !important;
}
body.pp-body--embed .pp-detailHeader {
  display: none !important;
}

.pp-header {
  padding: 16px;
  background: var(--pp-card);
  border-bottom: 1px solid var(--pp-border);
}

.pp-detailHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 4px 14px;
  margin: 8px 12px 0;
  position: relative;
}

.pp-detailHeader__title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 700;
  font-size: 17px;
  color: #111827;
  pointer-events: none;
}

.pp-detailHeader__back,
.pp-detailHeader__close {
  border: 0;
  background: transparent;
  font-size: 22px;
  color: #6b7280;
  cursor: pointer;
  padding: 8px 12px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.pp-detailHeader__back:hover,
.pp-detailHeader__close:hover {
  color: #111827;
}

.pp-title {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 700;
}

.pp-intro {
  margin: 0;
  font-size: 14px;
  color: var(--pp-muted);
}

.pp-hero {
  width: 100%;
  aspect-ratio: 8 / 3;
  object-fit: cover;
  background: #e5e7eb;
  display: block;
}

.pp-priceBar {
  margin: 8px 12px 0;
  padding: 14px 16px;
  background: var(--pp-card);
  border-radius: var(--pp-radius);
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow: var(--pp-shadow);
}

.pp-priceMain {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--pp-accent);
  text-align: center;
}

.pp-priceSub {
  margin-top: 6px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
  color: #1d4ed8;
}

.pp-priceSub--muted {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}

.pp-badgeRow {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 10px;
}

.pp-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  background: var(--pp-accent-bg);
  color: var(--pp-accent);
  margin-bottom: 0;
}

.pp-section {
  margin: 8px 12px;
  padding: 14px 16px;
  background: var(--pp-card);
  border-radius: var(--pp-radius);
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow: var(--pp-shadow);
}

.pp-section h2 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--pp-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.3;
}

/* 미리보기 embed: 카드 우측 상단 체크 + 조건 행 숨김 */
.pp-secCard {
  position: relative;
}

body.pp-body--secEdit .pp-secCard:not(.pp-section--cond) {
  padding-right: 44px;
}

body.pp-body--secEdit .pp-priceBar.pp-secCard {
  padding-right: 44px;
}

.pp-secHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--pp-border);
}

.pp-secHead h2 {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.pp-secToggle {
  display: none;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #64748b;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.pp-secToggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--pp-accent);
  cursor: pointer;
}

.pp-secToggle--icon {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 28px;
  height: 28px;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: var(--pp-shadow);
}

.pp-priceBar.pp-secCard > .pp-secToggle--icon {
  top: 10px;
  right: 10px;
}

/* 숨김 토글: 우측 고정 열 (값 열 정렬 유지) */
.pp-secToggle--hide {
  position: static;
  width: 100%;
  padding: 7px 0 0;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  opacity: 0.85;
}

.pp-secToggle--hide .pp-secToggle__hideTxt {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: #94a3b8;
}

.pp-secToggle--hide input {
  width: 15px;
  height: 15px;
}

/* 조건 블록: [행들 1fr] [숨김 44px] — 값 열이 전 행 동일 폭 */
.pp-secEditRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  column-gap: 6px;
  align-items: start;
}

.pp-secEditRow__main {
  min-width: 0;
}

.pp-secEditRow__main .pp-row:last-child {
  border-bottom: none;
}

.pp-secEditRow + .pp-secEditRow {
  margin-top: 0;
}

body.pp-body--secEdit .pp-secToggle {
  display: inline-flex;
}

body:not(.pp-body--secEdit) .pp-secToggle {
  display: none !important;
}

/* 카드 접기 (헤더·토글만 남김, 상단 다시보기 목록으로 보내지 않음) */
body.pp-body--secEdit .pp-secCard.pp-sec--off {
  background: #f1f5f9;
  border-color: #e2e8f0;
  box-shadow: none;
}
body.pp-body--secEdit .pp-secCard.pp-sec--off > *:not(.pp-secHead):not(.pp-secToggle) {
  display: none !important;
}
body.pp-body--secEdit .pp-secCard.pp-sec--off > .pp-secHead {
  margin: 0;
  opacity: 0.72;
}
body.pp-body--secEdit .pp-secCard.pp-sec--off:not(:has(> .pp-secHead)) {
  min-height: 44px;
  padding: 12px 44px 12px 14px;
}
body.pp-body--secEdit .pp-secCard.pp-sec--off:not(:has(> .pp-secHead))::before {
  content: "접힘";
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
}
body.pp-body--secEdit .pp-secCard.pp-sec--off[data-sec-label]:not(:has(> .pp-secHead))::before {
  content: attr(data-sec-label) " · 접힘";
}
body.pp-body--secEdit .pp-priceBar.pp-secCard.pp-sec--off {
  margin: 8px 12px;
}

/* 조건 행 숨김 → 회색으로 자리 유지 */
body.pp-body--secEdit .pp-secEditRow.pp-sec--off {
  opacity: 0.42;
  filter: grayscale(0.4);
}
body.pp-body--secEdit .pp-secEditRow.pp-sec--off .pp-secEditRow__main {
  pointer-events: none;
}
body.pp-body--secEdit .pp-secEditRow.pp-sec--off .pp-secToggle--hide {
  opacity: 1;
  filter: none;
  color: #94a3b8;
}

body.pp-body--secEdit .pp-section--cond .pp-secHead {
  position: relative;
  padding-right: 36px;
}

body.pp-body--secEdit .pp-section--cond .pp-secHead .pp-secToggle--icon {
  position: absolute;
  top: 0;
  right: 0;
}

body.pp-print-mode .pp-secToggle {
  display: none !important;
}

body.pp-body--secEdit .pp-editVal {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-bottom: 1.5px solid transparent;
  background: transparent;
  padding: 0 1px 1px;
  margin: 0;
  min-width: 3ch;
  max-width: 100%;
  width: 100%;
  text-align: right;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--pp-text);
  line-height: 1.45;
}

body.pp-body--secEdit .pp-editVal--lg {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

body.pp-body--secEdit .pp-editVal:hover {
  border-bottom-color: #cbd5e1;
}

body.pp-body--secEdit .pp-editVal:focus {
  outline: none;
  border-bottom-color: var(--pp-accent);
}

body.pp-body--secEdit .pp-editVal::placeholder {
  color: #cbd5e1;
  font-weight: 500;
}

body.pp-body--secEdit .pp-priceMain--edit {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 6px;
}

body.pp-body--secEdit .pp-row--edit .pp-row__edit {
  min-width: 0;
  width: 100%;
  text-align: right;
  display: flex;
  justify-content: flex-end;
}

body.pp-body--secEdit .pp-editHint {
  margin: 0 0 10px;
  padding: 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.4;
  color: #64748b;
}

body.pp-body--secEdit .pp-exactToggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.4;
  color: var(--pp-text);
  cursor: pointer;
}

body.pp-body--secEdit .pp-exactToggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--pp-accent);
  flex-shrink: 0;
}

body.pp-body--secEdit .pp-galleryBtn.is-hero {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  border-radius: 8px;
}

body.pp-body--secEdit .pp-galleryBtn.is-hero::after {
  content: "대표";
  position: absolute;
  right: 4px;
  top: 4px;
  z-index: 1;
  padding: 2px 6px;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

body.pp-body--secEdit .pp-galleryBtn {
  position: relative;
}

/* 라벨 100px 고정 그리드 — detailSheet__viewRow 와 동일 */
.pp-row {
  display: grid;
  grid-template-columns: var(--pp-label-w) minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0;
  align-items: center;
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  border-bottom: 1px solid #f0f1f3;
}

.pp-row:last-child {
  border-bottom: none;
}

.pp-row > span:first-child {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.45;
  color: var(--pp-muted);
  min-width: 0;
}

.pp-row > span:last-child,
.pp-row > .pp-row__edit {
  font-weight: 500;
  color: var(--pp-text);
  text-align: right;
  min-width: 0;
  word-break: break-word;
}

.pp-map {
  width: 100%;
  height: 180px;
  border-radius: 10px;
  overflow: hidden;
  background: #ddd;
}

.pp-mapWrap {
  position: relative;
}

.pp-mapLockBtn {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 2;
  border: 1px solid #d1d5db;
  background: rgba(255, 255, 255, 0.95);
  color: #1f2937;
  border-radius: 999px;
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

/* 고객용 공유 매물: 위치(미니지도) 카드 하단 안내 */
.pp-locationDisclaimer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #f3f4f6;
  font-size: 11px;
  line-height: 1.55;
  color: var(--pp-muted);
}

.pp-locationDisclaimer p {
  margin: 0;
}

.pp-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.pp-gallery img,
.pp-gallery video {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #eee;
}

.pp-error {
  padding: 48px 20px;
  text-align: center;
  font-size: 16px;
  color: var(--pp-muted);
}

/* 비공개(링크 비활성) 안내 — 본문 + 일반 공유 페이지와 동일 FAB */
.pp-privateExpiredWrap {
  min-height: 40vh;
}

.pp-privateExpired {
  margin-top: 12px;
}

.pp-privateExpired__title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 800;
  color: var(--pp-text);
  text-align: center;
  line-height: 1.4;
}

.pp-privateExpired__body {
  margin: 0;
  font-size: 15px;
  color: var(--pp-muted);
  text-align: center;
  line-height: 1.55;
}

/* 미리보기(embed)에서도 만료 안내 시 문의 버튼 노출 */
body.pp-body--embed .pp-privateExpiredWrap .pp-fab {
  display: flex !important;
}

.pp-fab {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
  z-index: 50;
}

.pp-fab a {
  flex: 1;
  text-align: center;
  padding: 14px;
  border-radius: 12px;
  font-weight: 700;
  text-decoration: none;
  font-size: 15px;
}

.pp-fab .pp-call {
  background: var(--pp-accent);
  color: #fff;
}

.pp-fab .pp-sms {
  background: #fff;
  color: var(--pp-accent);
  border: 2px solid var(--pp-accent);
}

.pp-listCard {
  margin: 12px;
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
  background: var(--pp-card);
  border: 1px solid var(--pp-border);
  position: relative;
}

.pp-listCard__indexBadge {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 2;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(55, 65, 81, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 24px;
  text-align: center;
}

.pp-listCard img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #e5e7eb;
}

.pp-listCard__body {
  padding: 12px 14px 14px;
}

.pp-listCard__price {
  font-size: 18px;
  font-weight: 800;
  color: var(--pp-accent);
  text-align: center;
}

.pp-listCard__meta {
  font-size: 13px;
  color: var(--pp-muted);
  margin-top: 4px;
}

.pp-listCard__mapBlock {
  margin-top: 10px;
}

.pp-listCard__map {
  height: 160px;
}

.pp-listCard__mapAddr {
  margin-top: 8px;
  font-size: 12px;
  color: var(--pp-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pp-listCard__btn {
  display: block;
  margin-top: 10px;
  padding: 10px;
  text-align: center;
  border-radius: 8px;
  background: #f3f4f6;
  color: var(--pp-accent);
  font-weight: 600;
  text-decoration: none;
  font-size: 14px;
}

.pp-listCard__condCompact .pp-row {
  grid-template-columns: 72px minmax(0, 1fr);
  font-size: 12px;
  gap: 8px;
  padding: 5px 0;
}

.pp-listCard__condCompact .pp-row span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pp-listCard__condCompact .pp-row > span:first-child {
  font-size: 11px;
}

.pp-listCard__condCompact .pp-row > span:last-child {
  text-align: right;
}

.pp-muted {
  color: var(--pp-muted);
}

/* 360° 가상투어 (고객 페이지 전용 섹션 — virtual_tours 연동) */
.pp-section--virtualTour {
  padding: 0;
  overflow: hidden;
}

.pp-virtualTourBody {
  padding: 14px 16px 16px;
}

.pp-section--virtualTour h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
}

.pp-virtualTourCard {
  position: relative;
  margin: 0;
  width: 100%;
  border-radius: 0;
  overflow: hidden;
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  aspect-ratio: 16 / 9;
  max-height: 220px;
  cursor: pointer;
}

.pp-virtualTourCard--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
}

.pp-virtualTourThumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.95;
}

.pp-virtualTourBadge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.2);
  pointer-events: none;
}

.pp-virtualTourBtn {
  display: block;
  width: 100%;
  margin: 0;
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.pp-virtualTourBtn:active {
  opacity: 0.92;
}

.pp-watermark {
  margin: 18px 12px 96px;
  text-align: center;
  font-size: 12px;
  color: #9ca3af;
}

/* 일부 브라우저가 prefers-color-scheme: dark 로 배경·카드를 덮어쓰는 경우 대비 */
@media (prefers-color-scheme: dark) {
  :root {
    --pp-bg: #f5f6f8;
    --pp-card: #ffffff;
    --pp-text: #111111;
    --pp-muted: #6b7280;
    --pp-accent: #2563eb;
    --pp-border: #e5e7eb;
  }

  body.pp-body {
    background-color: #f5f6f8;
    color: #111827;
  }

  .pp-header,
  .pp-priceBar,
  .pp-section:not(.pp-section--virtualTour),
  .pp-listCard {
    background-color: #ffffff;
    color: #111827;
    border-color: #e5e7eb;
  }

  .pp-section h2,
  .pp-title {
    color: #111827;
  }

  .pp-row {
    border-bottom-color: #f3f4f6;
  }

  .pp-priceSub {
    color: #1d4ed8;
  }

  .pp-priceSub--muted {
    color: #374151;
  }

  .pp-badge {
    background: #eff6ff;
    color: #1d4ed8;
  }

  .pp-fab .pp-sms {
    background: #ffffff;
    color: #2563eb;
    border-color: #2563eb;
  }
}
