/* filter-chips.css — list/map 공통 모바일 필터 칩바 + 바텀시트 컴포넌트.
   list.html 인라인 CSS 에서 추출. map.html 도 같은 룩앤필을 쓰기 위해 공유.
   페이지별 컨테이너 포지셔닝은 각자 오버라이드. */

/* ─────────────────────────────────────────────────────────────
   필터 칩 바 — 가로 스크롤 칩 + 바텀시트 (PC/모바일 공통)
   ───────────────────────────────────────────────────────────── */
.mobile-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-2) var(--space-3);
  box-shadow: var(--shadow-sm);
  transition: border-radius .15s ease;
}
.mobile-filter-bar .m-fbar-inner {
  flex: 1 1 auto;
  min-width: 0;
  display: flex; gap: 8px;
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  mask-image: linear-gradient(to right, transparent 0, #000 8px, #000 calc(100% - 16px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 8px, #000 calc(100% - 16px), transparent 100%);
}
.mobile-filter-bar .m-fbar-inner::-webkit-scrollbar { display: none; }
.m-chip {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
  background: var(--color-bg-subtle, #f1f5f9);
  color: var(--color-text);
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .12s, color .12s;
}
.m-chip:hover { background: var(--color-border); text-decoration: none; }
.m-chip.is-active {
  background: #111;
  color: #fff;
}
.m-chip.m-chip-sort {
  background: transparent;
  color: var(--color-text);
  padding-left: 8px;
}
.m-chip.m-chip-sort i { font-size: 0.75rem; opacity: .7; }
.m-chip.m-chip-reset {
  background: var(--color-bg, #fff);
  color: var(--color-danger, #dc2626);
  border-color: var(--color-danger, #dc2626);
  font-weight: 700;
}
.m-chip.m-chip-reset:hover {
  background: var(--color-danger, #dc2626);
  color: #fff;
}
.m-chip.m-chip-reset i { font-size: 0.9em; }
.m-fbar-search {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--color-bg-subtle, #f1f5f9);
  border: 1px solid transparent;
  transition: width .22s ease, flex-basis .22s ease, background .15s, border-color .15s, box-shadow .15s;
}
.m-fbar-search.is-open {
  flex-basis: min(360px, 72vw);
  width: min(360px, 72vw);
  background: #fff;
  border-color: var(--color-border, #d1d5db);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}
.m-fbar-search-toggle {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--color-text, #111827);
  cursor: pointer;
}
.m-fbar-search-toggle:hover { background: rgba(15, 23, 42, .06); }
.m-fbar-search-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity .12s ease;
}
.m-fbar-search.is-open .m-fbar-search-input { opacity: 1; }
.m-fbar-search-submit {
  flex: 0 0 auto;
  margin-right: 4px;
  border: 0;
  border-radius: 999px;
  background: var(--color-accent, #b58500);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 6px 12px;
  opacity: 0;
  transform: translateX(-6px);
  pointer-events: none;
  transition: opacity .12s ease, transform .18s ease;
}
.m-fbar-search.is-open .m-fbar-search-submit {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}
@media (max-width: 640px) {
  .m-chip { padding: 6px 14px; font-size: 0.875rem; }
}

/* 바텀시트 — 모바일 풀폭 / PC 는 중앙 고정 폭 */
.offcanvas.m-sheet.offcanvas-bottom {
  height: auto;
  max-height: 85vh;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  overflow: hidden;
}
.offcanvas.m-sheet.m-sheet-tall { height: 80vh; }
@media (min-width: 641px) {
  .offcanvas.m-sheet.offcanvas-bottom {
    top: var(--m-sheet-top, 0);
    left: var(--m-sheet-left, 0);
    right: auto;
    bottom: auto;
    width: 420px;
    max-width: 420px;
    height: auto;
    max-height: min(70vh, 560px);
    border-radius: 16px;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    margin: 0;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
    transform: translateY(-6px);
    opacity: 0;
    transition: transform .15s ease, opacity .15s ease;
  }
  .offcanvas.m-sheet.offcanvas-bottom.showing,
  .offcanvas.m-sheet.offcanvas-bottom.show {
    transform: translateY(0);
    opacity: 1;
  }
  .offcanvas.m-sheet.m-sheet-tall {
    height: auto;
    max-height: min(70vh, 560px);
  }
  body.m-sheet-dropdown-open .offcanvas-backdrop {
    background-color: transparent;
  }
}
.m-sheet-form { display: flex; flex-direction: column; min-height: 0; }
.offcanvas.m-sheet.m-sheet-tall .m-sheet-form { height: 100%; }
.m-sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 8px;
}
.m-sheet-header h5 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.m-sheet-close {
  background: transparent; border: 0; padding: 6px;
  font-size: 1.1rem; color: var(--color-text-muted); cursor: pointer;
}
.m-sheet-body {
  padding: 8px 20px 16px;
  overflow-y: auto;
  flex: 1 1 auto; min-height: 0;
}
.m-sheet-body.no-pad { padding: 0; }
.m-sheet-footer {
  display: flex; gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
  flex-shrink: 0;
}
.m-btn-cancel, .m-btn-apply {
  flex: 1; padding: 14px 16px;
  border-radius: 8px; font-weight: 700; font-size: 0.95rem;
  border: 0; cursor: pointer;
}
.m-btn-cancel { background: var(--color-bg-subtle, #e5e7eb); color: var(--color-text); }
.m-btn-apply { background: #111; color: #fff; }

/* 필터 바 우측 달력 트리거 */
.m-fbar-cal {
  flex: 0 0 40px;
  width: 40px; height: 40px;
  padding-left: 8px;
  margin-left: 0;
  box-sizing: content-box;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0;
  border-left: 1px solid var(--color-bg-subtle, #e5e7eb);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  transition: color .12s;
}
.m-fbar-cal i {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: var(--color-bg-subtle, #f1f5f9);
  font-size: 1.05rem;
  transition: background-color .12s, color .12s;
}
.m-fbar-cal:hover i { background: var(--color-border); }
.m-fbar-cal.is-active i { background: #111; color: #fff; }

/* 달력 시트 — 월 헤더 + 요일 + 그리드 */
.m-cal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.m-cal-nav {
  width: 36px; height: 36px;
  border: 0; border-radius: 999px;
  background: transparent; color: var(--color-text);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color .12s;
}
.m-cal-nav:hover { background: var(--color-bg-subtle, #f1f5f9); }
.m-cal-title { font-weight: 800; font-size: 1.05rem; }
.m-cal-dow {
  display: grid; grid-template-columns: repeat(7, 1fr);
  text-align: center; font-size: 0.78rem;
  color: var(--color-text-muted);
  padding: 6px 0;
  border-bottom: 1px solid var(--color-bg-subtle);
}
.m-cal-dow span:first-child { color: var(--color-danger, #dc2626); }
.m-cal-dow span:last-child { color: var(--color-info, #1e40af); }
.m-cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding-top: 6px;
}
.m-cal-day {
  position: relative;
  aspect-ratio: 1;
  display: inline-flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1px;
  border: 0;
  background: transparent;
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--color-text);
  cursor: pointer;
  transition: background-color .12s, color .12s;
  padding: 2px 0;
}
.m-cal-day:hover:not(.is-empty):not(:disabled) { background: var(--color-bg-subtle, #f1f5f9); }
.m-cal-day.is-empty {
  pointer-events: none;
  background: transparent;
  cursor: default;
}
.m-cal-day .d-num { font-size: 0.9rem; line-height: 1; }
.m-cal-day .d-cnt {
  font-size: 0.65rem; line-height: 1;
  color: var(--color-text-muted);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.m-cal-day.is-sun .d-num { color: var(--color-danger, #dc2626); }
.m-cal-day.is-sat .d-num { color: var(--color-info, #1e40af); }
.m-cal-day.is-today { box-shadow: inset 0 0 0 1px var(--color-primary, #1a365d); font-weight: 800; }
.m-cal-day.in-range {
  background: var(--color-accent-soft, #fef3c7);
  border-radius: 0;
}
.m-cal-day.is-range-start,
.m-cal-day.is-range-end,
.m-cal-day.is-single {
  background: #111;
  color: #fff;
  font-weight: 800;
  border-radius: 10px;
}
.m-cal-day.is-range-start { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.m-cal-day.is-range-end { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.m-cal-day.is-range-start.is-range-end,
.m-cal-day.is-single { border-radius: 10px; }
.m-cal-day.is-range-start .d-num,
.m-cal-day.is-range-end .d-num,
.m-cal-day.is-single .d-num { color: #fff; }
.m-cal-day.is-range-start .d-cnt,
.m-cal-day.is-range-end .d-cnt,
.m-cal-day.is-single .d-cnt { color: rgba(255,255,255,.85); }
.m-cal-hint {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  text-align: center;
}
.m-cal-hint.is-warn { color: var(--color-danger, #dc2626); }

/* 달력 시트 — 그리드 전체가 스크롤 없이 보이도록 max-height 확장 */
#mSheetMapDate, #mSheetCalendar { max-height: 95vh; }
#mSheetMapDate .m-sheet-body,
#mSheetCalendar .m-sheet-body { overflow: visible; }
@media (min-width: 641px) {
  #mSheetMapDate, #mSheetCalendar { max-height: min(85vh, 660px); }
}

/* 정렬 시트 — radio list */
.m-sort-list { list-style: none; padding: 0; margin: 0; }
.m-sort-list label {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 4px; cursor: pointer; font-size: 0.95rem;
  border-bottom: 1px solid var(--color-bg-subtle);
}
.m-sort-list label:last-child { border-bottom: 0; }
.m-sort-list label input { display: none; }
.m-sort-list label .check { opacity: 0; font-size: 1.1rem; }
.m-sort-list label input:checked ~ .check { opacity: 1; }
.m-sort-list label input:checked + span { font-weight: 700; }

/* 그리드 버튼 (유형, 시도, 법원 등) */
.m-btn-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.m-btn-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.m-btn-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.m-btn-grid label {
  position: relative;
  display: block;
  text-align: center;
  padding: 12px 8px;
  background: var(--color-bg-subtle, #f1f5f9);
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m-btn-grid label input { display: none; }
.m-btn-grid label:has(input:checked) {
  background: #111; color: #fff; font-weight: 700;
}
.m-btn-grid label i.bi { margin-right: 4px; }
.m-btn-grid label .m-btn-emoji {
  position: absolute;
  top: 3px;
  right: 6px;
  font-size: 0.85rem;
  line-height: 1;
}

/* 우산 카테고리 (전체/부동산/동산) */
.m-btn-grid--umbrella label {
  background: #fff;
  color: var(--color-text, #0f172a);
  border-radius: 12px;
  font-weight: 700;
  border: 1.5px solid var(--color-border-strong, #cbd5e1);
}
.m-btn-grid--umbrella label:has(input:checked) {
  background: var(--color-primary, #1a365d);
  color: #fff;
  border-color: var(--color-primary, #1a365d);
  box-shadow: var(--shadow-primary-glow);
}
.m-btn-grid + .m-btn-grid { margin-top: 10px; }
.m-btn-grid--full { grid-template-columns: 1fr; }

/* 지역 시트 — 탭 */
.m-tab-switch {
  display: flex;
  background: var(--color-bg-subtle, #f1f5f9);
  border-radius: 999px;
  padding: 4px;
  margin: 0 20px 12px;
}
.m-tab-switch button {
  flex: 1; padding: 8px 12px;
  background: transparent; border: 0;
  font-size: 0.9rem; color: var(--color-text-muted);
  border-radius: 999px;
  cursor: pointer;
}
.m-tab-switch button.is-active {
  background: #fff;
  color: var(--color-text);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}

/* 시군구 아코디언 */
.m-acc-item { border-bottom: 1px solid var(--color-bg-subtle); }
.m-acc-head {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 14px 4px;
  background: transparent; border: 0;
  font-size: 0.95rem; cursor: pointer;
  text-align: left;
}
.m-acc-head .chev { transition: transform .15s; }
.m-acc-item.is-open .m-acc-head .chev { transform: rotate(180deg); }
.m-acc-body {
  display: none;
  padding: 4px 4px 12px;
}
.m-acc-item.is-open .m-acc-body { display: block; }
.m-acc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.m-acc-chips label {
  background: var(--color-bg-subtle, #f1f5f9);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  border: 1px solid transparent;
}
.m-acc-chips label input { display: none; }
.m-acc-chips label:has(input:checked) { background: #111; color: #fff; }
.m-acc-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: center;
  min-height: 32px;
  background: #fff;
  border: 1px solid var(--color-border, #d1d5db);
  border-radius: 999px;
  color: var(--color-text, #111827);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
  transition: background .15s, border-color .15s, box-shadow .15s, transform .15s;
}
.m-acc-more i { font-size: 0.9rem; }
.m-acc-more:hover {
  background: var(--color-bg-subtle, #f8fafc);
  border-color: var(--color-primary, #2563eb);
  box-shadow: 0 2px 6px rgba(15, 23, 42, .12);
  transform: translateY(-1px);
}

/* 금액 슬라이더 */
.m-slider-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.m-slider-row .lbl { color: var(--color-text-muted); font-size: 0.9rem; }
.m-slider-row .val { font-weight: 700; font-size: 1rem; }
.m-slider-wrap { padding: 0 4px 20px; }
.m-slider-wrap input[type=range] {
  width: 100%;
  -webkit-appearance: none; appearance: none;
  height: 3px; background: var(--color-bg-subtle, #e5e7eb);
  outline: none;
}
.m-slider-wrap input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: #0bbf8b; cursor: pointer;
}
.m-slider-wrap input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: #0bbf8b; cursor: pointer; border: 0;
}

/* 적용 중 필터 칩 (active filters) */
.active-filters {
  display: flex; flex-wrap: wrap; gap: var(--space-1); align-items: center;
  padding: var(--space-2) var(--space-3); background: var(--color-info-soft);
  border-radius: var(--radius-lg); font-size: var(--text-sm);
}
.active-filters .af-label { font-weight: 700; color: var(--color-info); margin-right: var(--space-1); }
.active-filters .af-chip {
  background: #fff; border: 1px solid var(--color-border);
  border-radius: var(--radius-full); padding: 4px 10px;
  font-size: var(--text-xs); color: var(--color-text);
  text-decoration: none; display: inline-flex; align-items: center; gap: 4px;
  cursor: pointer;
}
.active-filters .af-chip:hover { background: var(--color-bg-subtle); }
.active-filters .af-chip i { font-size: 0.75rem; opacity: .6; }
.active-filters .af-clear {
  margin-left: auto; color: var(--color-info); font-weight: 700;
  font-size: var(--text-xs); text-decoration: underline;
  background: transparent; border: 0; cursor: pointer; padding: 0;
}
