/* ================================================================
   Contact Form 7 — single source of truth for the Gaikokujinzai form
   All rules previously scattered across base.css / media.css for
   Snow Monkey Forms (.smf-*) have been consolidated here with the
   .cf7-* namespace. The form template (current-form-cf7.html) uses
   .cf7-* wrappers and passes class:cf7-text-control__control etc.
   to the CF7 shortcodes so this stylesheet matches by both wrapper
   class and input class.
   ================================================================ */


/* ---------- 1. Row layout (label + control columns) ------------- */

.cf7-form--simple-table .cf7-item {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: stretch;
	padding: 1rem 0;
	border-bottom: 1px solid #646464;
}

.cf7-form--simple-table .cf7-item__col {
	flex: 1 1 auto;
}

.cf7-form--simple-table .cf7-item__col--label {
	flex: 0 0 14em;
	max-width: 14em;
	position: relative;
	z-index: 0;
	display: flex;
	justify-content: flex-start;
	align-items: center;
	padding: 0 90px 0 0;
	font-size: 1.25em;
	font-weight: 700;
}

.cf7-form--simple-table .cf7-item__col--controls {
	flex: 1 1 calc(100% - 24em) !important;
	max-width: calc(100% - 24em) !important;
}

.cf7-form--simple-table .cf7-item__col--controls p {
	font-size: 1.15em;
	font-weight: 500;
	margin: 0;
}

.cf7-form--simple-table .cf7-item__col--controls .wp-block-columns + p {
	margin: 1em 0 0;
}


/* ---------- 2. Required / optional badge ------------------------ */

.cf7-form--simple-table .cf7-item .cf7-item__col--label::after {
	position: absolute;
	display: block;
	content: "必須";
	width: 80px;
	height: 24px;
	line-height: 24px;
	text-align: center;
	color: #FFFFFF;
	font-size: 0.85em;
	font-weight: 500;
	background: #C80000;
	margin: auto;
	inset: 0 0 0 auto;
}

.cf7-form--simple-table .cf7-item.no_must .cf7-item__col--label::after {
	content: "任意";
	background: #646464;
}

.cf7-form--simple-table .cf7-item.row_privacy .cf7-item__col--label::after {
	display: none;
}


/* ---------- 3. Text / email / tel / date / textarea inputs ------ */

.cf7-form .cf7-text-control__control,
.cf7-form .cf7-textarea-control__control {
	width: 100%;
	background-color: #FFFFFF;
	box-shadow: none !important;
	border: 1px solid transparent !important;
	border-radius: 5px !important;
	padding: 1em !important;
	max-width: 100%;
	outline: 0;
	transition: border-color 0.2s ease;
}

.cf7-form .cf7-text-control__control:focus,
.cf7-form .cf7-textarea-control__control:focus {
	border-color: #3a87fd !important;
}

.cf7-form .cf7-text-control__control[aria-invalid="true"],
.cf7-form .cf7-textarea-control__control[aria-invalid="true"] {
	background: #FFC5BD;
}

.cf7-form .wpcf7-not-valid {
	background: #FFC5BD !important;
}


/* ---------- 4. Select ------------------------------------------- */

.cf7-form .cf7-select-control {
	display: block;
	width: 100%;
	position: relative;
}

.cf7-form .cf7-select-control__control {
	width: 100%;
	background-color: #FFFFFF;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'><path d='M1 2.5 L4 5.5 L7 2.5' stroke='%23EE7700' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
	background-repeat: no-repeat;
	background-position: right 1em center;
	background-size: 8px 8px;
	appearance: none;
	-webkit-appearance: none;
	box-shadow: none !important;
	border: 1px solid transparent !important;
	border-radius: 5px !important;
	padding: 1em 2.5em 1em 1em !important;
	cursor: pointer;
	outline: 0;
}

.cf7-form .cf7-select-control__control:focus {
	border-color: #3a87fd !important;
}

/* Toggle span no longer needed — arrow now lives on the select itself. */
.cf7-form .cf7-select-control__toggle {
	display: none;
}


/* ---------- 5. Checkboxes (and acceptance) ---------------------- */

.cf7-form .wpcf7-checkbox,
.cf7-form .wpcf7-acceptance {
	display: block;
}

.cf7-form .wpcf7-checkbox .wpcf7-list-item,
.cf7-form .wpcf7-acceptance .wpcf7-list-item {
	display: inline-block;
	font-size: 1.15em;
	font-weight: 500;
	margin: 0.25em 2em 0.25em 0;
}

.cf7-form .wpcf7-checkbox .wpcf7-list-item label,
.cf7-form .wpcf7-acceptance .wpcf7-list-item label {
	cursor: pointer;
	display: inline-flex;
	align-items: center;
}

/* Hide native checkbox — drawn via the label sibling */
.cf7-form .wpcf7-checkbox input[type="checkbox"],
.cf7-form .wpcf7-acceptance input[type="checkbox"] {
	display: none !important;
}

.cf7-form .wpcf7-checkbox .wpcf7-list-item-label,
.cf7-form .wpcf7-acceptance .wpcf7-list-item-label {
	position: relative;
	display: inline-flex;
	align-items: center;
}

.cf7-form .wpcf7-checkbox .wpcf7-list-item-label::before,
.cf7-form .wpcf7-acceptance .wpcf7-list-item-label::before {
	content: "";
	display: inline-block;
	vertical-align: middle;
	width: 1.2em;
	height: 1.2em;
	line-height: 1.2em;
	margin: 0 0.5em 0 0;
	border: 1px solid #000000;
	border-radius: 4px;
	background: #FFFFFF;
	flex: 0 0 auto;
}

.cf7-form .wpcf7-checkbox input:checked + .wpcf7-list-item-label::after,
.cf7-form .wpcf7-acceptance input:checked + .wpcf7-list-item-label::after {
	position: absolute;
	inset: 0 auto 0 -0.1em;
	margin: auto;
	width: 1em;
	height: 1em;
	line-height: 1;
	text-align: center;
	font-size: 1.4em;
	display: block;
	content: "✓";
	color: #C80000;
	font-weight: bold;
}


/* ---------- 6. 担当者名 row (姓/名 inline) ---------------------- */

.cf7-form .cf7-item.row_name .wp-block-column {
	display: flex;
	align-items: center;
	width: 100%;
}

.cf7-form .cf7-item.row_name .wp-block-column p {
	margin: 0 0.5em 0 0;
}

.cf7-form .cf7-item.row_name .wp-block-column .wpcf7-form-control-wrap,
.cf7-form .cf7-item.row_name .wp-block-column .cf7-text-control {
	flex: 1 1 auto;
	width: 100%;
}


/* ---------- 7. Privacy row -------------------------------------- */

.cf7-form .cf7-item.row_privacy {
	justify-content: center;
	border: none;
	font-size: 1.2em;
	font-weight: 700;
	text-align: center;
}

.cf7-form .cf7-item.row_privacy .cf7-item__col--label {
	display: none;
}

.cf7-form .cf7-item.row_privacy .wpcf7-list-item {
	margin: 0;
}


/* ---------- 8. bg_box notice (ご利用について) ------------------- */
/* base.css keeps .editor_contents .bg_box (white box, used elsewhere
   on the site). This block scopes the orange contact-form variant
   to .cf7-form only. */

.cf7-form .bg_box {
	padding: 3em;
	margin: 1.5em auto;
	border-radius: 20px;
	background: var(--color, #EE7700);
	color: #FFFFFF !important;
}

.cf7-form .bg_box > :nth-last-child(1) {
	margin-bottom: 0 !important;
}

.cf7-form .bg_box > :nth-child(1) {
	margin-top: 0 !important;
}

.cf7-form .bg_box p {
	font-size: 1.5em;
	font-weight: 700;
	margin: 0 0 0.5em;
}

/* List items (and any p that wpautop wraps inside them) sit at 19px */
.cf7-form .bg_box li,
.cf7-form .bg_box li p {
	font-size: 19px !important;
	font-weight: 500 !important;
	margin: 0;
}

.cf7-form .bg_box ul:not(.choices) li::before {
	background: #FFFFFF;
}

.cf7-form .bg_box a {
	color: #FFFFFF;
}

.cf7-form .bg_box + p {
	text-align: center;
}


/* ---------- 9. Submit button ------------------------------------ */

.cf7-action {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 1em;
	margin: 1.5em 0;
}

/* wpautop may wrap content in <p>. Make any <p> inside .cf7-action
   a flex container too, so the spans become flex items either way. */
.cf7-action > p {
	display: flex !important;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 1em;
	margin: 0;
	padding: 0;
	width: 100%;
	flex: 1 1 100%;
}

/* Kill any <br> wpautop sneaks in between buttons */
.cf7-action br {
	display: none;
}

/* Wrapper span — pseudo-element anchor for the arrow.
   <input type="submit"> doesn't support ::before/::after, so the
   arrow has to live on a parent element that does.
   flex-basis 200px lets two buttons reliably fit on a single row at
   typical content widths (~720px), max 400px each. */
.cf7-action .cf7-button-control {
	position: relative;
	display: block;
	flex: 1 1 200px;
	width: 100%;
	max-width: 400px;
	margin: 0;
}

.cf7-action .cf7-button-control__control {
	display: block;
	width: 100%;
	padding: 0.75em !important;
	background: #3695D9 !important;
	text-align: center;
	color: #FFFFFF !important;
	font-size: 1.2em !important;
	font-weight: 700;
	border: none !important;
	border-radius: 8px !important;
	cursor: pointer;
}

.cf7-action .cf7-button-control::after {
	position: absolute;
	z-index: 1;
	display: block;
	content: "";
	width: 0.5em;
	height: 0.5em;
	margin: auto;
	inset: 0 0.5em 0 auto;
	border-top: 2px solid #FFFFFF;
	border-right: 2px solid #FFFFFF;
	transform: rotate(45deg);
	pointer-events: none;
}

/* Back button variant — grey bg, arrow on the left pointing left. */
.cf7-action .cf7-button-control--back .cf7-button-control__control {
	background: #999999 !important;
}

.cf7-action .cf7-button-control--back::after {
	inset: 0 auto 0 0.5em;
	transform: rotate(-135deg);
}

.cf7-form .wpcf7-spinner,
.cf7-form .wpcf7-spinner::before {
	display: none !important;
}


/* ---------- 10. CF7 validation messages ------------------------- */

.cf7-form .wpcf7-not-valid-tip {
	color: #C80000;
	font-size: 0.875em;
	margin-top: 0.25em;
	display: block;
}

/* Hide CF7's generic validation banner — per-field tips do the work.
   The .wpcf7-response-output sits as a sibling of .cf7-form (both are
   direct children of <form class="wpcf7-form">), so target it via the
   general-sibling combinator. */
.cf7-form--simple-table ~ .wpcf7-response-output,
.wpcf7-form:has(.cf7-form--simple-table) .wpcf7-response-output {
	display: none !important;
}


/* ---------- 11. Confirm-page overrides -------------------------- */
/* Applied only when the form template has class .cf7-form--confirm
   (i.e. the multistep confirmation page). Hides required badges,
   drops the input-sized text down to plain 16px body text. */

.cf7-form--confirm.cf7-form--simple-table .cf7-item .cf7-item__col--label::after,
.cf7-form--confirm .cf7-item .cf7-item__col--label::after {
	display: none !important;
	content: none !important;
}

.cf7-form--confirm .cf7-item__col--controls,
.cf7-form--confirm .cf7-item__col--controls p {
	font-size: 16px;
	font-weight: normal;
}

.cf7-form--confirm .cf7-item__col--controls p + p {
	margin-top: 0.5em;
}


/* ---------- 12. Mobile (≤ 900px) -------------------------------- */

@media screen and (max-width: 900px) {
	.cf7-form--simple-table .cf7-item {
		display: block !important;
		padding: 1.6em 0;
	}

	.cf7-form--simple-table .cf7-item__col--label {
		flex: 0 0 100%;
		max-width: 100%;
		margin: 0 0 0.5em;
		padding: 0 90px 0 0;
	}

	.cf7-form--simple-table .cf7-item__col--controls {
		flex: 1 1 100% !important;
		max-width: 100% !important;
	}

	/* Action buttons stack to one column ≤900px (two columns on desktop) */
	.cf7-action .cf7-button-control {
		flex: 1 1 100%;
		max-width: 400px;
	}
}
