.selector-colles {
    position: relative;
}

.selector-colles-boto {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.5rem 0.875rem;
    border: 0;
    border-radius: 0.625rem;
    background-color: var(--color-white);
    box-shadow: var(--shadow-sm);
    color: inherit;
    text-align: left;

    &:hover {
        box-shadow: var(--shadow-md);
    }

    &:focus-visible {
        outline: 2px solid var(--color-secondary);
        outline-offset: 2px;
    }

    &[aria-expanded="true"] .selector-colles-chevron {
        transform: rotate(180deg);
    }
}

/* The colours of the colles ticked, overlapping as a hand of cards */
.selector-colles-colors {
    display: flex;
    flex-shrink: 0;

    &:empty {
        display: none;
    }

    span {
        width: 0.875rem;
        height: 0.875rem;
        border: 2px solid var(--color-white);
        border-radius: 50%;
        background-color: var(--colla);

        & + span {
            margin-left: -0.3rem;
        }
    }
}

.selector-colles-resum {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-weight: 500;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.selector-colles-chevron {
    flex-shrink: 0;
    line-height: 0;
    color: var(--color-gray-darker);
    transition: transform 0.15s ease;

    svg {
        width: 0.75rem;
        height: 0.75rem;
        fill: currentColor;
    }
}

.selector-colles-menu.dropdown-menu {
    width: 100%;
    min-width: 16rem;
    margin-top: 0.375rem;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0.75rem;
    background-color: var(--color-white);
    box-shadow: var(--shadow-md), 0 0 0 1px rgb(0 0 0 / 0.04);

    /* In the sheet of the filters on phones, the list opens in place: no menu over a sheet */
    @media (width < 48rem) {
        position: static;
        margin-top: 0.5rem;
        box-shadow: var(--shadow-sm);
    }
}

.selector-colles-cerca {
    position: relative;
    border-bottom: 1px solid var(--color-gray-lighter);
}

.selector-colles-cerca-icona {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0.875rem;
    display: flex;
    align-items: center;
    color: var(--color-gray-dark);
    pointer-events: none;

    svg {
        width: 0.875rem;
        height: 0.875rem;
        fill: currentColor;
    }
}

.selector-colles-cerca-input {
    width: 100%;
    padding: 0.625rem 0.875rem 0.625rem 2.25rem;
    border: 0;
    background: transparent;
    font-size: 0.9375rem;

    &:focus {
        outline: none;
    }
}

.selector-colles-llista {
    max-height: 20rem;
    margin: 0;
    padding: 0.25rem 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none;

    @media (width < 48rem) {
        max-height: 40dvh;
    }

    li[hidden] {
        display: none;
    }

    label {
        display: flex;
        align-items: center;
        gap: 0.625rem;
        padding: 0.4rem 0.875rem;
        cursor: pointer;
        font-size: 0.9375rem;

        &:hover {
            background-color: var(--color-gray-lighter);
        }
    }

    .form-check-input {
        flex-shrink: 0;
        margin: 0;

        &:checked {
            border-color: var(--color-primary);
            background-color: var(--color-primary);
        }

        &:focus {
            box-shadow: 0 0 0 0.2rem rgb(255 179 0 / 0.25);
        }
    }
}

.selector-colles-totes {
    border-bottom: 1px solid var(--color-gray-lighter);
    margin-bottom: 0.25rem;
    padding-bottom: 0.25rem;
    font-weight: 500;
}

.selector-colles-color {
    flex-shrink: 0;
    width: 0.3rem;
    height: 1.125rem;
    border-radius: 2px;
    background-color: var(--colla);
}

.selector-colles-nom {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.selector-colles-buit {
    margin: 0;
    padding: 0.75rem 0.875rem;
    font-size: 0.875rem;
    color: var(--color-gray-darker);
}
