@use "../../scss/mixins/breakpoints";
@use "../../scss/variables/colors";
@use "../../scss/functions/rem";

.jp-form-legend,
.jp-form-label-wide {
	padding: rem.convert(16px) 0 rem.convert(5px);
	font-size: rem.convert(14px);
	font-weight: 600;
}

.jp-form-label {
	display: block;
	font-size: rem.convert(14px);
	line-height: 1.5;
	margin-bottom: rem.convert(5px);
}

.jp-form-label-wide {
	padding: rem.convert(8px) 0;
	display: block;
}

.jp-form-label input[type="radio"] + span {
	font-weight: 400;
	margin-left: 8px;
}

.jp-form-radio-gap .components-radio-control__option {
	margin-bottom: rem.convert(4px);

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

.jp-form-button {
	margin-top: rem.convert(16px);

	@include breakpoints.breakpoint( ">480px" ) {
		position: absolute;
		right: rem.convert(16px);
		bottom: rem.convert(16px);
	}
}

.jp-form-toggle-explanation {
	font-size: rem.convert(14px);
	word-break: break-word;
	vertical-align: baseline;

	.jp-form-toggle-privacy-info {
		margin-left: rem.convert(5px);
		padding-left: rem.convert(5px);
		border-left: 1px solid rgba(colors.$gray, 0.5);
	}
}

.jp-form-fieldset {
	clear: both;
	position: relative;

	.jp-form-legend + .jp-form-setting-explanation {
		margin-top: 0;
		margin-bottom: rem.convert(8px);
	}
}

.jp-form-input-with-prefix {
	display: inline-flex;
	width: 100%;
	margin-bottom: rem.convert(24px);

	span:first-child {
		min-width: rem.convert(60px);
		text-align: center;
		background: #f6f6f6;
		border: 1px solid #c8d7e1;
		color: #4f748e;
		padding: rem.convert(8px) rem.convert(14px);
		white-space: nowrap;

		@include breakpoints.breakpoint( "<660px" ) {
			display: block;
			text-align: left;
		}
	}

	input[type="text"] {
		width: 100%;

		@include breakpoints.breakpoint( ">660px" ) {
			border-left: 0;
		}

		@include breakpoints.breakpoint( "<660px" ) {
			border-top: 0;
		}
	}

	@include breakpoints.breakpoint( "<660px" ) {
		display: block;
		box-sizing: border-box;
	}
}

.jp-form-input-suffix {
	text-align: center;
	background: #f6f6f6;
	border: 1px solid #c8d7e1;
	color: #4f748e;
	padding: rem.convert(8px) rem.convert(14px);
	white-space: nowrap;
	flex: 1 0 auto;
	display: flex;
}

button.jp-form-input-suffix {
	background: initial;
	border-radius: 0;
}

.jp-form-has-child {
	margin-bottom: rem.convert(24px);

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

	> .jp-form-fieldset,
	> .jp-form-setting-explanation {
		margin-left: rem.convert(36px);
	}

	> .jp-form-fieldset {
		margin-bottom: rem.convert(16px);
	}
}

.jp-form-block-fade {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 1;
	background: rgba(255, 255, 255, 0.8);
	width: 100%;
	height: 100%;
}

.jp-form-offlinemode-message.is-compact {
	width: 100%;
	padding: 0 1rem;
	position: absolute;
	top: -24px;
	z-index: 1;
}

.jp-form-textarea {

	&-wide {
		width: 100%;
	}
}
