.ez-custom-dropdown {
    *,
    *:after,
    *:before {
        box-sizing: border-box;
        font-family: $font-family-sans-serif;
    }

    &__wrapper {
        position: relative;
        max-width: calculateRem(680px);
    }

    &__selection-info {
        list-style: none;
        padding-left: 0;
        margin: 0 0 calculateRem(10px) 0;
        padding: 0 calculateRem(16px) calculateRem(6px) calculateRem(8px);
        border: calculateRem(1px) solid $ibexa-color-base-dark;
        border-radius: $ibexa-border-radius;
        position: relative;
        min-height: calculateRem(38px);
        background: $ibexa-white;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        cursor: pointer;

        &:before {
            content: '';
            position: absolute;
            z-index: 1;
            top: calculateRem(21px);
            right: calculateRem(8px);
            width: 0;
            height: 0;
            border-style: solid;
            border-width: calculateRem(7px) calculateRem(4px) 0 calculateRem(4px);
            border-color: $ibexa-black transparent transparent transparent;
        }

        &:after {
            content: '';
            position: absolute;
            z-index: 1;
            top: calculateRem(10px);
            right: calculateRem(8px);
            width: 0;
            height: 0;
            border-style: solid;
            border-width: 0 calculateRem(4px) calculateRem(7px) calculateRem(4px);
            border-color: transparent transparent $ibexa-black transparent;
        }

        &.is-invalid {
            @include input-invalid();
        }
    }

    &__selected-item {
        @include tag;

        display: inline-block;
        max-width: calculateRem(380px);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    &__selected-overflow-number {
        position: absolute;
        right: calculateRem(25px);
        top: calculateRem(6px);
        width: calculateRem(32px);
        height: calculateRem(25px);
        background: $ibexa-color-base;
        border-radius: $ibexa-border-radius;
        border: calculateRem(1px) solid $ibexa-color-base-dark;
        color: $ibexa-color-font;
        font-size: calculateRem(14px);
        font-weight: normal;
        text-align: center;
        line-height: calculateRem(24px);

        &:before {
            content: '...';
            position: absolute;
            left: calculateRem(-20px);
            display: block;
            width: calculateRem(20px);
            height: calculateRem(23px);
        }
    }

    &__remove-selection {
        display: inherit;
        position: absolute;
        top: 50%;
        right: 0;
        width: calculateRem(28px);
        height: calculateRem(20px);
        transform: translateY(-50%);

        &:before,
        &:after {
            content: '';
            width: calculateRem(2px);
            height: calculateRem(12px);
            background: $ibexa-black;
            position: absolute;
            top: 50%;
            left: 50%;
        }

        &:before {
            transform: translate(50%, -50%) rotate(-45deg);
        }

        &:after {
            transform: translate(50%, -50%) rotate(45deg);
        }
    }

    &__items {
        list-style: none;
        padding-left: 0;
        margin: 0;
        position: absolute;
        top: calc(100% - #{calculateRem(1px)});
        transform: scaleY(1);
        transform-origin: top center;
        transition: transform 0.2s $ibexa-admin-transition;
        width: 100%;
        background: $ibexa-white;
        border: calculateRem(1px) solid $ibexa-color-base-dark;
        color: $ibexa-color-font;
        z-index: 2;
        border-radius: 0 0 $ibexa-border-radius $ibexa-border-radius;
        overflow-y: auto;

        &--hidden {
            transform: scaleY(0);
        }

        &--position-top {
            top: initial;
            bottom: 100%;
            transform-origin: bottom center;
        }
    }

    &__item {
        margin: calculateRem(2px) 0;
        padding: calculateRem(8px) calculateRem(16px);
        min-height: calculateRem(30px);
        transition: background 0.2s $ibexa-admin-transition;

        &:hover {
            color: $ibexa-color-primary;
            cursor: pointer;
        }

        &[disabled] {
            color: $ibexa-color-base-pale;

            &:hover {
                background: inherit;
                cursor: not-allowed;
            }
        }

        &:last-child {
            margin-top: 0;
        }

        &:last-child {
            margin-bottom: 0;
        }

        .ez-input {
            margin-right: calculateRem(5px);
            margin-bottom: calculateRem(-2px);
        }
    }

    &--overflow {
        .ez-custom-dropdown__selected-item {
            max-width: calc(100% - #{calculateRem(96px)});
        }
    }
}
