/* ===== 검색 페이지 전용 ===== */

/* 필터 바 */
.filter-bar {
  /* 웹플로우 네브바가 sticky라면 top 값을 네브바 높이(예: 67px)로 조정 */
  position: sticky; top: 0; z-index: 60;
  background: #fff;
  border-bottom: 1px solid var(--line-alternative);
  padding: 20px 0 14px; /* 페이지 헤드 제거 후 상단 여백 */
}
/* 좌표 버튼 + 필터 카테고리 — 항상 한 줄, 넘치면 가로 슬라이드 */
.filter-line { display: flex; align-items: center; gap: 8px; position: relative; }
/* 슬라이드 시 좌우 그라데이션 (스크롤 가능한 방향에만 표시) */
.filter-line::before, .filter-line::after, .chips-line::before {
  content: ''; position: absolute; top: 0; bottom: 0; width: 28px;
  z-index: 2; pointer-events: none; opacity: 0; transition: opacity .15s;
}
.filter-line::before { left: 40px; background: linear-gradient(to right, #fff, rgba(255,255,255,0)); } /* 좌표 버튼(32px)+간격(8px) 바로 뒤 */
.filter-line::after  { right: 0;   background: linear-gradient(to left,  #fff, rgba(255,255,255,0)); }
.chips-line::before  { left: 0;    background: linear-gradient(to right, #fff, rgba(255,255,255,0)); }
.filter-line.fade-l::before { opacity: 1; }
.filter-line.fade-r::after  { opacity: 1; }
.chips-line.fade-l::before  { opacity: 1; }
.filter-scroll {
  flex: 1; min-width: 0;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.filter-scroll::-webkit-scrollbar { display: none; }
.filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; width: max-content; }
.filter-row .tds-chip { white-space: nowrap; flex-shrink: 0; }
/* 필터 트리거는 tds-chip(border) 사용 — 캐럿만 추가 */
.tds-chip .caret { font-size: 9px; opacity: 0.55; margin-left: 2px; }
.tds-chip--border { background: #fff; }

/* 드롭다운 패널 */
.filter-wrap { position: relative; }
.filter-panel {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 70;
  min-width: 280px; max-width: 92vw;
  background: #fff; border: 1px solid var(--line-general);
  border-radius: var(--radius-card); box-shadow: var(--shadow-float);
  padding: 20px; display: none;
}
.filter-panel.open { display: block; }
.filter-panel h4 { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px 12px; max-height: 240px; overflow-y: auto; }
.check-grid label { white-space: nowrap; }
/* 테마 패널: 항목이 길어 줄바꿈 없이 3열로 넓게 */
[data-panel="theme"] { min-width: min(560px, 92vw); }
[data-panel="theme"] .check-grid { grid-template-columns: repeat(3, 1fr); max-height: 300px; }
.check-grid label, .sub-col label {
  display: flex; align-items: center; gap: 8px; padding: 6px 4px;
  font-size: 14px; color: var(--text-neutral); cursor: pointer; border-radius: 6px;
}
.check-grid label:hover, .sub-col label:hover { background: var(--bg-alternative); }
.panel-actions { display: flex; justify-content: space-between; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-alternative); }

/* 2단 선택 (좌: 그룹 / 우: 하위 항목) — 지역·제조사 공용 */
.twocol { display: flex; width: 420px; max-width: 84vw; border: 1px solid var(--line-alternative); border-radius: 12px; overflow: hidden; }
.group-col { width: 45%; border-right: 1px solid var(--line-alternative); max-height: 300px; overflow-y: auto; background: var(--bg-alternative); }
.sub-col { flex: 1; max-height: 300px; overflow-y: auto; padding: 6px; }
.group-row {
  display: flex; align-items: center; gap: 6px; padding: 11px 10px 11px 14px;
  cursor: pointer; font-size: 14px; font-weight: 500; color: var(--text-neutral);
  user-select: none;
}
.group-row .sel-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.group-row .arrow { margin-left: auto; color: var(--text-assistive); font-size: 12px; }
.group-row.active { background: #fff; font-weight: 700; color: var(--text-general); box-shadow: inset 3px 0 0 var(--primary); }
.panel-hint { font-size: 12px; color: var(--text-assistive); font-weight: 400; }
.sub-col .sub-all { border-bottom: 1px solid var(--line-alternative); margin-bottom: 4px; padding-bottom: 4px; }
.sub-col .sub-all label { width: 100%; }

/* 적용된 필터 칩 줄: 가로 슬라이드 + 오른쪽 초기화(그라데이션 뒤로) */
.chips-line { display: flex; align-items: center; margin-top: 10px; position: relative; }
.chips-line[hidden] { display: none; }
.chips-scroll { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips-scroll::-webkit-scrollbar { display: none; }
.active-chips { display: flex; flex-wrap: nowrap; gap: 8px; width: max-content; }
.chips-fade {
  flex-shrink: 0; width: 36px; align-self: stretch; margin-left: -36px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0), #fff);
  pointer-events: none; position: relative; z-index: 1;
}
.chips-reset {
  flex-shrink: 0; position: relative; z-index: 1;
  background: #fff; border: none; padding: 6px 0 6px 6px;
  font-size: 13px; font-weight: 500; color: var(--text-neutral); font-family: inherit;
  text-decoration: underline; text-underline-offset: 2px;
}
/* 칩 전체가 해제 버튼 */
.achip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-tint); color: var(--primary);
  border: none; cursor: pointer;
  border-radius: 999px; padding: 7px 12px 7px 14px;
  font-size: 13px; font-weight: 600; line-height: 1.3; font-family: inherit;
}
.achip .x { width: 13px; height: 13px; opacity: 0.65; }

/* 가격 */
.price-inputs { display: flex; align-items: center; gap: 8px; }
.price-inputs input {
  width: 110px; padding: 10px 12px; border: 1px solid var(--line-general);
  border-radius: 12px; font-family: inherit; font-size: 16px; outline: none; /* 16px: iOS 포커스 확대 방지 */
}
.price-inputs input:focus { border-color: color-mix(in srgb, var(--tds-primary-general) 40%, transparent); }
.price-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.price-presets button {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-general);
  background: #fff; font-size: 13px; color: var(--text-neutral);
}
.price-presets button:hover { border-color: var(--primary); color: var(--primary); }

/* 결과 헤더 */
.result-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 0 4px; }
.result-left { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.result-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.result-head .count { font-size: 15px; color: var(--text-neutral); flex-shrink: 0; }
.result-head .count b { color: var(--text-heavy); margin: 0 2px; }
.my-loc, .data-updated {
  font-size: 12.5px; color: var(--text-alternative);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 좌표 활성화 토글 버튼 (필터 줄 맨 앞) */
.loc-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  width: 32px; height: 32px; border-radius: 8px; /* 카테고리 칩(small)과 동일 높이 */
  background: #fff; border: 1px solid var(--line-general);
  color: var(--text-alternative);
  --ix-color: var(--tds-text-general);
  --ix-default: var(--tds-ix-normal-default);
  --ix-hovered: var(--tds-ix-normal-hovered);
  --ix-focused: var(--tds-ix-normal-focused);
  --ix-pressed: var(--tds-ix-normal-pressed);
}
.loc-icon-btn.is-active {
  color: var(--tds-primary-general);
  border-color: color-mix(in srgb, var(--tds-primary-general) 75%, transparent);
  background: color-mix(in srgb, var(--tds-primary-general) 5%, #fff);
}
.sort-select {
  border: none; background: transparent; font-family: inherit; font-size: 14px;
  font-weight: 600; color: var(--text-general); cursor: pointer; outline: none;
  padding: 6px 4px;
}

/* 카드 그리드 — 데스크탑 4열 */
.car-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px 20px;
  padding: 20px 0 8px;
}
@media (max-width: 1024px) { .car-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 820px)  { .car-grid { grid-template-columns: repeat(2, 1fr); gap: 24px 16px; } }
@media (max-width: 480px)  { .car-grid { grid-template-columns: 1fr; gap: 24px; } }



/* 더 보기 / 빈 결과 */
.load-more-wrap { display: flex; justify-content: center; padding: 32px 0 8px; }
.empty { text-align: center; padding: 80px 0; color: var(--text-alternative); }
.empty .emoji { font-size: 40px; margin-bottom: 12px; }

@media (max-width: 640px) {
  .page-head h1 { font-size: 22px; }
  .filter-bar { top: 0; }
  .twocol { width: 100%; }
  /* 모바일: 테마 패널도 2열로 (패널 폭은 JS가 화면 꽉 차게 통일) */
  [data-panel="theme"] .check-grid { grid-template-columns: repeat(2, 1fr); }
}
