/*
    Validation popups
    ---------------------------------------------------------------------------------
*/
.arrow(@selector, @left: 50%, @border-color: #ccc, @position: top, @size: 3px, @background-color: #fff, @border-width: 1px) {
    @{selector}:after, @{selector}:before {
        bottom: 100%;
        border: solid transparent;
        content: " ";
        height: 0;
        width: 0;
        position: absolute;
        pointer-events: none;
    }

    @{selector}:after {
        .b(@position, @background-color);
        border-width: @size;
        left: @left;
        margin-left: @size * -1;
    }

    @{selector}:before {
        .b(@position, @border-color);
        border-width: @size + @border-width;
        left: @left;
        margin-left: ( @size + @border-width ) * -1;
    }

    .b(top, @border-color) {
        border-bottom-color: @border-color;
    }

    .b(right, @border-color) {
        border-left-color: @border-color;
    }

    .b(bottom, @border-color) {
        border-top-color: @border-color;
    }

    .b(left, @border-color) {
        border-right-color: @border-color;
    }
}

.box-shadow(@shadow, ...) {
    // Multiple shadow solution from http://toekneestuck.com/blog/2012/05/15/less-css-arguments-variable/
    -webkit-box-shadow: @arguments;
    -moz-box-shadow: @arguments;
    box-shadow: @arguments;
}

.drop-shadow(@x-axis: 0, @y-axis: 1px, @blur: 2px, @alpha: 0.1) {
    .box-shadow(@x-axis @y-axis @blur rgba(0, 0, 0, @alpha));
}

.widget-drop-shadow {
    .drop-shadow(1px, 1px, 2px, 0.15);
}


.info-label(@selector, @color: @textColor, @borderColor: @inputBorder) {
    @{selector} {
        background: white;
        color: @color !important;
        border: 1px solid @borderColor;
        border-radius: 5px;
        .widget-drop-shadow;
        min-height: 12px;
        padding: 5px 8px !important;
        //max-width: 200px;
        white-space: nowrap;
        height: inherit;
        line-height: 1.3em;
        font-size: 14px !important;
        z-index: @z-index-form-validation-info;
        margin-top: 7px;
        position: absolute;
        left: 10px;
        top: 23px;
        -webkit-transform: scale3d(1,1,1); // chrome rendering issue http://stackoverflow.com/questions/11002195/chrome-does-not-redraw-div-after-it-is-hidden
        //.ie & { top: 20px !important; }
    }

    .arrow(@selector, 10px, @borderColor, @size: 4px);
}

@selector: label.error;
.info-label(@selector, @color-error, @color-error);

/*
    END validation popups
*/

// This is needed for comboboxes in popups
.legacy-combobox__form-validation-error {
    display: inline-block;
    position: absolute;
    top: 10px;
    right: -91px;
    color: @color-error;
    font-weight: bold;
    font-size: @font-size--13;
    vertical-align: middle;
    white-space: normal;
    padding: 4px 0;
    line-height: 14px;
}
/** VALIDATION AND ERROR STATES **/
.form__validation-error-wrapper {
    position: relative;
    display: block;
}

.form__validation-error-wrapper--inline {
    display: inline-block;
}

.form__validation-error {
    .rounded-small();
    position: absolute;
    left: 10px;
    bottom: -7px;
    transform: translateY(100%);
    padding: 5px 8px;
    white-space: nowrap;
    line-height: @font-size-base * 1.3;
    font-size: @font-size-base !important;
    background: #fff;
    color: @color-error;
    border: 1px solid @color-error;
    z-index: @z-index-form-validation-info;

    &:before, &:after {
        position: absolute;
        left: 10px;
        bottom: 100%;
        content: ' ';
        border: 0 solid transparent;
        pointer-events: none;
    }

    &:before {
        border-bottom-color: @color-error;
        border-width: 5px;
        margin-left: -5px;
    }

    &:after {
        border-bottom-color: #fff;
        border-width: 4px;
        margin-left: -4px;
    }
}

.form-actions__error-summary {
    padding: 10px 0 0;
    color: @color-error;
}

.form-element-error-focus-box-shadow() {
    box-shadow: 0 0 0 3px #e0b2b2;
}

.form-element-error-focus() {
    &:focus {
        .form-element-error-focus-box-shadow();
        outline: 0;
        border: 1px solid @color-error;
    }
}

.form-element--has-error,
.form-element--has-error:invalid {
    .form-element-error-focus();
    border: 1px solid @color-error;
}

.form-element--blend-with-grid {
    &.form-element--has-error {
        border: 1px solid @color-error;
    }

    &.form-element--has-error:invalid {
        border: 1px solid @color-error;
    }
}

input.error, select.error, textarea.error {
    .form-element--has-error;
}

input.error:focus,
select.error:focus,
textarea.error:focus {
    .form-element-error-focus-box-shadow() !important;
}



label.wrappedError {
    white-space: pre-wrap;
}

.errorSummary {
    padding: 10px 0 0;
    margin: 0;
    color: @color-error !important;
    clear: both;
}

.errorCount {
    font-weight: bold;
}

.errorSpan {
    display: block;
    position: relative;
}

// Validation popovers

label.errorLabel,
label.error.errorLabel {
    color: @color-error !important;
}

label.error {
    top: 40px !important;
}

.combobox-presenter {
    label.error, label.warning, label.info {
        top: 24px!important;
    }
}

.dropdown__presenter {
    label.error, label.warning, label.info {
        top: 61px !important;
    }
}

// Legacy pages
.validationRequiredErrorMessage, .validationInlineErrorMessage {
    display: inline-block;
    position: relative;
    margin-left: 5px;
    font-size: @font-size--13;
    color: @color-error !important;
    font-weight: bold;
    vertical-align: middle;
    white-space: normal;
    padding: 4px 0;
    line-height: 14px;
}