/**
 * Forms
 */

input[type=text],
input[type=password],
input[type=email],
input[type=tel],
input[type=date],
input[type=month],
input[type=week],
input[type=time],
input[type=number],
input[type=search],
input[type=url],
select,
textarea {
	border: $input-border-width solid #ddd;
	border-radius: $input-border-radius;
	color: $input-color;
	font-size: $input-font-size;
	line-height: $input-line-height;
	height: $input-height;
	padding: $input-padding-x $input-padding-y;

	&:focus {
		border-color: $input-focus-border-color;
	}
}

textarea {
	height: auto;
}

::-webkit-input-placeholder {
	color: $input-placeholder-color !important;
}

:-moz-placeholder {
	color: $input-placeholder-color !important;
}

::-moz-placeholder {
	color: $input-placeholder-color !important;
}

:-ms-input-placeholder {
	color: $input-placeholder-color !important;
}

// Gravity forms

div.gform_wrapper {
	.gform_body {
		width: auto;
	}

	ul.gform_fields {
		margin-left: -$input-spacing !important;
		margin-right: -$input-spacing !important;

		li.gfield {
			clear: both;
			padding-left: $input-spacing !important;
			padding-right: $input-spacing !important;
			margin-top: 0;
			margin-bottom: $input-spacing * 2;

			&::before,
			&::after {
				content: '';
				display: table;
			}

			&::after {
				clear: both;
			}

			div.ginput_container {
				margin: 0;
			}
		}

		@media (min-width: 768px) {

			// Halfs
			li.gf_left_half,
			li.gf_right_half {
				clear: none;
				float: left;
				padding-left: $input-spacing !important;
				padding-right: $input-spacing !important;
				width: 50%;
			}

			// Thirds
			li.gf_left_third,
			li.gf_middle_third,
			li.gf_right_third {
				clear: none;
				float: left;
				padding-left: $input-spacing !important;
				padding-right: $input-spacing !important;
				width: 33.333333%;
			}

			// Names
			li.gfield .ginput_container_name {
				@include flexbox;
				@include flex-flow(row nowrap);
				margin-left: -$input-spacing !important;
				margin-right: -$input-spacing !important;

				span {
					@include flex(1, 1, auto);
					min-width: 1px;
					padding-left: $input-spacing !important;
					padding-right: $input-spacing !important;

					&.name_prefix,
					&.name_suffix {
						@include flex(0, 1, 100px);
					}
				}
			}

			// Time
			li.gfield .ginput_container_time {
				// float: left;
			}

			// Address
			li.gfield .ginput_container_address {
				margin-left: -$input-spacing !important;
				margin-right: -$input-spacing !important;
				width: auto;

				span {
					display: inline-block;
					padding-left: $input-spacing !important;
					padding-right: $input-spacing !important;
				}

				.ginput_full {
					width: 100%;
				}

				.ginput_left,
				.ginput_right {
					margin-right: 0 !important;
					width: 50%;
				}
			}
		}

		&::before,
		&::after {
			content: '';
			display: table;
		}

		&::after {
			clear: both;
		}
	}

	// footer
	.gform_footer {
		margin: 0;
		padding: 0;
		text-align: left;

		input.button,
		button,
		input[type="submit"] {
			//height: $input-height; // make buttons same height as form fields
			//margin: 0;
			//padding: $input-padding-x $input-padding-y;

			.width75 &,
			.btn-full & {
				width: 100%;
			}
		}
	}
}

/* inline form styles */
.inline_form_wrapper.gform_wrapper {

	.top_label .gfield_label,
	.ginput_complex label,
	.gfield_time_hour label,
	.gfield_time_minute label,
	.gfield_time_ampm label,
	.gfield_date_month label,
	.gfield_date_day label,
	.gfield_date_year label,
	.instruction {
		@include sr-only;
	}

	.gform_footer {
		padding: 0;
		margin: $input-spacing * 2 0 0;

		button,
		input[type="button"],
		input[type="submit"] {
			//height: $input-height;
			//padding: $input-padding-x $input-padding-y;
		}
	}

	body & label.gfield_label+div.ginput_container {
		margin-top: 0;
	}
}

/* hide labels */
.hide_labels_wrapper.gform_wrapper {
	.top_label {
		.gfield_label {
			@include sr-only;
		}
	}

	.gform_footer {
		margin: 0;
	}
}

// @import "datepicker";

/* Small devices (tablets, 768px and up) */
@media (min-width: 768px) {

	.inline_form_wrapper.gform_wrapper {
		form {
			@include flexbox;
			@include flex-direction(row);
			@include flex-wrap(nowrap);
		}

		.validation_error {
			display: none;
		}

		.gform_body {
			@include flex(1, 1, auto);
			min-width: 1px;
			padding-right: $input-spacing;

			ul.gform_fields {
				@include flexbox;
				@include flex-direction(row);
				@include flex-wrap(nowrap);
				@include align-items(center);

				li.gfield {
					@include flex(1, 1, auto);
					min-width: 1px;
					margin: 0;
				}
			}
		}

		.gform_footer {
			clear: none;
			@include flex(0, 0, auto);
			margin: 0;
			min-width: 1px;
			width: auto;
		}
	}
}