@import "inputs";

fieldset {
	border: 0;
	padding: 0;
	margin: 0;
}

label {
	.typography-family(@family-weight-regular);
}


.form_content {
	.generate-spacing-rule(6,padding,all);
}

.form_field__dropzone,
.form_field_holder {
	&.required {
		&:before {
			content: '*';
			color: @color_teritary;
			position: absolute;
			top: @spacing-min;
			right: @spacing-min;
			z-index: 6;  // The input's have background so you need to put a z-index so it can stay on top of it
			.typography-rule(1);
		}
	}
}

.form_field_holder {
	display: block;
	position: relative;
	padding: 0;
	.generate-spacing-rule(2,margin,bottom);
	.clear_fix;
	> .svg-icon_error-dims,
	> .svg-icon_success_form-dims {
		stroke: @color-error;
		display: none;
		position: absolute;
		top: 11px;
		right: 9px;
		z-index: 1; // The input's have background so you need to put a z-index so they can stay on top of it
		&.svg-icon_success_form-dims {
			stroke: @color-success;
			right: 16px;
		}
	}
	&.form_field_holder--icon {
		input {
			.generate-spacing-rule(1,padding,left,35px);
			& + label {
				left: ~"calc(@{spacing-min} + 35px + (1 * @{spacing-step}))";
			}
		}
	}
	&.form_field_holder--grid {
		padding-left: @grid-gutter-width/2;
		padding-right: @grid-gutter-width/2;
		&.required {
			&:before {
				right: ~"calc(@{spacing-min} + (@{grid-gutter-width}/2))";
			}
		}
	}
}

.form_field_holder--datepicker {
	background: white;
	border: 1px solid @color-gray-9;
	border-radius: @input-border-radius;
	input {
		border: 0;
		width: calc(~"100% - 40px");
	}
	.form_field_holder--datepicker__icon {
		display: flex;
		align-items: center;
		justify-content: center;
		position: absolute;
		top: 0;
		bottom: 0;
		right: 0;
		cursor: pointer;
		.generate-spacing-rule(2,padding,right);
		&:before {
			content: '';
			background: rgba(255,255,255,0);
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
			z-index: 1;
		}
		svg {
			stroke: @color-gray-3;
		}
	}
}

.form_field_holder--flex {
	display: flex;
	.checkbox,
	.radio-button {
		& ~ * {
			flex: 1 0;
			.generate-spacing-rule(2,margin,left);
			.generate-spacing-rule(2,margin,right);
		}
	}
}

.form_field_holder--text {
	&.required {
		&:before {
			top: -@spacing-min;
			right: 0;
		}
	}
}


.form_field_captcha_holder {
	.clear_fix;
	li {
		position: relative;
		padding-left: 0;
		.generate-spacing-rule(1,padding,right);
		> svg {
			display: none;
		}
		&:last-of-type {
			border: 1px solid @color-gray-9;
			border-radius: @input-border-radius;
			display: flex;
			align-items: center;
			justify-content: center;
			height: 50px;
			padding: 0 !important;
		}
	}
}

.form_field__label {
	color: @color-gray-3;
	display: block;
	.typography-rule(0);
	.generate-spacing-rule(1,padding,bottom);
}

.form_field__icon {
	display: block;
	position: absolute;
	top: ~"calc(@{spacing-min} + (1 * @{spacing-step}))";
	left: ~"calc(@{spacing-min} + (1 * @{spacing-step}))";
	z-index: 1; // The input's have background so you need to put a z-index so it can stay on top of it
}

.form_field_center {
	color: @color-gray-3;
	text-align: center;
	.typography-rule(1);
	a {
		text-align: center;
	}
	.checkbox,
	.radio-button {
		float: none;
		display: inline-block;
		vertical-align: top;
		& + label {
			display: inline-block;
			vertical-align: top;
			.generate-spacing-rule(2,margin,left);
		}
	}
}

.form_field_holder_text {
	.generate-spacing-rule(2,margin,bottom);
}

.form_field_holder_error {
	label {
		color: @color-error !important;
	}
	.checkbox,
	.radio-button {
		border-color: @color-error;
	}
	input[type="text"],
	input[type="password"],
	input[type="number"],
	input[type="email"],
	textarea {
		color: @color-gray-3;
		background: rgba(255,102,51,0.05);
		border-color: @color-error;
		.placeholder(@color-gray-3);
		.generate-spacing-rule(1,padding,all);
		&.initialized {
			.generate-spacing-rule(1,padding,top,9px);
		}
	}
	textarea {
		&.initialized {
			.generate-spacing-rule(1,padding,top,9px);
		}
	}
	.spinner {
		border-color: @color-error;
		input,
		span {
			color: @color-gray-3;
			background: rgba(255,102,51,0.05);
			border-color: @color-error;
		}
	}
}

.form_field_holder_group {
	ul {
		.clear_fix;
		li {
			.generate-spacing-rule(1,padding,top);
			.generate-spacing-rule(1,padding,right);
			&:first-of-type,
			&:nth-of-type(2) {
				padding-top: 0;
			}
			&:nth-of-type(2n) {
				padding-right: 0;
			}
		}
	}
}

.form_field_holder_collection {
	> span {
		color: @color-gray-3;
		text-align: left;
		display: block;
		.typography-rule(1,regular);
		.generate-spacing-rule(2,padding,bottom);
	}
	> ul {
		border: 1px solid @color-gray-9;
		border-radius: @input-border-radius;
		height: 53px;
		.clear_fix;
		> li {
			border-right: 1px solid @color-gray-9;
			position: relative;
			padding: 0;
			&:last-of-type {
				border: 0;
			}
			input {
				border: 0;
				height: 49px;
				padding: 0 ~"calc(@{spacing-min} + (1 * @{spacing-step}))";
			}
		}
	}
}

.form_field__dropzone {
	border: 1px dashed @color-gray-9;
	border-radius: @global-radius;
	.generate-spacing-rule(4,padding,all);
	&:hover,
	&.active {
		border-color: @color_main;
	}
	p,
	a,
	span {
		color: @color-gray-3;
		display: inline-block;
		padding: 0;
		.typography-rule(1,bold);
	}
	a {
		color: @color_main;
		&.link--message {
			position: absolute;
			top: 0;
			right: 0;
			display: block;
			cursor: pointer;
			.typography-rule(none);
			&:before {
				content: '';
				background: rgba(255,255,255,0);
				position: absolute;
				top: 0;
				left: 0;
				right: 0;
				bottom: 0;
			}
			svg {
				stroke: @color_main;
			}
		}
	}
	span {
		.generate-spacing-rule(0,padding,left);
		.generate-spacing-rule(0,padding,right);
	}
	.warning_message {
		span {
			padding: 0;
			.typography-rule(0,regular);
		}
	}
	.form_field__dropzone__requirements {
		color: @color-gray-4;
		display: block;
		.typography-rule(0,regular);
		.generate-spacing-rule(0,padding,left,5px);
		li {
			list-style: circle;
			.generate-spacing-rule(1,padding,top);
		}
	}
	> ul {
		.generate-spacing-rule(1,padding,top);
		.center_nav;
		> li {
			border: 1px solid @color-gray-9;
			border-radius: 4px;
			.generate-spacing-rule(1,margin,all);
		}
		img {
			display: block;
			margin: 0 auto;
		}
		.form_field__dropzone__items {
			.generate-spacing-rule(2,padding,all);
		}
		.form_field__dropzone__links {
			border-top: 1px solid @color-gray-9;
			display: flex;
			a {
				border: 0;
				display: flex;
				flex: 1 0;
				justify-content: center;
				.typography-lineheight(100%);
				.generate-spacing-rule(1,padding,top);
				.generate-spacing-rule(1,padding,bottom);
				.generate-spacing-rule(2,padding,left);
				.generate-spacing-rule(2,padding,right);
				svg {
					stroke: @color-gray-4;
				}
			}
		}
	}
}

.checkbox,
.radio-button {
	background: white;
	border: 1px solid @color-gray-8;
	float: left;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	margin: 0;
	position: relative;
	.transition(border 0.3s);
	svg {
		display: block;
		width: 20px;
		height: 20px;
        min-width: 20px;
        min-height: 20px;
	}
	&:not(.on) {
		svg {
			display: none;
		}
	}
	&.on:not(.negative) {
		& + label {
			& + ul {
				border-top: 1px solid @color-gray-9;
				display: block !important;
				.generate-spacing-rule(1,margin,top);
				.generate-spacing-rule(2,padding,left,20px);
			}
		}
	}
	&.error {
		border-color: @color-error;
		& + label {
			color: @color-error !important;
		}
	}
	&.disabled {
		background: @color-gray-9;
		& + label {
			color: @color-gray-7;
		}
	}
	& + label {
		color: @color-gray-3;
		display: block;
		margin: 0;
		.generate-spacing-rule(2,margin,left,20px);
		.typography-rule(1,regular,false,@typography-base-size,20px);
		&.label--link {
			.generate-spacing-rule(1,margin,left);
			.generate-spacing-rule(1,margin,right);
			strong {
				width: auto;
				overflow: hidden;
				.generate-spacing-rule(1,padding,left);
			}
		}
	}
}

.checkbox {
	border-radius: 2px;
	&.on:not(.negative) {
		background: @color_main;
		border-color: @color_main;
		svg {
			stroke: white;
			&.svg-icon_close-dims {
				display: none;
			}
			&.svg-icon_tick-dims {
				display: block;
			}
		}
	}
	&.negative {
		border-color: @color-error;
		svg {
			stroke: @color-error;
			&.svg-icon_close-dims {
				display: block;
			}
			&.svg-icon_tick-dims {
				display: none;
			}
		}
	}
}


.radio-button {
	border-radius: 50%;
	&:before {
		content: "";
		background: @color_main;
		border-radius: 50%;
		display: none;
		width: 10px;
		height: 10px;
	}
	&.on {
		&:before {
			display: block;
		}
	}
}



.checkbox--pill {
	background: @color-gray-7;
	border: 0;
	border-radius: 60px;
	float: none;
	position: relative;
	width: 56px;
	height: 26px;
	min-height: 26px;
	cursor: pointer;
	.transition(all 0.3s);
	&.checkbox--pill--active,
	&.on {
		&:before {
			left: calc(~"100% - 24px");
		}
		&:after {
			width: 100%;
		}
	}
	&.checkbox--pill--right {
		float: right;
		& + label {
			margin-left: 0;
			.generate-spacing-rule(2,padding,right,56px);
		}
	}
	&.checkbox--pill--left {
		float: left;
		& + label {
			margin-left: 0;
			.generate-spacing-rule(2,padding,left,56px);
		}
	}
	&.checkbox--pill--flex {
		& + label {
			.generate-spacing-rule(2,margin,left);
		}
	}
	&:before,
	&:after {
		content: '';
		position: absolute;
		top: 0;
		left: 0;
	}
	&:before {
		background: white;
		border-radius: 50%;
		top: 2px;
		left: 2px;
		width: 22px;
		height: 22px;
		z-index: 1;
		.transition(left 0.5s);
	}
	&:after {
		background: @color_main;
		border-radius: 60px;
		width: 0;
		height: 100%;
	}
	& + label {
		.typography-lineheight(26px);
	}
	svg {
		display: none;
	}
	input {
		visibility: hidden;
		position: absolute;
		margin-left: -9999px;
	}

	label {
		display: block;
		width: 100%;
		height: 100%;
		cursor: pointer;
	}
}




.value_slider {
	span {
		color: @color-gray-3;
		text-overflow: ellipsis;
		white-space: nowrap;
		max-width: 85px;
		overflow: hidden;
		float: left;
		.typography-rule(1);
		.generate-spacing-rule(2,padding,bottom);
		&.max {
			float: right;
		}
	}
	.ui-slider {
		background: @color-gray-9;
		border-radius: 10px;
		position: relative;
		width: ~"calc(100% - (@{spacing-min} + @{spacing-step}) * 2)";
		height: 2px;
		margin: 0 auto;
		overflow: visible;
		clear: left;
		@media only screen and (max-width: @categories-media-max-width) {
			width: ~"calc(100% - (@{spacing-min} + @{spacing-step}) * 4)";
		}
		.ui-slider-range {
			background: @color_main;
			border-radius: 10px;
			display: block;
			position: absolute;
			top: 0;
			height: 2px;
		}
		.ui-slider-handle {
			background: @color_main;
			border-radius: 50%;
			display: inline-block;
			position: absolute;
			top: 0;
			padding: 0;
			width: 16px;
			height: 16px;
			margin: -7px 0 0 -8px;
			cursor: pointer;
			@media only screen and (max-width: @categories-media-max-width) {
				width: 20px;
				height: 20px;
				margin: -9px 0 0 -10px;
			}
		}
	}
}

.spinner {
	text-align: center;
	.typography-rule(0);
	&.spinner--fluid {
		display: flex;
		li {
			display: flex;
			flex: 1 0;
			input,
			.spinner__control {
				width: 100%;
				height: 50px;
			}
			.form_field_holder__input {
				input {
					height: 48px;
				}
			}
			&.spinner__input_holder {
				flex-grow: 2;
				.form_field_holder {
					width: 100%;
				}
			}
		}
	}
	li {
		display: inline-block;
		vertical-align: top;
		margin: 0 2px;
		input,
		.spinner__control {
			color: @color-gray-3;
			background: white;
			border: 1px solid @color-gray-9;
			border-radius: @input-border-radius;
			text-align: center;
			display: block;
			width: 40px;
			height: 40px;
			.generate-spacing-rule(1,padding,all);
			&:focus {
				outline: none;
			}
		}
		.form_field_holder {
			margin: 0;
		}
		.form_field_holder__group {
			input {
				text-align: left;
			}
		}
		.spinner__control {
			position: relative;
			cursor: pointer;
			&:before {
				color: @color_main;
				border-color: @color_main;
				display: block;
				position: absolute;
				top: 50%;
				left: 50%;
				.translate(-50%,-50%);
				.typography-rule(3);
			}
			&.spinner__control--up {
				&:before {
					content: "+";
				}
			}
			&.spinner__control--down {
				&:before {
					content: "-";
				}
			}
		}
	}
}

.suggestion-ui {
	position: relative;
	&.required {
		&:before {
			content: '*';
			color: @color_teritary;
			position: absolute;
			top: @spacing-min;
			right: @spacing-min;
			z-index: 6;  // The input's have background so you need to put a z-index so it can stay on top of it
			.typography-rule(1);
		}
	}
}
.suggestion_box {
	background: white;
	border: 1px solid @color-gray-9;
	border-top: 0;
	border-radius: @custom-options-border-radius;
	position: absolute;
	top: 50px;
	left: 0;
	right: 0;
	z-index: 1;
	li {
		color: @color-gray-3;
		border-bottom: 1px solid @color-gray-9;
		.typography-rule(1);
		.generate-spacing-rule(2,padding,all);
		&:last-of-type {
			border: 0;
		}
	}
}
.data-box {
	li {
		color: @color-gray-3;
		border-bottom: 1px solid @color-gray-9;
		position: relative;
		.generate-spacing-rule(1,padding,all);
		.generate-spacing-rule(1,padding,right,24px);
		a {
			display: block;
			position: absolute;
			top: 50%;
			right:  ~"calc(@{spacing-min} + (1 * @{spacing-step}))";
			.translate(0,-50%);
			cursor: pointer;
			.typography-rule(none);
			&:before {
				content: '';
				background: rgba(255,255,255,0);
				position: absolute;
				top: 0;
				left: 0;
				right: 0;
				bottom: 0;
			}
			svg {
				stroke: @color-gray-3;
			}
		}
	}
}


.token-input-list {
	background: @color-gray-10;
	border: 1px solid @color-gray-9;
	position: relative;
	.generate-spacing-rule(1,padding,all);
	.generate-spacing-rule(2,margin,bottom);
	&.error {
		background: @color-gray-10;
		border: 1px solid @color-error;
		input {
			color: @color-error;
			.placeholder(@color-error);
		}
	}
	&:after {
		content: "";
		clear: both;
		display: block;
	}
	.token-input-token {
		color: @color-gray-3;
		background: white;
		border: 1px solid @color-gray-9;
		float: left;
		position: relative;
		padding: 0;
		.typography-rule(0);
		.generate-spacing-rule(1,margin,bottom);
		p {
			color: @color-gray-3;
			.typography-rule(1);
			.generate-spacing-rule(1,padding,all);
			.generate-spacing-rule(1,padding,right,30px);
		}
		span {
			position: absolute;
			top: 50%;
			right: 10px;
			display: block;
			cursor: pointer;
			width: 20px;
			height: 20px;
			.translate(0,-50%);
			svg {
				stroke: @color-gray-3;
				display: block;
			}
		}
	}
	.token-input-input-token {
		&:before {
			display: none;
		}
		input {
			height: 35px;
			background: transparent;
			width: 100% !important;
			padding: 0;
			border: 0 !important;
			.box-shadow(none);
		}
	}
}

.form_field_holder__group {
	display: flex;
	border: 1px solid @color-gray-9;
	border-radius: @input-border-radius;
	&.form_field_holder__group--opposite {
		.form_field_holder__input {
			border-radius: @global-radius 0 0 @global-radius;
		}
		.form_field_holder__addon {
			border-radius: 0 @global-radius @global-radius 0;
		}
		.form_field_holder__addon__left {
			border-radius: @global-radius 0 0 @global-radius;
		}
	}
	.input-group-addon {
		padding: auto;
		.typography-rule(1);
	}
	.form_field_holder__input {
		border:none;
		color: @color-gray-3;
		background: white;
		.box-shadow(none);
		display: flex !important;
		flex: 0 auto;
		align-items: center;
		padding: 0;
		height: auto;
		z-index: auto;
        textarea,
		input,
		.redactor_box,
		.form_field__dropzone {
			border: 0;
			width: 100%;
		}
		input[type="file"] {
			display: inline-block;
			width: auto;
		}
		.multiselect__button,
		.select {
			border: 0;
		}
		.options {
			left: -1px;
			width: calc(~"100% + 2px");
			li {
				border-color: @color-gray-8;
				&:first-of-type {
					border-top: 1px solid @color-gray-8;
				}
			}
		}

		.custom-select {
			background: none;
			width: 100%;
		}
	}
}

.form_field_holder__addon {
	background: @color-gray-9;
	border-radius: @global-radius 0 0 @global-radius;
	border: none;
	display: flex;
	align-items: center;
	flex: 1 0;
	width: auto;
	color: @color-gray-4;
	.typography-lineheight(24px);
	.generate-spacing-rule(2,padding,left);
	.generate-spacing-rule(2,padding,right);

	img {
		border-radius: 50%;
	}

	.form_field_holder__addon__text {
		display: inline-block;
	}
}

.form_field_holder--drop_zone {
	.form_field_holder__addon,
	.form_field_holder__input {
		border-style: dashed;
	}
}

.form_field_holder--editor {
	.form_field_holder__addon {
		border-bottom: 1px solid @color-gray-9;
		border-right: 1px solid @color-gray-8;
		border-radius: @global-radius 0 0 0;
		position: absolute;
		top: 0;
		left: 0;
		width: auto;
		height: ~"calc(((@{spacing-min} + (2 * @{spacing-step})) * 2) + 25px)";
		z-index: 3;
	}
	.form_field_holder__input {
		border-radius: @global-radius !important;
	}
	.redactor_toolbar {
		position: relative;
		padding-left: ~"calc(((@{spacing-min} + (2 * @{spacing-step})) * 2) + 25px)";
		&:before {
			content: '';
			background: @color-gray-9;
			border-right: 1px solid @color-gray-8;
			position: absolute;
			top: 0;
			left: 0;
			bottom: 0;
			width: ~"calc(((@{spacing-min} + (2 * @{spacing-step})) * 2) + 25px)";
		}
	}
}
