@import('mixins');

/*
 * Group
 */

.cs-field-group {
	position: relative;

	.group-loading {
		position: absolute;
		top: 0;
		right: 0;
		left: 0;
		bottom: 0;
		display: none;
		background: fade( #FFFFFF, 80% );
		z-index: 100;

		.spinner {
			visibility: visible;
			width: 48px;
			height: 48px;
			position: absolute;
			transform: translate(-50%,-50%);
			transition: all 300ms ease-in-out;
			top: 50%;
			left: 50%;
			z-index: 2;
			margin: 0;

			&:before {
				width: 48px;
				height: 48px;
				border-width: 3px;
			}

		}
	}

	.cs-groups {
		position: relative;
		margin: 0;

		.cs-select-group {
			position: absolute;
			top: 20px;
			left: 0;
			z-index: 10;
			transition: all 300ms cubic-bezier(0.6, 0, 0, 0.6);
			opacity: 0;
			visibility: hidden;
		}

		.cs-group {
			position: relative;
			margin-bottom: 5px;
			background: #FFFFFF;

			&.cloned {
				display: none;
			}

			& > .cs-group-title {
				font-weight: 600;
				font-size: 14px;
				box-sizing: border-box;
				color: fade( @section_heading, 80% );
				display: table;
				cursor: pointer;
				width: 100%;
				position: relative;
				margin: 0;
				padding: 0 100px 0 15px;
				min-height: 0;
				z-index: 1;
				background: fade( #e5e5e5, 50% );
				height: 46px;
				border-radius: 10px;
				transition: all 300ms cubic-bezier(0.6, 0, 0, 0.6);
				transition-property: border-color, color, background, padding-left;
				// transition: border-color cubic-bezier(0.6, 0, 0, 0.6) 150ms, padding-left cubic-bezier(0.6, 0, 0, 0.6) 300ms, color cubic-bezier(0.6, 0, 0, 0.6) 150ms, background cubic-bezier(0.6, 0, 0, 0.6) 150ms;

				&:active,
				&:hover,
				&:focus {
					background: fade( #e5e5e5, 80% );
					border-color: #e5e5e5;
					outline: none;
					color: @section_heading;
				}

				.group-title,
				.group-type {
					display: table-cell;
					vertical-align: middle;
				}

				.group-title {
					display: none;
				}

				.group-type {
					// display: block;
				}

				&.title-active {
					.group-title {
						display: table-cell;
					}

					.group-type {
						position: absolute;
						top: 14px;
						right: 90px;
						opacity: 0.3;
						font-size: 12px;
					}
				}

			}

			.group-actions {
			    width: auto;
			    position: absolute;
			    right: 0;
			    top: 0;
			    z-index: 10;
			    padding: 12px 15px;
			    transition: all 300ms cubic-bezier(0.6, 0, 0, 0.6);

				a,
				button {
					transition: all 300ms cubic-bezier(0.6, 0, 0, 0.6);
					font-size: 15px;
					color: fade( @body_text, 40% );
					text-decoration: none;
					z-index: 100;
					font-style: normal;
					text-align: center;
					display: inline-block;
					width: 20px;

					&:hover {
						color: @body_text;
					}
				}
				button {
					width: 16px;
				}

				.cs-toggle-group {
					border: 0;
					background: 0;
					padding: 0;
					line-height: 100%;
					margin: 0;
					cursor: pointer;
					outline: none;

					i {
						font-family: 'dashicons';
						font-size: 19px;
						font-style: normal;
						line-height: 100%;
						margin: 0;
						padding: 0;

						&:before {
							content: "\f347";
						}
					}
				}

				i {
				    font-family: 'dashicons';
				}

			}

			.cs-group-content {
				border: 2px solid fade( #e5e5e5, 50% ) !important;
				border-top: 0 !important;
				border-radius: 0 0 10px 10px;
				padding: 0 !important;
				display: none;
				margin: 0;

				.cs-element {
					padding: 15px;

					@media only screen and( max-width: 1400px ) {

						.cs-fieldset {
							display: block;
							width: 100%;
							margin: 0;
							padding: 0;

							.cs-title {
								display: block;
								width: 100%;
								margin: 0;
								padding: 0;
							}

						}

					}

					// &:nth-child(2) {
					// 	border-top: 0;
					// }

					&:last-child {
						border-bottom: 0;
					}

				}

				@media only screen and( max-width: 1400px ) {

					.cs-fieldset {
						display: block;
						width: 100%;
						margin: 0;
						padding: 0;

						.cs-title {
							display: block;
							width: 100%;
							margin: 0;
							padding: 0;
						}

					}

				}

				/* Nested groups */
				.cs-group-content .cs-group-content {

					& > .cs-element {
						padding: 15px;

						.cs-fieldset {
							display: block;
							width: 100%;
							margin: 0;
							padding: 0;

							.cs-title {
								display: block;
								width: 100%;
								margin: 0;
								padding: 0;
							}

						}
					}
				}

			}

			&.open {

				& > .cs-group-title {
					border-bottom-left-radius: 0;
					border-bottom-right-radius: 0;
					background: fade( #e5e5e5, 60% );
					color: @section_heading;
				}

				& > .cs-group-content {
					border-color: fade(#e5e5e5, 60%) !important;
				}

				& > .group-actions {

					i {
						color: @section_heading;
					}

					.cs-toggle-group {
						i {
							&:before {
								content: "\f343";
							}
						}
					}
				}

			}

			&.required-error {

				& > .cs-group-title {
					background: fade( @link_negative, 18% );
					color: @section_heading;
				}

				& > .cs-group-content {
					border-color: fade( @link_negative, 18% ) !important;
				}

				& > .group-actions {

					i {
						color: @section_heading;
					}

				}

			}

			&.selected {

				.cs-group-title {
					background: fade(@selection_highlight, 35%);

					&:hover {
						background: fade(@selection_highlight, 35%) !important;
					}
				}

			}

		}

		&.select-mode {

			.group-actions {
				opacity: 0;
			}

			.cs-select-group {
				visibility: visible;
				opacity: 1;
				left: 12px;
			}

			.cs-group-title {
				padding-left: 36px !important;
			}

		}

	}

	.cs-groups-empty {
		border: 2px dotted #e5e5e5;
		border-radius: 6px;
		padding: 60px 30px;
		text-align: center;
		font-size: 12px;
		color: @alt_text;
	}

	.group-placeholder {
		height: 40px;
        border: 2px dotted @selection_highlight;
        border-radius: 4px;
        margin-bottom: 5px;
	}

	// .ui-sortable-helper .cs-group-content {
	// 	display: none !important;
	// }


	.page-title-action {
		margin: 0 !important;
		display: block;
		text-decoration: none;
	}

	.cs-group-toolbar {
		margin: 15px 0 0 0;

		ul {
			padding: 0;
			margin: 0;
			font-size: 0;

			li {
				position: relative;
				display: inline-block;
				vertical-align: top;
				margin: 0;
				padding: 5px 0 5px 0;
				font-size: 14px;

				a {
					margin-right: 20px !important;
				}

				.cs-help {
					display: none;
				}

			}

		}

	}

	.group-sets-available,
	.group-sets {
		display: none;
		visibility: hidden;
		opacity: 0;
	}

}

/**
 * Toolbar buttons
 */
.toolbar-wrapper {
	margin: 15px 0 0 0;

	ul {
		padding: 0;
		margin: 0;
		font-size: 0;

		li {
			display: inline-block;
			vertical-align: top;
			margin: 0;
			padding: 5px 0 5px 0;

		}

	}

}

.toolbar-button:focus,
.toolbar-button:visited,
.toolbar-button {
	text-decoration: none;
	color: @link_positive;
	font-size: 12px;
	transition: color ease-in-out 200ms;
	margin-right: 20px;
	padding: 0 !important;

	&:before {
		content: "";
		vertical-align: middle;
		font-size: 14px;
		background: @link_positive;
		color: #FFFFFF;
		font-family: 'dashicons';
		display: inline-block;
		border-radius: 50% !important;
		border: 2px solid @link_positive;
		text-align: center;
		padding: 0;
		box-sizing: border-box;
		width: 24px;
		height: 24px;
		margin: -2px 8px 0 0;
		line-height: 20px;
		text-indent: 0px;
		transition: all ease-in-out 200ms;
	}

	&.no,
	&.empty,
	&.delete,
	&.remove {
		color: @link_negative;

		&:before {
			border: 2px solid @link_negative;
			background-color: @link_negative;
		}
	}

	&:active,
	&:focus {
		outline: none;
		box-shadow: none;
	}

	&.schemes:before {
		content: "\f540";
	}

	&.add:before {
		content: "\f132";
	}

	&.no:before {
		content: "\f158";
	}

	&.remove:before {
		content: "\f460";
	}

	&.delete:before {
		content: "\f182";
	}

	&.update:before {
		content: "\f087";
	}

	&.saveas:before {
		content: "\e904";
	}

	&.export:before {
		content: "\f316";
	}

	&.import:before {
		content: "\f317";
	}

	&.manage:before {
		content: "\f469";
	}

	&.expand:before {
		content: "\f211";
	}

	&.contract:before {
		content: "\f506";
	}

	&.editor:before,
	&.edit:before {
		content: "\f464";
	}

	&.revert:before {
		content: "\f531";
	}

	&.backup:before {
		content: "\f468";
	}

	&.preview:before {
		content: "\f177";
	}

	&.buy:before {
		content: "\f174";
	}

	&.active,
	&:hover {
		color: @body_text;
	}

	&.active:before,
	&:hover:before {
		background: @body_text;
		border-color: @body_text;
		color: #FFFFFF;
		-webkit-transform: rotate(360deg);
		-ms-transform: rotate(360deg);
		transform: rotate(360deg);
	}

	&.disabled {
		color: @button_disabled_text;
		cursor: not-allowed;

		&:before {
			border-color: @button_disabled_text;
			background-color: @button_disabled_text;
		}
	}

}

/**
 * URL
 */

.cs-field-url {

	.url-fieldset {
		position: relative;

		& > .url-value {
			padding-left: 26px !important;
			max-width: 400px;
			width: 100%;
		}

		.finder-window {
			max-width: 400px;
			width: 100%;
			margin: 10px 0 0 0;
			border: 1px solid #CCC;
			border-bottom: 2px solid #CCC;
			border-radius: 3px;
			overflow: hidden;
			position: relative;
		}

		.finder-search {
			background: #f7f7f7;
			border-bottom: 1px solid #CCC;
			padding: 10px;

			input {
				width: 210px;
			}

			select {
				width: 135px;
				cursor: pointer;
			}

			.close {
				width: 20px;
				font-size: 15px;
				cursor: pointer;
				font-weight: bold;
				text-align: center;
				display: inline-block;
			}
		}

		.finder-results {
			height: 220px;
			overflow: auto;

			&::-webkit-scrollbar-track {
				-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.1);
				border-radius: 0;
				background-color: #FFFFF;
			}

			&::-webkit-scrollbar {
				width: 5px;
				background-color: #FFFFF;
			}

			&::-webkit-scrollbar-thumb {
				border-radius: 5px;
				-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.1);
				background-color: #999;
			}

			ul {
				padding: 0;
				margin: 0;

				li {
					margin: 0;
					font-size: 12px;
					padding: 7px 10px;
					border-bottom: 1px solid #EEE;
					cursor: pointer;

					&.selected {
						font-weight: bold;
					}

					&:last-child {
						border: 0;
					}

					span {
						float: right;
						font-size: 0.85em;
						opacity: 0.55;
					}

					&:hover {
						background: #0073aa;
						color: white;

						span {
							opacity: 1;
						}
					}
				}
			}
		}

		.finder-nothing {
			h3 {
				position: absolute;
				top: 50%;
				left: 50%;
				.transform(~"translate(-50%,-50%)");
			}
		}

		.finder-loader {
			position: absolute;
			top: 0;
			left: 0;
			bottom: 0;
			right: 0;
			background: #FFF;
			z-index:100;

			.spinner {
				position: absolute;
				top: 50%;
				left: 50%;
				margin: 0;
				padding: 0;
				.transform(~"translate(-50%,-50%)");
				visibility: visible;
			}

		}

		.url-field-icon {
			cursor: pointer;
			position: absolute;
			font-size: 16px;
			width: 24px;
			text-align: center;
			top: 5px;
			left: 3px;
			opacity: 0.5;
			.transition(~"all", 300ms, ~"cubic-bezier(0.6, 0, 0, 0.6)");
		}

		.toolbar-button {
			margin-left: 5px;
		}

	}

}

/**
 * File Upload
 */

.slr-file-upload {
	width: auto;
	display: inline-block;
	font-size: 11px;
	padding: 10px;
	border: 2px solid #e5e5e5;
	border-radius: 4px;
	background: #FFFFFF;
	position: relative;

	.slr-upload-form {
		position: relative;
	}

	.toolbar-button {
		margin: 0 5px !important;
	}

	.progress-bar {
		width: 246px;
		position: absolute;
		top: 0px;
		left: 0px;
		height: 24px;
		background: #FFFFFF;
		border: 2px solid #e5e5e5;
		border-radius: 4px;
		display: none;

		.indicator {
			position: absolute;
			top: 5px;
			left: 50%;
			.transform(~"translateX(-50%)");
			z-index: 10;
		}

		.bar {
			display: block;
			position: absolute;
			top: 0;
			width: 0;
			background: #2bf589;
			height: 100%;
			.transition(~"all", 200ms, ~"ease-in-out");
		}
	}

	.loading {
		display: none;

		.spinner {
			margin: 3px 5px;
			float: none;
			visibility: visible;
			display: inline-block;
			vertical-align: middle;
		}

		.percent {
			padding: 4px;
			display: inline-block;
			vertical-align: middle;
		}

	}

	.slr-uploaded {

		.uploaded-item {
			display: inline-block;
			vertical-align: middle;
			text-decoration: none;
			margin: 0 5px 0 0;
			border-right: 1px solid #e5e5e5;
			padding: 7px 12px 7px 2px;

			& > i {
				font-size: 14px;
				display: inline-block;
				vertical-align: middle;
				margin: -3px 7px 0 0;
			}
		}

	}

	.file-placeholder {
		width: 250px;
	}

}


/**
 * Switcher field
 */
.cs-field-switcher {

	.cs-switcher-container {
		cursor: pointer;
		position: relative;
		width: 48px;
		height: 28px;
		-moz-border-radius: 20px;
		-webkit-border-radius: 20px;
		border-radius: 20px;
		margin: 0 8px 4px 0;
		vertical-align: middle;
		display: table-cell;

		span {
			position: relative;
			margin-top: -26px;
			display: block;
			left: 2px;
			width: 24px;
			height: 24px;
			background-color: white;
			transition: left 150ms ease-out;
			border-radius: 16px;
			box-shadow: rgba(0, 0, 0, 0.3) 0 4px 15px;
		}

		input {
			position: absolute;
			top: 0;
			left: 0;
			opacity: 0;

			&:checked {
				&~em {
					background: #2bf589;
					border: 2px solid #2bf589;
				}

				&~span {
					left: 22px;
				}

			}

		}

		em {
			position: relative;
			display: block;
			height: inherit;
			font-size: 11px;
			line-height: 26px;
			font-weight: 500;
			font-style: normal;
			text-transform: uppercase;
			background-color: transparent;
			.transition(~"background, border", 150ms);
			border: 2px solid #e5e5e5;
			border-radius: 16px;
		}

		&:hover {

			em {
				border-color: #2bf589;
			}

		}

	}

	.cs-text-desc {
		margin-top: 0;
		vertical-align: middle;
		display: table-cell;
		padding: 5px 10px;
		font-size: 11px;
	}

}


/**
 * Inline Select
 */

.cs-field-inline_select {

	label {
		display: inline-block !important;
		border: 2px solid @tab_active_bg;
		margin: 0 -2px -2px 0;
		padding: 0;
		-webkit-transition: all 200ms ease-out;
		-moz-transition: all 200ms ease-out;
		-o-transition: all 200ms ease-out;
		transition: all 200ms ease-out;

		&:first-child {
			border-radius: 3px 0 0 3px;
		}

		&:last-child {
			border-radius: 0 3px 3px 0;
		}

		&:only-child {
			border-radius: 3px;
		}

		>input {
			display: none;

			&+span {
				cursor: pointer;
			}

			&:checked {
				&+span {
					z-index: 90;
					position: relative;
				}

			}

		}

		> span {
			font-family: @body_font, arial, sans-serif;
			font-size: 11px;
			display: block;
			vertical-align: top;
			padding: 4px 8px;
			line-height: 150%;
			margin: 0;
	  		color: @tab_text;

			i {
				font-size: 20px;
				height: 18px;
			}

		}

		&:hover,
		&:hover > span {
			background: @tab_hover_bg;
			border-color: @tab_hover_bg;
			color: @tab_hover_text;
			position: relative;
			z-index: 100;
		}

		&:hover > input:checked + span,
		& > input:checked + span {
			background: @tab_active_bg;
			border-color: @tab_active_bg;
			color: @tab_active_text;
		}

		& > input:checked ~ span {
			background: @tab_active_bg;
			border-color: @tab_active_bg;
			color: @tab_active_text;
		}

	}

	.cs-inline-select-fields {
		display: inline-block;
		border-radius: 3px;
		font-size: 0;
		line-height: 0;
		margin: 0;
		padding: 0 !important;
	}

}