@import "../less/mixins";

.siteorigin-widget-form-no-styles {
	display: none !important;
}

.siteorigin-widget-form {
	a {
		box-shadow: none;
	}

	display: block !important;
	margin: 15px 0;

	&.siteorigin-widget-form-main {
		min-width: 600px;
	}

	.siteorigin-widget-field {
		margin: 1em 0;

		label {
			display: block;
			margin-bottom: 3px;
		}

		label.siteorigin-widget-field-label {
			font-weight: bold;
		}

		&:last-child {
			margin-bottom: 0;
		}

		&:first-child {
			margin-top: 0;
		}

		.siteorigin-widget-field-description {
			font-size: 0.9em;
			margin-top: 0.2em;
			color: #999;
			font-style: italic;
		}

		&.siteorigin-widget-field-separator {
			margin: 1.75em 0;
		}

		&.siteorigin-widget-field-is-optional {
			.field-optional {
				font-weight: normal;
				font-size: 0.8em;
				vertical-align: super;
				padding-left: 0.5em;
				color: #54a242;
				font-style: italic;
			}
		}

		input[type="text"] {
			width: 100%;
		}

		input.siteorigin-widget-input-color {
			width: auto;
		}
	}

	.siteorigin-widget-field-type-slider {

		.siteorigin-widget-slider-wrapper {
			margin: 10px 0;
			border: 1px solid #E0E0E0;
			padding: 12px 15px;
			background: #F4F4F4;
			.rounded(4px);
			max-width: 500px;
			display: block;
			margin-left: 55px;

		}

		.siteorigin-widget-slider-value {
			display: block;
			float: left;
			margin-top: 0;
			border: 1px solid #E0E0E0;
			padding: 11px 0;
			background: #F4F4F4;
			font-weight: bold;
			color: #666;
			width: 45px;
			text-align: center;
		}

		.siteorigin-widget-value-slider {
			position: relative;
			height: 5px;
			background: #A0A0A0;
			.box-shadow(~"inset 0 1px 2px rgba(0,0,0,0.25)");
			.rounded(4px);
		}

		.ui-slider-handle {
			cursor: move;
			.box-sizing(border-box);
			border: 1px solid #a4a3a8;
			z-index: 10;
			position: absolute;
			width: 18px;
			height: 18px;
			margin-top: -7px;
			margin-left: -9px;
			background: #F9F9F9;
			.rounded(10px);
			top: 0;
			left: 0;
			.box-shadow(~"inset 0 1px 0 #FFFFFF, 0 1px 1px rgba(0,0,0,0.1)");
		}

		input[type="number"] {
			display: none;
		}

	}

	.siteorigin-widget-field-repeater {

		.siteorigin-widget-field-repeater-top {
			background: #F0F0F0;
			border: 1px solid #D0D0D0;
			padding: 10px;
			position: relative;

			h3 {
				font-size: 13px;
				margin: 0;
				padding: 0 !important;
			}
		}

		.siteorigin-widget-field-expand,
		.siteorigin-widget-field-remove {
			width: 14px;
			height: 14px;
			position: absolute;
			top: 50%;
			margin-top: -7px;
			cursor: pointer;
			font-size: 14px;
			line-height: 14px;
			text-align: center;

			&:before {
				font-family: dashicons;
				vertical-align: middle;
				color: #999999;
			}

		}

		.siteorigin-widget-field-expand {
			right: 12px;

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

			&:hover {
				background: #989fa5;

				&:before {
					color: #FFFFFF;
				}
			}
		}

		.siteorigin-widget-field-remove {
			right: 28px;

			&:before {
				content: '\f158';
			}

			&:hover {
				background: #ff0000;

				&:before {
					color: #FFFFFF;
				}
			}
		}

		.siteorigin-widget-field-repeater-items {
			background: #FCFCFC;
			border: 1px solid #EEEEEE;
			border-top: 0;
			border-bottom: 0;

			.siteorigin-widget-field-repeater-item {
				background: #FCFCFC;
				border-bottom: 1px solid #EEEEEE;

				.siteorigin-widget-field-repeater-item-top {
					padding: 10px;
					cursor: move;
					position: relative;
					background: #F6F6F6;

					h4 {
						font-size: 12px;
						margin: 0;
					}

				}

				h4 {
					font-size: 15px;
					margin: 0;
				}

				&:last-child {
					border-bottom: 0;
				}

				.siteorigin-widget-field-repeater-item-form {
					border-top: 1px solid #EEEEEE;
					display: none;
					padding: 10px;
				}
			}
		}

		.siteorigin-widget-field-repeater-add {
			padding: 7px 10px;
			background: #F0F0F0;
			border: 1px dashed #D0D0D0;
			font-size: 12px;
			line-height: 1em;
			text-align: center;
			cursor: pointer;

			&:hover {
				background: #F4F4F4;
			}
		}

		/* This is for sub level forms */

		.siteorigin-widget-field-repeater {

			.siteorigin-widget-field-repeater-top {
				background: #eaf2f6;
				border-color: #c9d0d4;

				h3 {
					color: #42484b;
				}
			}

			.siteorigin-widget-field-repeater-items {
				background: #f6fdff;
				border-color: #e8eff3;

				.siteorigin-widget-field-repeater-item {
					background: #f8fdff;
					border-bottom-color: #e8eff3;

					.siteorigin-widget-field-repeater-item-top {
						background: #f0f8fc;
					}

					.siteorigin-widget-field-repeater-item-form {
						border-top-color: #e8eff3;
					}
				}
			}

			.siteorigin-widget-field-repeater-add {
				background: #eaf2f6;
				border-color: #c9d0d4;
				color: #42484b;

				&:hover {
					background: #edf5f9;
				}
			}

		}
	}

	.media-field-wrapper {
		position: relative;
		display: block;
		float: left;

		.gradient( #f9f9f9, #f2f2f2, #f9f9f9 );
		.box-shadow(~"0 1px 2px rgba(0,0,0,0.1)");
		.rounded(3px);

		border: 1px solid #bbbbbb;

		height: 32px;

		&:hover {
			.gradient( #ffffff, #f7f7f7, #ffffff );
			.box-shadow(~"0 1px 2px rgba(0,0,0,0.15)");
		}

		.current{
			.box-sizing(border-box);
			float: left;
			height: 32px;

			padding: 4px;
			border-right: 1px solid #bbb;
			position: relative;

			box-shadow: 1px 0 0 #FFF;

			.title{
				display: none;
				position: absolute;
				bottom: 34px;
				left: 0;
				padding: 4px 12px;
				background: #333;
				color: #CCC;
				font-weight: bold;
				width: auto;
				white-space: nowrap;
			}

			.thumbnail-wrapper{
				border: 1px solid #999;
				line-height: 0;
				box-shadow: 0px 1px 1px #FFF;
				width: 22px;
				height: 22px;

				.gradient( #cfcfcf, #cccccc, #cfcfcf  );
				box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);

				img{
					height: 100%;
					width: 100%;
					box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
				}
			}
		}

		.media-upload-button {
			display: block;
			float: left;
			color: #666;
			text-decoration: none;
			text-shadow: 0 1px 0 #FFF;
			font-weight: 600;
			font-size: 11px;
			padding: 7px 8px 7px 6px;
			outline: none;
			cursor: pointer;
		}

		&:hover .media-upload-button{
			color: #707070;
		}
	}

	.media-remove-button{
		display: block;
		text-decoration: none;
		float: left;
		color: #AAA;
		font-size: 11px;
		line-height: 1em;
		padding: 11px 0 11px 6px;
		.transition(0.25s);

		opacity: 1;
		&.remove-hide {
			pointer-events: none;
			opacity: 0;
		}

		&:hover {
			color: #BC0B0B;
		}
	}

	.media-fallback-external {
		float: left;
		padding: 4px 8px;
		margin-top: 2px !important;
		margin-left: 25px !important;
		width: 320px !important;
	}

	.siteorigin-widget-field-type-widget,
	.siteorigin-widget-field-type-section {

		> label {
			background: #F0F0F0;
			border: 1px solid #D0D0D0;
			padding: 10px;
			display: block;
			margin-bottom: 0;

			&:before {
				float: left;
				margin: 3px 6px 0 0;
				display: block;
				width: 14px;
				height: 14px;
				font-size: 14px;
				line-height: 1;
				font-family: "dashicons";
				content:"\f132";

			}

			&.siteorigin-widget-section-visible {
				&:before {
					content:"\f460";
				}
			}
		}

		.siteorigin-widget-section {
			padding: 10px;
			background: #FCFCFC;
			border: 1px solid #EEEEEE;
			border-top: 0;

			&.siteorigin-widget-section-hide {
				display: none;
			}
		}
	}

	.siteorigin-widget-field-type-link {

		position: relative;

		.existing-content-selector {
			padding: 20px;
			display: none;
			position: absolute;
			top: 110%;
			right: 0px;
			width: 360px;
			z-index: 10;
			border: 1px solid #c0c0c0;
			background: #F6F6F6;
			.box-shadow(~"0 2px 4px rgba(0,0,0,0.2)");
			.rounded(3px);

			.content-text-search {
				width: 100%;
				margin-bottom: 15px;
			}

			.posts {
				margin: 0;
				padding: 0;
				background: #fff;
				max-height: 300px;
				overflow-y: scroll;
				border: 1px solid #e4e4e4;

				li {
					cursor: pointer;
					padding: 5px 10px;
					color: #32373c;
					border-bottom: 1px solid #f1f1f1;
					margin: 0;
					font-size: 0.95em;

					&:hover {
						background: #eaf2fa;
					}

					&:last-child {
						border-bottom: 0;
					}

					span {
						font-size: 0.9em;
						display: inline-block;
						float: right;
						color: #999;
						margin-left: 10px;
					}
				}

				&.loading {
					min-height: 40px;
					background: #FFFFFF url("img/wpspin_light.gif") center center no-repeat;

					@media  (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
						& {
							background-image: url("img/wpspin_light-2x.gif");
							background-size: 16px 16px;
						}
					}

					li {
						display: none;
					}
				}
			}

			.buttons {
				margin-top: 15px;
				text-align: right;

				a {
					display: inline-block;
				}
			}
		}

		.url-input-wrapper {
			display: block;
			margin-right: 130px;
		}

		.select-content-button {
			float: right;
			width: 120px;
			text-align: center;
		}

	}

	.siteorigin-widget-icon-selector {
		padding: 10px;
		border: 1px solid #D8D8D8;
		background: #FFFFFF;
		.box-shadow(~"0 1px 2px rgba(0,0,0,0.0275)");

		select.siteorigin-widget-icon-family {
			font-size: 11px;
		}

		.siteorigin-widget-icon-icons {

			height: 160px;
			overflow-y: scroll;
			margin-top: 10px;

			.siteorigin-widget-icon-icons-icon {
				.box-sizing(border-box);
				float: left;

				width: 58px;
				height: 48px;
				margin: 3px;
				padding: 4px 0;
				border:1px solid #D0D0D0;
				background: #FFFFFF;

				font-size: 40px;
				overflow: hidden;

				cursor: pointer;
				text-align: center;

				&.siteorigin-widget-active {
					background: #f6fafc;
					border: 1px solid #43aaec;
					color: #078dce;
					.box-shadow(~"0 1px 2px rgba(0,0,0,0.25)");
				}
			}

		}
	}

	.siteorigin-widget-field-description {
		clear: both;
	}
}

.siteorigin-widgets-query-builder {

	.query-builder-content {
		padding: 20px;

		.query-builder-form-field {
			label {
				span {
					display: block;
					font-size: 13px;
					line-height: 24px;
					color: #666;
				}
			}

			.sow-select-posts {
				margin-top: 2px;
			}

			input[type="text"] {
				width: 400px;
			}

			input[type="number"] {
				width: 150px;
			}

			.sow-order-button {
				display: inline-block;
				width: 19px;
				height: 19px;
				margin: 0 0 -6px 10px;
				cursor: pointer;
				background: url(./img/ordering-icons.png);

				&.sow-order-button-desc {
					background-position: left top;
				}

				&.sow-order-button-asc {
					background-position: left bottom;
				}
			}

			margin-bottom: 10px;

            small {
                display: block;
            }
		}
	}

	.media-toolbar-secondary {

		.sow-post-count-message {
			margin-top: 21px;
		}

		.sow-post-selector-summary {
			margin-top: 10px;
			display: block;
			width: 41px;
			height: 41px;
			float: left;
			overflow: hidden;
			background: green;
			margin-right: 10px;

			&:last-child {
				margin-right: 0;
			}
		}
	}

	.sow-post-selector-summary {
		display: block;
		float: left;
		margin: 0 15px 15px 0;

		width: 130px;

		.sow-thumbnail {
			width: 130px;
			height: 130px;

			img {
				width: 100%;
				height: auto;
			}
			margin-bottom: 4px;
		}

		.sow-title {
			height: 2.5em;
			overflow: hidden;
			line-height: 1.2em;
			text-align: center;
		}

		&.sow-post-loading {
			.sow-thumbnail {
				background: url(./img/loading.gif) center center no-repeat #EEEEEE;

				img {
					display: none;
				}
			}
		}

		.sow-remove {
			display: none;
		}
	}

	#sow-post-selector {
		.sow-autocomplete-field {
			text-align: right;
			margin-bottom: 20px;

			input[type=text] {
				width: 320px;
				margin-left: 10px;
			}

			.ui-autocomplete {
				max-height: 182px;
				overflow-y: auto;
				/* prevent horizontal scrollbar */
				overflow-x: hidden;
			}
		}

		.sow-posts-sortable {

			.ui-state-highlight {
				display: block;
				float: left;
				margin: 0 15px 15px 0;
				background: #F3F3F3;
			}

			.sow-post-selector-summary {
				cursor: move;
				position: relative;

				.sow-remove {
					position: absolute;
					top: -5px;
					right: -5px;
					width: 19px;
					height: 19px;
					z-index: 10;
					text-decoration: none;
					background: #333333;
					text-align: center;

					&:before {
						content: '\f158';
						font: 14px/1 dashicons;
						vertical-align: middle;
						color: #EEEEEE;
					}

					&:hover {

						background: #444444;

						&:before {
							color: #FFFFFF;
						}

					}
				}

				&:hover .sow-remove {
					display: block;
				}
			}

			&:after {
				content: "";
				display: table;
				clear: both;
			}
		}
	}
}

.siteorigin-widget-preview {
	display: block !important;
}

.siteorigin-widget-help-link {
	display: block;
	margin: 1em 0;
}


.siteorigin-widget-preview-dialog {

	@edge_spacing: 30px;
	@border_color: #D8D8D8;

	.siteorigin-widgets-preview-modal-overlay {
		position: fixed;
		z-index: 100000;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background: rgba(0,0,0,0.7);
	}

	.so-widget-toolbar, .so-widget-iframe {
		position: fixed;
		z-index: 500001;
		.box-sizing(border-box);
	}

	.so-widget-toolbar {
		left: @edge_spacing;
		right: @edge_spacing;
		top: @edge_spacing;
		height: 50px;
		background: #fafafa;
		border-bottom: 1px solid @border_color;

		h3 {
			margin: 15px 0 15px 20px;
		}

		.close {
			position: absolute;
			box-sizing: border-box;
			width: 50px;
			height: 50px;
			display: block;
			cursor: pointer;

			top: 0;
			right: 0;

			.transition(0.2s);
			background: #fafafa;
			border-left: 1px solid #d8d8d8;
			border-bottom: 1px solid #d8d8d8;

			&:hover {
				background: #e9e9e9;
				.so-dialog-icon {
					color: #333333;
				}
			}

			.dashicons {
				position: absolute;
				top: 50%;
				left: 50%;
				text-decoration: none;
				width: 21px;
				height: 21px;
				margin-left: -11px;
				margin-top: -10px;
				font-size: 21px;
				text-align: center;
				color: #666666;
				text-align: center;
			}
		}
	}

	.so-widget-iframe {
		top: @edge_spacing + 50px;
		left: @edge_spacing;
		right: @edge_spacing;
		bottom: @edge_spacing;
		background: #FFFFFF url("img/wpspin_light.gif") center center no-repeat;

		@media  (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
			& {
				background-image: url("img/wpspin_light-2x.gif");
				background-size: 16px 16px;
			}
		}

		iframe {
			width: 100%;
			height: 100%;
		}
	}

}

/* Icons */
.widget-icon.so-widget-icon {
	background-size: cover;
	background-image: url("./img/bundle-icon.png");
}