@use "@wordpress/base-styles/colors" as *;
@use "@wordpress/base-styles/mixins" as *;
@use "@wordpress/base-styles/variables" as *;
@use "../utils/theme-variables" as *;

.components-radio-control {
	border: 0;
	margin: 0;
	padding: 0;

	font-family: $default-font;
	font-size: $default-font-size;

}

.components-radio-control__group-wrapper.has-help {
	margin-block-end: $grid-unit-15;
}

.components-radio-control__option {
	display: grid;
	grid-template-columns: auto 1fr;
	grid-template-rows: auto minmax(0, max-content);
	column-gap: $grid-unit-10;
	align-items: center;
}

.components-radio-control__input[type="radio"] {
	grid-column: 1;
	grid-row: 1;

	@include radio-control;

	display: inline-flex;
	margin: 0;
	padding: 0;
	appearance: none;

	&:not(:disabled) {
		cursor: var(--wpds-cursor-control);
	}

	&:focus {
		@include button-style-outset__focus(var(--wp-admin-theme-color));
	}

	&:checked {
		background: $components-color-accent;
		border-color: $components-color-accent;

		&::before {
			content: "";
			border-radius: $radius-round;
		}
	}

	&:disabled {
		background: $components-color-gray-100;
		border: 1px solid $components-color-gray-300;
		opacity: 1; // Override style from wp-admin forms.css.

		&:checked::before {
			border-color: $components-color-gray-400;
			opacity: 1; // Override style from wp-admin forms.css.

		}
	}
}

.components-radio-control__label {
	grid-column: 2;
	grid-row: 1;

	.components-radio-control:not(:disabled) & {
		cursor: var(--wpds-cursor-control);
	}

	line-height: $radio-input-size-sm;

	@include break-small() {
		line-height: $radio-input-size;
	}
}

.components-radio-control__option-description {
	grid-column: 2;
	grid-row: 2;

	padding-block-start: $grid-unit-05;

	// Override the top margin of the StyledHelp component from BaseControl.
	// TODO: we should tweak the StyledHelp component to not have a top margin.
	&.components-radio-control__option-description {
		margin-top: 0;
	}
}
