/* landsearch_result.php 모바일(≤767) — v2.html 구조 + PC cascade 색상.
   768+ 영향 0. 모든 룰 .rsl-list scope로 한정. */

@media (min-width: 768px) {
  .rsl-list .list-wrap.rsl-list__mobile { display: none; }
  .rsl-list .rsl-list__viewtoggle { display: none !important; }
}

/* data-view 토글: card일 때 리스트형 wrapper 숨김 (양쪽 partial 모두 DOM에 출력되므로) */
@media (max-width: 767px) {
  .rsl-list[data-view="card"] .list-wrap.rsl-list__mobile:not(.rsl-list__mobile--card) { display: none; }
}

@media (max-width: 767px) {
  /* === 리스트형/카드형 전환 토글 (toolbar 위 별도 행) === */
  .rsl-list .rsl-list__viewtoggle {
    display: flex;
    margin: 8px clamp(10px, 1.8vw, 14px) 8px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    box-sizing: border-box;
    width: calc(100% - clamp(20px, 3.6vw, 28px));
  }
  .rsl-list .rsl-list__viewtoggle .vt-btn {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    background: #fff;
    color: #6b7280;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    border: none;
    outline: none;
  }
  .rsl-list .rsl-list__viewtoggle .vt-btn:hover { color: #111; }
  .rsl-list .rsl-list__viewtoggle .vt-btn.is-active {
    background: #f4f0ff;
    color: #5b3fd8;
  }
  .rsl-list .rsl-list__viewtoggle .vt-btn svg { display: block; }
}

@media (max-width: 767px) {
  /* PC 영역 숨김 */
  .rsl-list .rsl-list__thead,
  .rsl-list .rsl-list__body { display: none; }

  /* 모바일 미사용 요소 숨김 */
  .rsl-list .rsl-list__recommend,
  .rsl-list .rsl-list__view-selected,
  .rsl-list .listtmp__left,
  .rsl-list .rsl-list__perpage { display: none !important; }

  /* "경매" ::before 배지 제거 */
  .rsl-list--auction .rsl-list__count .total-count::before { display: none; }

  /* 회색 배경 — viewport 가득 차게 (음수 margin 트릭으로 부모 폭 제한 우회) */
  .rsl-list .rsl-list__main {
    background: #f2f3f5;
    width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }
  html, body { overflow-x: hidden; }

  /* 정렬 영역 강제 표시 (PC base의 display:none override) */
  .rsl-list .listtmp__sorts.rsl-list__sort { display: flex !important; }

  /* 정렬 영역 밑 가이드선 제거 (PC base cascade 차단) */
  .rsl-list .listtmp__sorts.rsl-list__sort,
  .rsl-list .rsl-list__controls.listtmp,
  .rsl-list .listtmp__right,
  .rsl-list .rsl-list__header { border: none !important; box-shadow: none !important; }
  .rsl-list .rsl-list__header::after,
  .rsl-list .rsl-list__toolbar::after,
  .rsl-list .listtmp__sorts.rsl-list__sort::after { display: none !important; }

  /* ===== toolbar (기본: 1행 가로 정렬, viewport 가득) — 가로 padding·margin clamp ===== */
  .rsl-list .rsl-list__toolbar {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px clamp(10px, 1.8vw, 14px);
    margin: 8px clamp(10px, 1.8vw, 14px) 12px;
    max-width: 100%;
    width: calc(100% - clamp(20px, 3.6vw, 28px));
    display: flex !important;
    align-items: center;
    flex-wrap: nowrap !important;
    gap: 8px;
    overflow: hidden;
  }

  /* 총건수 */
  .rsl-list .rsl-list__toolbar .rsl-list__count {
    display: inline-flex !important;
    align-items: center;
    height: 22px;
    flex: 0 0 auto !important;
    width: auto !important;
    margin: 0;
    padding: 0;
  }
  .rsl-list .rsl-list__toolbar .total-count {
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
  }
  .rsl-list .rsl-list__toolbar .total-count em {
    color: #2563eb;
    font-size: 14px;
    font-weight: 700;
    font-style: normal;
    line-height: 1;
  }

  /* 컨트롤 묶음 — 부모 폭 가둠 (자식이 폭 넘지 못하게) */
  .rsl-list .rsl-list__toolbar .rsl-list__controls.listtmp {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 6px;
    flex: 1 1 0 !important;
    width: auto !important;
    height: 22px;
    margin: 0;
    padding: 0;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  /* listtmp__right — PC base의 display:contents override + 부모 폭 가둠 */
  .rsl-list .rsl-list__toolbar .rsl-list__controls.listtmp .listtmp__right {
    display: flex !important;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    flex: 1 1 0 !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    justify-content: flex-end;
  }

  /* 정렬 5개 묶음 — 자식 폭 합이 부모 넘으면 가로 스크롤
     basis auto로 자식 폭만큼 자라되 max-width 100%로 캡 */
  .rsl-list .listtmp__sorts.rsl-list__sort {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden;
    scrollbar-width: none;
    min-width: 0 !important;
    max-width: 100% !important;
    gap: 4px;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
  }
  .rsl-list .listtmp__sorts.rsl-list__sort::-webkit-scrollbar { display: none; }

  /* 정렬 버튼 (pill 직사각형) */
  .rsl-list .listtmp__sorts.rsl-list__sort .listtmp__sort {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    padding: 0 8px;
    height: 22px;
    box-sizing: border-box;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    background: none;
    color: #6b7280;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    text-decoration: none;
    outline: none;
  }
  .rsl-list .listtmp__sorts.rsl-list__sort .listtmp__sort.is-active {
    background: #1860ef;
    color: #fff;
    border-color: #1860ef;
  }

  /* ===== 카드 컨테이너 — viewport 가득, padding·gap clamp ===== */
  .rsl-list .list-wrap.rsl-list__mobile {
    max-width: 100%;
    width: 100%;
    margin: 0;
    display: flex; flex-direction: column;
    gap: clamp(5px, 1.2vw, 8px);
    padding: 0 clamp(8px, 2vw, 14px) clamp(8px, 2vw, 14px);
    box-sizing: border-box;
  }
  .rsl-list .list-wrap.rsl-list__mobile .item {
    position: relative;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
  }
  .rsl-list .list-wrap.rsl-list__mobile .item-body {
    display: flex; flex-direction: row;
    align-items: stretch;
    width: auto; min-width: 0;
    gap: clamp(8px, 1.6vw, 12px);
    padding: clamp(10px, 1.8vw, 14px);
  }
  /* 주소 한 줄: 2행(addr2 + d-day) 숨김 — 모든 모바일 ≤767 */
  .rsl-list .list-wrap.rsl-list__mobile .info-line + .info-line { display: none; }
  /* thumb: 폭은 320~545 사이에서 연속 비례, height는 info 영역 stretch */
  .rsl-list .list-wrap.rsl-list__mobile .thumb {
    width: 100px;
    height: 120px;
    border-radius: 8px; overflow: hidden;
    background: #e5e7eb;
    flex-shrink: 0; position: relative;
  }
  .rsl-list .list-wrap.rsl-list__mobile .thumb img {
    width: 100%; height: 100%; object-fit: cover; display: block;
  }
  .rsl-list .list-wrap.rsl-list__mobile .info {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 3px;
  }
  .rsl-list .list-wrap.rsl-list__mobile .info-top {
    display: flex; flex-direction: column; align-items: flex-start;
    gap: 3px; overflow: hidden;
  }
  .rsl-list .list-wrap.rsl-list__mobile .case-id { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  /* info-line: 좌-소재지(addr-line) / 우-날짜·D-day */
  .rsl-list .list-wrap.rsl-list__mobile .info-line {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
  }
  .rsl-list .list-wrap.rsl-list__mobile .addr-line {
    flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-size: 14px;
  }
  .rsl-list .list-wrap.rsl-list__mobile .addr-line:empty::before { content: "\00a0"; }
  .rsl-list .list-wrap.rsl-list__mobile .info-line .sale-date,
  .rsl-list .list-wrap.rsl-list__mobile .info-line .d-day {
    flex-shrink: 0;
    text-align: right;
    padding-right: 0;
    font-size: 14px;
  }
  .rsl-list .list-wrap.rsl-list__mobile .info-top .sale-date {
    font-size: 12px; font-weight: 700;
    color: #e03131;
    flex-shrink: 0;
  }
  .rsl-list .list-wrap.rsl-list__mobile .info-line .d-day { font-weight: 700; }
  .rsl-list .list-wrap.rsl-list__mobile .usage-badge {
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    font-weight: 700;
    color: #1860ef;
    background: #e8f0ff;
    padding: 2px 8px;
    border-radius: 4px;
    line-height: 1.4;
    flex-shrink: 0;
  }
  /* usage-badge 앞 점 숨김 (우측 정렬되면 가운데 어색) */
  .rsl-list .list-wrap.rsl-list__mobile .info-top .info-dot:nth-of-type(2) { display: none; }
  .rsl-list .list-wrap.rsl-list__mobile .addr {
    font-size: 16px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    line-height: 1.3;
  }
  .rsl-list .list-wrap.rsl-list__mobile .area { font-size: 14px; line-height: 1.3; }

  /* price-row — 감정/최저 항상 2줄 고정 */
  .rsl-list .list-wrap.rsl-list__mobile .price-row {
    display: flex; flex-direction: column; gap: 3px;
    width: auto; max-width: none; min-height: 0;
    margin-top: 2px;
  }
  .rsl-list .list-wrap.rsl-list__mobile .price-line {
    display: flex; align-items: center; gap: 4px;
  }
  .rsl-list .list-wrap.rsl-list__mobile .p-label {
    display: inline-flex; align-items: center;
    font-size: 12px; line-height: 1; height: 18px;
    padding: 0 5px;
    border-radius: 3px; color: #fff;
  }
  .rsl-list .list-wrap.rsl-list__mobile .p-label.appr { background: #111; }
  .rsl-list .list-wrap.rsl-list__mobile .p-label.min  { background: #4e7ff0; }
  .rsl-list .list-wrap.rsl-list__mobile .p-val { font-size: 14px; font-weight: 700; color: #111; }
  .rsl-list .list-wrap.rsl-list__mobile .p-val.highlight { font-size: 14px; color: #4e7ff0; }
  .rsl-list .list-wrap.rsl-list__mobile .p-rate { font-size: 14px; }

  /* item-footer — padding clamp */
  .rsl-list .list-wrap.rsl-list__mobile .item-footer {
    border-top: 1px solid #e5e7eb;
    padding: clamp(5px, 1vw, 8px) clamp(10px, 1.8vw, 14px);
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
  }
  .rsl-list .list-wrap.rsl-list__mobile .tags-left {
    display: flex; gap: 4px;
    overflow-x: auto; white-space: nowrap;
    flex: 1; scrollbar-width: none;
  }
  .rsl-list .list-wrap.rsl-list__mobile .tags-left::-webkit-scrollbar { display: none; }
  .rsl-list .list-wrap.rsl-list__mobile .tag {
    font-size: 14px; padding: 2px 6px;
    border-radius: 3px; flex-shrink: 0;
  }
  .rsl-list .list-wrap.rsl-list__mobile .tag.stat {
    background: transparent; color: #111;
    margin-left: auto;
  }
  .rsl-list .list-wrap.rsl-list__mobile .tag.warn { background: #fef2f2; }

  /* 선택 모드 체크박스 */
  .item-rowcheck--card { position: absolute; top: 8px; right: 8px; z-index: 2; }
  .rsl-list:not(.is-select-mode) .item-rowcheck--card { display: none; }
}

/* === 무한 스크롤 sentinel (리스트형·카드형 공용) ===
   각 .list-wrap 안 마지막에 위치. 부모 display:none이면 자동 비활성. */
@media (max-width: 767px) {
  .rsl-list .list-wrap .rsl-list__sentinel {
    height: 60px;
    margin: 8px 0 4px;
    display: flex; align-items: center; justify-content: center;
    color: #6b7280;
    font-size: 13px;
  }
  .rsl-list .list-wrap .rsl-list__sentinel.is-loading::before {
    content: "";
    display: inline-block;
    width: 18px; height: 18px;
    border: 2px solid #e5e7eb;
    border-top-color: #1860ef;
    border-radius: 50%;
    animation: rsl-spin 0.8s linear infinite;
    margin-right: 8px;
  }
  .rsl-list .list-wrap .rsl-list__sentinel.is-loading::after {
    content: "불러오는 중…";
  }
  @keyframes rsl-spin { to { transform: rotate(360deg); } }
}

/* 481~767 / 376~480 / ~375 thumb·주소·stretch는 ≤767 기본 블록에서 일괄 처리.
   각 구간 블록은 padding·gap·toolbar 등 작은 화면 특수 처리만 담당. */

/* ============================================
   모바일 large (481~767): 정렬탭 우측 정렬 (총건수는 base에서 고정)
   ============================================ */
@media (min-width: 481px) and (max-width: 767px) {
  .rsl-list .listtmp__sorts.rsl-list__sort {
    justify-content: flex-end !important;
    margin-left: auto !important;
  }
}

/* 376~480·~375 padding·gap·thumb은 모두 base clamp가 처리.
   각 구간 블록은 폰트/패딩 미세 차이만 담당 (현재는 모두 14px 통일이라 사실상 비어 있음). */

/* ============================================
   모바일 small (~375): toolbar 1행 유지 (정렬은 가로 스크롤 — base에서 처리),
   카드 작은 화면용 라운드 + 정보 우선순위 축소
   ============================================ */
@media (max-width: 375px) {
  /* thumb 라운드만 조정 (사이즈는 base clamp) */
  .rsl-list .list-wrap.rsl-list__mobile .thumb { border-radius: 6px; }

  /* 작은 화면 정보 우선순위: 조회수 숨김, 위험 태그 2개까지만 (면적은 평 단위로 짧아져서 유지) */
  .rsl-list .list-wrap.rsl-list__mobile .tag.stat { display: none; }
  .rsl-list .list-wrap.rsl-list__mobile .tag.warn:nth-of-type(n+3) { display: none; }
}
