/* ==========================================================================
   Contact page (page-contact.php) & Thanks page (page-thanks.php)
   Breakpoint: 768px and up = PC layout / below = SP layout
   ========================================================================== */

/* --- Shared field tokens --------------------------------------------------- */
.p-cfp-form-wrap {
	background: var(--color-white);
	padding: 60px 20px 80px;
}

.p-cfp-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0 10px;
	height: 26px;
	border-radius: 3px;
	color: var(--color-white);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.1em;
	flex-shrink: 0;
}

.p-cfp-badge--required {
	background: #cf0100;
}

.p-cfp-badge--optional {
	background: #707070;
}

.p-cfp-fields {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.p-cfp-field__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 14px;
	margin-bottom: 8px;
}

.p-cfp-field__label {
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 0.1em;
}

.p-cfp-field__note {
	font-size: 11px;
	letter-spacing: 0.1em;
	color: #707070;
}

/* CF7-generated controls */
.p-cfp-form .wpcf7-form-control-wrap {
	display: block;
	width: 100%;
}

.p-cfp-form input.wpcf7-form-control:not(.wpcf7-submit),
.p-cfp-form textarea.wpcf7-form-control,
.p-cfp-form select.wpcf7-form-control {
	width: 100%;
	height: 60px;
	padding: 14px 22px;
	background: #f9f9f9;
	border: 1px solid #b5b5b5;
	border-radius: 5px;
	font-family: var(--font-jp);
	font-size: 14px;
	letter-spacing: 0.1em;
	color: var(--color-text);
}

.p-cfp-form textarea.wpcf7-form-control {
	height: 200px;
	resize: vertical;
	line-height: 1.8;
}

.p-cfp-form select.wpcf7-form-control {
	appearance: none;
	background-image: url('../images/contact/icon-select-arrow.svg');
	background-repeat: no-repeat;
	background-position: right 20px center;
	background-size: 15px auto;
	cursor: pointer;
}

.p-cfp-form input.wpcf7-form-control::placeholder,
.p-cfp-form textarea.wpcf7-form-control::placeholder {
	color: #b5b5b5;
}

.p-cfp-form input.wpcf7-not-valid,
.p-cfp-form textarea.wpcf7-not-valid,
.p-cfp-form select.wpcf7-not-valid {
	border-color: #cf0100;
}

.p-cfp-form .wpcf7-not-valid-tip {
	display: block;
	margin-top: 8px;
	font-size: 12px;
	color: #cf0100;
}

.p-cfp-form .wpcf7-response-output {
	margin-top: 24px;
	padding: 16px 20px;
	border: 1px solid #cf0100;
	border-radius: 5px;
	font-size: 14px;
}

/* Radio group (お問い合わせ内容) */
.p-cfp-radio-group .wpcf7-form-control.wpcf7-radio {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.p-cfp-radio-group .wpcf7-list-item {
	margin: 0;
}

.p-cfp-radio-group .wpcf7-list-item label {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 160px;
	height: 60px;
	background: #f9f9f9;
	border: 1px solid #b5b5b5;
	border-radius: 5px;
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 0.1em;
	color: var(--color-text);
	cursor: pointer;
	transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}

.p-cfp-radio-group .wpcf7-list-item label:has(input:checked) {
	background: rgba(0, 142, 102, 0.08);
	border-color: var(--color-green);
	color: var(--color-green);
}

.p-cfp-radio-group .wpcf7-list-item label::before {
	content: '';
	display: block;
	width: 21px;
	height: 21px;
	flex-shrink: 0;
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
	background-image: url('../images/contact/icon-radio-doc.svg');
}

.p-cfp-radio-group .wpcf7-list-item label:has(input:checked)::before {
	background-image: url('../images/contact/icon-radio-consult.svg');
}

.p-cfp-radio-group input[type="radio"] {
	position: absolute;
	inset: 0;
	margin: 0;
	opacity: 0;
	width: 100%;
	height: 100%;
	cursor: pointer;
}

/* Address group */
.p-cfp-address {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.p-cfp-address__row--zip .wpcf7-form-control-wrap {
	max-width: 240px;
}

/* Textarea placeholder note wraps naturally */
.p-cfp-form textarea.wpcf7-form-control {
	white-space: normal;
}

/* Privacy box + acceptance */
.p-cfp-bottom {
	margin-top: 40px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 40px;
}

.p-cfp-privacy {
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
}

.p-cfp-privacy__box {
	width: 100%;
	height: 148px;
	overflow-y: auto;
	padding: 12px 18px;
	background: var(--color-white);
	border: 1px solid #b5b5b5;
	border-radius: 5px;
	font-size: 12px;
	line-height: 1.4;
	letter-spacing: 0.1em;
	color: #707070;
}

.p-cfp-privacy__box p {
	margin-bottom: 4px;
}

.p-cfp-privacy__agree-wrap {
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
}

/*
 * CF7 renders: <span class="p-cfp-badge">必須</span> then a deeply nested
 * wrap > acceptance > list-item > label > [checkbox, text]. `display:
 * contents` flattens every wrapper so checkbox/text/badge all become
 * direct flex items here, which lets SP force the checkbox onto its own
 * line (flex-basis:100%) while PC keeps everything on one row - matching
 * the Figma structure without needing any change in the CF7 admin form.
 */
.p-cfp-privacy__agree {
	width: 100%;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	row-gap: 10px;
	column-gap: 14px;
	font-size: 14px;
	letter-spacing: 0.1em;
	justify-content: center;
}

.p-cfp-privacy__agree .wpcf7-form-control-wrap,
.p-cfp-privacy__agree .wpcf7-form-control.wpcf7-acceptance,
.p-cfp-privacy__agree .wpcf7-list-item,
.p-cfp-privacy__agree .wpcf7-list-item label {
	display: contents;
}

/* Invisible line-breaker: forces a wrap onto a new line at SP without
   resizing the checkbox itself (unlike putting flex-basis:100% on it). */
.p-cfp-privacy__agree::after {
	content: '';
	order: -2;
	flex-basis: 100%;
	width: 0;
}

.p-cfp-privacy__agree .wpcf7-list-item-label {
	order: -1;
	font-weight: 500;
}

/* The error tip lands as a flex item too (its wrap is display:contents),
   so give it its own line rather than letting it sit beside the badge. */
.p-cfp-privacy__agree .wpcf7-not-valid-tip {
	order: 1;
	flex-basis: 100%;
	margin-top: 0;
	text-align: center;
}

.p-cfp-privacy__agree .p-cfp-badge {
	order: 0;
}

.p-cfp-privacy__agree input[type="checkbox"] {
	order: -3;
	flex: 0 0 24px;
	appearance: none;
	width: 24px;
	height: 24px;
	border: 1px solid #b5b5b5;
	border-radius: 2px;
	background: var(--color-white);
	position: relative;
	cursor: pointer;
}

.p-cfp-privacy__agree input[type="checkbox"]:checked::before {
	content: '';
	position: absolute;
	top: 6px;
	left: 6px;
	width: 12px;
	height: 12px;
	border-radius: 1px;
	background: var(--color-green);
}

.p-cfp-privacy__note {
	font-size: 14px;
	letter-spacing: 0.1em;
	text-align: center;
}

/* Step actions */
.p-cfp-actions {
	display: flex;
	justify-content: center;
}

.p-cfp-actions--confirm {
	flex-direction: column;
	align-items: center;
}

.p-cfp-form .wpcf7-submit {
	appearance: none;
	-webkit-appearance: none;
	display: inline-block;
	width: 230px;
	height: 60px;
	padding: 10px 60px 10px 60px;
	background: var(--color-green);
	color: var(--color-white);
	font-size: 15px;
	font-family: var(--font-jp);
	letter-spacing: 0.1em;
	text-align: left;
	line-height: 38px;
	border: 1px solid var(--color-green);
	border-radius: 0;
	cursor: pointer;
	transition: background-color .3s var(--ease), color .3s var(--ease);
	background-image: url('../images/top/icon-btn-arrow.svg');
	background-repeat: no-repeat;
	background-position: right 20px center;
	background-size: 30px 30px;
}

.p-cfp-form .wpcf7-submit:hover:not(:disabled) {
	background-color: var(--color-white);
	color: var(--color-green);
}

.p-cfp-form .wpcf7-submit:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.p-cfp-form .wpcf7-spinner {
	margin-left: 12px;
}

.p-cfp-back {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--color-green);
	font-size: 14px;
	letter-spacing: 0.1em;
	transition: opacity .3s var(--ease);
}

.p-cfp-back:hover {
	opacity: 0.4;
}

.p-cfp-back__icon {
	width: 22px;
	height: 22px;
	transform: rotate(90deg);
}

/* Confirm step */
.p-cfp-step--confirm {
	max-width: 840px;
	margin: 0 auto;
}

.p-cfp-step__heading {
	padding-bottom: 20px;
	margin-bottom: 12px;
	border-bottom: 1px solid #ccc;
	font-size: 20px;
	font-weight: 400;
	letter-spacing: 0.1em;
	color: #161b1f;
}

.p-cfp-confirm {
	display: flex;
	flex-direction: column;
	margin-bottom: 40px;
}

.p-cfp-confirm-row {
	display: flex;
	gap: 20px;
	padding: 24px 0;
	border-bottom: 1px solid #eee;
	font-size: 14px;
	letter-spacing: 0.1em;
}

.p-cfp-confirm-label {
	color: #707070;
}

.p-cfp-confirm-value {
	color: var(--color-text);
	line-height: 1.6;
	white-space: pre-line;
}

/* ==========================================================================
   Thanks page (page-thanks.php)
   ========================================================================== */
.p-thanks {
	background: var(--color-white);
	padding: 60px 20px 80px;
}

.p-thanks__inner {
	max-width: 840px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	gap: 32px;
}

.p-thanks__heading {
	padding-bottom: 20px;
	border-bottom: 1px solid #ccc;
	font-size: 20px;
	font-weight: 400;
	letter-spacing: 0.1em;
	color: #161b1f;
}

.p-thanks__body {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 32px;
}

.p-thanks__text {
	font-size: 14px;
	letter-spacing: 0.1em;
	line-height: 1.8;
}

.p-thanks__note {
	width: 100%;
	background: var(--color-bg, #fffff5);
	padding: 30px 24px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.p-thanks__note-heading {
	font-size: 16px;
	font-weight: 500;
	letter-spacing: 0.1em;
	color: var(--color-green);
}

.p-thanks__note-list {
	font-size: 14px;
	letter-spacing: 0.1em;
	line-height: 2;
}

.p-thanks__note-list a {
	color: var(--color-green);
	text-decoration: underline;
}

/* ==========================================================================
   PC layout
   ========================================================================== */
@media (min-width: 768px) {
	.p-cfp-form-wrap {
		padding: 80px 20px 120px;
		max-width: 700px;
		margin: 0 auto;
	}

	.p-cfp-fields {
		max-width: 700px;
		margin: 0 auto;
	}

	.p-cfp-bottom {
		max-width: 550px;
		margin: 40px auto 0;
	}

	.p-cfp-field__label {
		font-size: 16px;
	}

	/* PC: checkbox, text and badge all in one row */
	.p-cfp-privacy__agree::after {
		display: none;
	}

	.p-cfp-step__heading {
		font-size: 24px;
	}

	.p-cfp-confirm-row {
		flex-direction: row;
		align-items: center;
		gap: 50px;
	}

	.p-cfp-confirm-label {
		width: 190px;
		flex-shrink: 0;
		font-size: 16px;
	}

	.p-cfp-confirm-value {
		font-size: 16px;
	}

	.p-thanks {
		padding: 80px 20px 120px;
	}

	.p-thanks__heading {
		font-size: 24px;
	}

	.p-thanks__text {
		font-size: 16px;
	}

	.p-thanks__note {
		padding: 40px 50px;
	}

	.p-thanks__note-heading {
		font-size: 20px;
	}

	.p-thanks__note-list {
		font-size: 16px;
	}
}