@import "../../../base/less/mixins";

.sow-form-field {
	display: block;
	margin-bottom: 1em;
	.clearfix();

	label {
		display: block;
		margin-bottom: 5px;

		@label_width: default;
		@label_align: default;
		width: @label_width;
		text-align: @label_align;
		@label_font_color: default;
		color: @label_font_color;

		strong {
			@label_font_family: default;
			@label_font_weight: default;
			.font(@label_font_family, @label_font_weight);

			@label_font_size: default;
			font-size: @label_font_size;
		}

		&.sow-form-field-label-left {
			float: left;
			margin-right: 10px;
		}

		&.sow-form-field-label-right {
			float: right;
			margin-left: 10px;
		}
	}

	.sow-field-container {
		overflow: hidden;
		display: block;

		textarea:focus,
		input:focus,
		> :focus {
			@outline_style: solid;
			@outline_color: default;
			@outline_width: 1px;

			// NB: Do not optimize this into a single line, otherwise the removal of 'default' values won't work.
			outline-style: @outline_style;
			outline-color: @outline_color;
			outline-width: @outline_width;
		}
	}

	@field_font_family: default;
	@field_font_weight: default;
	@field_font_size: default;
	@field_font_color: default;

	@field_background: default;

	@field_margin: default;
	@field_padding: default;
	@field_border_radius: default;
	@field_border_color: default;
	@field_border_width: default;
	@field_border_style: default;
	@field_max_width: default;
	@field_height: default;
	@field_height_textarea: default;
	@responsive_breakpoint: 780px;

	.sow-text-field {
		height: @field_height;
	}

	& when not ( @field_max_width = false ) {
		@media (min-width: @responsive_breakpoint) {
			.sow-text-field {
				max-width: @field_max_width;
			}

			&.sow-form-field-datepicker .sow-field-container,
			&.sow-form-field-location .sow-field-container {
				max-width: @field_max_width;
			}

			&.sow-form-field-datepicker .sow-text-field,
			&.sow-form-field-location .sow-text-field {
				max-width: none;
			}

			textarea {
				max-width: @field_max_width;
			}
		}
	}

	textarea {
		height: @field_height_textarea;
	}

	textarea,
	.sow-text-field {
		display: block;
		width: 100%;
		.box-sizing(border-box);
		border-radius: @field_border_radius;

		margin: @field_margin;
		border: @field_border_width @field_border_style @field_border_color;
		padding: @field_padding;

		background: @field_background;
		color: @field_font_color;

		font-size: @field_font_size;
		.font(@field_font_family, @field_font_weight);
	}

	&.sow-form-field-radio {
		ul {
			list-style: none;
			margin: 0;
			padding: 0;

			li {
				margin: 0;
			}

			label {
				margin-bottom: 0;
				display: flex;
				align-items: center;
			}

			input {
				float: left;
				margin-right: 0.5em;
				height: auto;
			}
		}
	}

	&.sow-form-field-checkboxes {
		ul {
			list-style: none;
			margin: 0;
			padding: 0;

			li {
				align-items: center;
				display: flex;
				margin: 0;
			}

			label {
				margin-bottom: 0;
			}

			input {
				height: auto;
				margin-right: 0.5em;
			}
		}
	}

	@description_font_size: 0.9em;
	@description_font_color: #999999;
	@description_font_style: italic;

	.sow-form-field-description {
		font-size: @description_font_size;
		margin-top: 0.2em;
		margin-left: 0.2em;
		color: @description_font_color;
		font-style: @description_font_style;
	}
}

.sow-recaptcha {
	margin-bottom: 1em;
}

.sow-contact-form {
	// Container Background
	@container_background: default;
	@container_padding: 10px;

	// Container border
	@container_border_color: #c0c0c0;
	@container_border_width: 1px;
	@container_border_style: solid;

	padding: @container_padding;
	border: @container_border_color @container_border_style @container_border_width;
	background-color: @container_background;

	.sow-error {
		@error_background: #fce4e5;
		@error_border: #ec666a;
		@error_text: #ec666a;
		@error_padding: 5px;
		@error_margin: 10px;

		background: @error_background;
		border: 1px solid @error_border;
		color: @error_text;
		border-radius: 2px;
		padding: @error_padding;
		font-size: 0.8em;
		list-style: none;
		margin: 0 0 @error_margin 0;

		li {
			margin: 0;
		}
	}

	.sow-submit-wrapper {

		.sow-submit {

		}

		.sow-submit:disabled {

		}
	}

	.sow-submit-styled {

		@submit_background_color: #eeeeee;
		@submit_background_gradient: 10%;
		@submit_border_color: #989a9c;
		@submit_border_style: solid;
		@submit_border_width: 1px;
		@submit_border_radius: 3px;
		@submit_text_color: #5a5a5a;
		@submit_font_size: default;
		@submit_weight: 500;
		@submit_padding: 10px;
		@submit_width: default;
		@submit_align: left;

		@submit_inset_highlight: 50%;

		text-align: @submit_align;
		.sow-submit {
			color: @submit_text_color;
			& when( @submit_background_gradient > 0% ) {
				.gradient(
					lighten(@submit_background_color, @submit_background_gradient),
					darken(@submit_background_color, @submit_background_gradient),
					lighten(@submit_background_color, @submit_background_gradient)
				);
			}
			
			& when( @submit_background_gradient = 0% ) {
				background: @submit_background_color;
			}

			border: @submit_border_width @submit_border_style @submit_border_color;
			border-radius: @submit_border_radius;
			font-weight: @submit_weight;
			font-size: @submit_font_size;
			padding: @submit_padding @submit_padding * 2;
			display: inline-block;
			width: @submit_width;

			.sow-submit-box-shadow ( @percent ) when ( @percent > 0% ) {
				box-shadow: inset 0 -1px 0 fade( #ffffff, @percent );
			}

			.sow-submit-box-shadow( @submit_inset_highlight );
		}

		.sow-submit:disabled {
			color: lighten(@submit_text_color, 20%);
			cursor: not-allowed;
			background: lighten(@submit_background_color, 20%);
			border: @submit_border_width @submit_border_style lighten(@submit_border_color, 20%);

		}
	}
}
