/* =========================================================
 * MHB Post Filter
 * ========================================================= */
.mhb-pf {
    --mhb-pf-accent: #00009D;
    width: 100%;
    box-sizing: border-box;
}
.mhb-pf *,
.mhb-pf *::before,
.mhb-pf *::after {
    box-sizing: border-box;
}

/* -------- Collapse row -------- */
.mhb-pf-collapse-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}
.mhb-pf-collapse {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #c9d4e2;
    border-radius: 999px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1;
    transition: background .2s ease;
}
.mhb-pf-collapse:hover { background: #f3f6fa; }
.mhb-pf-chevron {
    display: inline-flex;
    transition: transform .25s ease;
}
.mhb-pf.is-collapsed .mhb-pf-chevron { transform: rotate(180deg); }

/* -------- Bar -------- */
.mhb-pf-bar {
    background: #E8EEF5;
    border-radius: 6px;
    padding: 24px 28px;
    overflow: visible;
    transition: max-height .3s ease, opacity .25s ease, padding .3s ease;
}
.mhb-pf.is-collapsed .mhb-pf-bar {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.mhb-pf-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 28px;
}

/* -------- Field / label -------- */
.mhb-pf-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}
.mhb-pf-year,
.mhb-pf-sort {
    flex: 1 1 240px;
    max-width: 320px;
}
.mhb-pf-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--mhb-pf-accent);
    line-height: 1.2;
}

/* -------- Shared control look -------- */
.mhb-pf-control {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #fff;
    color: #1f2937;
    border: 1px solid #c9d4e2;
    border-radius: 4px;
    padding: 11px 14px;
    font-size: 15px;
    line-height: 1.3;
    min-height: 44px;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}
.mhb-pf-control:focus,
.mhb-pf-control:focus-visible {
    outline: none;
    border-color: var(--mhb-pf-accent);
    box-shadow: 0 0 0 2px rgba(0, 0, 157, 0.12);
}
.mhb-pf-caret {
    display: inline-flex;
    color: #6b7280;
    flex: 0 0 auto;
}

/* -------- Year dropdown -------- */
.mhb-pf-dropdown { position: relative; }
.mhb-pf-toggle-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mhb-pf-panel {
    position: absolute;
    z-index: 40;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid #c9d4e2;
    border-radius: 6px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.15);
    padding: 6px;
    display: none;
}
.mhb-pf-dropdown.is-open .mhb-pf-panel { display: block; }
.mhb-pf-dropdown.is-open .mhb-pf-caret { transform: rotate(180deg); }

.mhb-pf-options {
    max-height: 240px;
    overflow-y: auto;
}
.mhb-pf-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    color: #1f2937;
}
.mhb-pf-option:hover { background: #f3f6fa; }
.mhb-pf-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.mhb-pf-check {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border: 2px solid #b6c2d3;
    border-radius: 3px;
    position: relative;
    transition: background .15s ease, border-color .15s ease;
}
.mhb-pf-option input:checked + .mhb-pf-check {
    background: var(--mhb-pf-accent);
    border-color: var(--mhb-pf-accent);
}
.mhb-pf-option input:checked + .mhb-pf-check::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.mhb-pf-option input:focus-visible + .mhb-pf-check {
    box-shadow: 0 0 0 2px rgba(0, 0, 157, 0.25);
}
.mhb-pf-done {
    width: 100%;
    margin-top: 6px;
    background: var(--mhb-pf-accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 11px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .04em;
    cursor: pointer;
    font-family: inherit;
}
.mhb-pf-done:hover { filter: brightness(1.1); }
.mhb-pf-empty {
    padding: 12px 10px;
    color: #6b7280;
    font-size: 14px;
}

/* -------- Sort (native select) -------- */
.mhb-pf-select-wrap { position: relative; }
.mhb-pf-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 40px;
}
.mhb-pf-select-wrap .mhb-pf-caret {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* -------- Actions -------- */
.mhb-pf-actions {
    flex-direction: row;
    align-items: center;
    gap: 20px;
    flex: 0 0 auto;
}
.mhb-pf-search {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: var(--mhb-pf-accent);
    border: 1.5px solid var(--mhb-pf-accent);
    border-radius: 999px;
    padding: 10px 22px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    transition: background .2s ease, color .2s ease;
    font-family: inherit;
}
.mhb-pf-search:hover {
    background: var(--mhb-pf-accent);
    color: #fff;
}
.mhb-pf-reset {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #4b5563;
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
}
.mhb-pf-reset:hover { color: var(--mhb-pf-accent); }

/* -------- Responsive -------- */
@media (max-width: 767px) {
    .mhb-pf-fields {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    /* Kill the desktop flex-grow — in a column it stretches each field
       vertically and creates large gaps that ignore the gap value. */
    .mhb-pf-year,
    .mhb-pf-sort,
    .mhb-pf-actions {
        flex: 0 0 auto;
        max-width: none;
        width: 100%;
    }
    .mhb-pf-actions {
        justify-content: space-between;
    }
    .mhb-pf-search { flex: 1 1 auto; justify-content: center; }
}
