/**
 * Form-specific CSS
 *
 * Mixes legacy classes with new (but overly complicated) classes.
 * E.g.: .ui-field-contain is the "old" version of
 *       .meapp-form-item and .meapp-form-group (combined)
 * TODO
 */

.meapp-select-multiple {
	height: auto !important;
}

.meapp-form-item {
	margin: 10px;
	max-width: 600px;
	line-height: 1.15;
}

fieldset {
	padding: 0;
	border: none;
}

/* TODO: Why is radio a part of this? */
.meapp-form-radio,
.meapp-form-group,
.ui-field-contain {
	position: relative;
	margin-top: 1.5rem;
	margin-bottom: 2rem !important;
}

.meapp-form-inline > .meapp-form-group,
.meapp-form-inline > .ui-field-contain {
	display: inline-block;
	margin-bottom: 0;
}

.meapp-form-help {
	margin-top: 0.125rem;
	margin-left: 0.125rem;
	color: #b3b3b3;
	font-size: 0.8rem;
}
.meapp-checkbox .meapp-form-help, 
.meapp-form-radio .meapp-form-help, 
.meapp-form-group .meapp-form-help {
	position: absolute;
	width: 100%;
}
.meapp-checkbox .meapp-form-help {
	position: relative;
	margin-bottom: 1rem;
}
.meapp-form-radio .meapp-form-help {
	padding-top: 0.25rem;
	margin-top: -1rem;
}

.meapp-form-group input {
	height: 1.9rem;
}
.meapp-form-group textarea {
	resize: none;
}
.meapp-form-group select {
	width: calc(100% + 6px); /* adjust to input width */
	font-size: 1rem;
	height: 1.6rem;
	padding: 0.125rem 0.125rem 0.0625rem;
	border: 1px solid #BBC2C6;
	border-radius: 5px;
	height: 36px;
	line-height: 1.6;
	box-shadow: none;
}
.meapp-form-group .meapp-control-label {
	position: absolute;
	top: 0.6rem;
	pointer-events: none;
	padding-left: 0.6rem;
	z-index: 1;
	color: #b3b3b3;
	font-size: 1rem;
	font-weight: normal;
	-webkit-transition: all 0.28s ease;
	transition: all 0.28s ease;
}
.meapp-form-group textarea {
	min-height: 67px;
	resize: vertical;
}
.meapp-form-group input[type="file"] {
	line-height: 1;
}
.meapp-form-group select,
.meapp-form-group input:focus,
.meapp-form-group input:valid,
.meapp-form-group input[value]:not([value='']),
.meapp-form-group input.meapp-has-value,
.meapp-form-group textarea:focus,
.meapp-form-group textarea:valid,
.meapp-form-group textarea.meapp-has-value {
	color: #333;
}
.meapp-form-group select ~ .meapp-control-label,
.meapp-form-group input:focus ~ .meapp-control-label,
.meapp-form-group input:valid ~ .meapp-control-label,
.meapp-form-group input[value]:not([value='']) ~ .meapp-control-label,
.meapp-form-group input[type='date'] ~ .meapp-control-label,
.meapp-form-group input[type='time'] ~ .meapp-control-label,
.meapp-form-group textarea:focus ~ .meapp-control-label,
/*
.meapp-form-group textarea:valid ~ .meapp-control-label,
*/
.meapp-form-group textarea:not(:empty) ~ .meapp-control-label {
	/* TODO: This doesn't work properly for textareas! */
	font-size: 0.8rem;
	color: gray;
	top: -1rem;
	left: 0;
	white-space: nowrap;
	overflow-x: auto;
}
.meapp-form-group select:focus,
.meapp-form-group input:focus,
.meapp-form-group textarea:focus {
	outline: none;
	border: 1px solid #4E6D8D;
	border-radius: 5px;
}
.meapp-form-group select:focus ~ .meapp-control-label,
.meapp-form-group input:focus ~ .meapp-control-label,
.meapp-form-group textarea:focus ~ .meapp-control-label {
	color: #4E6D8D;
}

.meapp-checkbox label,
.meapp-form-radio label {
	position: relative;
	cursor: pointer;
	padding-left: 2rem;
	text-align: left;
	color: #333;
	display: block;
	white-space: nowrap;
}
.meapp-checkbox > label.meapp-control-label,
.meapp-form-radio > label {
	/* This is the label *next to* the checkbox! */
	padding-left: 0;
}
.meapp-checkbox > label {
	margin-bottom: 10px;
}
.meapp-checkbox > label:last-child {
	margin-bottom: 3rem;
}

.meapp-checkbox input,
.meapp-form-radio input {
	width: auto;
	opacity: 0.00000001;
	position: absolute;
	left: 0;
}

.meapp-radio {
	margin-bottom: 1rem;
	display: inline-flex;
	margin-top: 1rem;
	margin-right: 2rem;
	width: 180px;
}
.meapp-radio .meapp-helper {
	position: absolute;
	top: -0.25rem;
	left: -0.25rem;
	cursor: pointer;
	display: block;
	font-size: 1rem;
	-webkit-user-select: none;
	 -moz-user-select: none;
	  -ms-user-select: none;
		  user-select: none;
	color: #999;
}
.meapp-radio .meapp-helper::before, 
.meapp-radio .meapp-helper::after {
	content: '';
	position: absolute;
	left: 0;
	top: 0;
	margin: 0.25rem;
	width: 1rem;
	height: 1rem;
	-webkit-transition: -webkit-transform 0.28s ease;
	transition: -webkit-transform 0.28s ease;
	transition: transform 0.28s ease;
	transition: transform 0.28s ease, -webkit-transform 0.28s ease;
	border-radius: 50%;
	border: 0.125rem solid currentColor;
}
.meapp-radio .meapp-helper::after {
	-webkit-transform: scale(0);
		  transform: scale(0);
	background-color: #4E6D8D;
	border-color: #4E6D8D;
}
.meapp-radio label:hover .meapp-helper {
	color: #4E6D8D;
}
.meapp-radio input:checked ~ .meapp-helper::after {
	-webkit-transform: scale(0.5);
		  transform: scale(0.5);
}
.meapp-radio input:checked ~ .meapp-helper::before {
	color: #4E6D8D;
}

.meapp-checkbox .meapp-helper {
	color: #999;
	position: absolute;
	top: 0;
	left: 0;
	width: 1rem;
	height: 1rem;
	z-index: 0;
	border: 0.125rem solid currentColor;
	border-radius: 0.0625rem;
	-webkit-transition: border-color 0.28s ease;
	transition: border-color 0.28s ease;
}
.meapp-checkbox .meapp-helper::before, 
.meapp-checkbox .meapp-helper::after {
	position: absolute;
	height: 0;
	width: 0.2rem;
	background-color: #337ab7;
	display: block;
	-webkit-transform-origin: left top;
		  transform-origin: left top;
	border-radius: 0.25rem;
	content: '';
	-webkit-transition: opacity 0.28s ease, height 0s linear 0.28s;
	transition: opacity 0.28s ease, height 0s linear 0.28s;
	opacity: 0;
}
.meapp-checkbox .meapp-helper::before {
	top: 0.65rem;
	left: 0.38rem;
	-webkit-transform: rotate(-135deg);
		  transform: rotate(-135deg);
	box-shadow: 0 0 0 0.0625rem #fff;
}
.meapp-checkbox .meapp-helper::after {
	top: 0.3rem;
	left: 0;
	-webkit-transform: rotate(-45deg);
		  transform: rotate(-45deg);
}
.meapp-checkbox label:hover .meapp-helper {
	color: #4E6D8D;
}
.meapp-checkbox input:checked ~ .meapp-helper {
	color: #4E6D8D;
}
.meapp-checkbox input:checked ~ .meapp-helper::after, .meapp-checkbox input:checked ~ .meapp-helper::before {
	opacity: 1;
	-webkit-transition: height 0.28s ease;
	transition: height 0.28s ease;
}
.meapp-checkbox input:checked ~ .meapp-helper::after {
	height: 0.5rem;
}
.meapp-checkbox input:checked ~ .meapp-helper::before {
	height: 1.2rem;
	-webkit-transition-delay: 0.28s;
		  transition-delay: 0.28s;
}

.meapp-has-error .meapp-legend.meapp-legend, .meapp-has-error.form-group .meapp-control-label.meapp-control-label {
	color: #d9534f;
}
.meapp-has-error.meapp-form-group .meapp-form-help,
.meapp-has-error.meapp-form-group .meapp-helper, .meapp-has-error.meapp-checkbox .meapp-form-help,
.meapp-has-error.meapp-checkbox .meapp-helper, .meapp-has-error.meapp-radio .meapp-form-help,
.meapp-has-error.meapp-radio .meapp-helper, .meapp-has-error.meapp-form-radio .meapp-form-help,
.meapp-has-error.meapp-form-radio .meapp-helper {
	color: #d9534f;
}

.awpb-item-form {
	padding: 40px;
	margin: 40px auto;
	box-shadow: 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12), 0 3px 5px -1px rgba(0, 0, 0, 0.2);
	max-width: 500px;
}

.awpb-item-form form {
    width: auto;
	max-width: 500px;
    min-width: auto;
}

.awpb-item-form div[data-role="header"] {
    background-color: #67727a;
    position: relative;
    z-index: 999;
    max-width: 500px;
    height: 71px;
    text-align: center;
}

div.sum:not(.red) {
	background-color: #f9f9f9;
}
div.sum.red {
	color: red;
}
div.sum.green {
	color: green;
}

input[type='number'] {
	text-align: end;
}

form table.table-stripe {
	border-collapse: collapse;
}
form table.table-stripe td {
	border: 1px solid rgb(234, 234, 234);
}
form table.table-stripe td,
form table.table-stripe th {
	padding: 4px;
	padding-left: 10px;
	padding-right: 10px;
}
.meapp-form-group select[multiple] {
	height: 324px;
	width: 100%;
}
.meapp-form-item.filtered-multiselect {
	max-width: none;
}
.meapp-form-item.filtered-multiselect input {
	max-width: calc(100% - 6px);
}

.loader {
	pointer-events: none !important;
	background-color: #BBC2C6 !important;
	color: grey !important;
}

input:invalid {
	border-color: #d9534f;
}
input.invalid {
	border-color: #d9534f;
}