@import "mixins";
.lea-input-autocomplete {
    position: relative;
    float: left;
    width: 100%;
    input {
        width: 100%;
        border-radius: $border-radius;
        box-shadow: none;
        border: $border-input;
        background-color: $background-input;
        font-family: $title;
        font-size: 1rem;
        padding: 1.2rem 1rem 0.5rem;
        margin: 1.1rem 0;
        color: $black;
        box-sizing: border-box;
        transition: $short-transition;
        cursor: text;
        &:focus {
            outline: none;
            transition: $short-transition;
            border: $border-focus;
        }
        &.input-error {
            // transition: $short-transition;
            transition: $short-transition;
            border: $border-error;
            color: $red;
        }
        &:disabled {
            background-color: $bg-grey;
            border: $border-disabled;
            color: $dark-grey;
            cursor: not-allowed;
            &~.select-arrow {
                z-index: 2;
                cursor: not-allowed;
                path {
                    fill: $light-grey;
                }
            }
            &~.clear-button {
                display: none;
            }
        }
        display: block;
        line-height: 1.3;
        -moz-appearance: none;
        -webkit-appearance: none;
        appearance: none;
        background-color: $background-input;
         ::-ms-expand {
            display: none;
        }
    }
    .select-arrow {
        position: absolute;
        right: 1rem;
        top: 1.95rem;
        z-index: -1;
        transform: scale(0.8);
        path {
            fill: $accent;
        }
    }
    .clear-button {
        position: absolute;
        right: 0.75rem;
        top: 1.6rem;
        z-index: -1;
        transform: scale(0.8);
        z-index: 3;
    }
    label {
        position: absolute;
        transform-origin: left;

        top: 2.05rem;
        left: 1rem;
        font-size: 1rem;
        color: $dark-grey;
        &.label-focus {
            color: $accent;
            transition: $short-transition;
        }
        // &.label-float {
        //     transform: scale(0.7) translate(-0.5rem, -1rem);
        //     transition: $short-transition;
        // }
        &.label-float {
            transform: scale(0.7) translate(0rem, -1rem);
            transition: $short-transition;
        }
        &.label-not-float {
            transform: scale(1) translate(0);
            transition: $short-transition;
        }
        &.label-error {
            color: $red;
            transition: $short-transition;
        }
        &.label-disabled {
            color: $dark-grey;
        }
    }
    .select-dropdown {
        position: absolute;
        width: 100%;
        top: 4.4rem;
        background-color: $white;
        z-index: 99;
        border: $border-input;
        border-radius: $border-radius-dropdown;
        overflow: hidden;
        .select-options-container {
            position: relative;
            float: left;
            width: 100%;
            .select-header {
                padding: 1rem 1rem 0.8rem;
                color: $accent;
                font-size: 0.7rem;
                border-bottom: $border-input;
                float: left;
                width: 100%;
                box-sizing: border-box;
                p {
                    float: left;
                    width: calc(100% - 4rem);
                    margin: 0;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                    padding: 0.2rem 0;
                }
            }
            .options-container {
                max-height: 10rem;
                overflow-y: auto;
                &.has-header {
                    max-height: 10rem;
                    margin-top: 3.15rem;
                }
                .select-option {
                    padding: 0.8rem;
                    font-size: 0.8rem;
                    color: $dark-grey;
                    border-bottom: $border-input;
                    cursor: pointer;
                    position: relative;
                    float: left;
                    width: 100%;
                    box-sizing: border-box;
                    &:last-of-type {
                        border-bottom: none;
                    }
                    &:hover {
                        background-color: $accent;
                        color: white;
                    }
                }
            }
        }
    }
    // .error {
    //     position: absolute;
    //     bottom: 0;
    //     font-size: 0.7rem;
    //     height: 0.7rem;
    //     overflow: hidden;
    //     left: 0;
    //     span {
    //         position: relative;
    //         float: left;
    //         color: $red;
    //         animation: 0.2s error ease-in-out;
    //         animation-delay: 0.1s;
    //         ;
    //     }
    // }
    // @keyframes error {
    //   from {
    //     margin-top: -1rem;
    //   }
    //   to {
    //     margin-top: 0;
    //   }
    // }
    .error {
        position: absolute;
        bottom: 0;
        font-size: 0.7rem;
        height: 0.9rem;
        overflow: hidden;
        left: 0;
        span {
            position: relative;
            // float: left;
            color: $red;
        }
    }
    // @keyframes error {
    //     from {
    //         margin-top: -1rem;
    //     }
    //     to {
    //         margin-top: 0;
    //     }
    // }
}

.error {
    span {
        transition: $short-transition;
        margin-top: -1rem;
    }
}

.input-error+.error {
    span {
        transition: $short-transition;
        margin-top: 0;
    }
}

.lea-input-loading {
    position: absolute;
    right: 0.5rem;
    top: 2.15rem;
    z-index: -1;
    z-index: 3;
}

.dark-mode {
    .lea-input-autocomplete {
        label {
            color: $light-grey;
        }
        input {
            color: $white;
            &:disabled {
                background-color: $dark-grey;
                border: $border-disabled;
                color: $grey;
            }
        }
        .select-dropdown {
            @include dark-select-dropdown
        }
    }
}