label {
    color: $ias-medium-gray;
    font-size: 13px;
    line-height: 22px;
    vertical-align: middle;
    padding-right: 5px;
    user-select: none;
}

// IF the label has the "disabled" class, or if it has a parent with the class: "disable-labels", then show as disabled.
// checkboxes and radio-buttons are excluded, since they take care of their own labels.
label.disabled, .disable-labels label:not(.ias-checkbox):not(.ias-radio-button) {
    cursor: default;
    opacity: $disabled-opacity;
}

.form-control, select.form-control {
    border-radius: 3px;
    border-color: $ias-border-gray;
    font-size: 1rem;

    &:focus {
        border-color: $ias-blue-4;
    }
}

.form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control {
    background-color: transparent;
    color: $ias-medium-gray;
    opacity: $disabled-opacity;
}

.login-form {
    margin-left: 25px;
    padding: 25px;
    position: relative;

    .btn-primary {
        margin-right: 10px;
    }
}

// Common code for checkboxes and radio buttons (things that have a "checked" state)
@mixin checkable-type($input-type) {
    cursor: pointer;
    display: inline-flex;
    line-height: 24px;
    margin: 0 0 5px 0;
    position: relative;
    user-select: none;

    > .ias-icon {
        display: flex;
        justify-content: center;
        align-items: center;
        border: 1px solid $ias-medium-gray;
        border-radius: 3px;
        color: transparent;
        font-size: 16px;
        height: 24px;
        width: 24px;
        flex-shrink: 0;

        &:before {
            font-weight: bold;
        }
    }

    &:hover {
        > input[type=#{$input-type}] {
            &:not(:disabled) {
                &~ .ias-icon {
                    border-color: $ias-blue-4;
                }
            }
        }
    }

    > input[type=#{$input-type}] {
        opacity: 0;
        position: absolute;
        height: 0;
        width: 0;

        &+ * {
            margin-right: 7px;
        }

        &:disabled {
            cursor: default;

            &:checked ~ .ias-icon {
                color: $ias-medium-gray;
            }

            & ~ .ias-icon, &~ span:not(.ias-icon) {
                cursor: default;
                opacity: $disabled-opacity;
            }
        }

        &:not(:disabled) {
            &:checked ~ .ias-icon {
                color: $ias-blue-3;
            }
        }
    }
}

// Styling for checkboxes, i.e.:
//<label class="ias-checkbox">
//    <input type="checkbox">
//    <i class="ias-icon ias-icon-check_thick"></i>
//    <span>Select Me</span>
//</label>
.ias-checkbox {
    @include checkable-type('checkbox');
}

// Styling for radio buttons, i.e.:
//<label class="ias-radio-button">
//    <input type="radio" name="text-after">
//    <i class="ias-icon ias-icon-check_thick"></i>
//    <span>Select Me</span>
//</label>
.ias-radio-button {
    @include checkable-type('radio');

    > input[type=radio] ~ .ias-icon {
        // Border for a radio button should be a circle
        border-radius: 50%;
    }
}

// Styling for the search input field
.ias-search {
    display: grid;
    grid-template-columns: [left] 32px 1fr 32px [right];
    align-items: center;

    > .ias-icon {
        order: 1;
        grid-column-start: left;
        grid-row: 1;
        z-index: 10;
        padding-left: 4px;
    }

    > input {
        order: 2;
        grid-column: left / right;
        grid-row: 1;
        padding-left: 32px;
        padding-right: 32px;
    }

    > button {
        order: 3;
        grid-row: 1;
        grid-column-end: right;
    }
}
