/* ============================================================
   매물 목록 + 회원 페이지 (home.css, sub.css 다음에 로드)
   ============================================================ */

/* ---------- 필터 바 ---------- */
.lst-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 16px 0 0;
}
.lst-seg { display: flex; background: var(--bg); border-radius: 11px; padding: 3px; }
.lst-seg button {
  font-size: 14px; font-weight: 700; color: var(--sub);
  padding: 8px 14px; border-radius: 9px; min-height: 38px;
}
.lst-seg button.is-on { background: #fff; color: var(--blue); box-shadow: var(--shadow); }
.lst-sel {
  font: inherit; font-size: 14px; font-weight: 600; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; min-height: 40px;
}
.lst-q { position: relative; flex: 1; min-width: 170px; max-width: 320px; }
.lst-q input {
  width: 100%; font: inherit; font-size: 14px; min-height: 40px;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 8px 34px; background: #fff;
}
.lst-q input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(14,147,220,.14); }
.lst-q svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--mut); }
.lst-sp { flex: 1; }
.lst-view { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.lst-view button {
  display: grid; place-items: center; width: 42px; min-height: 40px; color: var(--mut); background: #fff;
}
.lst-view button + button { border-left: 1px solid var(--line); }
.lst-view button.is-on { color: var(--blue); background: var(--blue-soft); }
.lst-map {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
  font-size: 14px; font-weight: 700; color: var(--blue);
  border: 1.5px solid var(--blue); border-radius: 10px; padding: 0 13px; background: #fff;
}
.lst-map:hover { background: var(--blue-soft); }
/* 관심만 보기 토글 */
.lst-fav {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
  padding: 0 13px; border-radius: 10px; font-size: 14px; font-weight: 700;
  color: var(--sub); background: #fff; border: 1px solid var(--line);
  transition: color .15s, border-color .15s, background .15s;
}
.lst-fav svg path { fill: none; stroke: currentColor; stroke-width: 1.9; }
.lst-fav b { font-variant-numeric: tabular-nums; }
.lst-fav:hover { color: #E52D4E; border-color: #FFC2CD; }
.lst-fav.is-on { color: #E52D4E; border-color: #FF3B5C; background: #FFF0F3; }
.lst-fav.is-on svg path { fill: #FF3B5C; stroke: #FF3B5C; }
.lst-count {
  margin-top: 18px; font-size: 14px; color: var(--sub);
  display: flex; align-items: center; gap: 10px;
}
.lst-cnt { margin-right: auto; white-space: nowrap; }
.lst-count b { color: var(--blue); font-size: 15px; }

/* ---------- 격자형 ---------- */
.lst { margin-top: 14px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.lcard {
  position: relative; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  transition: transform .2s, box-shadow .2s, border-color .2s; cursor: pointer;
}
.lcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--sky); }
.lcard-img { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg); }
.lcard-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lcard-body { padding: 13px 14px 15px; }
.lcard-price { font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 7px; }
.lcard-price .deal { font-size: 11.5px; font-weight: 700; color: #fff; background: var(--blue); border-radius: 5px; padding: 2.5px 6px; }
.lcard-price .deal-전세 { background: var(--jeonse); }
.lcard-price .deal-매매 { background: var(--sale); }
.lcard-title {
  margin-top: 6px; font-size: 13.5px; color: var(--ink); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.lcard-meta { margin-top: 5px; font-size: 12.5px; color: var(--mut); }
.lcard-meta b { color: var(--sub); font-weight: 600; }
.lcard-bdgs { margin-top: 9px; display: flex; gap: 5px; flex-wrap: wrap; }

/* 하트 */
.fav-b {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.92); color: #B9C0D0;
  box-shadow: var(--shadow); transition: color .15s, transform .15s;
}
.fav-b:hover { transform: scale(1.1); color: #FF5A76; }
.fav-b.is-on { color: #FF3B5C; }
.fav-b.is-on svg path { fill: currentColor; }
.fav-b:not(.is-on) svg path { fill: none; }

/* ---------- 리스트형 ---------- */
.lst.is-rows { grid-template-columns: 1fr; gap: 12px; }
.lst.is-rows .lcard { display: flex; align-items: stretch; }
.lst.is-rows .lcard-img { flex: 0 0 210px; aspect-ratio: auto; min-height: 140px; }
.lst.is-rows .lcard-body { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 14px 18px; }
.lst.is-rows .lcard-title { -webkit-line-clamp: 2; font-size: 14.5px; }
.lst.is-rows .fav-b { top: 50%; transform: translateY(-50%); right: 18px; }
.lst.is-rows .fav-b:hover { transform: translateY(-50%) scale(1.1); }

/* ---------- 페이지 번호 ---------- */
.pager {
  margin: 34px 0 0; display: flex; align-items: center; justify-content: center;
  gap: 6px; flex-wrap: wrap;
}
.pager button {
  min-width: 40px; height: 40px; padding: 0 12px; border-radius: 10px;
  font-size: 14.5px; font-weight: 700; color: var(--sub);
  background: #fff; border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .15s, border-color .15s, background .15s;
}
.pager button:hover:not(:disabled) { color: var(--blue); border-color: var(--sky); background: var(--blue-soft); }
.pager button[aria-current="page"] {
  background: var(--blue); border-color: var(--blue); color: #fff;
}
.pager button:disabled { opacity: .38; cursor: default; }
.pager .p-arrow { color: var(--sub); }
.pager .p-gap { min-width: 22px; color: var(--mut); font-weight: 600; user-select: none; }
.pager-info { margin-top: 12px; text-align: center; font-size: 13px; color: var(--mut); }

/* ---------- 빈 결과 ---------- */
.lst-empty {
  margin-top: 26px; background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 40px 24px; text-align: center;
}
.lst-empty b { font-size: 17px; }
.lst-empty p { margin-top: 8px; font-size: 14px; color: var(--sub); line-height: 1.7; }
.lst-alt { margin-top: 22px; text-align: left; }
.lst-alt h4 { font-size: 15px; margin-bottom: 12px; }

/* ---------- 회원 페이지 ---------- */
.mwrap { max-width: 430px; margin: 0 auto; }
.mwrap .form { box-shadow: var(--shadow); }
.m-links { margin-top: 16px; display: flex; justify-content: center; gap: 18px; font-size: 13.5px; }
.m-links a { color: var(--sub); }
.m-links a:hover { color: var(--blue); text-decoration: underline; }
.m-note {
  margin-top: 14px; background: var(--blue-soft); border-radius: 12px;
  padding: 12px 15px; font-size: 13px; color: var(--blue-deep); line-height: 1.7;
}

/* 헤더 회원 링크 스타일은 home.css 한 곳에서만 정의한다 */

/* 가입 유도 모달 */
.dim { position: fixed; inset: 0; z-index: 90; background: rgba(14, 18, 33, .5); }
.mb-modal {
  position: fixed; z-index: 91; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(92vw, 380px); background: #fff; border-radius: 18px; padding: 28px 24px 20px;
  box-shadow: var(--shadow-lg); text-align: center;
}
.mb-modal .x { position: absolute; top: 10px; right: 14px; font-size: 22px; color: var(--mut); padding: 6px; }
.mb-modal h3 { font-size: 19px; font-weight: 800; }
.mb-modal p { margin-top: 10px; font-size: 14px; color: var(--sub); line-height: 1.75; }
.mb-btns { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.btn-main {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px;
  background: var(--blue); color: #fff; font-size: 15px; font-weight: 800; border-radius: 12px; padding: 0 18px;
}
.btn-main:hover { background: var(--blue-deep); }
.btn-ghost2 {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px;
  border: 1.5px solid var(--line); color: var(--ink); font-size: 14.5px; font-weight: 700; border-radius: 12px;
}
.btn-ghost2:hover { border-color: var(--blue); color: var(--blue); }
.mb-later { margin-top: 12px; font-size: 13px; color: var(--mut); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 마이페이지 ---------- */
.my-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.my-head p { font-size: 14.5px; color: var(--sub); }
.my-head b { color: var(--ink); }
.btn-out { font-size: 13.5px; color: var(--mut); text-decoration: underline; text-underline-offset: 3px; }
.btn-out:hover { color: var(--ink); }
.my-tabs { margin-top: 20px; display: flex; gap: 6px; border-bottom: 1px solid var(--line); }
.my-tabs button {
  font-size: 15px; font-weight: 700; color: var(--sub);
  padding: 11px 15px; border-bottom: 2.5px solid transparent; margin-bottom: -1px;
}
.my-tabs button.is-on { color: var(--blue); border-color: var(--blue); }
.my-pane { margin-top: 22px; }
.fav-done { opacity: .55; }
.fav-done .lcard-img::after {
  content: "거래완료"; position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(20,24,43,.45); color: #fff; font-size: 15px; font-weight: 800; letter-spacing: .04em;
}
.fav-saved { margin-top: 5px; font-size: 12px; color: var(--mut); }

/* ---------- 반응형 ---------- */
@media (max-width: 1023px) {
  .lst { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 767px) {
  .lst { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* ── 필터바: 격자로 자리를 못박아 3줄로 고정한다 ──
     1줄 거래유형 / 2줄 가격·유형·지역 / 3줄 검색 + 관심 */
  .lst-bar {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 8px; padding-top: 14px;
  }
  .lst-seg    { grid-area: 1 / 1 / 2 / 4; width: 100%; }
  .lst-seg button { flex: 1; padding: 8px 0; font-size: 13.5px; }
  .price-wrap { grid-area: 2 / 1 / 3 / 2; }
  #selType    { grid-area: 2 / 2 / 3 / 3; }
  #selDong    { grid-area: 2 / 3 / 3 / 4; }
  .lst-q      { grid-area: 3 / 1 / 4 / 3; max-width: none; min-width: 0; }
  .lst-fav    { grid-area: 3 / 3 / 4 / 4; justify-content: center; padding: 0 8px; }

  .lst-price, #selType, #selDong {
    width: 100%; min-width: 0; justify-content: space-between;
    font-size: 13px; padding-left: 9px; padding-right: 7px;
  }
  .lst-q input { font-size: 13.5px; }
  .lst-sp, .lst-map { display: none; }

  /* 정렬·보기전환은 "N개의 매물" 줄로 */
  #selSort { font-size: 13px; padding: 6px 8px; min-height: 36px; }
  .lst-view button { width: 36px; min-height: 36px; }
  .lst.is-rows .lcard-img { flex-basis: 128px; min-height: 108px; }
  .lst.is-rows .lcard-body { padding: 10px 12px; }
  .lst.is-rows .fav-b { right: 10px; }
  .lcard-price { font-size: 15.5px; }
  .my-tabs { overflow-x: auto; scrollbar-width: none; }
  .pager { gap: 4px; }
  .pager button { min-width: 38px; height: 38px; padding: 0 9px; font-size: 14px; }
}

/* ---------- 가격 드롭다운 (목록 페이지) ---------- */
.price-wrap { position: relative; }
.lst-price { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.lst-price i { font-style: normal; font-weight: 700; color: var(--blue); }
.lst-price.is-on { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.price-pop {
  position: absolute; z-index: 60; top: calc(100% + 8px); left: 0;
  width: min(430px, calc(100vw - 32px));
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 18px 18px 14px;
}
.pp-sec { margin-bottom: 14px; }
.pp-sec > b { display: block; font-size: 13.5px; margin-bottom: 8px; }
.pp-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.pp-opt {
  font-size: 13px; font-weight: 600; color: var(--sub);
  border: 1px solid var(--line); border-radius: 18px; padding: 7px 12px; background: #fff;
  min-height: 34px; cursor: pointer; transition: all .15s;
}
.pp-opt:hover { border-color: var(--sky); color: var(--blue); }
.pp-opt.is-on { background: var(--blue-soft); border-color: var(--blue); color: var(--blue-deep); font-weight: 700; }
.price-pop-foot {
  display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line);
}
.price-pop-foot .btn-ghost2 { flex: 1; min-height: 42px; font-size: 14px; }
.price-pop-foot .btn-main { flex: 1.4; min-height: 42px; font-size: 14.5px; }

@media (max-width: 767px) {
  /* 좁은 화면에서는 화면 중앙 고정 */
  .price-pop {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    max-height: 78dvh; overflow-y: auto;
  }
}
