/*
 * Form Styles
 */

form {
    .clearfix();

    fieldset {
        border: 0;
        margin: 0 0 20px;
        padding: 0;

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

    legend {
        display: none;
    }

    .buttonGroup:last-child {
        margin-bottom: 0;
    }

    &.withBackground {
        background: @light_color;
        padding: 20px 20px 0;
    }

    /*
     * Hide Anti Spam Field
     */

    .answer {
        display: none;
    }
}

/*
 * Datepicker styles
 */

.ui-datepicker-div {

    a {
        text-decoration: none;
    }
}

.row {
    float: left;
    width: 100%;
    margin: 0 0 15px;
    .clearfix();

    label {
        float: left;
        padding: 0 0 15px;
        font-family: @body_font;
        color: @text_color;
    }

    .inputWrap, .datepickerWrap {
        float: left;
        width: 100%;
    }

    input:not([type="checkbox"]):not([type="radio"]), textarea, select, .chosen-search input {
        float: left;
        position: relative;
        width: 100%;
        padding: 12px 10px;
        border: 1px solid @border_color;
        line-height: normal;
        border-radius: @border_radius;
        color: @text_color;
        font-family: @body_font;
        .placeholder(lighten(@text_color, 10%));

        &:focus {
            border: 1px solid @primary_color;
        }
    }

    .validationMessage {
        .clearfix();
        clear: both;
        font-family: @body_font;
        padding: 10px 0;
        z-index: 5;
        border-radius: @border_radius;
        .ems(14);
        font-weight: 400;
        display: none;
        line-height: 22px;
    }

    .buttonInline {
        clear: both;
        display: flex;

        @media @mobile {
            display: block;
        }

        &:after {
            display: none;
        }

        select, input, .chosen-single {
            border-top-right-radius: 0;
            border-bottom-right-radius: 0;
            min-width: 200px;
            flex: 1 0;

            @media @mobile {
                margin-bottom: 10px;
                width: 100%;
            }
        }

        button, .button, .buttonAlt {
            flex: 1 1 auto;
            margin: 0;
            white-space: nowrap;
            border-top-left-radius: 0;
            border-bottom-left-radius: 0;

            @media @mobile {
                width: 100%;
                border-radius: @border_radius;
            }
        }
    }

    &.errorWrap, &.successWrap {

        .validationMessage {
            display: block;
        }

        .inputWrap, .datepickerWrap {
            position: relative;

            &:after {
                position: absolute;
                top: 10px;
                right: 15px;
                z-index: 10;
            }
        }
    }

    &.errorWrap {

        .validationMessage {
            color: @alert_color;
        }

        .inputWrap {

            &:after {
                .rems(16);
                .fa(f06a, @alert_color);
            }
        }

        input:not([type="checkbox"]):not([type="radio"]), textarea, select, .chosen-search input,
        .chosen-container .chosen-single {
            border-color: @alert_color;
        }

        // disable chosen select icon as error exists
        .chosen-container {

            .chosen-single {

                div {

                    b {

                        &:after {
                            display: none;
                        }
                    }
                }
            }
        }
    }

    &.successWrap {

        .validationMessage {
            color: @success_color;
        }

        .inputWrap {

            &:after {
                .rems(16);
                .fa(f058, @success_color);
            }
        }

        input:not([type="checkbox"]):not([type="radio"]), textarea, select, .chosen-search input {
            border-color: @success_color;
        }
    }

    input[disabled] {
        background: @light_color;
        border: 1px solid @border_color;
    }

    /*
     * Checkboxes
     */

    input[type=checkbox] {
        float: left;
        display: inline;
        margin: 20px;
        padding: 0;
        *height: 13px;
        *width: 13px;
    }

    input[type=checkbox], input[type=radio] {
        position: absolute;
        left: -9999px;

        & + label {
            position: relative;
            float: left;
            padding: 0 0 0 30px;
            cursor: pointer;
            user-select: none;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            width: 100%;

            &:before {
                position: absolute;
                left: 0;
                top: 2px;
                width: 20px;
                height: 20px;
                border: 1px solid @border_color;
                cursor: pointer;
                content: '';
                background: #fff;
                border-radius: @border_radius;
            }

            &:after {
                position: absolute;
                top: 14px;
                left: 5px;
                .rems(15);
                opacity: 0;
                transition: opacity 0.25s;
                transform: translateY(-50%);
                .fa(f00c, @highlight_color);
                border-radius: @border_radius;
            }
        }

        &:checked {

            & + label {

                &:after {
                    opacity: 1;
                }
            }
        }

        &[type=radio] {

            & + label {

                &:before {
                    border-radius: 100%;
                    content: '';
                }

                &:after {
                    position: absolute;
                    top: 7px;
                    left: 5px;
                    background: #fff;
                    width: 12px;
                    height: 12px;
                    background: @highlight_color;
                    border-radius: 100%;
                    transform: scale(0);
                    transition: transform 0.25s;
                    content: '';
                }
            }

            /*
             * Set outline when keyboarding
             */
            &:focus + label {

                &:before {
                    border: 1px solid @highlight_color;
                }
            }

            &:checked {

                & + label {

                    &:after {
                        transform: scale(1);
                    }
                }
            }
        }

        /*
         * Set outline when keyboarding
         */

        &:focus + label {

            &:before {
                border: 1px solid @highlight_color;
            }
        }
    }
}

/*
 * File upload styling
 */

.fileUpload {

    label {
        .button();
        margin: 0;
    }

    input {
        display: none;
    }

    .fileName {
        display: block;
        clear: both;
        font-weight: 700;
        .rems(14);
        padding: 10px 0;

        span {
            display: block;
        }
    }
}

/*
 * Checkbox Toggle - Similar to the one seen in iOS
 */

.checkboxToggle {
    visibility: hidden;

    + label {
        cursor: pointer;
        display: block;
        position: relative;
        box-shadow: inset 0 0 0px 1px #d5d5d5;
        text-indent: -5000px;
        height: 20px;
        width: 40px;
        border-radius: 10px;

        &:before {
            content: '';
            position: absolute;
            display: block;
            height: 20px;
            width: 18px;
            top: 0;
            left: 0;
            border-radius: 10px;
            transition: background 0.25s ease-in-out 0s, width 0.25s ease-in-out 0s;
        }

        &:after {
            content: '';
            position: absolute;
            display: block;
            height: 18px;
            width: 18px;
            margin: 1px;
            top: 0;
            left: 0;
            border-radius: 50%;
            background: @highlight_color;
            transition: left 0.25s ease-in-out 0s, background 0.25s ease-in-out 0s;
        }
    }

    &:checked {

        + label {

            &:before {
                width: 100%;
                background: @highlight_color;
            }

            &:after {
                left: 50%;
                background: #fff;
            }
        }
    }
}

/*
 * Form inline styles
 */

.formInline {

    .row {

        .datepickerWrap, .buttonInline {
            clear: none;
        }

        label {
            width: 30%;
            padding: 8px 0; // padding adjusted to compensate for border on input
        }

        .inputWrap, .datepickerWrap {
            padding: 0 0 0 20px;
            width: 70%;
        }

        .mobileChosen {

            select {
                position: absolute;
                width: 100%;
            }
        }
    }

    .validationMessage {
        width: 70%;
        float: right;
        padding-left: 20px;

        @media @mobile {
            padding-left: 0;
            width: 100%;
            float: none;
        }
    }

    input[type=radio] + label + div,
    input[type=checkbox] + label + div {
        float: none;
        width: 100%;
        padding-left: 30px;
    }

    @media @mobile {

        .row {

            label {
                clear: both;
                width: 100%;
            }

            .inputWrap, .datepickerWrap {
                padding: 0;
                width: 100%;
            }
        }
    }
}

/*
 * Tooltip styles
 */

.toolTip {
    position: relative;
    display: inline-block;
    cursor: pointer;

    i {
        .ems(25);
        color: @dark_color;
        float: left;
    }

    &:before {
        content: attr(data-tooltip);
        border-radius: @border_radius;
        padding: 20px;
        min-width: 260px;
        color: #fff;
        text-align: center;
        position: absolute;
        background: @dark_color;
        z-index: 5;
        border: solid 1px @border_color;
        display: none;
    }

    &:after {
        content: '';
        width: 13px;
        height: 13px;
        display: block;
        position: absolute;
        background: @dark_color;
        z-index: 10;
        display: none;
    }

    &:hover {

        &:before, &:after {
            display: block;
        }
    }

    &.tooltipTop {

        &:before {
            bottom: calc(~"100% + 16px");
            left: 50%;
            transform: translateX(-50%);
        }

        &:after {
            bottom: calc(~"100% + 5px");
            left: 50%;
            margin-left: -2.5px;
            transform: rotate(45deg) translateX(-50%);
            border-right: solid 1px @border_color;
            border-bottom: solid 1px @border_color;
        }
    }

    &.tooltipRight {

        &:before {
            left: calc(~"100% + 16px");
            top: 50%;
            transform: translateY(-50%);

        }

        &:after {
            left: calc(~"100% + 5px");
            top: 50%;
            margin-top: -2.5px;
            transform: rotate(45deg) translateY(-50%);
            border-left: solid 1px @border_color;
            border-bottom: solid 1px @border_color;
        }
    }

    &.tooltipBottom {

        &:before {
            top: calc(~"100% + 16px");
            left: 50%;
            transform: translateX(-50%);
        }

        &:after {
            top: calc(~"100% + 14px");
            left: 50%;
            margin-left: -2.5px;
            transform: rotate(45deg) translateX(-50%);
            border-left: solid 1px @border_color;
            border-top: solid 1px @border_color;
        }
    }

    &.tooltipLeft {

        &:before {
            right: calc(~"100% + 16px");
            top: 50%;
            transform: translateY(-50%);

        }

        &:after {
            right: calc(~"100% + 15px");
            top: 50%;
            margin-top: -2.5px;
            transform: rotate(45deg) translateY(-50%);
            border-right: solid 1px @border_color;
            border-top: solid 1px @border_color;
        }
    }

}

/*
 * Footer newsletter
 */

.footerWrap {

    .footer {

        .footerNewsletter {

            .row {

                &.errorWrap {

                    .inputWrap {

                        &:after {
                            top: 50%;
                            transform: translateY(-50%);
                            color: @alert_color;
                        }
                    }

                    .validationMessage {
                        padding-left: 10px;
                    }
                }
            }
        }
    }
}

/*
 * Number inputs - counter
 */
.numberArrowWrap {
   position: relative;

    input:not(.right) {
        padding-left: 35px;
    }

    input.right {
        padding-right: 35px;
    }
}

.numberButtons {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 35px;

    .numberButton {
        position: absolute;
        left: 0;
        text-align: center;
        width: 100%;
        height: 50%;
        background: none;
        cursor: pointer;
        z-index: 300;

        &.add {
            top: 1px;
            line-height: 30px;
        }

        &.subtract {
            bottom: 1px;
            line-height: 20px;
        }
    }
}

.numberArrows {

    &.right {

        + .numberButtons {
            left: auto;
            right: 0;
        }
    }

    &.fade {

        + .numberButtons {
            opacity: 0;
            visibility: hidden;
            transition: opacity 400ms linear 0s, visibility 0s linear 400ms;
            z-index: 100;

            &:hover, &:focus {
                opacity: 1;
                visibility: visible;
                transition-delay: 0s;
            }
        }

        &:hover, &:focus {

            + .numberButtons {
                opacity: 1;
                visibility: visible;
                transition-delay: 0s;
            }
        }
    }
}
