/* 並び替え・絞り込みのモーダル（PageParts/modal-filtering.php）。図鑑と Review で共有 */
.modal-filtering {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: min(92%, 520px);
    max-height: calc(var(--vh, 1vh) * 100 - 77px);
    display: none;
    flex-direction: column;
    z-index: 11;
    background: #fff;
    color: #06293a;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 20, 35, .45);
    opacity: 0;
    overflow: hidden;
}
@media (min-width: 992px) {
    .modal-filtering {
        top: 80px;
        margin-left: 130px; /* サイドバーの幅の半分だけ右へ */
    }
}
.modal-filtering[style*="block"] {
    display: flex !important;
}

.mf-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 6px;
}
.mf-title {
    font-size: 18px;
    font-weight: 800;
}
.mf-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #eef3f6;
    color: #405763;
    font-size: 18px;
    cursor: pointer;
}

.modal-filtering-selectwrap {
    flex: 1;
    overflow-y: auto;
    padding: 0 18px;
}
.mf-section {
    padding: 12px 0;
    border-top: 1px solid #e3eaee;
}
.mf-section:first-child { border-top: none; }
.mf-heading {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 800;
    color: #0d5a7d;
    text-transform: none;
}
.mf-sortrow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.mf-label {
    flex: none;
    width: 3.6em;
    font-size: 13px;
    font-weight: 700;
    color: #5b6b75;
}
.mf-select {
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 38px;
    padding: 0 10px;
    border: 1px solid #c9d6de;
    border-radius: 8px;
    background: #fff;
    color: #06293a;
    font-size: 15px;
}
/* 降順／昇順。アイコンだけでは分からないので文字も出す */
.mf-order {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: .35em;
    height: 38px;
    padding: 0 12px;
    border: 1px solid #c9d6de;
    border-radius: 8px;
    background: #f5f8fa;
    color: #06293a;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.mf-order-text:empty { display: none; }

.mf-check {
    align-items: center;
    gap: 8px;
    margin: 2px 0 0;
    font-size: 14px;
    font-weight: 700;
    color: #06293a;
    cursor: pointer;
}
.mf-check input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: #2ea44f;
}

.mf-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.mf-chip {
    padding: 6px 14px;
    border: 1px solid #c9d6de;
    border-radius: 999px;
    background: #fff;
    color: #06293a;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.mf-chip.is-active {
    background: #06293a;
    border-color: #06293a;
    color: #fff;
}
.mf-filter-value[hidden] { display: none; }
/* 値は札で選ぶ（modal-filtering.php の script）。多いときは、この枠の中でスクロールする */
.mf-filter-value.is-mirrored { display: none; }
.mf-values {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: min(34vh, 220px);
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #e3eaee;
    border-radius: 10px;
    background: #f5f8fa;
}
.mf-values[hidden] { display: none; }
.mf-values .mf-chip { padding: 5px 12px; font-size: 13px; }

/* 図鑑のときだけ出す部品。Review では出さない（押しても何も起きないため） */
.mf-dict-only { display: none; }
.modal-filtering.is-dict .mf-dict-only { display: inline-flex; }
.modal-filtering.is-dict .mf-close { display: grid; place-items: center; }

.modal-filtering-btnwrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px 14px;
    border-top: 1px solid #e3eaee;
}
.mf-reset {
    margin-right: auto;
    border: none;
    background: none;
    color: #5b6b75;
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
}
.modal-filtering-btn {
    min-width: 96px;
    height: 40px;
    padding: 0 18px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
.mf-btn--ghost {
    border: 1px solid #c9d6de;
    background: #fff;
    color: #405763;
}
.mf-btn--primary {
    border: none;
    background: #78e2a8; /* 採集ページのボタンと同じ緑 */
    color: #fff;
}
/* Review は right 側だけのレイアウトなので、ボタンを右寄せに */
.modal-filtering:not(.is-dict) .modal-filtering-btnwrap { justify-content: flex-end; }

.modal-filtering.fadein.is-animated {
    animation: popup 0.4s cubic-bezier(0.22, 1, 0.36, 1) 1 forwards;
}
@keyframes popup {
    0% { opacity: 0; margin-top: 30px; }
    100% { opacity: 1; margin-top: 0; }
}
