label {
    font-weight: 500;
}

/*
 * Reset Focus and Active shadows
 */
input:active,
input:focus {
    outline: 0;
    box-shadow: none !important;
}

.form-control {
    box-shadow: none !important;
    resize: none;

    &:active,
    &:focus {
        box-shadow: none;
    }

    &:not(.fc-alt) {
        border-left: 0;
        border-right: 0;
        border-top: 0;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        padding: 0;

        &.auto-size {
            padding-top: 6px;
        }
    }
}

/*
 * Checkbox and Radio
 */
.checkbox, .radio {
    label {
        padding-left: 30px;
        position: relative;
    }

    input {
        top: 0;
        left: 0;
        margin-left: 0 !important;
        z-index: 1;
        cursor: pointer;
        @include opacity(0);
        margin-top: 0;
    }

    .input-helper {
        &:before, &:after {
            @include transition(all);
            @include transition-duration(250ms);
            @include backface-visibility(hidden);
            position: absolute;
            content: "";
        }

        &:before {
            left: 0;
            border: 1px solid #ccc;
        }
    }

    &.disabled {
        @include opacity(0.6);
    }

}

.checkbox {
    margin-top: 4px;
    margin-bottom: 4px;
    
    input {
        width: 17px;
        height: 17px;

        &:checked + .input-helper {
            &:before {
                @include scale(0);
            }

            &:after {
                @include scale-rotate(1, -50deg);
                @include opacity(1);
            }
        }
    }

    .input-helper {
        &:before {
            top: 0;
            width: 17px;
            height: 17px;
        }

        &:after {
            @include opacity(0);
            @include scale-rotate(0, 80deg);
            width: 22px;
            height: 9px;
            border-bottom: 2px solid $m-teal;
            border-left: 2px solid $m-teal;
            border-bottom-left-radius: 2px;
            left: -1px;
            top: 1px;
        }
    }

    &.fc-alt {
        label {
            color: $m-alt;
        }
        .input-helper {
            &:before {
                border: 1px solid $m-alt;
            }
            &:after {
                border-bottom: 2px solid $m-alt;
                border-left: 2px solid $m-alt;
            }
        }
    }
}

.radio-group {

    &.fc-alt {
        .radio {
            color: $m-alt;

            .input-helper {
                &:before {
                    left: 0;
                    border: 1px solid $m-alt;
                }
                &:after {
                    background: $m-alt;
                }
            }
        }
    }

}

.radio {
    input {
        width: 19px;
        height: 19px;

        &:checked + .input-helper {
            &:after {
                @include scale(1);
            }
        }
    }

    .input-helper {
        &:before {
            top: -1px;
            width: 19px;
            height: 19px;
            border-radius: 50%;
        }

        &:after {
            width: 11px;
            height: 11px;
            background: $m-teal;
            border-radius: 50%;
            top: 3px;
            left: 4px;
            @include scale(0);
        }
    }
}

.checkbox-inline,
.radio-inline {
    vertical-align: top;
    margin-top: 0;
    padding-left: 25px;
}

/*
 * Select
 */
html:not(.ie9) {
    .select {
        position: relative;

        &:before {
            position: absolute;
            top: -1px;
            content: "";
            height: calc(100% - 1px);
            width: 30px;
            background-color: #FFF;
            background-position: right calc(100% - 7px);
            background-repeat: no-repeat;
            background-image: url('./img/select.png');
            // @include img-retina('./src/assets/img/select.png', './src/assets/img/select@2x.png', 12px, 12px);
            pointer-events: none;
            z-index: 5;
        }

        &:not(.fg-line):before {
            right: 0;
        }

        &.fg-line:before {
            right: 10px;
        }
    }
}


/*
 * Input Group Addon
 */
.input-group {
    &:not(.input-group-lg):not(.input-group-sm) .input-group-addon {
        font-size: 15px;
    }

    &.fc-alt {
        .input-group-addon {
            color: $m-alt;
        }

        .fg-line {
            &:after { background: $m-alt; }
            input.form-control {
                color: $m-alt;
                border-color: $m-alt;
                background-color: transparent;
                @include placeholder($m-alt-placeholder);
            }

        }

        .fg-label { color: $m-alt; }

        &.has-error {
            .fg-line {
                &:after { background: $m-red; }
                input {
                    color: $m-red;
                    border-color: $m-red;
                }

            }

            & .input-group-addon {
                color: $m-red !important;
                border-color: transparent;
                background-color: transparent;
            }
        }

    }

    &.has-error {
        .input-group-addon {
            color: $m-red !important;
            border-color: transparent !important;
            background-color: transparent !important;
        }
    }

}

.input-group-addon {
    border-width: 0px 0px 1px 0px;
    min-width: 42px;

    & > .zmdi {
        position: relative;
        top: 3px;
    }
}

// .has-error {
//     & .input-group-addon {
//         color: #eb3954 !important;
//         border-color: transparent;
//         background-color: transparent;
//     }
// }

/*
 * Input Feilds
 */
.fg-line {
    position: relative;
    vertical-align: top;

    &:not(.form-group) {
        display: inline-block;
        width: 100%;
    }

    .form-control {
        &:disabled {
            color: #9d9d9d;
            background: transparent;
        }
    }

    &:not(.disabled):after,
    &:not(.readonly):after {
        position: absolute;
        z-index: 3;
        bottom: 0;
        left: 0;
        height: 2px;
        width: 0;
        content: "";
        @include transition(all);
        @include transition-duration(300ms);
    }

    &:not([class*=has-]):after {
        background: $m-blue;
    }

    &.readonly .form-control {
        color: #9d9d9d;
        background: transparent;
    }

    &.fg-toggled {
        &:after {
            width: 100%;
        }
    }
}

.fg-float  {
    margin-top: 2px;
    position: relative;

    .form-control {
        @include placeholder(#fff);
        position: relative;
        background: transparent;
        z-index: 1;
    }

    .fg-label {
        @include transition(all);
        @include transition-duration(200ms);
        position: absolute;
        top: 5px;
        font-weight: 400;
        color: #959595;
        pointer-events: none;
        z-index: 0;
        left: 0;
        white-space: nowrap;
    }

    .fg-toggled .fg-label {
        top: -20px;
        font-size: 11px;
    }
}

.control-label {
    font-weight: normal;
}

/*
 * Toggle Switch
 */
@mixin ts-color($color){
    input {
        &:not(:disabled) {
            &:checked {
                & + .ts-helper {
                    background: rgba($color, .5);

                    &:before {
                        background: $color;
                    }

                    &:active {
                        &:before {
                            box-shadow: 0 2px 8px rgba(0,0,0,0.28), 0 0 0 20px rgba($color, .2);
                        }
                    }
                }
            }
        }
    }
}

.toggle-switch {
    display: inline-block;
    vertical-align: top;
    @include user-select(none);

    .ts-label {
        display: inline-block;
        margin: 0 20px 0 0;
        vertical-align: top;
        -webkit-transition: color 0.56s cubic-bezier(0.4, 0, 0.2, 1);
        transition: color 0.56s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .ts-helper {
        display: inline-block;
        position: relative;
        width: 40px;
        height: 16px;
        border-radius: 8px;
        background: rgba(0,0,0,0.26);
        -webkit-transition: background 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        transition: background 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        vertical-align: middle;
        cursor: pointer;

        &:before {
            content: '';
            position: absolute;
            top: -4px;
            left: -4px;
            width: 24px;
            height: 24px;
            background: #fafafa;
            box-shadow: 0 2px 8px rgba(0,0,0,0.28);
            border-radius: 50%;
            webkit-transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1), background 0.28s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1);
            transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1), background 0.28s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        }
    }

    &:not(.disabled) {
        .ts-helper {
            &:active {
                &:before {
                    box-shadow: 0 2px 8px rgba(0,0,0,0.28), 0 0 0 20px rgba(128,128,128,0.1);
                }
            }
        }
    }

    input {
        position: absolute;
        z-index: 1;
        width: 46px;
        margin: 0 0 0 -4px;
        height: 24px;
        @include opacity(0);
        cursor: pointer;

        &:checked {
            & + .ts-helper {
                &:before {
                    left: 20px;
                }
            }
        }
    }

    &:not([data-ts-color]){
        @include ts-color($m-teal);
    }

    &.disabled {
        @include opacity(0.6);
    }

    &[data-ts-color="red"] {
        @include ts-color($m-red);
    }

    &[data-ts-color="blue"] {
        @include ts-color($m-blue);
    }

    &[data-ts-color="amber"] {
        @include ts-color($m-amber);
    }

    &[data-ts-color="purple"] {
        @include ts-color($m-purple);
    }

    &[data-ts-color="pink"] {
        @include ts-color($m-pink);
    }

    &[data-ts-color="lime"] {
        @include ts-color($m-lime);
    }

    &[data-ts-color="cyan"] {
        @include ts-color($m-cyan);
    }

    &[data-ts-color="green"] {
        @include ts-color($m-green);
    }

}

/*
 * IE 9 Placeholder
 */
.ie9-placeholder {
    color: #888 !important;
    font-weight: normal;
}

/*
 * Validation
 */
@mixin checkbox-fgline-validation($color) {
    .checkbox .input-helper {
        &:before {
            border-color: lighten($color, 20%);
        }

        &:after {
            border-bottom-color: lighten($color, 10%);;
            border-left-color: lighten($color, 10%);
        }
    }

    .fg-line:after {
        background: $color;
    }

}

.has-error {
    @include checkbox-fgline-validation($m-red);
}

.has-success {
    @include checkbox-fgline-validation($m-green);
}

.has-warning {
    @include checkbox-fgline-validation($m-orange);
}


/*
 * Text Area
 */

.text-area.form-group {

    &.fc-alt {
        color: $m-alt;

        .fg-line {

            &:after {
                background-color: $m-alt;
            }

            textarea {
                color: $m-alt;
                background: transparent;
                @include placeholder($m-alt-placeholder);
            }
        }


    }



}
