/* Path: wp-content/plugins/wcellar-filter/assets/css/filter-bar.css
 * PLP 상단 필터 바 — 사이드바 대체. 배치는 행사 페이지(/event/)와 동일.
 *
 * 주의: .wcf-bar 에 clip-path/overflow 를 걸면 드롭다운 팝오버가 잘린다.
 */

.wcf-bar-outer {
    position: sticky;
    top: 0; /* filter-bar.js 가 사이트 헤더 높이로 덮어쓴다 */
    z-index: 500;
    background: #fff;
    box-shadow: 0 6px 14px -10px rgba(0, 0, 0, .18);
}

.wcf-bar {
    box-sizing: border-box;
    max-width: 1600px;
    margin: 0 auto;
    padding: 10px 60px 11px;
    background: #fff;
    color: #1a1a1a;
    border-bottom: 1px solid #ececec;
    flex-wrap: wrap;
}

/* 데스크톱: 컨트롤 한 줄 + 우측 끝에 상품수·정렬 */
.wcf-bar {
    display: flex;
    align-items: flex-end;
    gap: 8px 14px;
}

.wcf-controls {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    flex: 1 1 auto;
    gap: 8px 14px;
}

.wcf-meta {
    display: flex;
    align-items: flex-end;
    flex: 0 0 auto;
    gap: 12px;
}

/* 모바일 전용 '필터' 버튼 — 데스크톱에서는 숨김 */
.wcf-mobile-toggle {
    display: none;
}

.wcf-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 0;
    min-width: 100px;
}

.wcf-block--wide {
    flex: 1.6 1 0; /* 와이너리는 이름이 길어 넓게 */
    min-width: 150px;
}

/* 우측 끝: 상품 수 + 정렬 — 한 줄 안에서 줄어들지 않게 */
.wcf-block--end {
    flex: 0 0 auto;
    flex-direction: row;
    align-items: flex-end;
    gap: 12px;
    margin-left: auto;
}

.wcf-block-label {
    font-size: 10.5px;
    letter-spacing: .06em;
    color: rgba(26, 26, 26, .5);
    text-transform: uppercase;
}

.wcf-total {
    margin: 0 0 9px;
    font-size: 12.5px;
    color: rgba(26, 26, 26, .55);
    white-space: nowrap;
}

.wcf-total b {
    font-size: 14px;
    color: #9b0047;
}

.wcf-sort-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wcf-sort {
    min-width: 148px;
    padding: 8px 30px 8px 12px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%239b0047' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right 12px center;
    border: 1px solid #dcdcdc;
    border-radius: 2px;
    -webkit-appearance: none;
    appearance: none;
    font-family: inherit;
    font-size: 13px;
    color: #1a1a1a;
    cursor: pointer;
}

.wcf-sort:hover {
    border-color: #9b0047;
}

/* 테마 기본 정렬 드롭다운은 상단 바가 대체한다 */
.plp-header .plp-sort {
    display: none;
}

/* ── 컨트롤(버튼 + 팝오버) ───────────────────────── */
.wcf-ctrl {
    position: relative;
}

.wcf-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #dcdcdc;
    border-radius: 2px;
    font-family: inherit;
    font-size: 13px;
    color: #1a1a1a;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

.wcf-btn:hover {
    border-color: #9b0047;
}

.wcf-btn[aria-expanded="true"] {
    border-color: #9b0047;
    box-shadow: 0 0 0 2px rgba(155, 0, 71, .12);
}

.wcf-btn-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wcf-caret {
    flex: 0 0 auto;
    color: #9b0047;
}

/* ── 팝오버 ──────────────────────────────────────── */
.wcf-pop {
    position: absolute;
    z-index: 600;
    top: calc(100% + 4px);
    left: 0;
    min-width: 240px;
    max-width: 78vw;
    padding: 8px;
    background: #fff;
    border: 1px solid #dcdcdc;
    border-radius: 8px;
    box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .22);
}

.wcf-pop[hidden] {
    display: none;
}

/* 오른쪽 끝 컨트롤은 팝오버를 왼쪽으로 정렬해 화면 밖으로 나가지 않게 */
.wcf-controls > .wcf-block:nth-last-child(2) .wcf-pop,
.wcf-controls > .wcf-block:nth-last-child(3) .wcf-pop {
    left: auto;
    right: 0;
}

.wcf-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.wcf-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 5px;
    font-size: 13.5px;
    line-height: 1.3;
    color: #1a1a1a;
    cursor: pointer;
}

.wcf-opt:hover {
    background: #f6eef2;
    color: #9b0047;
}

/* 체크박스 — 테마 전역 CSS 가 input 에 appearance:none 을 걸어 크기가 0 이 된다.
   (그래서 골라도 체크 표시가 전혀 안 보였다) 여기서 직접 네모+체크표시를 그린다. */
.wcf-opt input[type="checkbox"] {
    flex: 0 0 auto;
    position: relative;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background: #fff;
    border: 1.5px solid #c9c9c9;
    border-radius: 3px;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: background-color .12s, border-color .12s;
}

.wcf-opt input[type="checkbox"]:hover {
    border-color: #9b0047;
}

.wcf-opt input[type="checkbox"]:checked {
    background: #9b0047;
    border-color: #9b0047;
}

/* 체크 표시(✓) */
.wcf-opt input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    top: 1px;
    left: 5px;
    width: 4px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.wcf-opt input[type="checkbox"]:focus-visible {
    outline: 2px solid rgba(155, 0, 71, .35);
    outline-offset: 1px;
}

/* 고른 항목은 줄 전체를 강조 — 한눈에 보이게 */
.wcf-opt:has(input[type="checkbox"]:checked) {
    background: #f6eef2;
    color: #9b0047;
    font-weight: 600;
}

.wcf-opt-name {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wcf-count {
    flex: 0 0 auto;
    font-size: 11.5px;
    color: rgba(26, 26, 26, .45);
}

.wcf-filter-input,
.wcf-winery-search {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    margin-bottom: 6px;
    font-family: inherit;
    font-size: 16px; /* iOS 자동 확대 방지 */
    color: #1a1a1a;
    border: 1px solid #dcdcdc;
    border-radius: 5px;
}

.wcf-filter-input:focus,
.wcf-winery-search:focus {
    outline: none;
    border-color: #9b0047;
}

.wcf-hint {
    margin: 2px 0 8px;
    font-size: 11.5px;
    line-height: 1.5;
    color: rgba(26, 26, 26, .5);
}

.wcf-hint code {
    padding: 1px 4px;
    background: #f3f3f3;
    border-radius: 3px;
    font-size: 11px;
}

.wcf-empty,
.wcf-more {
    padding: 12px 10px;
    text-align: center;
    font-size: 12.5px;
    color: rgba(26, 26, 26, .45);
}

.wcf-winery-pick {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 10px;
    background: none;
    border: 0;
    border-radius: 5px;
    font-family: inherit;
    font-size: 13.5px;
    text-align: left;
    color: #1a1a1a;
    cursor: pointer;
}

.wcf-winery-pick:hover,
.wcf-winery-pick.is-active {
    background: #f6eef2;
    color: #9b0047;
}

/* 범위(가격·빈티지) */
.wcf-pop-range {
    min-width: 268px;
}

.wcf-range-fields {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 2px;
}

.wcf-range-fields label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 0;
    font-size: 11.5px;
    color: rgba(26, 26, 26, .55);
}

.wcf-range-fields input {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 8px;
    font-family: inherit;
    font-size: 15px;
    border: 1px solid #dcdcdc;
    border-radius: 5px;
}

.wcf-range-sep {
    align-self: flex-end;
    padding-bottom: 8px;
    color: rgba(26, 26, 26, .4);
}

.wcf-range-apply,
.wcf-show-more {
    width: 100%;
    padding: 9px 10px;
    margin-top: 4px;
    background: #9b0047;
    border: 0;
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    color: #fff;
    cursor: pointer;
}

.wcf-show-more {
    background: #fff;
    border: 1px solid #dcdcdc;
    color: #1a1a1a;
}

.wcf-range-apply:hover {
    background: #7d0039;
}

/* ── 선택 칩 ─────────────────────────────────────── */
.wcf-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding-top: 8px;
}

.wcf-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 10px;
    background: #f6eef2;
    border-radius: 999px;
    font-size: 12.5px;
    color: #9b0047;
}

.wcf-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    background: rgba(155, 0, 71, .12);
    border: 0;
    border-radius: 50%;
    font-size: 13px;
    line-height: 1;
    color: #9b0047;
    cursor: pointer;
}

.wcf-chip-remove:hover {
    background: rgba(155, 0, 71, .25);
}

.wcf-clear-all {
    padding: 5px 10px;
    background: none;
    border: 0;
    font-family: inherit;
    font-size: 12.5px;
    color: rgba(26, 26, 26, .55);
    text-decoration: underline;
    cursor: pointer;
}

.wcf-clear-all:hover {
    color: #9b0047;
}

/* ── 모바일: 2열 + 팝오버는 바텀시트 ─────────────── */
@media (max-width: 768px) {
    .wcf-bar {
        padding: 8px 16px 9px;
    }

    /* 고정 바에는 [필터] [N개 상품] [정렬] 한 줄만 남긴다 */
    .wcf-meta {
        flex: 1 1 auto;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        width: 100%;
    }

    .wcf-mobile-toggle {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 8px 12px;
        background: #fff;
        border: 1px solid #dcdcdc;
        border-radius: 2px;
        font-family: inherit;
        font-size: 13px;
        color: #1a1a1a;
        cursor: pointer;
    }

    .wcf-mobile-toggle b {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 17px;
        height: 17px;
        background: #9b0047;
        border-radius: 999px;
        font-size: 11px;
        color: #fff;
    }

    .wcf-total {
        margin: 0;
        font-size: 12px;
    }

    .wcf-sort-block .wcf-block-label {
        display: none;
    }

    .wcf-sort {
        min-width: 0;
        max-width: 132px;
    }

    /* 필터 컨트롤은 '필터' 버튼을 눌렀을 때 바텀시트로 올라온다 */
    .wcf-controls {
        display: none;
    }

    body.wcf-filters-open .wcf-controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        position: fixed;
        z-index: 10000;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 78vh;
        overflow-y: auto;
        padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
        background: #fff;
        border-radius: 14px 14px 0 0;
        box-shadow: 0 -8px 30px -8px rgba(0, 0, 0, .3);
    }

    body.wcf-filters-open::before {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 9998;
        background: rgba(0, 0, 0, .35);
    }

    .wcf-block,
    .wcf-block--wide {
        min-width: 0;
    }

    .wcf-ctrl {
        position: static;
    }

    .wcf-pop {
        position: fixed;
        z-index: 10000;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        min-width: 0;
        max-width: none;
        max-height: 72vh;
        overflow-y: auto;
        padding: 16px;
        border: 0;
        border-radius: 14px 14px 0 0;
        box-shadow: 0 -8px 30px -8px rgba(0, 0, 0, .3);
    }

    .wcf-list {
        max-height: 46vh;
    }

    body.wcf-pop-open::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 9999;
        background: rgba(0, 0, 0, .35);
    }
}

/* ==========================================================================
   모바일 필터 — 전체화면 방식
   '필터' 버튼 한 번 → 화면 전체가 필터로 전환 → 여러 개 고른 뒤 '결과 보기' 한 번에 적용.
   (예전에는 시트 위에 시트가 겹치고, 체크할 때마다 페이지가 리로드돼 답답했다)
   ========================================================================== */

/* 시트 헤더/푸터는 기본(데스크톱·현행 모바일)에서는 숨김 */
.wcf-sheet-head,
.wcf-sheet-foot {
    display: none;
}

@media (max-width: 768px) {

    /* ---------- 공통: 아코디언(팝오버를 그 자리에 펼침) ---------- */
    .wcf-controls,
    .wcf-controls {
        display: none;
        grid-template-columns: 1fr;  /* 한 줄에 하나씩 */
        gap: 0;
        padding: 0;
    }

    body.wcf-filters-open .wcf-controls,
    body.wcf-filters-open .wcf-controls {
        display: block;
    }

    .wcf-sheet-head,
    .wcf-sheet-head,
    .wcf-sheet-foot,
    .wcf-sheet-foot {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .wcf-sheet-head,
    .wcf-sheet-head {
        position: sticky;
        top: 0;
        z-index: 2;
        padding: 14px 16px;
        background: #fff;
        border-bottom: 1px solid #ececec;
    }

    .wcf-sheet-title {
        flex: 1 1 auto;
        font-size: 15px;
        font-weight: 600;
    }

    .wcf-sheet-reset {
        padding: 6px 10px;
        background: none;
        border: 0;
        font-family: inherit;
        font-size: 12.5px;
        color: rgba(26, 26, 26, .55);
        text-decoration: underline;
    }

    .wcf-sheet-close {
        width: 30px;
        height: 30px;
        padding: 0;
        background: none;
        border: 0;
        font-size: 22px;
        line-height: 1;
        color: #1a1a1a;
    }

    /* 각 필터 = 아코디언 한 줄 */
    .wcf-block,
    .wcf-block {
        display: block;
        border-bottom: 1px solid #f0f0f0;
    }

    .wcf-block-label,
    .wcf-block-label {
        display: none;   /* 버튼 안에 이름이 있으므로 위 라벨은 뺀다 */
    }

    .wcf-btn,
    .wcf-btn {
        padding: 15px 16px;
        border: 0;
        border-radius: 0;
        font-size: 14.5px;
    }

    .wcf-btn[aria-expanded="true"],
    .wcf-btn[aria-expanded="true"] {
        box-shadow: none;
        color: #9b0047;
    }

    /* 팝오버가 바텀시트가 아니라 '그 자리에서 펼쳐진다' */
    .wcf-pop,
    .wcf-pop {
        position: static;
        max-height: none;
        padding: 0 16px 14px;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .wcf-list,
    .wcf-list {
        max-height: 240px;
    }

    /* 하단 고정 '결과 보기' */
    .wcf-sheet-foot,
    .wcf-sheet-foot {
        position: sticky;
        bottom: 0;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
        background: #fff;
        border-top: 1px solid #ececec;
    }

    .wcf-sheet-apply {
        width: 100%;
        padding: 14px;
        background: #9b0047;
        border: 0;
        border-radius: 4px;
        font-family: inherit;
        font-size: 14.5px;
        color: #fff;
    }

    
    /* ---------- 모바일: 전체화면 필터 ---------- */
    body.wcf-filters-open {
        overflow: hidden; /* 뒤 목록이 스크롤되지 않게 */
    }

    /* sticky 바(z-index:500)가 쌓임 맥락을 만들어 그 안의 fixed 패널이 갇힌다.
       전체화면일 때만 sticky 를 풀어 패널이 사이트 헤더 위로 올라오게 한다. */
    body.wcf-filters-open .wcf-bar-outer {
        position: static;
        z-index: auto;
    }

    body.wcf-filters-open .wcf-controls {
        position: fixed;
        z-index: 100000;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        display: block;
        max-height: none; /* 기본 바텀시트의 78vh 제한을 푼다 — 전체화면이므로 */
        padding: 0;
        overflow-y: auto;
        background: #fff;
        border-radius: 0;
        box-shadow: none;
    }

    body.wcf-filters-open::before {
        display: none;   /* 전체화면이라 백드롭 불필요 */
    }
}

/* ── 등록일자 필터 (평점 대체): 라디오 단일선택 + 특정날짜 ── */
.wcf-opt input[type="radio"] {
    flex: 0 0 auto; position: relative;
    width: 18px; height: 18px; min-width: 18px; min-height: 18px;
    margin: 0; padding: 0; box-sizing: border-box;
    background: #fff; border: 1.5px solid #c9c9c9; border-radius: 50%;
    -webkit-appearance: none; appearance: none; cursor: pointer;
    transition: background-color .12s, border-color .12s;
}
.wcf-opt input[type="radio"]:hover { border-color: #9b0047; }
.wcf-opt input[type="radio"]:checked { border-color: #9b0047; }
.wcf-opt input[type="radio"]:checked::after {
    content: ""; position: absolute; top: 4px; left: 4px;
    width: 8px; height: 8px; border-radius: 50%; background: #9b0047;
}
.wcf-opt input[type="radio"]:focus-visible { outline: 2px solid rgba(155,0,71,.35); outline-offset: 1px; }
.wcf-opt:has(input[type="radio"]:checked) { background: #f6eef2; color: #9b0047; font-weight: 600; }

.wcf-date-specific { padding: 10px; border-top: 1px solid #eee; margin-top: 4px; display: block; }
.wcf-date-specific-label { display: block; font-size: 12px; color: #888; margin-bottom: 6px; white-space: normal; }
.wcf-date-row { display: flex; gap: 6px; align-items: center; }
.wcf-date-input {
    flex: 1 1 auto; min-width: 0; padding: 6px 8px;
    border: 1.5px solid #d5d5d5; border-radius: 5px; font-size: 13px; color: #1a1a1a; background: #fff;
}
.wcf-date-apply {
    flex: 0 0 auto; padding: 6px 12px; border: 0; border-radius: 5px;
    background: #9b0047; color: #fff; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.wcf-date-apply:hover { background: #7d0039; }
