.input {
    display: inline-block;
    max-width: 100%;
    min-width: 3em;
    height: 2.4em;
    margin: .2em 0;
    line-height: 2.2em;
    background-color: transparent;
    border: none;
    color: @font-normal-color;
    font-family: inherit;
    border-bottom: 1px solid @color-light-gray;
    outline: none;
    vertical-align: middle;
    transition: border-color .3s ease;
    box-sizing: border-box;

    &[disabled],
    &[readonly] {
        cursor: not-allowed;
    }

    &:focus {
        border-color: @color-semi-light-gray;

        &.input-default {
            border-color: @base-default-color;
        }

        &.input-primary {
            border-color: @base-primary-color;
        }

        &.input-cobalt {
            border-color: @base-cobalt-color;
        }

        &.input-success {
            border-color: @base-success-color;
        }

        &.input-danger {
            border-color: @base-danger-color;
        }

        &.input-alert {
            border-color: @base-alert-color;
        }

        &.input-notice {
            border-color: @base-notice-color;
        }

        &.input-force {
            border-color: @base-force-color;
        }

        &.input-light {
            &.input-default {
                border-color: lighten(@base-default-color, 5%);
            }

            &.input-primary {
                border-color: lighten(@base-primary-color, 5%);
            }

            &.input-cobalt {
                border-color: lighten(@base-cobalt-color, 5%);
            }

            &.input-success {
                border-color: lighten(@base-success-color, 5%);
            }

            &.input-danger {
                border-color: lighten(@base-danger-color, 5%);
            }

            &.input-alert {
                border-color: lighten(@base-alert-color, 5%);
            }

            &.input-notice {
                border-color: lighten(@base-notice-color, 5%);
            }

            &.input-force {
                border-color: @font-default-color;
            }
        }
    }

    &.input-block {
        display: block;
        width: 100%;
    }

    &.input-lg {
        font-size: 115%;
    }

    &.input-xg {
        font-size: 130%;
    }

    &.input-sm {
        font-size: 95%;
    }

    &.input-xs {
        font-size: 85%;
    }

    &.input-round {
        padding: 0 1.2em;
        border-radius: 2px;
        border: 1px solid @color-dark-silver;
        @complex-transition: border-color .3s ease, box-shadow .3s ease, -webkit-box-shadow .3s ease;
        @complex-shadow: 1px 2px 3px 0 rgba(0, 0, 0, .075) inset, 1px 1px 0 rgba(255, 255, 255, .85);
        transition: @complex-transition;
        box-shadow: @complex-shadow;

        &:focus {
            border-color: @base-primary-color;
            box-shadow: 0 0 5px rgba(96, 146, 254, .75);
        }
    }

    &select {
        border-width: 1px;
        border-color: @color-semi-light-gray;
        border-style: solid;
        border-radius: 2px;
        padding: 0 .6em;
        box-shadow: 0 0 4px rgba(0, 0, 0, .125);

        &:focus {
            border-bottom: 1px solid @color-semi-light-gray;
        }

        &.input-xs {
            font-size: 85%;
        }

        &.input-sm {
            font-size: 95%;
        }

        &.input-lg {
            font-size: 105%;
        }

        &.input-xg {
            font-size: 115%;
        }

        &.input-default {
            border-color: @base-default-color;
        }

        &.input-primary {
            border-color: @base-primary-color;
        }

        &.input-cobalt {
            border-color: @base-cobalt-color;
        }

        &.input-success {
            border-color: @base-success-color;
        }

        &.input-danger {
            border-color: @base-danger-color;
        }

        &.input-alert {
            border-color: @base-alert-color;
        }

        &.input-notice {
            border-color: @base-notice-color;
        }

        &.input-force {
            border-color: @base-force-color;
        }
    }

    &textarea {
        width: 100%;
        height: auto;
        padding: 1.2em 0;
        line-height: 1.6;
        resize: none;
        box-sizing: border-box;

        &[readonly] {
            background-color: @color-light-bg;
            cursor: not-allowed;
        }
    }
}

.works-input-label {
    position: relative;
    display: inline-block;
    vertical-align: middle;

    input {
        position: relative;
        z-index: 5;
        margin-top: 0;
        margin-bottom: 0;
        font-size: 100%;
        border-bottom: none;
    }

    &:before {
        display: block;
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        border-bottom-width: 1px;
        border-bottom-style: solid;
        border-bottom-color: @color-light-gray;
        border-bottom-color: rgba(0, 0, 0, .2);
    }

    &:after {
        display: block;
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 0;
        border-bottom: 1px solid @color-semi-light-gray;
        z-index: 10;
        transition: width .75s ease;
    }

    &.works-input-block {
        width: 100%;
    }

    &.works-input-disabled {
        input {
            border-bottom-color: @color-silver !important;
            border-bottom-color: rgba(0, 0, 0, .1) !important;
            color: @color-gray !important;
            color: rgba(0, 0, 0, .5) !important;
        }

        .works-input-placeholder {
            color: @color-semi-light-gray !important;
            color: rgba(0, 0, 0, .375) !important;
        }
    }

    &.works-input-lg {
        font-size: 115%;
    }

    &.works-input-xg {
        font-size: 130%;
    }

    &.works-input-sm {
        font-size: 95%;
    }

    &.works-input-xs {
        font-size: 85%;
    }

    &.works-input-label-validation .works-input-validation {
        position: absolute;
        top: .3em;
        right: .6em;
    }

    &.works-input-label-placeholder .works-input-validation {
        top: 1.4em;
    }

    &.works-input-label-validation-success .works-input-validation {
        .works-input-validation-first,
        .works-input-validation-last {
            stroke: @base-primary-color;
        }
    }

    &.works-input-label-validation-error .works-input-validation {
        .works-input-validation-first,
        .works-input-validation-last {
            stroke: @base-danger-color;
        }
    }

    &.works-input-label-validation {
        input {
            padding-right: 2.8em;
            box-sizing: border-box;
        }

        &.works-input-label-validation-active {
            .works-input-validation {
                .works-input-validation-last {
                    stroke-dashoffset: 0;
                }
            }

            &.works-input-label-validation-success {
                &:after {
                    border-bottom-color: @base-primary-color;
                }

                .works-input-validation {
                    .works-input-validation-first {
                        stroke-dashoffset: 11.3137px;
                    }
                }
            }

            &.works-input-label-validation-error {
                &:after {
                    border-bottom-color: @base-danger-color;
                }

                .works-input-validation {
                    .works-input-validation-first {
                        stroke-dashoffset: 0;
                    }
                }
            }
        }
    }

    .works-input-validation {
        &.works-input-validation-success .works-input-validation-first {
            stroke-dashoffset: 5.6568px;
            transition: stroke-dashoffset .15s ease-in;
        }

        &.works-input-validation-success .works-input-validation-last {
            stroke-dashoffset: 10.6301px;
            transition: stroke-dashoffset .35s cubic-bezier(.25,.8,.25,1);
            transition-delay: .12s;
        }

        &.works-input-validation-error .works-input-validation-first {
            stroke-dashoffset: 11.3137px;
            transition: stroke-dashoffset .25s ease-in;
        }

        &.works-input-validation-error .works-input-validation-last {
            stroke-dashoffset: 11.3137px;
            transition: stroke-dashoffset .25s cubic-bezier(.25,.8,.25,1);
            transition-delay: .25s;
        }
    }

    &.works-input-focus,
    &.works-input-label-validation-active {
        &:after {
            width: 100%;
        }
    }

    &.works-input-label-placeholder {
        margin-bottom: 1.2em;

        input {
            margin-top: 1.2em;
        }

        .works-input-placeholder {
            display: block;
            position: absolute;
            width: 100%;
            top: 1.2em;
            left: 0;
            color: @font-extra-light-color;
            color: rgba(0, 0, 0, .6);
            font-size: 100%;
            padding: 0 .6em;
            height: 2.4em;
            line-height: 2.4em;
            transform: translate3d(0, 0, 0);
            transition: transform .4s cubic-bezier(.25,.8,.25,1), font-size .4s cubic-bezier(.25,.8,.25,1);
            box-sizing: border-box;
        }

        &.works-input-lock {
            &.works-input-label-validation-active {
                &:after {
                    border-bottom-width: 2px;
                }
            }

            .works-input-placeholder {
                font-size: 80%;
                transform: translate3d(-.6em, -1.6em, 0);
            }
        }
    }

    &.works-input-focus {
        &.works-input-default {
            &:after {
                border-bottom-color: @base-default-color;
            }

            .works-input-placeholder {
                color: @base-default-color;
            }
        }

        &.works-input-primary {
            &:after {
                border-bottom-color: @base-primary-color;
            }

            .works-input-placeholder {
                color: @base-primary-color;
            }
        }

        &.works-input-cobalt {
            &:after {
                border-bottom-color: @base-cobalt-color;
            }

            .works-input-placeholder {
                color: @base-cobalt-color;
            }
        }

        &.works-input-success {
            &:after {
                border-bottom-color: @base-success-color;
            }

            .works-input-placeholder {
                color: @base-success-color;
            }
        }

        &.works-input-danger {
            &:after {
                border-bottom-color: @base-danger-color;
            }

            .works-input-placeholder {
                color: @base-danger-color;
            }
        }

        &.works-input-alert {
            &:after {
                border-bottom-color: @base-alert-color;
            }

            .works-input-placeholder {
                color: @base-alert-color;
            }
        }

        &.works-input-notice {
            &:after {
                border-bottom-color: @base-notice-color;
            }

            .works-input-placeholder {
                color: @base-notice-color;
            }
        }

        &.works-input-force {
            &:after {
                border-bottom-color: @base-force-color;
            }

            .works-input-placeholder {
                color: @base-force-color;
            }
        }
    }
}