form {
    padding: 10px;
    flex-grow: 1;
}

.form-label {
    padding: .375rem .75rem;
}

.form-control {
    display: block;
    background-clip: padding-box;
    width: 100%;

    &.form-control-light {
        border-top: none;
        border-left: none;
        border-right: none;
        background-color: transparent;
    }
}

.form-inline {
    display: flex;
    flex-flow: row wrap;
    align-items: center;
}

.form-inline .form-check {
    width: 100%;
}

.form-check-inline {
    display: inline-block;
    margin-right: 1rem;
}

.invalid-feedback {
    display: block;
    flex-basis: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: $form-invalid-color;
}

form.needs-validation:invalid {
    [type="submit"] {
        pointer-events: none;
    }
}

label.required::after {
    content: " *";
    color: $required-color;
}

input[type="range"] {
    width: 100%;
}

@media (min-width: 576px) {
    .form-inline label {
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 0;
    }

    .form-inline .form-group {
        display: flex;
        flex-flow: row wrap;
        align-items: center;
    }

    .form-inline .form-control {
        display: inline-block;
        width: auto;
        vertical-align: middle;
    }

    .form-inline input[type=search] {
        width: 100%;
        max-width: 200px;
    }

    .form-inline .form-control-plaintext {
        display: inline-block;
    }

    .form-inline .input-group,
    .form-inline .custom-select {
        width: auto;
    }

    .form-inline .form-check {
        display: flex;
        align-items: center;
        justify-content: center;
        width: auto;
        padding-left: 0;
    }

    .form-inline .form-check-input {
        position: relative;
        flex-shrink: 0;
        margin-top: 0;
        margin-right: 0.25rem;
        margin-left: 0;
    }
}

input:focus-visible {
    outline: none;
}

input[type=search] {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    @extend .icon-svg-magnifier;
    background-position: 10px center;
    background-size: 1.2em;
    background-repeat: no-repeat;
    padding-left: calc(1.2em + 15px) !important;
    padding-right: 5px !important;

    &::-webkit-search-cancel-button {
        -webkit-appearance: none;
        @extend .icon-svg-cancel;
        height: 20px;
        width: 20px;
        cursor: pointer;
    }
}

.switch {
    position: relative;
    display: inline-block;
    width: $switch-width;
    height: $switch-height;
    margin: 10px;

    input[type=checkbox] {
        opacity: 0;
        width: 0;
        height: 0;

        &:checked + .slider {
            background: $switch-background-color-on;
        }

        &:checked + .slider:before {
            transform: translateX(26px);
        }
    }

    .slider {
        position: absolute;
        cursor: pointer;
        border: 1px solid #ffffff;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: $switch-background-color-off;
        transition: .4s;

        &.round {
            border-radius: 34px;

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

        &:before {
            position: absolute;
            content: "";
            height: $switch-trigger-size;
            width: $switch-trigger-size;
            left: $switch-trigger-gap;
            bottom: $switch-trigger-gap + 1px;
            background: #ffffff;
            forced-color-adjust: none;
            border: 1px solid #ffffff;
            transition: .4s;
        }
    }
}

.input-group {
    padding: 0;
    display: flex;
    flex-wrap: wrap;

    & > :not(:first-child):not(.dropdown):not(.invalid-feedback) {
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
        margin-left: -1px;
    }

    &.has-validation > :nth-last-child(n + 3) {
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
        margin-left: -1px;
    }

    &:not(.has-validation) > :not(:last-child):not(.dropdown) {
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }

    .form-control {
        flex-grow: 1;
        width: auto;
    }

    .input-group-addon {
        line-height: normal;
        background-color: #fff;
        color: #000;
        border: 1px solid #000;
        padding-top: 7px;
        padding-left: 10px;
        padding-right: 10px;
        padding-bottom: 5px;
    }

    .dropdown {
        background: #fff;
        box-shadow: 1px 1px 3px 0 rgba(0, 0, 0, 0.5);
        padding: 20px;
        width: 100%;
        top: 100%;
        left: 0;
        right: 0;
    }
}

.select-badge {
    margin: 0 .5em;
    font-family: $font-family-base;
    font-size: 13px;

    select {
        padding: .625em 1em;
        padding-right: 2.75em;
        border: solid white 1px;
        border-radius: .875em;
        background: #D9D9D9;
        outline: none;
        -webkit-appearance: none;
        -moz-appearance: none;
    }

    .arrow {
        position: absolute;
        width: 2em;
        height: 100%;
        top: 1px;
        right: 2px;
        border-left: solid white 1px;
        pointer-events: none;
    }
}
