/*!
 * Copyright (c) 2017 Edelweiss72 GmbH - All Rights Reserved
 * Unauthorized usage or distribution of this file, via any medium is strictly prohibited
 * Proprietary and confidential
 *
 * @author Wladimir Eberts <w.eberts@edelweiss72.de>
 */

// column style
.mod-form:not(.no-column) {
    &,
    :not(.m-multi) {
        > .m-field:not(.no-column) {
            > .m-error {
                display: flex;
                flex: 0 1 100%;
                flex-flow: row wrap;

                &::before {
                    content: '';

                    @include if-parent('.m-field.has-label') {
                        flex: 0 1 $form-column-label;
                        margin-right: $form-gutter;
                    }
                }

                > ul {
                    flex: 1 1 $form-column-disable;
                }
            }

            > .m-inner {
                display: flex;
                flex-flow: row wrap;

                > * {
                    flex: 0 1 100%;
                }

                > .m-label {
                    max-height: fit-content;
                    margin-right: $form-gutter;
                    flex: 1 1 $form-column-label;
                }

                > .m-item {
                    flex: 999 1 $form-column-disable;
                }

                > .m-multi {
                    @if unit($form-column-disable) == 'em' {
                        // IE11: fallback as calc() does not work for flex
                        flex: 999 1 ($form-column-disable + em($form-gutter));
                        flex: 999 1 calc(#{$form-column-disable} + #{$form-gutter}); // sass-lint:disable-line no-duplicate-properties
                    }
                    @else {
                        flex: 999 1 ($form-column-disable + $form-gutter);
                    }

                    &:not(.m-multi-radio):not(.m-multi-checkbox) {
                        justify-content: space-between;
                    }
                }
            }

            > .m-description {
                display: flex;
                flex: 0 1 100%;
                flex-flow: row wrap;

                &::before {
                    content: '';

                    @include if-parent('.m-field.has-label') {
                        flex: 0 1 $form-column-label;
                        margin-right: $form-gutter;
                    }
                }

                > div {
                    flex: 1 1 $form-column-disable;
                }
            }
        }
    }
}
