@import "../variables";

.slider {
	margin-bottom:15px;
	font-size: 0.7em;
	position:relative;
	z-index:1;

	.is-disabled &-demo-overlay, .is-coming &-demo-overlay {
		position:absolute;
		width:100%;
		height:100%;
		background-color: rgba($dark-grey, 0.80);
		z-index:2;
		display:flex;
		justify-content:center;
		align-items:center;
	}

	.is-disabled &-demo-overlay-text {
		padding: 3px 20px 3px 5px;
	}

	.is-coming &-demo-overlay-text {
		opacity:0;
		transition: opacity .2s ease;
		position:absolute;
		display:flex;
		justify-content: center;
		align-items: center;
	}

	.is-coming:hover &-demo-overlay-text {
		opacity:1;
	}

	&-container {
		margin-top: 0.1em;
		display: flex;
		flex-flow: row nowrap;
		width:100%;
	}

	&-demo-overlay {
		position: absolute;
		width: 100%;
		z-index: 5;
		display:none;

		&-text {
			opacity:0;
			color:$white;
			font-size: 13px;
			display: block;
			font-size: 13px;
			transition:opacity .2s ease;
			position: relative;
			top: 0;
			bottom: 0;
			left: 0;
			right: 0;
			cursor: default;

			&-more {
				position: absolute;
				top: 0;
				bottom: 0;
				right: 0;
				display: flex;
				align-items: center;
				justify-content: center;
				overflow: hidden;

				width: 40px;
				background-color: $green;
				background-image: url('../../images/add-feature.svg');
				background-position: center;
				background-repeat: no-repeat;

				transition: all 500ms ease;

				&-text {
					opacity: 0;
					flex-direction: column;
					padding-left: 60px;
					transition: all 200ms ease;
					transition-delay: 200ms;
				}

				&:hover {
					width: 260px;
					background-image: url('../../images/pro-version.svg');
					background-position: 10% center;
				}

				&:hover &-text {
					opacity: 1;
					padding-left: 10px;
				}
			}
		}

		&:hover &-text {
			background-color: darken($dark-grey, 2%);
			opacity:1;
		}
	}

	&-title {
		text-transform: uppercase;
		letter-spacing: 0.05em;
		padding-left: 0.8em;
		display: inline-block;
		pointer-events: none;
		margin-bottom: .5em;
	}

	&-reset {
		opacity: 0;
		margin-left: 0.6rem;
		display: inline-block;
		cursor: pointer;
		color: $white;
		transition: opacity 500ms ease;
		background-color: $black;
		border-radius: 5px;
		padding: 0 1rem;

		&:hover {
			background-color: $white;
			color: $dark-grey;
		}
	}

	&-tooltip {
		opacity: 1;
		margin-left: 5px;
		display: inline-block;
		cursor: pointer;
		color: darken($white, 25%);
		font-weight: 700;
		transition: background-color 200ms ease, color 200ms ease;
		background-color: darken($dark-grey, 2%);
		border-radius: 50%;
		width: 15px;
		height: 15px;
		text-align: center;
		line-height: 15px;

		&:hover {
			background-color: $white;
			color: $dark-grey;
		}
	}

	&:hover &-reset {
		opacity: 1;
	}

	&-text-controller {
		float: right;
		width: 5.2rem;
		font-size: inherit;
		text-align: right;
		background: none;
		border: 0;
		border-radius: 0;
		color: $medium-grey;

		// we'll use textfield appearance until we've figured out sth better
		-moz-appearance: textfield;
		-webkit-appearance: textfield;

		&.is-indiv {
			//Do not put more than 43px without checking that it make serif terminal curve go crazy
			margin-right:43px;
		}
	}

	&-controller {
		position: relative;
		overflow: hidden;
		background-color: #FFF;
		margin-top: 2px;
		flex:1;
		/* fix a overflow hidden and border-radius error in chrome */
		mask-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC);
		-webkit-mask-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC);
		mask-repeat: repeat;
		-webkit-mask-repeat: repeat;

		&, &-bg, &-handle {
			border-radius: 1rem;
			cursor: pointer;
		}

		&-bg {
			height: 1.2rem;
			@include themify() {
				background-color: $theme-background;
			}

			&.is-not-advised {
				background-color:$red;
			}
		}

		&-bg.is-not-advised &-handle {
			border-color:$red;
		}

		&-handle {
			float: right;
			width: 1.2rem;
			height: 1.2rem;
			@include themify() {
				border:solid 0.4rem $theme-background;
			}
			background-color: $dark-grey;
		}
	}

	&-range-limiter-bg {
		border-radius: 0;
		height: 1.2rem;
		width: 100%;
		background: transparentize(#555, 0.4);
		position: absolute;
		left: 0;
		top: 0;
		background-image: linear-gradient(-45deg, rgba(255, 255, 255, .2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .2) 75%, transparent 75%, transparent);
		background-size: 25px 25px;

		&.min {
			mask-image: radial-gradient(circle at calc(100%) 50%, transparent 9px, #555 10px);
			-webkit-mask-image: radial-gradient(circle at calc(100%) 50%, transparent 9px, #555 10px);
		}

		&.max {
			mask-image: radial-gradient(circle at 0px 50%, transparent 9px, #555 10px);
			-webkit-mask-image: radial-gradient(circle at 0px 50%, transparent 9px, #555 10px);
		}
	}


	&.is-coming {
		.slider-demo-overlay {
			background-color: rgba($dark-grey, 0.65);
			z-index:1;
			&-text {
				text-align: center;
			}
		}
	}

	&.is-child {
		width: 90%;
		margin-top:-1rem;
		margin-left:10%;
		position: relative;
		z-index:0;

		.slider-title {
			color: $medium-grey;
		}

		.slider-container {
			&:before {
				content: "";
				position: absolute;
				border-bottom: 1px solid lighten($dark-grey, 12%);
				border-left: 1px solid lighten($dark-grey, 12%);
				width: 20px;
				height: 50px;
				top: -23px;
				left: -15px;
				z-index: 0;
			}
		}

		.slider-demo-overlay {
			top: 3px;
			width: 270px;
			left: -35px;
			height:100%;
			&-text {
				margin-left:9px;
				margin-right:1px;
			}
		}
	}

}

.sliders {
	color: $white;
	background-color: $dark-grey;
	padding:1rem;
}

.slider-divider {
	width: 100%;
	height: 2px;
	background: #14151A;
	margin-top: 20px;
	margin-bottom: 20px;
}

.indiv-switch {
	flex: 0 0 28px;
	height: 12px;
	position: relative;
	margin-left: 5px;
	margin-top: 2px;
	cursor:pointer;
	display: flex;
	justify-content: space-between;

	&-btn {
		line-height: 12px;
		height: 12px;
		width: 12px;
		text-align: center;
		border-radius: 50%;
		transition: all .2s ease;
		z-index:1;
		font-size:16px;
		background: $white;
		color:$dark-grey;

		&:hover {
			background: $yellow;
		}

		&.is-active {
			background: $yellow;
		}
	}
}

.radio-slider {
	.radio-buttons-wrap {
		padding: 0 0 0 0.8em;
	}
	.radio-button-container{
		color: $light-grey;
		margin: 0 8% 3% 0;
	}
	.slider-container {
		margin: 10px 0 0;
	}
	label {
		cursor: pointer;
		position: relative;
		text-transform: uppercase;
	}
	.box-value-label {
		display: inline-block;
		padding: 0 0 0 20px;
	}
	.box-value-label::after {
		background-image: url('../../images/radio-button.svg');
		background-position: 0px 0px;
		background-repeat: no-repeat;
		content: "";
		height: 16px;
		left: 0px;
		position: absolute;
		top: -1px;
		width: 16px;
	}
	input[type="radio"] {
		height: 0px;
		visibility: hidden;
		width: 0px;
	}
	input[type="radio"]:checked + .box-value-label::after {
		background-image: url('../../images/radio-button-active.svg');
	}
	.radio-buttons-wrap {
		align-items: center;
		display: flex;
		flex-flow: row;
		flex-wrap: wrap;
		justify-content: flex-start;
		width: 100%;
	}
}
