// React colorful control.
.customize-control-kirki-react-colorful {
	.kirki-control-form {
		position: relative;
		box-sizing: border-box;
	}

	.kirki-control-form * {
		box-sizing: border-box;
	}

	.kirki-control-cols {
		display: flex;
		align-items: flex-start;
	}

	.kirki-control-left-col {
		padding-inline-end: 30px;
		width: 90%;
		width: calc(100% - 35px);
	}

	.kirki-control-right-col {
		display: flex;
		justify-content: flex-end;
		width: 35px;
	}

	.use-hue-mode {
		.react-colorful {
			height: auto;
		}

		.react-colorful__saturation {
			display: none;
		}

		.react-colorful__last-control {
			border-radius: 4px;
		}

		input.kirki-color-input {
			padding-inline-start: 8px;
			padding-inline-start: 8px;
		}
	}

	.kirki-trigger-circle-wrapper {
		position: relative;
		top: -3px;
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 3px;
		width: 33px;
		height: 33px;
		border-radius: 50%;
		border: 1px solid #ccc;
	}

	.kirki-trigger-circle {
		position: relative;
		padding: 0;
		display: block;
		width: 25px;
		height: 25px;
		background-size: 10px;
		border: none;
		border-radius: 50%;
		cursor: pointer;

		.kirki-color-preview {
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
		}
	}

	.colorPickerContainer {
		position: absolute;
		top: 35px;
		right: 0;
		margin-top: 5px;
		width: 100%;
		padding: 15px;
		background-color: #fff;
		border-radius: 6px;
		box-shadow: rgba(0, 0, 0, 0.09) 0 12px 15px 0;
		z-index: 9999;

		opacity: 0;
		visibility: hidden;
		transition: all 0.2s;
		transition-property: opacity, visibility; // Yes, only opacity and visibility please.

		&.is-open {
			opacity: 1;
			visibility: visible;
			transition: all 0.2s ease 10ms; // When we open the picker popup, the top offset is changed, so we need to wait a bit.
			transition-property: opacity, visibility; // Yes, only opacity and visibility please.
		}
	}

	.react-colorful {
		width: 100%;
		border-radius: 4px;
	}

	.react-colorful__saturation {
		border-radius: 4px 4px 0 0;
	}

	.react-colorful__last-control {
		border-radius: 0 0 4px 4px;
	}

	.react-colorful__pointer {
		width: 20px;
		height: 20px;
	}

	.kirki-color-input-wrapper {
		margin-top: 15px;
	}

	.kirki-color-input-control {
		position: relative;
		display: flex;
		align-items: center;
		width: 100%;
	}

	input.kirki-color-input {
		display: block;
		position: relative;
		padding-inline-start: 32px;
		padding-inline-end: 8px;
		width: 100%;
		height: 30px;
		line-height: 30px;
		color: #333;
		border: 1px solid #ccc;
		border-radius: 4px;
		z-index: 1;
	}

	.kirki-color-input:focus,
	.kirki-color-input:active {
		box-shadow: 0 0 0 1px #2271b1;
		outline: none;
		border-color: #2271b1;
	}

	.kirki-color-preview-wrapper {
		position: absolute;
		left: 6px;
		width: 22px;
		height: 22px;
		background-repeat: repeat;
		background-size: 8px;
		border-radius: 50%;
		border: 1px solid #ddd;
		border: 2px solid #fff;
		-webkit-box-shadow: 0px 0px 0px 1px #ddd;
		box-shadow: 0px 0px 0px 1px #ddd;
		z-index: 2;
	}

	.kirki-color-preview,
	.kirki-control-reset {
		position: absolute;
		padding: 0;
		background-color: transparent;
		cursor: pointer;
	}

	.kirki-color-preview {
		display: block;
		width: 100%;
		height: 100%;
		border-radius: 50%;
		border-width: 0;
	}

	.kirki-control-reset {
		display: flex;
		align-items: center;
		justify-content: center;
		top: 4px;
		right: 35px;
		width: 17px;
		height: 17px;
		border-radius: 50%;
		border-width: 0;
		z-index: 3;
	}

	.kirki-control-reset:hover i {
		color: #f00;
		transform: rotate(-45deg);
	}

	.kirki-control-reset i {
		font-size: 12px;
		width: auto;
		height: auto;
		transform: rotate(45deg);
		transition: transform 0.2s;
	}

	.kirki-color-swatches {
		display: flex;
		flex-wrap: wrap;
		gap: 4px;
		align-items: center;
		margin-bottom: 12px;
	}

	.kirki-color-swatch {
		position: relative;
		display: block;
		padding: 0;
		width: 25px;
		height: 25px;
		border-radius: 50%;
		border: 2px solid #fff;
		cursor: pointer;
		transform: scale(1, 1);
		transition: transform 0.2s;
		-webkit-box-shadow: 0px 0px 0px 1px #ddd;
		box-shadow: 0px 0px 0px 1px #ddd;
	}

	.kirki-color-swatch:active,
	.kirki-color-swatch:focus {
		outline: none;
	}

	.kirki-color-swatch:hover,
	.kirki-color-swatch:focus {
		transform: scale(1.1, 1.1);
	}

	.kirki-label-tooltip {
		position: absolute;
		bottom: 45px;
		left: -8px;
		padding: 7px 10px 3px; // The 4px of bottom side is handled by label / description's margin-bottom.
		width: auto; // just for fallback for max-content.
		width: max-content;
		max-width: 100px;
		color: #fff;
		background-color: rgba(0, 0, 0, 0.7);
		border-radius: 4px;
		opacity: 0;
		visibility: hidden;
		transition: all 0.2s;

		&::before {
			content: "";
			position: absolute;
			bottom: -8px;
			left: 19px;
			border-width: 8px 7px 0 7px;
			border-style: solid;
			border-color: rgba(0, 0, 0, 0.7) transparent transparent transparent;
		}

		.customize-control-title {
			line-height: 1.2;
		}
	}

	.kirki-trigger-circle-wrapper {
		&:hover ~ .kirki-label-tooltip {
			opacity: 1;
			visibility: visible;
		}
	}

	&[data-kirki-parent-control-type="kirki-multicolor"] {
		margin-inline-end: 8px;
		margin-bottom: 20px;
		padding-inline-end: 0;
		width: 35px;

		.kirki-control-reset {
			top: -19px;
			right: 8px;
		}
	}

	&[data-kirki-parent-control-type="kirki-typography"] {
		.colorPickerContainer {
			top: 55px;
		}

		.kirki-control-reset {
			top: 30px;
			right: auto;
			left: 35px;
		}
	}
}
