%input {
    padding: 10px 15px;
    width: calc(100% - 32px);
    border: 1px solid color('grey', 4);
    font-size: 16px;
    border-radius: 2px;

    &:focus {
        border: 1px solid color('grey', 8);
        outline: 1px solid $blue;
        outline-offset: -3px;
        outline-style: dotted;
    }

    &:disabled {
        background-color: color('grey', 2);
        cursor: default;
    }

    &::placeholder {
        color: color('grey', 4);
        font-style: italic;
    }
}

%label {
    display: block;
    margin-bottom: 5px;
    color: color('grey', 5);
}

%input__option--container {
    border: 1px solid color('grey', 4);
    border-radius: 2px;
    padding: 10px 15px;
    margin-bottom: 10px;
    background: $white;
}

%input__option {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: auto;
}

%input__option--input {
    position: relative;
    padding-left: 35px;
    cursor: pointer;
    display: inline-block;
    line-height: 25px;
    user-select: none;

    &:before {
        content: '';
        left: 0;
        position: absolute;
        height: 20px;
        width: 20px;
        border: 2px solid color('grey', 4);
        transition: all .2s;
    }

    &:after {
        content: "";
        position: absolute;
        display: none;
    }
}

.form__item {
    min-width: 350px;
}

input {
    @extend %input;
}

label,
.input__label {
    @extend %label;
}

.input__hint {
    @extend %label;
    font-style: italic;
    font-size: .8em;
}

.input__error {
    @extend %label;
    color: $red;
    background: $lightred;
    padding: 10px 5px;

    +input {
        border-color: $red;
    }
}

textarea {
    @extend %input;
    height: 200px;
    resize: none;
}

.input__currency {
    padding-left: 50px;
    width: calc(100% - 67px);

    &--contianer {
        position: relative;
    }

    &--symbol {
        position: absolute;
        line-height: 40px;
        width: 40px;
        text-align: center;
        border-right: 1px solid color('grey', 4);
        color: color('grey', 4);
    }
}

.input__checkbox {
    @extend %input__option;

    &:checked {
        +.input__checkbox--text {
            &:after {
                display: block;
            }

            &:before {
                border: 2px solid $blue;
                background-color: $blue;
            }
        }
    }

    &:disabled {
        +.input__checkbox--text {
            cursor: initial;

            &:before {
                background-color: rgb(235, 235, 228);
                border: 2px solid rgb(235, 235, 228);
            }
        }
    }

    &--container {
        @extend %input__option--container;
    }

    &--container-inline {
        @extend %input__option--container;
        display: inline-block;

        .input__checkbox--text {
            padding: 30px 0 0 0;

            &:before,
            &:after {
                left: 50%;
            }

            &:after {
                transform: translateX(-50%) rotate(45deg);
            }

            &:before {
                top: 0;
                transform: translateX(-50%);
            }
        }
    }

    //custom checkbox
    &--text {
        @extend %input__option--input;

        &:hover {
            &:before {
                background-color: color('grey', 3);
            }
        }

        &:after {
            left: 8px;
            top: 3px;
            width: 5px;
            height: 12px;
            border: solid white;
            border-width: 0 3px 3px 0;
            transform: rotate(45deg);
        }

        &:before {
            border-radius: 2px;
        }
    }
}

.input__radio {
    @extend %input__option;

    &:checked {
        +.input__radio--text {
            &:after {
                display: block;
            }

            &:before {
                border: 2px solid $blue;
            }

            &:hover {
                &:after {
                    background-color: $blue;
                }
            }
        }

        &:disabled {
            +.input__radio--text:after {
                background-color: $white;
            }

            +.input__radio--text:hover {
                &:after {
                    background-color: $white;
                }
            }
        }
    }

    &:disabled {
        +.input__radio--text {
            cursor: initial;

            &:before {
                background-color: rgb(235, 235, 228);
                border: 2px solid rgb(235, 235, 228);
            }

            &:hover {
                &:after {
                    background-color: rgb(235, 235, 228);
                }
            }
        }
    }

    &--container {
        @extend %input__option--container;
    }

    &--container-inline {
        @extend %input__option--container;
        display: inline-block;

        .input__radio--text {
            padding: 30px 0 0 0;

            &:before,
            &:after {
                left: 50%;
                transform: translateX(-50%);
            }

            &:before {
                top: 0;
            }
        }
    }

    //custom radio button
    &--text {
        @extend %input__option--input;

        &:hover {
            &:after {
                background-color: color('grey', 3);
                display: block;
            }
        }

        &:before {
            border-radius: 50%;
        }

        &:after {
            left: 5px;
            top: 5px;
            width: 14px;
            height: 14px;
            border-radius: 50%;
            background-color: $blue;
        }
    }
}

.input__toggle {
    @extend %input__option;

    &:checked+.input__toggle--switch {
        background-color: darken($lightblue, 10%);

        &:before {
            transform: translateY(-5px) translateX(35px);
            background-color: $blue;
            box-shadow: 0 0 6px 0px $accentblue;
        }
    }

    &:disabled+.input__toggle--switch {
        background-color: rgb(235, 235, 228);

        &:before {
            background-color: darken(#F1F1F1, 20%);
            box-shadow: none;
        }
    }

    &:focus+.input__toggle--switch {
        box-shadow: 0 0 1px #2196F3;
    }

    &--container {
        @extend %input__option--container;
        position: relative;
    }

    &--container-inline {
        @extend %input__option--container;
        position: relative;
        display: inline-block;

        .input__toggle--text {
            padding: 30px 0 0 0;
            margin: 0px 20px;

            &:before,
            &:after {
                left: 50%;
                transform: translateX(-50%);
            }

            &:before {
                top: 0;
            }
        }

        .input__toggle--switch {
            top: 15px;
            left: 50%;
            transform: translateX(-50%);
        }
    }

    &--switch {
        position: absolute;
        cursor: pointer;
        height: 15px;
        width: 60px;
        top: 50%;
        left: 10px;
        background-color: $grey;
        transition: .4s;
        border-radius: 34px;
        transform: translateY(-50%);

        &:before {
            position: absolute;
            content: "";
            height: 25px;
            width: 25px;
            transform: translateY(-5px);
            background-color: color('grey', 1);
            transition: .4s;
            border-radius: 50%;
            box-shadow: 0 0 6px 0px color('grey', 5);
        }
    }

    &--text {
        margin: 10px 0 10px 60px;
    }
}

.input__select {
    @extend %input;
    -webkit-appearance: none;
    -ms-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: transparent;
    cursor: pointer;
    width: 100%;

    &::-ms-expand {
        display: none;
    }

    &--container {
        background-color: $white;
        position: relative;

        &:before {
            font-family: 'Font Awesome 5 Free';
            content: "\f078";
            font-weight: 900;
            position: absolute;
            top: 13px;
            right: 10px;
        }
    }
}

.input__file {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: auto;

    &:disabled~.input__file--text {
        color: lighten($grey, 15%);
        border-color: lighten($grey, 15%);
    }

    &--container {
        display: flex;
        align-items: center;
    }

    &--button, &--button-img {
        margin: 0;
        padding: 5px 30px;
        transition: all .2s;
        min-height: auto;
        min-width: auto;

        &:before {
            content: "\f574";
            font-family: "Font Awesome 5 Free";
            font-weight: 900;
            margin-right: 10px;
        }
    }

    &--button-img:before{
        content: "\f1c5";
    }

    &--text {
        margin-left: 25px;
        font-style: italic;
        white-space: nowrap;
        border-bottom: 2px solid $grey;
        transition: all .5s;

        &.active {
            border-color: $blue;
        }
    }
}

input[type=search], .input__search{
    -webkit-appearance: none;
    height: 100%;
}

.input__search {
    border-radius: 2px 0 0 2px;
    border-right: none;

    &--container {
        display: flex;
    }

    &--button {
        border-radius: 0 2px 2px 0;
        box-shadow: none;
        margin: 0;
    }
}

.form__fieldset {
    background: $white;
    box-shadow: 0 5px 0px 0px color('grey', 2);
    border: none;
    padding: 0;

    &-header {
        position: relative;
        padding: 0 0 0 70px;
        @include component_heading;
    }

    &-body {
        padding: 20px;
        padding-left: 70px;
    }

    .form__item {
        margin-bottom: 25px;
    }
}

form,
.form {
    .form__item:not(:only-of-type) {
        margin-bottom: 25px;
    }

    .form__fieldset {
        margin-bottom: 15px;

        &-header {
            padding-top: 15px;

            h4 {
                transform: translateY(-15px);
            }
        }
    }
}