@import (once) "../../include/vars";
@import (once) "../../include/mixins";

.input-material {
    position: relative;
    min-width: 196px;
    height: 48px;
    display: inline-block;
    margin: 0;
    width: 100%;
    border: none;

    input {
        position: absolute;
        top: 16px;
        left: 0;
        right: 0;
        bottom: 8px;
        border: 0;
        border-bottom: 2px @borderColor solid;
        background-color: transparent;
        outline: none;
        font-size: 16px;
        padding-bottom: 8px;
        padding-left: 0;
        width: 100%;
        z-index: 2;
        height: 28px;
        box-shadow: none!important;
    }

    hr {
        content: "";
        display: block;
        position: absolute;
        width: 0;
        opacity: 0;
        height: 3px;
        background-color: @gray;
        bottom: -4px;
        z-index: 2;
        .transition(all, .3s, linear);
    }

    .label, .informer {
        position: absolute;
        display: block;
        z-index: 1;
        color: inherit;
        font-size: 12px;
    }

    .label {
        opacity: 0;
        top: 16px;
        left: 0;
        .transition(all, .3s, linear);
    }

    .informer {
        opacity: 0;
        bottom: 12px;
        font-size: 12px;
        .transition(all, .3s, linear);
    }

    input::-webkit-input-placeholder {
        font-size: 1rem;
        position: absolute;
        left: 0;
        z-index: 1;
        opacity: 1;
        color: @gray;
        .transition(all, .3s, linear);
    }

    .helper-button {
        top: 8px;
    }

    &.full-size {
        width: 100%;
    }

    input:hover {
        border-color: @borderColor;
    }
}

.input-material {
    &.with-icon {
        margin-left: 32px;
        width: ~"calc(100% - 32px)";

        .icon {
            width: 24px;
            height: 24px;
            font-size: 24px;
            line-height: 1;
            position: absolute;
            left: -32px;
            top: 50%;
            margin-top: -8px;
            display: block;
            opacity: .2;
            .transition(all, .3s, linear);

            img {
                width: 100%;
                max-width: 100%;
                height: 100%;
                max-height: 100%;
            }

        }

        &.full-size {
            width: ~"calc(100% - 32px) !important";
        }
    }
}

.input-material {
    hr ~ input:focus {
        border-bottom: 0;
    }

    input:focus ~ hr {
        opacity: 1;
        width: 100%;
        .transition(all, .3s, linear);
    }

    input:focus ~ .label {
        opacity: 1;
        top: 0;
        .transition(all, .3s, linear);
    }

    input:focus  {
        &::-webkit-input-placeholder {
            opacity: 0;
            .translateX(100%);
            .transition(all, .2s, linear);
        }
    }

    input:focus ~ .informer {
        opacity: 1;
        bottom: -.75rem;
        .transition(all, .3s, linear);
    }

    input:focus ~ .icon {
        opacity: 1;
        .transition(all, .3s, linear);
    }

    &.permanent-label {
        input:not(:placeholder-shown) ~ .label {
            top: 0;
            opacity: 1;
        }
    }

    input:-webkit-autofill,
    input:-webkit-autofill:hover,
    input:-webkit-autofill:focus,
    input:-webkit-autofill:active {
        transition: background-color 5000s ease-in-out 0s;
        -webkit-text-fill-color: #fff !important;
    }
}
