@use "../../variables/colors" as colors;

/**
 * Form Group
 *
 * <div class="edd-form-group">
 *   <label class="edd-form-group__label">Label</label>
 *   <div class="edd-form-group__control">
 *   	<input type="text" class="edd-form-group__input" />
 *   </div>
 *   <p class="edd-form-group__help">Help</p>
 * </div>
 *
 *
 * <fieldset class="edd-form-group">
 *   <legend class="edd-form-group__label">Label</label>
 *
 *   <div class="edd-form-group__control">
 *   	<input type="radio" class="edd-form-group__input" />
 *   	<label>Radio 1</label>
 *   </div>
 *
 *   <div class="edd-form-group__control">
 *   	<input type="radio" class="edd-form-group__input" />
 *   	<label>Radio 2</label>
 *   </div>
 * </fieldset>
 *
 */
.edd-form-group {
	margin-bottom: 16px;

	&:last-of-type {
		margin-bottom: 0;
	}

	legend {
		margin-bottom: 8px;
	}

	select {
		max-width: 100%;
	}
}

.edd-form-group__label,
.edd-form-group>label {
	display: block;
	font-weight: 600;
	margin-bottom: 8px;
	padding: 0;
}

.edd-form-group__control {
	margin-bottom: 12px;
	max-width: 100%;

	&.is-radio,
	&.is-check {
		margin-top: 4px;
	}

	&:last-of-type {
		margin-bottom: 0;
	}

	&--is-inline {
		display: inline-flex;
		align-items: flex-end;
	}

	&--row {
		display: flex;
		align-items: center;
		gap: 8px;
	}
}

.edd-form-group__input {
	max-width: 100%;

	&[type="checkbox"],
	&[type="radio"] {
		margin-top: 0;

		+label {
			display: unset;
			font-weight: unset;
		}
	}
}

select.edd-form-group__input {
	max-width: 100%;
}

.edd-form-group__help {
	color: colors.$wp-gray-50;
	font-size: 13px;
	font-style: italic;
	line-height: initial;
	margin: 8px 0 0;
}

.edd-range {
	display: flex;
	align-items: center;
	gap: 15px;

	.edd-range__slider {
		min-width: 90px;
		height: 2px;
		border-radius: 10px;
		border: none;
		background: #ccc;

		.ui-slider-range {
			background: var(--edd-wp-admin-theme-color);
		}

		.ui-slider-handle {
			height: 15px;
			width: 15px;
			top: -6.5px;
			border-radius: 100%;
			background: var(--edd-wp-admin-theme-color);
			border: none;
			cursor: pointer;
			display: inline-block;
			position: relative;
		}
	}

	.edd-range__input {
		max-width: 60px;
	}
}
