[data-filter-select-root] .nice-select .list {
    box-sizing: border-box;
    width: 100%;
    left: 0;
    max-height: 18rem;
    overflow-y: auto;
    padding: 0;
    border: 1px solid var(--ui-border-color, #00000029);
    border-radius: 0;
    box-shadow: 0 5px 15px #00000012;
}

[data-filter-select-root] .nice-select .list [hidden] {
    display: none;
}

/* Closed scroll lists/search inputs must not receive native keyboard focus. */
[data-filter-select-root] div.nice-select:not(.open) > .list {
    visibility: hidden;
    transition-property: transform, opacity;
}

[data-filter-select-root] div.nice-select.open > .list {
    visibility: visible;
}

[data-filter-select-root] .nice-select .list .option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    min-height: 2.2rem;
    padding: .4rem .65rem;
    line-height: 1.3;
}

[data-filter-select-root] .nice-select .option > .filter-widget__count {
    margin-left: auto;
}

[data-filter-select-root] .nice-select .list .option:hover {
    background: #f5f5f5;
}

/* Nice Select изчиства фона на не-hover редовете с !important. Запазваме избора и клавиатурния фокус. */
[data-filter-select-root] .nice-select .list .option.selected, [data-filter-select-root] .nice-select .list .option.focus {
    background-color: #f9edf0 !important;
    box-shadow: inset 3px 0 #c92747;
}

.filter-select__selected-count {
    position: static;
    order: 1;
    flex-shrink: 0;
    margin-left: auto;
    pointer-events: none;
}

[data-filter-select-root] .nice-select > .filter-select__selected-count[hidden] {
    display: none;
}

[data-filter-select-root] .nice-select .list .filter-select__clear-row {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding: 0;
    border-top: 1px solid var(--ui-border-color, #00000029);
    background: #fff;
}

.filter-select__clear {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    min-height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #c92747;
    font: inherit;
    font-size: .75rem;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
}

.filter-select__clear::before {
    content: '';
    flex: 0 0 1rem;
    width: 1rem;
    height: 1rem;
    background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 10a9 9 0 1 1 2 8M3 4v6h6'/%3E%3C/svg%3E") center / contain no-repeat;
}

.filter-select__clear:hover {
    color: var(--main-color-1, #fff);
    background: var(--main-color-2, #c92747);
}

.filter-select__clear:focus-visible {
    outline: 1px solid #d4a3ac;
    outline-offset: -1px;
    color: var(--main-color-1, #fff);
    background: var(--main-color-2, #c92747);
    box-shadow: inset 3px 0 #c92747;
}

[data-filter-select-root] .nice-select .list .filter-select__dropdown-header {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 0;
    background: #fff;
    cursor: default;
}

.filter-select__selected-options {
    max-height: 7rem;
    overflow-y: auto;
    padding: .25rem .4rem;
    border-bottom: 1px solid var(--ui-border-color, #00000029);
}

.filter-select__selected-option {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    min-height: 2.2rem;
    padding: .4rem .5rem;
    border: 0;
    border-radius: 0;
    background: #fff;
    color: #303030;
    font: inherit;
    font-size: .875rem;
    line-height: 1.3;
    text-align: left;
    cursor: default;
}

.filter-select__selected-label {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.filter-select__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 1.75rem;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #ce2041;
    font: inherit;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.filter-select__remove:hover,
.filter-select__remove:focus-visible {
    background: #faedf0;
    outline: 1px solid #ce2041;
}

[data-filter-select-root] .nice-select .list .filter-select__search-row {
    padding: .5rem .65rem .4rem;
    background: #fff;
    cursor: default;
}

.filter-select__search {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    height: 2.25rem;
    padding: .4rem .6rem;
    border: 1px solid var(--ui-border-color, #00000029);
    border-radius: 0;
    background: #fafafa;
    color: #333;
    font: inherit;
    font-size: .8rem;
}

.filter-select__search:focus {
    outline: none;
    border-color: #aaa;
}

.filter-select__no-results {
    padding: .5rem .75rem;
    color: #888;
    font-size: .8rem;
}

.filter-select__option-icon {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    object-fit: contain;
}
[data-filter-select-root] .nice-select .option:has(.filter-select__option-icon) {
    display: flex;
    align-items: center;
    gap: .6rem;
}
[data-filter-select-root] .nice-select .option:has(.filter-select__option-icon) > span:not(.filter-widget__count) {
    margin-left: 0;
    margin-right: auto;
}

.filter-select {width:100%;}
.filter-select > .nice-select {width:100%;}

/* Единен фокус за затвореното поле и за search/clear контролите в dropdown-а. */
[data-filter-select-root] div.nice-select:not(.disabled):focus-within,
[data-filter-select-root] select.nice-select:focus-visible {
    outline: 1px solid var(--main-color-2, #c92747);
    outline-offset: 2px;
}

/* Хоризонтални admin лога: една и съща колона, включително текстов fallback. */
.filter-select__brand-box {
    order: 2;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 112px;
    width: 112px;
    height: 40px;
    box-sizing: border-box;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #666;
    font-size: 8px;
    line-height: 1.1;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    overflow: hidden;
}
.filter-select__brand-box > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
[data-filter-select-root] .nice-select .option:has(.filter-select__brand-box) {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-height: 40px;
}
[data-filter-select-root] .nice-select .option:has(.filter-select__brand-box) > span:not(.filter-select__brand-box):not(.filter-widget__count) {
    flex: 1;
    min-width: 0;
    margin: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.2;
}

.filter-select__brand-current-label {
    flex: 1;
    text-align: left;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-select__selected-option:has(.filter-select__brand-box) > .filter-select__remove {
    order: 3;
}
