/* ===========================
   LOOP FILTERS — dropdown + grid states
   Matches the pagination style · square corners
   =========================== */

.tbmlf,
.tbmlf *,
.tbmlf *::before,
.tbmlf *::after {
    box-sizing: border-box;
    border-radius: 0 !important;
}

.tbmlf [hidden] {
    display: none !important;
}

.tbmlf {
    --lf-ink: #000000;
    --lf-text: #666666;
    --lf-line: #E0E0E0;
    --lf-hover: #F2F2F2;
    --lf-width: 240px;   /* fixed, so it doesn't jump when the label changes */

    position: relative;
    z-index: 20;
    width: var(--lf-width);
    max-width: 100%;
    font-family: inherit;
}

.tbmlf__sr {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ---------- CONTROL ---------- */

.tbmlf__control {
    display: flex;
    gap: 6px;
}

.tbmlf .tbmlf__button {
    display: flex !important;
    flex: 1 1 auto;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    min-width: 0;
    height: 48px !important;
    margin: 0 !important;
    padding: 0 16px !important;
    font-family: inherit !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
    letter-spacing: 0 !important;
    text-align: left !important;
    text-transform: none !important;
    text-decoration: none !important;
    color: #111111 !important;
    background: #ffffff !important;
    border: 1px solid var(--lf-line) !important;
    box-shadow: none !important;
    cursor: pointer;
    transition: border-color 0.2s ease !important;
}

.tbmlf .tbmlf__button:hover,
.tbmlf.is-open .tbmlf__button {
    border-color: var(--lf-ink) !important;
}

.tbmlf .tbmlf__button:focus {
    outline: none !important;
}

.tbmlf .tbmlf__button:focus-visible {
    outline: 2px solid var(--lf-ink) !important;
    outline-offset: 2px !important;
}

.tbmlf__value {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.tbmlf.is-filtered .tbmlf__value {
    color: var(--lf-ink);
    font-weight: 600;
}

/* Chevron — same as the nav */
.tbmlf__chevron {
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tbmlf.is-open .tbmlf__chevron {
    transform: translateY(2px) rotate(-135deg);
}

/* Reset (×) */
.tbmlf .tbmlf__reset {
    position: relative !important;
    flex: 0 0 48px;
    width: 48px !important;
    height: 48px !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #111111 !important;
    background: #ffffff !important;
    border: 1px solid var(--lf-line) !important;
    box-shadow: none !important;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease !important;
}

.tbmlf .tbmlf__reset::before,
.tbmlf .tbmlf__reset::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 1.5px;
    background: currentColor;
    transform: translate(-50%, -50%) rotate(45deg);
}

.tbmlf .tbmlf__reset::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.tbmlf .tbmlf__reset:hover {
    color: #000000 !important;
    background: #DFDFDF !important;
    border-color: #DFDFDF !important;
}

.tbmlf .tbmlf__reset:focus-visible {
    outline: 2px solid var(--lf-ink) !important;
    outline-offset: 2px !important;
}

/* ---------- PANEL ---------- */

.tbmlf__panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 30;
    min-width: 100%;
    width: max-content;
    max-width: min(320px, calc(100vw - 32px));
    padding: 6px;
    background: #ffffff;
    border: 1px solid var(--lf-line);
    box-shadow: 0 16px 36px -14px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.2s ease,
                transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1),
                visibility 0s linear 0.25s;
}

/* Opens leftwards when there's no room on the right */
.tbmlf.is-right .tbmlf__panel {
    left: auto;
    right: 0;
}

.tbmlf.is-open .tbmlf__panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    transition-delay: 0s;
}

.tbmlf__list {
    position: relative;
    max-height: 320px;
    margin: 0 !important;
    padding: 0 !important;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none !important;
    outline: none;
}

/* ---------- OPTIONS ---------- */

.tbmlf__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin: 0 !important;
    padding: 10px 14px 10px calc(14px + var(--lf-depth, 0) * 14px);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--lf-text);
    white-space: nowrap;
    list-style: none !important;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.tbmlf__option + .tbmlf__option {
    margin-top: 2px !important;
}

/* Highlighted (mouse / keyboard) */
.tbmlf__option.is-active {
    color: var(--lf-ink);
    background: var(--lf-hover);
}

/* Selected — same as the pagination's current page */
.tbmlf__option[aria-selected="true"] {
    color: #ffffff;
    background: var(--lf-ink);
}

.tbmlf__text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tbmlf__count {
    flex-shrink: 0;
    font-size: 13px;
    color: #9a9a9a;
    font-variant-numeric: tabular-nums;
}

.tbmlf__option[aria-selected="true"] .tbmlf__count {
    color: rgba(255, 255, 255, 0.6);
}

.tbmlf__count:empty {
    display: none;
}

/* ---------- GRID STATES ---------- */

.tbmlf-hidden {
    display: none !important;
}

.tbmlf-grid {
    transition: opacity 0.15s ease;
}

.tbmlf-grid.tbmlf-leaving {
    opacity: 0;
}

.tbmlf-in {
    animation: tbmlf-in 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
    animation-delay: calc(var(--lf-i, 0) * 35ms);
}

@keyframes tbmlf-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.tbmlf-empty {
    margin: 0;
    padding: 40px 20px;
    font-size: 15px;
    text-align: center;
    color: #666666;
    border: 1px dashed #E0E0E0;
    border-radius: 0;
}

.tbmlf-empty[hidden] {
    display: none !important;
}

/* ---------- PAGINATION (same as the site's Elementor pagination) ---------- */

.tbmlf-pager[hidden] {
    display: none !important;
}

.tbmlf-pagination {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 4px !important;
    margin-top: 50px !important;
    padding: 0 !important;
}

.tbmlf-pagination .page-numbers {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 38px !important;
    height: 38px !important;
    margin: 0 !important;
    padding: 0 10px !important;
    border: 1px solid #E0E0E0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #666666 !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    transition: background .2s ease, border-color .2s ease, color .2s ease !important;
}

.tbmlf-pagination a.page-numbers:hover {
    background: #DFDFDF !important;
    border-color: #DFDFDF !important;
    color: #000000 !important;
}

.tbmlf-pagination a.page-numbers:focus-visible {
    outline: 2px solid #000000 !important;
    outline-offset: 2px !important;
}

.tbmlf-pagination .page-numbers.current {
    background: #000000 !important;
    border-color: #000000 !important;
    color: #ffffff !important;
}

.tbmlf-pagination .page-numbers.dots {
    min-width: auto !important;
    padding: 0 6px !important;
    border-color: transparent !important;
    background: transparent !important;
    color: #888888 !important;
}

.tbmlf-pagination .page-numbers.prev,
.tbmlf-pagination .page-numbers.next {
    padding: 0 14px !important;
}

/* ---------- LOAD MORE / LOAD LESS ---------- */

.tbmlf-loadmore {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 50px;
}

.tbmlf-pager .tbmlf-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 150px !important;
    height: 46px !important;
    margin: 0 !important;
    padding: 0 28px !important;
    font-family: inherit !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    text-decoration: none !important;
    border: 1px solid #E0E0E0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, color .2s ease !important;
}

/* Load More — solid, like the current page */
.tbmlf-pager .tbmlf-btn--more {
    color: #ffffff !important;
    background: #000000 !important;
    border-color: #000000 !important;
}

.tbmlf-pager .tbmlf-btn--more:hover {
    background: #333333 !important;
    border-color: #333333 !important;
}

/* Load Less — outline, like a page number */
.tbmlf-pager .tbmlf-btn--less {
    color: #666666 !important;
    background: transparent !important;
}

.tbmlf-pager .tbmlf-btn--less:hover {
    color: #000000 !important;
    background: #DFDFDF !important;
    border-color: #DFDFDF !important;
}

.tbmlf-pager .tbmlf-btn:focus-visible {
    outline: 2px solid #000000 !important;
    outline-offset: 2px !important;
}

.tbmlf-counter {
    margin: 14px 0 0;
    font-size: 13px;
    text-align: center;
    color: #888888;
    font-variant-numeric: tabular-nums;
}

/* Setup problems (admins only) */
.tbmlf-notice {
    margin: 8px 0 0;
    padding: 10px 14px;
    font-size: 13px;
    color: #1a1a1a;
    background: #F2F2F2;
    border-left: 3px solid #000000;
    border-radius: 0;
}

@media (prefers-reduced-motion: reduce) {
    .tbmlf *,
    .tbmlf *::before,
    .tbmlf-grid,
    .tbmlf-in {
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
        animation: none !important;
    }
}