@form-tree-icon-size: 13px;

.form-tree {
    width: 440px;
    max-width: 100%;

    &__title {
        display: block;
        padding: 5px;
        line-height: 20px;

        cursor: pointer;

        .form-tree--open & {
            border-bottom: 1px dashed @color-border-light;
        }

        &__image {
            display: inline-block;
            width: 40px;
            height: 12px;
            margin-right: 5px;
            position: relative;
            top: 1px;

            img {
                position: absolute;
                top: 0;
                right: 0;
                bottom: 0;
                left: 0;
                text-align: center;
                max-width: 100%;
                max-height: 100%;
            }
        }

        &__name {
            color: @color-link;
            text-decoration: underline;

            .form-tree__title:hover & {
                color: @color-link-hover;
            }
        }

        &__arrow {
            float: right;
            height: 24px;
            width: 24px;
            position: relative;
            top: -2px;

            background: @bg-input-icon;

            &:after {
                content: '';
                display: block;
                width: 0;
                height: 0;
                position: absolute;
                top: 9px;
                left: 7px;

                border-bottom: 5px solid @color-primary;
                border-left: 5px solid transparent;
                border-right: 5px solid transparent;
            }

            .form-tree--open & {

                &:after {
                    top: 10px;

                    border-top: 5px solid @color-primary;
                    border-bottom: 0;
                }
            }
        }
    }

    &__content {
        display: none;
        .reset-ul();
        padding: 0 0 5px 0;

        .form-tree--open & {
            display: block;
        }
    }

    &__placeholder {
        margin-right: 5px;

        outline: 1px dotted @color-red;
        outline-offset: -1px;
    }

    &__item {
        display: block;
        position: relative;

        background: @color-f;

        &--muted {
            color: @color-a;
        }

        &__click {
            padding: 4px 0;

            &--active {
                font-weight: 700;
            }
        }

        &__drag {
            padding: 4px 0 4px 5px;
            margin-right: 5px;
            margin-left: -5px;

            &:hover {
                outline: 1px dotted @color-border;
                outline-offset: -1px;
            }
        }

        &__name {
            display: block;
            font-size: 14px;
            cursor: default;

            &.ui-sortable-handle {
                .form-tree--dragable & {
                    cursor: move;
                }
            }

            input {
                margin: 0 10px;
            }

            &--link {
                color: @color-link;
                display: inline-block;
                padding: 5px 10px;

                .form-tree__item__click:hover & {
                    color: @color-link-hover;
                    text-decoration: underline;
                }
            }

            .form-tree--dragable & {
                padding-left: 10px;
                padding-right: 40px;
            }
        }

        &__icon {
            margin: 3px 5px 0;
            vertical-align: center;
            float: left;
            font-size: @form-tree-icon-size;

            &--level {
                margin-top: 3px;
                margin-left: 17px
            }
        }

        &__controls {
            position: absolute;
            top: 3px;
            right: 0;
            padding-right: 6px;
        }

        &__control {
            padding: 0 2px;

            text-decoration: none;
            color: @color-action;
            font-size: 13px;
        }

        &__choice {
            float: left;
            margin-right: 5px;
            position: relative;
            top: 1px;
        }

        ul {
            .reset-ul();
            padding-left: 20px;
        }
    }
}
