@import "@automattic/color-studio/dist/color-variables";
@import "@automattic/typography/styles/variables";
@import "@wordpress/base-styles/breakpoints";
@import "client/components/forms/form-radio/style";

$blueberry-color: #3858e9;
$dark-blueberry-color: #2145e6;
$blueberry-focus-color: #abc0f5;

@mixin question-options-container {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	gap: 28px;
	width: 100%;

	@media (max-width: $break-medium) {
		flex-direction: column;
	}
}

@mixin question-option-control {
	display: flex;
	flex-basis: calc(100% - 48px);
	gap: 16px;
	align-items: center;
	border-radius: 4px;
	border: solid 1px $studio-gray-5;
	padding: 16px;
	cursor: pointer;

	&:hover {
		border-color: $blueberry-color;
	}

	&:focus-visible {
		outline: 1px solid $blueberry-color;
	}

	@media (min-width: $break-medium) {
		flex-basis: calc(50% - 48px);
	}
}

.question-step {
	&__content {
		display: flex;
		flex-direction: column;
		align-items: start;
		gap: 44px;
		padding-bottom: 40px;
	}

	&__continue-button.components-button.is-primary {
		background-color: $blueberry-color;
		border-color: $blueberry-color;
		padding: 8px 14px 8px 14px;
		height: 40px;

		&:not(:disabled) {
			&:hover,
			&:focus,
			&:active {
				background-color: $dark-blueberry-color;
				border-color: $dark-blueberry-color;
			}

			&:focus {
				box-shadow: inset 0 0 0 1px $studio-white, 0 0 0 var(--wp-admin-border-width-focus) $blueberry-color;
			}
		}
	}

	.question-options__container {
		@include question-options-container;

		.question-options__option-control {
			@include question-option-control;

			&.checked {
				border-color: $blueberry-color;
			}

			&.disabled {
				opacity: 0.5;
				pointer-events: none;
			}

			// Radio styles
			input[type="radio"].form-radio {
				height: 20px;
				width: 20px;
				min-width: 20px;
				margin: 0;
				border-color: $studio-gray-20;

				&:checked {
					border-color: $blueberry-color;
				}

				&:checked::before {
					margin: 2px;
					width: 14px;
					height: 14px;
					background-color: $blueberry-color;
				}

				&:focus {
					border-color: $blueberry-color;
					box-shadow: 0 0 0 2px $blueberry-focus-color;
				}
			}

			// Checkbox styles
			.components-checkbox-control__input-container {
				margin-right: 0;

				svg.components-checkbox-control__checked {
					animation: grow 0.2s ease-in-out;
				}
			}

			.components-base-control__field {
				margin-bottom: 0;
			}

			.components-checkbox-control__input[type="checkbox"] {
				border-color: $studio-gray-20;

				&:checked {
					border-color: $blueberry-color;
					background: $blueberry-color;
					box-shadow: inset 0 0 0 1px $studio-white;

					&:focus {
						box-shadow: inset 0 0 0 1px #fff, 0 0 0 2px $blueberry-focus-color;
					}
				}

				&:focus {
					border-color: $blueberry-color;
					box-shadow: 0 0 0 2px $blueberry-focus-color;
				}
			}

			// Option label and help text styles
			.question-options__option-label {
				label {
					font-size: $font-body;
					font-weight: 500;
					line-height: 24px;
					color: $studio-gray-100;
				}

				.question-options__option-help-text {
					display: block;
					font-size: $font-body-extra-small;
					font-weight: 400;
					line-height: 20px;
					color: $studio-gray-80;
					padding-top: 4px;
				}
			}
		}
	}

	.step-container__header {
		margin-top: 96px;
	}

	&.disabled {
		.step-container__navigation button,
		.step-container__skip-wrapper button {
			opacity: 0.5;
			pointer-events: none;
		}
	}
}
