$primary-color:   #4268C1;
$secondary-color: #203D5A;
$gray-color:      #E1E5EB;

@mixin directionStyle( $ltrProperty, $rtlProperty, $value ) {
	body:not(.rtl) & {
		#{$ltrProperty}: $value;
	}
	body.rtl & {
		#{$rtlProperty}: $value;
	}
}

.jet-ajax-search,
.jet-ajax-search-block .jet-ajax-search{
	position: relative;

	&__form {
		display: flex;
		align-items: center;
		margin: 0;
		transition: 0.2s;
	}
	&__fields-holder {
		display: flex;
		align-items: center;
		flex: 1 1 auto;
		transition: 0.2s;
	}
	&__field-wrapper {
		position: relative;
		display: flex;
		flex: 1 1 auto;
	}
	&__field-icon {
		position: absolute;
		top: 50%;
		transform: translateY(-50%);
		width: 1em;
		text-align: center;

		@include directionStyle( left, right, 15px );
	}
	&__field[type="search"] {
		width: 100%;
		padding: 9px 15px;
		font-size: 14px;
		line-height: 1.3;
		box-sizing: border-box;
		background-color: #fff;
		border: 1px solid $gray-color;
		transition: 0.2s;

		&::-webkit-input-placeholder { color: inherit }
		&::-moz-placeholder          { color: inherit }
		&:-ms-input-placeholder      { color: inherit }
		&:-moz-placeholder           { color: inherit }

		&::-moz-placeholder { opacity: 1 }
		&:-moz-placeholder  { opacity: 1 }

		&, &:focus {
			box-shadow: none;

			-webkit-appearance: none;
			-moz-appearance: none;
			appearance: none;
		}
	}
	&__field-icon + &__field {
		@include directionStyle( padding-left, padding-right, 35px );
	}
	&__submit[type="submit"] {
		display: inline-flex;
		justify-content: center;
		align-items: center;
		flex: 0 1 auto;
		padding: 10px 15px;
		font-size: 14px;
		line-height: 1.3;
		text-align: center;
		text-transform: none;
		cursor: pointer;
		border: none;
		box-shadow: none;
		transition: 0.2s;

		color: #fff;
		background-color: $primary-color;

		@include directionStyle( margin-left, margin-right, 10px );

		&:hover {
			background-color: $secondary-color;
		}
	}
	&__submit-icon {
		margin: 0;
	}
	&__submit-icon + &__submit-label {
		@include directionStyle( margin-left, margin-right, 5px );
	}
	& &__categories {
		position: relative;
		display: flex;
		width: 200px;
		@include directionStyle( margin-left, margin-right, 10px );

		&-select {
			width: 100%;
			padding: 9px 15px;
			font-size: 14px;
			line-height: 1.3;
			color: inherit;
			overflow: hidden;
			white-space: nowrap;
			text-overflow: ellipsis;
			background-color: #fff;
			border: 1px solid $gray-color;
			border-radius: 0;
			box-shadow: none;
			text-shadow: none;
			transition: 0.2s;
			-webkit-appearance: none;
			-moz-appearance: none;
			appearance: none;

			&::-ms-expand {
				opacity: 0;
			}
		}

		&-select-icon {
			position: absolute;
			top: 50%;
			@include directionStyle(right, left, 15px );
			transform: translateY(-50%);
			transition: 0.2s;
			font-size: 0;
			line-height: 1;
			color: inherit;
			pointer-events: none;

			svg {
				width: 14px;
				height: 14px;
				path {
					transition: fill .2 ease;
				}
			}
		}

		.chosen-container-single {
			display: flex;
			width: 100% !important;

			.chosen-single,
			.chosen-drop {
				background: none;
				box-shadow: none;
				border-radius: 0;
			}
			.chosen-single {
				display: flex;
				justify-content: space-between;
				align-items: center;
				width: 100%;
				height: auto;
				padding: 9px 15px;
				font-size: 14px;
				line-height: 1.3;
				color: inherit;
				background-color: #fff;
				border: 1px solid $gray-color;
				border-radius: 0;
				transition: 0.2s;

				span {
					margin-right: 0;
					@include directionStyle( margin-right, margin-left, 15px );
				}

				div {
					display: none;
				}
			}
			.chosen-drop {
				margin-top: 10px;
				padding: 10px 0;
				background-color: #fff;
				border: none;
				border-radius: 3px;
				@include directionStyle( left, right, 0 );

				.jet-ajax-search-block & {
					box-shadow: 0 3px 10px rgba(32, 61, 90, 0.15);
				}
				//box-shadow: 0 3px 10px rgba(32, 61, 90, 0.15);

				::-webkit-scrollbar {
					width: 8px;
					background-color: transparent;

					&-button {
						width: 0;
						height: 0;
					}
					&-thumb {
						background-color: #ccc;
					}
					&-corner {
						background: transparent;
					}
				}
			}
			.chosen-results {
				padding: 0 10px;
				margin: 0;
				color: inherit;
			}
			.chosen-results li {
				background-image: none;
				border-radius: 3px;
				transition: .2s ease;

				&:not(:first-child) {
					margin-top: 1px;
				}
				&.highlighted {
					background-color: $primary-color;
				}
				&:before {
					display: none;
				}
			}
		}
	}

	&__results-area {
		display: none;
		position: absolute;
		@include directionStyle( left, right, 0 );
		z-index: 9999;
		width: 100%;
		margin-top: 10px;
		background-color: #fff;
		border-radius: 3px;

		.jet-ajax-search-block & {
			box-shadow: 0 3px 10px rgba(32, 61, 90, 0.15);
		}
		//box-shadow: 0 3px 10px rgba(32, 61, 90, 0.15);
		&.show{
			display: block;
		}
	}
	&__results-holder {
		display: none;
		&.show{
			display: block;
		}
	}
	&__results-list {
		overflow: hidden;
		transition: height 0.4s cubic-bezier(0.645, 0.045, 0.355, 1);

		&-inner{
			position: relative;
			display: flex;
			flex-direction: row;
			flex-wrap: nowrap;
			align-items: flex-start;
			width: 100%;
			transition: transform 0.4s cubic-bezier(0.645, 0.045, 0.355, 1);
		}
	}
	&__results-slide {
		margin: 0;
		flex: 0 0 100%;
		max-width: 100%;

		&::-webkit-scrollbar {
			width: 8px;
			background-color: #f7f7f7;

			&-button {
				width: 0;
				height: 0;
			}
			&-thumb {
				background-color: #ccc;
				border: none;
			}
			&-corner {
				background: transparent;
			}
		}
	}
	&__results-item {}
	&__item-link {
		display: flex;
		align-items: flex-start;
		padding: 10px;
		color: inherit;
		text-decoration: none;
		background-color: transparent;
		border: none;
		box-shadow: none;
		transition: all 0.3s ease-in-out;

		&:hover {
			background-color: #F7F8FB;
		}
	}
	&__item-thumbnail {
		flex-shrink: 0;
		width: 15%;

		@include directionStyle( margin-right, margin-left, 10px );

		&-img {
			width: 100%;
			vertical-align: top;
			margin: 0;
		}

		&-placeholder {
			position: relative;
			padding-bottom: 56.25%;
			background-color: #E8E8E8;
			background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0icGxhY2Vob2xkZXIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB3aWR0aD0iNjAwcHgiIGhlaWdodD0iNDAwcHgiIHZpZXdCb3g9IjAgMCA2MDAgNDAwIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA2MDAgNDAwIiB4bWw6c3BhY2U9InByZXNlcnZlIj48cmVjdCB4PSIwIiBmaWxsPSIjRThFOEU4IiB3aWR0aD0iNjAwIiBoZWlnaHQ9IjQwMCIvPjxwYXRoIGZpbGw9IiNGRkZGRkYiIGQ9Ik0yMzQuNTM5LDE0OC41djEwM2gxMzAuOTIydi0xMDNIMjM0LjUzOXogTTM1NC45MDgsMjQwLjMzSDI0NS43MDd2LTgwLjY2MWgxMDkuMjAxVjI0MC4zM0wzNTQuOTA4LDI0MC4zM3oiLz48cG9seWdvbiBmaWxsPSIjRkZGRkZGIiBwb2ludHM9IjI1MS41OCwyMzEuNjQzIDI3NC4wODgsMjA3Ljk4NCAyODIuNTIxLDIxMS42MzMgMzA5LjEzLDE4My4zMDggMzE5LjYwNCwxOTUuODM2IDMyNC4zMjksMTkyLjk4MiAzNDkuODk4LDIzMS42NDMgIi8+PGNpcmNsZSBmaWxsPSIjRkZGRkZGIiBjeD0iMjc3LjU4MiIgY3k9IjE4MC4xOCIgcj0iOS44MyIvPjwvc3ZnPg==);
			background-repeat: no-repeat;
			background-position: center;
			background-size: cover;
		}
	}
	&__item-content-wrapper {
		flex: 1 1 auto;
		overflow: hidden;
	}
	&__item-title {
		font-size: 16px;
		font-weight: 700;
	}
	&__item-content {
		font-size: 14px;
		margin-top: 5px;
	}
	&__item-rating {
		margin-top: 5px;
		line-height: 1;
	}
	&__rating-star {
		position: relative;
		display: inline-block;
		color: $gray-color;

		&:not(:last-child) {
			@include directionStyle(margin-right, margin-left, 2px);
		}

		&:before {
			display: block;
			position: absolute;
			overflow: hidden;
			color: #ffba00;
			top: 0;
			@include directionStyle(left, right, 0);
		}

		@for $i from 1 through 9 {
			&-#{$i}:before {
				width: $i * 10%
			}
		}

		&-empty:before {
			content: none;
		}
	}

	&__item-price {
		margin-top: 5px;

		.price {
			margin: 0;

			.amount {
				color: inherit;
			}
		}
	}

	&__navigation-holder {
		display: flex;
		align-items: center;
		flex-grow: 1;
		justify-content: flex-end;

		.jet-ajax-search__results-count + &:not(:empty),
		.jet-ajax-search__full-results + &:not(:empty) {
			@include directionStyle( margin-left, margin-right, 15px );
		}
	}
	&__navigation-container {
		display: flex;
		justify-content: center;
		align-items: center;

		& + & {
			@include directionStyle( margin-left, margin-right, 15px );
		}
	}

	& &__navigate-button {
		padding: 5px;
		font-size: 14px;
		line-height: 1;
		text-align: center;
		border: none;
		border-radius: 0;
		background: none;
		box-shadow: none;
		transition: 0.2s;
		cursor: pointer;

		&-disable {
			cursor: default;
			pointer-events: none;
			opacity: 0.5;
		}

		svg {
			width: 14px;
			height: 14px;
			pointer-events: none;
			path {
				transition: fill .2s ease;
			}
		}
	}
	&__navigate-button + &__navigate-button {
		@include directionStyle( margin-left, margin-right, 5px );
	}
	& &__next-button,
	& &__prev-button {
		display: flex;
		justify-content: center;
		align-content: center;
		color: $secondary-color;
		border: 1px solid $gray-color;

		&:before {
			width: 1em;
			height: 1em;
		}

		&:hover {
			color: #fff;
			background-color: $primary-color;
			border-color: $primary-color;
		}
	}
	& &__next-button {
		&:before {
			body:not(.rtl) & {
				transform: scale(-1, 1);
			}
		}

		svg{
			body.rtl & {
				transform: scale(-1, 1);
			}
		}
	}
	& &__prev-button {
		&:before {
			body.rtl & {
				transform: scale(-1, 1);
			}
		}

		svg{
			body.rtl & {
				transform: scale(-1, 1);
			}
		}
	}
	& &__bullet-button {
		width: 15px;
		height: 15px;
		padding: 0;
		font-size: 0;
		border: 1px solid $gray-color;
		border-radius: 50%;

		&:hover,
		&.jet-ajax-search__active-button {
			background-color: $gray-color;
		}
	}
	& &__number-button {
		padding: 0;
		color: inherit;
		border: 0 solid;

		&:hover,
		&.jet-ajax-search__active-button {
			color: $primary-color;
		}

		&:before {
			content: attr( data-number );
		}
	}

	&__results-header,
	&__results-footer {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 10px;

		&.is-empty {
			display: none;
		}
	}
	&__results-header {
		//border-bottom: 1px solid $gray-color;
	}
	&__results-footer {
		//border-top: 1px solid $gray-color;
	}

	& &__results-count,
	& &__full-results {
		display: inline-block;
		padding: 0;
		text-align: center;
		text-transform: none;
		cursor: pointer;
		transition: 0.2s;

		border: none;
		background: none;
		box-shadow: none;
	}
	& &__results-count {
		font-size: 14px;
		font-weight: 400;
		color: inherit;

		&:hover {
			color: $primary-color;
		}
	}
	& &__full-results {
		font-size: 16px;
		font-weight: 700;
		color: $primary-color;

		&:hover {
			color: $secondary-color;
		}
	}

	&__spinner-holder {
		display: none;
		&.show {
			display: block;
		}
	}
	&__spinner {
		display: flex;
		justify-content: center;
		width: 50px;
		height: 30px;
		margin: 5px auto;
		color: $primary-color;

		.rect {
			display: inline-block;
			height: 100%;
			width: 6px;
			margin: 0 1px;
			background-color: currentColor;
			animation: jet-spinner-animation 1.1s infinite cubic-bezier(0.645, 0.045, 0.355, 1);

			&-2 {
				animation-delay: -1.0s;
			}
			&-3 {
				animation-delay: -0.9s;
			}
			&-4 {
				animation-delay: -0.8s;
			}
			&-5 {
				animation-delay: -0.7s;
			}
		}
	}
	&__message {
		display: none;
		padding: 10px;
		&.show {
			display: block;
		}
	}

	&--mobile-skin {
		[data-elementor-device-mode="mobile"] & {
			.jet-ajax-search__form,
			.jet-ajax-search__fields-holder {
				flex-wrap: wrap;
			}

			.jet-ajax-search__fields-holder .jet-ajax-search__categories {
				width: 100% !important;
				margin: 10px 0 0;
			}

			.jet-ajax-search__submit[type="submit"] {
				width: 100%;
				margin: 10px 0 0;
			}
		}

		.jet-ajax-search-block & {
			@media( max-width: 767px ) {
				.jet-ajax-search__form,
				.jet-ajax-search__fields-holder {
					flex-wrap: wrap;
				}

				.jet-ajax-search__fields-holder .jet-ajax-search__categories {
					width: 100% !important;
					margin: 10px 0 0;
				}

				.jet-ajax-search__submit[type="submit"] {
					width: 100%;
					margin: 10px 0 0;
				}
			}
		}
	}

	&-icon {
		display: inline-block;
		line-height: 1;
		text-align: center;

		svg {
			display: block;
			width: 1em;
			height: 1em;
			fill: currentColor;
		}
	}
}

.jet-ajax-search-block {
	.jet-ajax-search {
		.jet-ajax-search__results-item {
			&:not(:first-child) {
				border-top-width: 1px;
				border-top-style: solid;
			}
		}
	}
}

@keyframes jet-spinner-animation {
	0% {
		transform: scaleY(0.4);
	}
	25% {
		transform: scaleY(0.9);
	}
	50% {
		transform: scaleY(0.2);
	}
	80% {
		transform: scaleY(0.4);
	}
	100%{
		transform: scaleY(0.4);
	}
}
