@-webkit-keyframes wcboost-spin {
	0% { -webkit-transform: rotate(0deg); }
	100% { -webkit-transform: rotate(360deg); }
}

@keyframes wcboost-spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

.wcboost-products-compare-button {
	text-decoration: none;
	display: inline-block;
	margin: 10px 0;

	&.loading .wcboost-products-compare-button__icon svg {
		animation: wcboost-spin .75s linear infinite;
	}
}

.wcboost-products-compare-button__icon {
	margin-right: 6px;
}

.wcboost-products-compare-button__icon svg {
	width: 1em;
	height: 1em;
	vertical-align: -0.15em;
	fill: currentColor;
}

ul.products li.product .wcboost-products-compare-button {
	margin: 10px;
}

// Table.
.wcboost-products-compare__table {
	overflow-x: auto;
	margin: 1em 0;

	&::-webkit-scrollbar {
		appearance: none;
		-webkit-appearance: none;
		height: 6px;
		width: 6px;
	}

	&::-webkit-scrollbar-track {
		background: #f1f1f1;
		border-radius: 3px;
	}

	&::-webkit-scrollbar-thumb {
		border-radius: 3px;
		background-color: rgba(0,0,0,0.5);
	}
}

table.compare_table {
	table-layout: fixed;

	td {
		width: 220px;
	}

	th {
		width: 160px;
		white-space: nowrap;
		position: sticky;
		left: 0;
		z-index: 9;
	}
}

@media (max-width: 767px) {
	table.compare_table {
		th {
			display: none;
		}

		td {
			padding: 30px 10px 10px 10px;
		}

		tr::before {
			content: attr(data-title);
			display: block;
			position: sticky;
			left: 0;
			white-space: nowrap;
			padding: 0 1em;
			font-size: 80%;
			opacity: 0.8;
			font-weight: 600;
		}
	}
}

// Popup.
.wcboost-products-compare-popup {
	display: none;
	position: fixed;
	top: 0;
	bottom: 0;
	left: 0;
	right: 0;
	width: 100%;
	z-index: 9999;

	.admin-bar & {
		top: 32px;
	}

	.wcboost-products-compare {

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

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

	.wcboost-products-compare__tools {
		overflow: hidden;
		padding: 1rem 0;
	}
}

@media screen and (max-width: 782px) {
	.admin-bar .wcboost-products-compare-popup {
		top: 48px;
	}
}

.wcboost-products-compare-popup__backdrop {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.5);
	z-index: 1;
	cursor: pointer;
}

.wcboost-products-compare-popup__header {
	padding: 0 20px;
	height: 60px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.wcboost-products-compare-popup__close {
	float: right;
	font-size: 20px;
	text-decoration: none;
	display: block;
	padding: 0.5em;

	svg {
		vertical-align: middle;
	}
}

.wcboost-products-compare-popup__title {
	font-weight: 700;
}

.wcboost-products-compare-popup__body {
	position: relative;
	width: calc(100% - 80px);
	height: calc(100% - 80px);
	margin: 40px;
	background-color: #fff;
	z-index: 2;

	.woocommerce-message,
	.is-success {
		display: none;
	}

	.wcboost-products-compare-clear {
		margin-right: 20px;
		float: right;
	}
}

.wcboost-products-compare-popup__content {
	padding-bottom: 20px;
	overflow-y: auto;
	max-height: calc(100% - 60px);
	padding: 0 20px;

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

@media (max-width: 767px) {
	.wcboost-products-compare-popup__body {
		width: 100%;
		height: 100%;
		margin: 0;
	}
}

/** Widget **/
.wcboost-products-compare-widget-item {
	font-size: 0.875em;
	position: relative;
	margin: 1em 0;

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

	img {
		max-width: 60px;
		margin-right: 1em;
		float: left;
	}

	.price {
		display: block;
	}

	.star-rating {
		font-size: 0.875em;
	}

	a.remove {
		line-height: 1;
		text-decoration: none;
		position: absolute;
		left: 0;
		top: 0;
		min-width: 1em;
		min-height: 1em;
		border-radius: 50%;
		transform: translate(-50%, -50%);

		&:hover {
			color: #111;

			&::before {
				color: inherit;
			}
		}
	}
}

.wcboost-products-compare-widget__buttons {

	.button {
		text-align: center;
		display: block;
		margin-top: 10px;
	}
}

/** Compare bar */
.wcboost-products-compare-bar {
	position: fixed;
	background-color: #f9f9f9;
	transition: transform 250ms ease-out, visibility 0s linear 0s;
	z-index: 99;

	.wcboost-products-compare-widget__products {
		list-style: none;
		margin: 0;
		padding: 0;
	}

	.wcboost-products-compare-widget__empty-message {
		margin: 20px 0;
	}

	&.wcboost-products-compare-bar--open {
		transform: none;
	}

	&.hide-if-single {
		visibility: hidden;
		transition: transform 250ms ease-out, visibility 0s linear 250ms;

		&.is-visible {
			visibility: visible;
			transition: transform 250ms ease-out, visibility 0s linear 0s;
		}
	}

	.wcboost-products-compare-widget__buttons {
		margin: 10px 0 20px 0;
	}
}

.wcboost-products-compare-bar__toggle-button {
	display: block;
	padding: 5px 10px;
	background: #f9f9f9;
	border-radius: 3px 3px 0 0;
	user-select: none;
	cursor: pointer;
	transition: 0.25s ease;

	svg {
		width: 1em;
		height: 1em;
		vertical-align: middle;
		margin-right: 6px;
	}

	.wcboost-products-compare-bar--open & svg {
		transform: rotate(180deg);
	}

	.hide-if-single & {
		transform: translateY(100%);
	}

	.hide-if-single.is-visible & {
		transform: translateY(0);
	}
}

.wcboost-products-compare-bar__content {
	padding-left: 30px;
	padding-right: 30px;
}

.wcboost-products-compare-bar--bottom {
	bottom: 0;
	left: 0;
	width: 100%;
	transform: translateY(100%);
	border-top: 1px solid rgba(0,0,0,0.1);

	.wcboost-products-compare-bar__toggle {
		position: absolute;
		top: 0;
		right: 30px;
		transform: translateY(-100%);
	}

	.wcboost-products-compare-bar__toggle-button {
		border-radius: 3px 3px 0 0;
		border: 1px solid rgba(0,0,0,0.1);
		border-bottom-width: 0;
	}

	.wcboost-products-compare-widget__products {
		padding: 20px 10px 10px 10px;
		margin: 10px 0;
		display: flex;
		gap: 30px;
		overflow-x: auto;

		&::-webkit-scrollbar {
			appearance: none;
			-webkit-appearance: none;
			height: 6px;
			width: 6px;
		}

		&::-webkit-scrollbar-track {
			background: #f1f1f1;
			border-radius: 3px;
		}

		&::-webkit-scrollbar-thumb {
			border-radius: 3px;
			background-color: rgba(0,0,0,0.5);
		}
	}

	.wcboost-products-compare-widget-item {
		flex-shrink: 0;
		flex-basis: 200px;
		margin: 0;
	}

	.wcboost-products-compare-widget__buttons {

		.button {
			margin: 0 10px;
			display: inline-block;
			width: auto;
		}
	}
}
