/* ============================================================
   listings.css — 메인(전체 매물) 전용
   ============================================================ */
.page-heading {
  font-size: 21px;
  font-weight: 900;
  color: var(--navy);
  margin: 6px 0 2px;
}

.search-bar {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.search-bar input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  font-size: 14px;
  background: #fff;
}

.search-bar button {
  width: 48px;
  border-radius: 12px;
  border: none;
  background: var(--navy);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

/* 카테고리 아이콘 (세부 종류 필터) */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 6px 0 12px;
}

.category-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 4px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text);
}

.category-item.on {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
  font-weight: 700;
}

.category-icon {
  display: block;
  width: 22px;
  height: 22px;
  margin: 0 auto 3px;
  opacity: 0.75;
}

/* 전체(세부 종류 해제) 타일 — 4열 그리드의 마지막 줄을 전체 폭으로 채우는 가로형 바 */
.category-item-all {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 4px;
}

.category-item-all .category-icon {
  margin: 0;
}

/* 선택 상태(네이비 배경)에선 검정 SVG를 흰색으로 반전 */
.category-item.on .category-icon {
  filter: brightness(0) invert(1);
  opacity: 1;
}

.sort-row {
  margin-bottom: 4px;
}

.empty-message {
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 22px 16px;
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
}


/* 모바일: 전체 매물 = 1열 대형 카드 (Zillow·Airbnb식) — 부동산에서 사진이 곧 결정 신호이고
   매물 수십 건+페이지네이션 규모라 밀도를 희생할 이유가 없다 (7-30 사용자 확정).
   랜딩 대표매물·큐레이션 슬라이더는 2열 폭 유지 = 다음 카드가 보여야 스와이프 힌트가 된다 */
@media (max-width: 767px) {
  .card-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* PC 계층(1024 컨테이너): 목록·거래완료 그리드 3열 — 카드 설명이 잘리지 않는 최대 열 수 */
@media (min-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- 필터 패널·페이지 헤드 (전 계층 공통 뼈대) ---------- */
/* ---------- 필터: 모바일·태블릿 = 필터 바 + 바텀시트 / PC = 펼친 칩 패널 ----------
   칩이 30개를 넘으면서 작은 화면에선 필터가 첫 화면을 다 먹었다 — 매물(상품)이 주연이 되도록
   칩 행을 시트로 접고, 선택값은 필터 바 버튼 라벨로 올린다(접혀도 상태가 항상 보이는 것이 성패). */
.filter-bar {
  display: flex;
  gap: 8px;
  padding: 10px 0 2px;
  overflow-x: auto;          /* 버튼 4개뿐이라 가로 스크롤 허용 (칩 30개와는 다른 상황) */
  scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-bar button {
  flex-shrink: 0;
  padding: 9px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}

.filter-bar button.on {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

/* 모바일·태블릿: 칩 행은 평소 숨김 — 시트로만 등장 */
.filter-panel .chip-row {
  display: none;
  flex-wrap: wrap;
  overflow-x: visible;
}

.filter-panel .chip-row.sheet-open {
  display: flex;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 14px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 70vh;
  overflow-y: auto;
  gap: 9px;
  box-shadow: 0 -10px 32px rgba(15, 23, 42, 0.22);
}

/* 시트 손잡이 — flex-basis 100%로 첫 줄 독점, 가운데 44px 바만 그린다 */
.chip-row.sheet-open::before {
  content: '';
  flex-basis: 100%;
  height: 4px;
  background: linear-gradient(#dfe4ea, #dfe4ea) center / 44px 4px no-repeat;
  margin-bottom: 6px;
}

/* 행 라벨이 시트 제목이 된다 */
.chip-row.sheet-open .chip-label {
  flex-basis: 100%;
  min-width: 0;
  font-size: 15.5px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

/* 시트 안 칩은 터치 타깃 확대 */
.chip-row.sheet-open .chip {
  font-size: 14.5px;
  padding: 10px 16px;
}

.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(15, 23, 42, 0.45);
}

body.sheet-lock {
  overflow: hidden;
}

@media (min-width: 1024px) {
  .filter-bar,
  .sheet-overlay {
    display: none;   /* PC: 전 항목이 한눈에 보이는 펼친 패널이 미덕 */
  }

  .filter-panel .chip-row {
    display: flex;
  }
}

.chip-label {
  flex-shrink: 0;
  align-self: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  min-width: 52px;
}

/* ============================================================
   PC 계층(≥1024): 프로토타입 레이아웃 — 제목+검색 한 행 · 필터 패널 카드 ·
   카테고리 9칸 한 줄 · 큐레이션 슬라이더 → 그리드
   ============================================================ */
@media (min-width: 1024px) {
  .page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
  }

  .page-head .page-heading {
    margin: 0;
    font-size: 26px;
  }

  .page-head .search-bar {
    flex: 1;
    max-width: 520px;
    margin: 0;
  }

  .filter-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px 18px 14px;
    margin: 16px 0 26px;
    box-shadow: 0 2px 10px rgba(27, 58, 92, 0.04);
  }

  /* 카테고리 8종 + 전체 = 9칸 한 줄 (전체 타일은 다른 타일과 같은 세로형으로) */
  .category-grid {
    grid-template-columns: repeat(9, 1fr);
    margin: 0 0 4px;
  }

  .category-item-all {
    grid-column: auto;
    order: -1;   /* 전체가 맨 앞 */
    flex-direction: column;
    gap: 3px;
    padding: 9px 4px;
  }

  .filter-panel .chip-row {
    border-top: 1px solid #f0f3f7;
    padding: 8px 0;
  }

  /* 큐레이션 슬라이더의 PC 그리드 전환은 components.css(공통) 한 곳에서 담당 */
}

/* ---------- 페이지네이션 (한 페이지뿐이면 서버가 아예 안 그림) ---------- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 18px 0 6px;
}

.page-link {
  min-width: 40px;
  padding: 9px 0;
  text-align: center;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.page-link.on {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

/* ---------- 전체 매물 헤드: 제목 + 페이지 크기 선택 ---------- */
.grid-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  scroll-margin-top: 64px;   /* #section-all 앵커 도착 시 sticky 헤더(모바일 52px)에 가리지 않게 */
}

@media (min-width: 1024px) {
  .grid-head {
    scroll-margin-top: 80px;   /* PC 헤더 64px */
  }
}

/* 페이지 크기 select — 기본 셀렉트 화살표를 지우고 필(pill) + 커스텀 셰브론으로 (칩과 같은 결) */
.page-size-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 32px 8px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%231b3a5c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 13px center;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.page-size-select:hover {
  border-color: var(--navy);
}

.page-size-select:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(27, 58, 92, 0.12);
}

/* ---------- 섹션 간 여백 — NOL식: 큐레이션·전체 매물이 한 덩어리로 붙지 않게 ---------- */
.column > section {
  margin-top: 44px;
}

.grid-head {
  margin-top: 44px;
}

@media (min-width: 1024px) {
  .column > section,
  .grid-head {
    margin-top: 60px;
  }
}
