//
// Variables
//
$control-spacing-vertical: $global-spacing-vertical !default;
$control-spacing-horizontal: 12px !default;
$control-body-max-width: 350px !default;


//
// Exported selectors
//
.#{$global-class-prefix}ui {

	.controls {
		padding: 0 $control-spacing-horizontal;
	}

	.control {
		margin-bottom: $control-spacing-vertical;

		&__header {

			.button {
				font-weight: 400;
			}
		}

		&__buttons {
			margin: 2px 0;
			display: inline-block;

			.button-group {

				.button {

					&::before {
						display: inline-block;
						-webkit-font-smoothing: antialiased;
						font: 400 16px/22px dashicons;
					}

					&.desktop::before {
						content: "\f472";
					}

					&.tablet::before {
						content: "\f471";
					}

					&.mobile::before {
						content: "\f470";
					}
				}
			}
		}

		&__title {
			display: block;
			font-size: 14px;
			font-weight: 600;
			margin-bottom: 5px;
			min-height: 28px;

			span {
				margin-right: 6px;
				vertical-align: middle;
			}

			// Fix for some widget forms
			input,
			select,
			textarea {
				font-weight: normal;
			}
		}

		&__description {
			display: block;
			margin-bottom: 5px;
			font-style: italic;
			line-height: 18px;
		}

		&__body {
			max-width: $control-body-max-width;
		}

		&__message {
			margin: ( $control-spacing-vertical * 2 ) 0 ( $control-spacing-vertical * 2 );
			text-align: center;
			word-break: break-all;
		}

		.actions {
			text-align: right;

			.button {
				min-width: 48%;

				&:not( :first-child ) {
					margin-left: 2%;
				}
			}
		}

		&__input-group {
			display: flex;

			.button {
				line-height: 20px;
				height: 26px;
				border: 1px solid #ddd;
				border-left: none;
				border-top-left-radius: 0;
				border-bottom-left-radius: 0;
				-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.07);
				box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.07);
			}
		}

		&__input-addon {
			padding: 0 10px 1px 4px;
			line-height: 24px;
		}

		&__input-label {
			display: block;
			margin: 2px 0 6px 2px;
			color: #a0a5aa;
		}
	}

	input ~ .control {

		&__title {
			display: inline;
		}
	}

	@import "controls/button-group";
	@import "controls/checkbox";
	@import "controls/colorpicker";
	@import "controls/editor";
	@import "controls/icon";
	@import "controls/link";
	@import "controls/list";
	@import "controls/media";
	@import "controls/radio";
	@import "controls/range";
	@import "controls/style";
	@import "controls/switch";

	// Contextual styles
	.modal-container {

		&.is-medium,
		&.is-large,
		&.is-x-large {

			.control {
				@include clearfix;

				&__header {
					float: left;
					margin-right: 12px;
					width: 350px;
				}

				&__body {
					display: block;
					padding: 2px;
					overflow: hidden;
				}
			}
		}
	}
}

// Icons
.#{$global-class-prefix}icon {

	&::before {
		display: inline-block;
		width: 20px;
		height: 20px;
		font-size: 20px;
		font-family: dashicons;
		text-decoration: inherit;
		font-weight: normal;
		font-style: normal;
		vertical-align: top;
		text-align: center;
		-webkit-transition: color .1s ease-in 0;
		transition: color .1s ease-in 0;
		-webkit-font-smoothing: antialiased;
	}
}

.#{$global-class-prefix}align-center,
.#{$global-class-prefix}align-middle {

	&::before {
		content: "\f207";
	}
}

.#{$global-class-prefix}align-left,
.#{$global-class-prefix}align-top {

	&::before {
		content: "\f206";
	}
}


.#{$global-class-prefix}align-right,
.#{$global-class-prefix}align-bottom {

	&::before {
		content: "\f208";
	}
}

.#{$global-class-prefix}align-justify {

	&::before {
		content: "\f214"
	}
}

.#{$global-class-prefix}align-top,
.#{$global-class-prefix}align-middle,
.#{$global-class-prefix}align-bottom {

	&::before {
		transform: rotate( 90deg );
		vertical-align: sub;
		line-height: 1;
	}
}