/// <reference path="_variables-shared.scss" />
/// <reference path="_mixins.scss" />
/// <reference path="../bs4/scss/bootstrap.scss" />

// Forms
// ------------------------------------------------------

fieldset.content-group {
    margin-bottom: 2rem;

    > legend {
        position: relative;
        font-size: $h5-font-size;
        font-weight: 400;
        color: $gray-500;
        text-transform: uppercase;
        margin-bottom: 1.2rem;

        &:before {
            position: absolute;
            content: ' ';
            width: 100%;
            left: 0;
            top: 50%;
            height: 1px;
            background: rgba(0,0,0, 0.12);
            z-index: 0;
        }

        > span {
            position: relative;
            display: inline-block;
            background: $body-bg;
            padding-right: 1rem;
            z-index: 1;
        }
    }
}

.form-group label:not(.form-check-label):not(.custom-control-label) {
	font-weight: $font-weight-medium;
}

.form-group.required > label:after {
    content: ' *';
}

.form-text {
    line-height: 1.3;
}


// Control with Icons
// ------------------------------------------------------

.has-icon {
	position: relative;
	display: flex;

	.form-control {
		position: relative;
		z-index: 2;
	}

	.input-group-icon {
		position: absolute;
		left: 0;
		z-index: 10;
		width: $input-height;
		height: $input-height;
		line-height: $input-height;
		text-align: center;
		vertical-align: middle;
	}

	&.has-icon-right .input-group-icon {
		left: auto;
		right: 0;
	}

	&.input-group-lg .input-group-icon {
		width: $input-height-lg;
		height: $input-height-lg;
		line-height: $input-height-lg;
		font-size: $font-size-lg;
	}

	&.input-group-sm .input-group-icon {
		width: $input-height-sm;
		height: $input-height-sm;
		line-height: $input-height-sm;
		font-size: $font-size-sm;
	}

	&:not(.has-icon-right) {
		.form-control {
			padding-left: $input-height;
		}

		&.input-group-lg .form-control {
			padding-left: $input-height-lg;
		}

		&.input-group-sm .form-control {
			padding-left: $input-height-sm;
		}
	}

	&.has-icon-right {
		.form-control {
			padding-right: $input-height;
		}

		&.input-group-lg .form-control {
			padding-right: $input-height-lg;
		}

		&.input-group-sm .form-control {
			padding-right: $input-height-sm;
		}
	}
}


// Checkbox & Radio tweaks
// ------------------------------------------------------

.radio input[type="radio"], 
.radio-inline input[type="radio"], 
.checkbox input[type="checkbox"], 
.checkbox-inline input[type="checkbox"] {
    margin-right: 0.25rem;
}


//
// Validation
// ------------------------------------------------------

.validation-summary-valid,
.validation-summary-errors {
    @extend .alert;

    > *:last-child {
        margin-bottom: 0;
    }
}

.validation-summary-valid {
    display: none;
    @extend .alert-success; 
}

.validation-summary-errors {
    @extend .alert-danger; 
}

.field-validation-error {
	display: block;
	color: $form-feedback-invalid-color;
	font-size: $font-size-sm;
	margin-top: 0.25rem;
	width: 100%;
}

.is-valid,
.is-invalid {
	&:focus {
		box-shadow: none !important;
	}
}

