/* ── Case filter ── */

.cf {
    position: relative;
}

/* Dropdowns row/column */
.cf__dropdowns {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    position: relative;
    z-index: 10;
}

/* Single select wrapper */
.cf__select {
    position: relative;
    width: 100%;
}

/* ── Trigger (shared base for button + searchable) ── */
.cf__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 10px 10px 20px;
    background: #fff;
    border: 1px solid #d2d2d2;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.48px;
    color: inherit;
    text-align: left;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}

.cf__trigger:focus-visible {
    outline: 2px solid #1a1a1a;
    outline-offset: 2px;
}

/* Open state */
.cf__select--open .cf__trigger {
    border-radius: 10px 10px 0 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .05);
    border-bottom-color: transparent;
}

/* ── Searchable trigger input ── */
.cf__input {
    flex: 1;
    min-width: 0;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    font: inherit;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.48px;
    color: inherit;
    outline: none;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cf__input:not([readonly]) {
    cursor: text;
    font-weight: 400;
}

.cf__input::placeholder {
    color: #a0a0a0;
    font-weight: 400;
}

.cf__input:focus-visible {
    outline: none;
}

/* Focus visible on searchable wrapper (closed only — open panel is its own indicator) */
.cf__select:not(.cf__select--open) .cf__trigger--search:has(.cf__input:focus-visible) {
    outline: 2px solid #1a1a1a;
    outline-offset: 2px;
}

/* No outline when open */
.cf__select--open .cf__trigger:focus-visible,
.cf__select--open .cf__trigger--search {
    outline: none;
}

/* ── Search clear button ── */
.cf__search-clear {
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: #f0f0f1;
    border-radius: 50%;
    cursor: pointer;
    color: #787c82;
    transition: background-color .15s, color .15s;
}

.cf__search-clear[hidden] {
    display: none;
}

.cf__search-clear:not([hidden]) {
    display: flex;
}

.cf__search-clear:hover {
    background: #e4e4e5;
    color: #1a1a1a;
}

.cf__search-clear:focus-visible {
    outline: 2px solid #1a1a1a;
    outline-offset: 2px;
}

/* ── Inactive state ── */
.cf__select--inactive .cf__trigger {
    border-color: #e2e2e2;
    cursor: default;
}

.cf__select--inactive .cf__label,
.cf__select--inactive .cf__input {
    opacity: .3;
}

/* ── Chevron ── */
.cf__chevron {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    color: inherit;
    transition: transform .2s;
}

.cf__select--open .cf__chevron {
    transform: rotate(180deg);
}

.cf__select--inactive .cf__chevron {
    opacity: .3;
}

/* ── Clear all button ── */
.cf__clear {
    background: none;
    border: none;
    padding: 10px 0;
    font-family: inherit;
    font-size: 14px;
    font-weight: 400;
    color: #595959;
    cursor: pointer;
    white-space: nowrap;
    transition: color .15s;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cf__clear:hover,
.cf__clear:focus-visible {
    color: #1a1a1a;
}

.cf__clear:focus-visible {
    outline: 2px solid #1a1a1a;
    outline-offset: 2px;
}

/* ── Label text ── */
.cf__label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Dropdown panel ── */
.cf__dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 247px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #d2d2d2;
    border-top: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .05);
    z-index: 20;
    display: none;
}

.cf__select--open .cf__dropdown {
    display: block;
    animation: cf-dropdown-in .12s cubic-bezier(.16, 1, .3, 1);
}

@keyframes cf-dropdown-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
}

.cf__dropdown::-webkit-scrollbar {
    width: 7px;
}

.cf__dropdown::-webkit-scrollbar-track {
    background: #eee;
    border-radius: 0 0 10px 0;
}

.cf__dropdown::-webkit-scrollbar-thumb {
    background: #d2d2d2;
    border-radius: 2px;
}

/* ── Option row ── */
.cf__option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color .15s;
}

.cf__option:last-of-type {
    border-bottom: none;
}

.cf__option:hover {
    background-color: #fafafa;
}

/* Checked items pinned to top */
.cf__option--pinned {
    background-color: #fffbeb;
}

.cf__option--pinned:hover {
    background-color: #fff6d4;
}

/* ── Hidden native checkbox ── */
.cf__option input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.cf__option input:focus-visible + .cf__checkbox {
    outline: 2px solid #1a1a1a;
    outline-offset: 2px;
}

/* ── Custom checkbox ── */
.cf__checkbox {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 1px solid #d2d2d2;
    border-radius: 4px;
    background: #fff;
    position: relative;
    transition: background-color .15s, border-color .15s;
}

.cf__option input:checked + .cf__checkbox {
    background-color: #FFD75A;
    border-color: #FFD75A;
}

.cf__option input:checked + .cf__checkbox::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 6px;
    width: 5px;
    height: 9px;
    border: solid #1a1a1a;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Single-select: radio style */
[data-single] .cf__checkbox {
    border-radius: 50%;
}

[data-single] .cf__option input:checked + .cf__checkbox::after {
    top: 4px;
    left: 4px;
    width: 10px;
    height: 10px;
    border: none;
    border-radius: 50%;
    background: #1a1a1a;
    transform: none;
}

/* ── Option label text ── */
.cf__option-label {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    color: inherit;
}

.cf__option-label strong {
    font-weight: 700;
}

/* ── Option count badge ── */
.cf__option-count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 500;
    color: #787c82;
    flex-shrink: 0;
    min-width: 24px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    background: #f0f0f1;
    border-radius: 10px;
    padding: 0 7px;
    transition: background-color .15s, color .15s;
}

.cf__option:hover .cf__option-count {
    background: #e4e4e5;
}

.cf__option input:checked ~ .cf__option-count {
    background: #FFD75A;
    color: #1a1a1a;
}

/* ── Indented hierarchy depth ── */
.cf__option[data-depth="1"] { padding-left: 40px; }
.cf__option[data-depth="2"] { padding-left: 60px; }
.cf__option[data-depth="3"] { padding-left: 80px; }
.cf__option[data-depth="4"] { padding-left: 100px; }
.cf__option[data-depth="5"] { padding-left: 120px; }

/* ── No results message ── */
.cf__no-results {
    padding: 12px 20px;
    text-align: center;
    color: #787c82;
    font-size: 14px;
}

/* ── Loader (injected by JS) ── */
.cf__loader {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .6);
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.cf__spinner {
    width: 44px;
    height: 44px;
    animation: cf-spin .8s linear infinite;
}

.cf__spinner circle {
    stroke: #FFD75A;
    stroke-dasharray: 80;
    stroke-dashoffset: 60;
    stroke-linecap: round;
}

@keyframes cf-spin {
    to { transform: rotate(360deg); }
}

/* ── Fade for project grid ── */
.cf-loading-target {
    opacity: .4;
    pointer-events: none;
    transition: opacity .3s ease;
}

/* ── Screen reader only ── */
.cf__live-region {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Desktop ── */
@media (min-width: 768px) {
    .cf__dropdowns {
        flex-direction: row;
        align-items: center;
        width: auto;
    }

    .cf__select {
        width: 307px;
    }
}
