/* ===== 목록 페이지 상세 필터 (좌측 사이드바 + 위로 접기) ===== */

.list-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    /* 320px: 헤더 한 줄(제목+초기화+접기버튼)이 한글·영문 모두 들어가는 최소 폭.
       280px에서는 필터가 걸려 '초기화'가 나타나면 22px가 넘쳐 버튼이 카드 밖으로 삐져나갔다. */
    grid-template-columns: 320px 1fr;
    align-items: start;
    gap: 24px;
}

/* 그리드 자식의 기본 min-width:auto가 긴 select 옵션 텍스트에 밀려 가로 스크롤을 만든다 */
.list-layout > * {
    min-width: 0;
}

/* 접힌 상태: 사이드바가 위쪽 가로 바로 변하고 본문이 전체 폭을 차지 */
.list-layout.is-collapsed {
    grid-template-columns: 1fr;
}
.list-layout.is-collapsed .filter-panel {
    grid-column: 1 / -1;
}
.list-layout.is-collapsed .filter-body {
    display: none;
}
.list-layout.is-collapsed .filter-head {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

/* ── 패널 ── */
.filter-panel {
    background: #fff;
    border: 1px solid #e9ecf2;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 80px;
}
.list-layout.is-collapsed .filter-panel {
    position: static;
}

.filter-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* wrap: 라벨이 길어지는 다른 언어에서도 카드 밖으로 넘치지 않게 하는 안전장치.
       폭이 모자라면 제목만 남기고 [초기화 + 접기버튼]이 아랫줄로 내려간다. */
    flex-wrap: wrap;
    gap: 8px 10px;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid #f0f2f5;
}

.filter-title {
    font-size: 17px;
    font-weight: 800;
    color: #1a1a1a;
    margin: 0;
    flex-shrink: 0;
}

.filter-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    /* 아랫줄로 내려가도 오른쪽 정렬 유지 */
    margin-left: auto;
    min-width: 0;
}

.filter-reset {
    font-size: 12px;
    color: #0066cc;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}
.filter-reset:hover { text-decoration: underline; }

.filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #dfe3ea;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #444;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.2s, color 0.2s;
}
.filter-toggle:hover { border-color: #0066cc; color: #0066cc; }

.filter-toggle .chev {
    font-size: 10px;
    transition: transform 0.25s;
}
.list-layout.is-collapsed .filter-toggle .chev {
    transform: rotate(180deg);
}

/* ── 필터 그룹 ── */
.filter-group { margin-bottom: 16px; }

.filter-group > label,
.filter-legend {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #555;
    margin-bottom: 7px;
}

.filter-group select,
.filter-group input[type="text"] {
    width: 100%;
    max-width: 100%;
    padding: 10px 12px;
    border: 1px solid #dfe3ea;
    border-radius: 8px;
    font-size: 13px;
    color: #333;
    background: #fff;
    box-sizing: border-box;
    font-family: inherit;
    text-overflow: ellipsis;
}
.filter-group select:focus,
.filter-group input[type="text"]:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}
.filter-group select:disabled {
    background: #f6f7f9;
    color: #aaa;
    cursor: not-allowed;
}

/* 시설 체크박스 */
.facility-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
}
.facility-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: #444;
    cursor: pointer;
    padding: 3px 0;
}
.facility-check input { margin: 0; cursor: pointer; accent-color: #0066cc; }

.filter-note {
    font-size: 11.5px;
    color: #999;
    line-height: 1.5;
    margin: 6px 0 0;
}
.filter-note.is-warn { color: #d97706; }

.filter-submit {
    width: 100%;
    padding: 13px;
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 4px;
    font-family: inherit;
    transition: background 0.2s;
}
.filter-submit:hover { background: #0052a3; }

/* ── 결과 헤더 / 정렬 ── */
.result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.result-title {
    font-size: 22px;
    font-weight: 800;
    color: #1a1a1a;
    margin: 0;
}
.result-title strong { color: #0066cc; }

.result-sub {
    font-size: 12px;
    color: #999;
    margin: 0 0 4px;
}

.sort-tabs { display: flex; gap: 6px; flex-wrap: wrap; }

.sort-tab {
    padding: 8px 16px;
    border: 1px solid #dfe3ea;
    border-radius: 999px;
    background: #fff;
    font-size: 12.5px;
    font-weight: 600;
    color: #555;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.sort-tab:hover { border-color: #0066cc; color: #0066cc; }
.sort-tab.active {
    background: #0066cc;
    border-color: #0066cc;
    color: #fff;
}

/* 적용된 필터 칩 */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eef5ff;
    border: 1px solid #d6e6ff;
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 12px;
    color: #0066cc;
    text-decoration: none;
    font-weight: 600;
}
.filter-chip:hover { background: #dcebff; }
.filter-chip .x { font-size: 13px; line-height: 1; opacity: 0.7; }

/* ── 모바일: 항상 위쪽 가로 바 ── */
@media (max-width: 900px) {
    .list-layout {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 16px;
    }
    .filter-panel {
        position: static;
        grid-column: 1 / -1;
    }
    .filter-head { flex-wrap: wrap; }
    .facility-grid { grid-template-columns: 1fr 1fr 1fr; }
    .result-title { font-size: 18px; }
}

@media (max-width: 560px) {
    .facility-grid { grid-template-columns: 1fr 1fr; }
    .result-head { align-items: flex-start; }
    .sort-tabs { width: 100%; }
    .sort-tab { flex: 1; text-align: center; padding: 8px 10px; }
}
