// /**
//  * Copyright © 2016 Magento. All rights reserved.
//  * See COPYING.txt for license details.
//  */

//
//  Actions-toolbar
//  _____________________________________________

.lib-actions-toolbar(
    @_actions-toolbar-actions-position: @actions-toolbar-actions__position,
    @_actions-toolbar-actions-reverse: @actions-toolbar-actions__reverse,
    @_actions-toolbar-margin: @actions-toolbar__margin,
    @_actions-toolbar-padding: @actions-toolbar__padding,
    @_actions-toolbar-actions-margin: @actions-toolbar-actions__margin,
    @_actions-toolbar-primary-actions-margin: @actions-toolbar-actions-primary__margin,
    @_actions-toolbar-secondary-actions-margin: @actions-toolbar-actions-secondary__margin,
    @_actions-toolbar-actions-links-margin-top: @actions-toolbar-actions-links__margin-top,
    @_actions-toolbar-primary-actions-links-margin-top: @actions-toolbar-actions-links-primary__margin-top,
    @_actions-toolbar-secondary-actions-links-margin-top: @actions-toolbar-actions-links-secondary__margin-top
) {
    .lib-clearfix();
    .lib-css(margin, @_actions-toolbar-margin);
    .lib-css(padding, @_actions-toolbar-padding);
    ._lib-actions-toolbar-align(@_actions-toolbar-actions-position);
    ._lib-actions-toolbar-floats(@_actions-toolbar-actions-position, @_actions-toolbar-actions-reverse);
    .primary,
    .secondary {
        display: inline-block;
        .action {
            .lib-css(margin, @_actions-toolbar-actions-margin);
        }
        a.action {
            display: inline-block;
            .lib-css(margin-top, @_actions-toolbar-actions-links-margin-top);
        }
    }
    .primary {
        .action {
            .lib-css(margin, @_actions-toolbar-primary-actions-margin);
        }
        a.action {
            .lib-css(margin-top, @_actions-toolbar-primary-actions-links-margin-top);
        }
    }
    .secondary {
        .action {
            .lib-css(margin, @_actions-toolbar-secondary-actions-margin);
        }
        a.action {
            .lib-css(margin-top, @_actions-toolbar-secondary-actions-links-margin-top);
        }
    }
}

//
//  Actions-toolbar-clear-floats
//  ---------------------------------------------

.lib-actions-toolbar-clear-floats() {
    .primary,
    .secondary {
        display: block;
        float: none;
    }
}

//
//  Internal use mixins
//  ---------------------------------------------

._lib-actions-toolbar-align(@_actions-toolbar-actions-position) when not (@_actions-toolbar-actions-position = justify) {
    .lib-css(text-align, @_actions-toolbar-actions-position);
}

._lib-actions-toolbar-floats(
    @_actions-toolbar-actions-position,
    @_actions-toolbar-actions-reverse
) when (@_actions-toolbar-actions-position = justify) and (@_actions-toolbar-actions-reverse = false) {
    .primary {
        float: left;
    }
    .secondary {
        float: right;
    }
}

._lib-actions-toolbar-floats(
    @_actions-toolbar-actions-position,
    @_actions-toolbar-actions-reverse
) when (@_actions-toolbar-actions-position = justify) and (@_actions-toolbar-actions-reverse = true) {
    .primary {
        float: right;
    }
    .secondary {
        float: left;
    }
}

._lib-actions-toolbar-floats(
    @_actions-toolbar-actions-position,
    @_actions-toolbar-actions-reverse
) when (@_actions-toolbar-actions-position = left) and (@_actions-toolbar-actions-reverse = false) {
    .primary {
        float: left;
    }
}

._lib-actions-toolbar-floats(
    @_actions-toolbar-actions-position,
    @_actions-toolbar-actions-reverse
) when (@_actions-toolbar-actions-position = left) and (@_actions-toolbar-actions-reverse = true) {
    .secondary {
        float: left;
    }
}

._lib-actions-toolbar-floats(
    @_actions-toolbar-actions-position,
    @_actions-toolbar-actions-reverse
) when (@_actions-toolbar-actions-position = right) and (@_actions-toolbar-actions-reverse = false) {
    .secondary {
        float: right;
    }
}

._lib-actions-toolbar-floats(
    @_actions-toolbar-actions-position,
    @_actions-toolbar-actions-reverse
) when (@_actions-toolbar-actions-position = right) and (@_actions-toolbar-actions-reverse = true) {
    .primary {
        float: right;
    }
}

._lib-actions-toolbar-floats(
    @_actions-toolbar-actions-position,
    @_actions-toolbar-actions-reverse
) when (@_actions-toolbar-actions-position = center) {
    .primary,
    .secondary {
        vertical-align: top;
    }
}
