/* Hybe Contact Form — ทุกสีมาจาก CSS variables ที่ส่งมาจาก shortcode/settings */

.hcf-wrap,
.hcf-modal {
	--hcf-bg: #553a2e;
	--hcf-form-bg: #f8f5f3;
	--hcf-text: #1c1917;
	--hcf-border: #ddd6d1;
	--hcf-input-bg: #ffffff;
	--hcf-input-text: #1c1917;
	--hcf-button-bg: #0a0a0a;
	--hcf-button-text: #ffffff;
	--hcf-link: #1c1917;
	--hcf-line: #4cc764;
	--hcf-error: #e5484d;
	--hcf-success: #30a46c;
	--hcf-radius: 28px;
	--hcf-max-width: 640px;
}

.hcf-wrap *,
.hcf-wrap *::before,
.hcf-wrap *::after,
.hcf-modal *,
.hcf-modal *::before,
.hcf-modal *::after {
	box-sizing: border-box;
}

.hcf-wrap {
	background: var(--hcf-bg);
	border-radius: calc(var(--hcf-radius) + 8px);
}

.hcf-wrap.hcf-no-bg {
	background: transparent;
	padding: 0;
}

.hcf-wrap .hcf-form {
	max-width: var(--hcf-max-width);
	margin: 0 auto;
	padding: clamp(24px, 5vw, 32px);
	background: var(--hcf-form-bg);
	color: var(--hcf-text);
	border: 1px solid var(--hcf-border);
	border-radius: var(--hcf-radius);
	font-family: inherit;
	line-height: 1.5;
	text-align: left;
}

.hcf-wrap .hcf-title {
	margin: 0 0 24px;
	padding: 0;
	font-size: clamp(22px, 4vw, 28px);
	font-weight: 700;
	line-height: 1.3;
	color: var(--hcf-text);
}

/* ---------- fields ---------- */
.hcf-wrap .hcf-field {
	margin: 0 0 20px;
}

.hcf-wrap .hcf-label {
	display: block;
	margin: 0 0 10px;
	font-size: 16px;
	font-weight: 600;
	color: var(--hcf-text);
}

.hcf-wrap .hcf-optional {
	font-weight: 400;
	opacity: .6;
	font-size: 14px;
}

.hcf-wrap .hcf-input,
.hcf-wrap .hcf-select {
	display: block;
	width: 100%;
	height: 60px;
	margin: 0;
	padding: 0 20px;
	font: inherit;
	font-size: 18px;
	color: var(--hcf-input-text);
	background: var(--hcf-input-bg);
	border: 1px solid var(--hcf-border);
	border-radius: 16px;
	box-shadow: none;
	outline: none;
	-webkit-appearance: none;
	appearance: none;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.hcf-wrap .hcf-input::placeholder {
	color: var(--hcf-input-text);
	opacity: .45;
}

.hcf-wrap .hcf-input:focus,
.hcf-wrap .hcf-select:focus {
	border-color: var(--hcf-button-bg);
	box-shadow: 0 0 0 3px rgba(127, 127, 127, .25);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--hcf-button-bg) 30%, transparent);
}

.hcf-wrap .hcf-select-wrap {
	position: relative;
}

.hcf-wrap .hcf-select {
	padding-right: 52px;
	cursor: pointer;
}

.hcf-wrap .hcf-select.is-empty {
	color: color-mix(in srgb, var(--hcf-input-text) 50%, transparent);
}

.hcf-wrap .hcf-select option {
	color: #1c1917;
	background: #fff;
}

.hcf-wrap .hcf-select-wrap::after {
	content: "";
	position: absolute;
	top: 50%;
	right: 24px;
	width: 10px;
	height: 10px;
	border-right: 2px solid var(--hcf-input-text);
	border-bottom: 2px solid var(--hcf-input-text);
	transform: translateY(-70%) rotate(45deg);
	pointer-events: none;
}

.hcf-wrap .hcf-req {
	color: inherit;
}

.hcf-wrap .hcf-error {
	margin: 6px 4px 0;
	font-size: 14px;
	color: var(--hcf-error);
	line-height: 1.4;
}

.hcf-wrap .hcf-error:empty {
	display: none;
}

.hcf-wrap .hcf-field.is-invalid .hcf-input,
.hcf-wrap .hcf-field.is-invalid .hcf-select {
	border-color: var(--hcf-error);
}

/* ---------- consent ---------- */
.hcf-wrap .hcf-consent {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	margin: 8px 0 0;
	padding: 0 4px;
	font-size: 15px;
	font-weight: 400;
	color: var(--hcf-text);
	cursor: pointer;
}

.hcf-wrap .hcf-consent input[type="checkbox"] {
	flex: 0 0 26px;
	width: 26px;
	height: 26px;
	margin: 0;
	background: var(--hcf-input-bg);
	border: 1.5px solid color-mix(in srgb, var(--hcf-text) 55%, transparent);
	border-radius: 5px;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
	display: grid;
	place-content: center;
}

.hcf-wrap .hcf-consent input[type="checkbox"]::before {
	content: "";
	width: 12px;
	height: 7px;
	margin-top: -3px;
	border-left: 2.5px solid var(--hcf-button-text);
	border-bottom: 2.5px solid var(--hcf-button-text);
	transform: rotate(-45deg) scale(0);
	transition: transform .12s ease;
}

.hcf-wrap .hcf-consent input[type="checkbox"]:checked {
	background: var(--hcf-button-bg);
	border-color: var(--hcf-button-bg);
}

.hcf-wrap .hcf-consent input[type="checkbox"]:checked::before {
	transform: rotate(-45deg) scale(1);
}

.hcf-wrap .hcf-consent input[type="checkbox"]:focus-visible {
	outline: 2px solid var(--hcf-button-bg);
	outline-offset: 2px;
}

.hcf-wrap .hcf-field.is-invalid .hcf-consent input[type="checkbox"] {
	border-color: var(--hcf-error);
}

.hcf-wrap .hcf-consent__text {
	opacity: .85;
	padding-top: 1px;
}

.hcf-wrap .hcf-consent a {
	color: var(--hcf-link);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* ---------- submit ---------- */
.hcf-wrap .hcf-submit {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 64px;
	margin: 24px 0 0;
	padding: 12px 24px;
	font: inherit;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--hcf-button-text);
	background: var(--hcf-button-bg);
	border: 0;
	border-radius: 999px;
	cursor: pointer;
	box-shadow: 0 10px 24px -12px var(--hcf-button-bg);
	transition: filter .15s ease, transform .1s ease;
	text-transform: none;
	letter-spacing: normal;
}

.hcf-wrap .hcf-submit:hover {
	filter: brightness(.94);
}

.hcf-wrap .hcf-submit:active {
	transform: translateY(1px);
}

.hcf-wrap .hcf-submit:focus-visible {
	outline: 3px solid var(--hcf-text);
	outline-offset: 3px;
}

.hcf-wrap .hcf-submit[disabled] {
	cursor: progress;
	opacity: .75;
}

.hcf-wrap .hcf-spinner {
	display: none;
	width: 20px;
	height: 20px;
	border: 2.5px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: hcf-spin .7s linear infinite;
}

.hcf-wrap .hcf-submit.is-loading .hcf-spinner {
	display: inline-block;
}

@keyframes hcf-spin {
	to { transform: rotate(360deg); }
}

/* ---------- note / divider / LINE ---------- */
.hcf-wrap .hcf-note {
	margin: 18px 0 0;
	font-size: 15px;
	text-align: center;
	color: var(--hcf-text);
	opacity: .7;
}

.hcf-wrap .hcf-divider {
	display: flex;
	align-items: center;
	gap: 20px;
	margin: 24px 0 0;
	font-size: 14px;
	color: var(--hcf-text);
}

.hcf-wrap .hcf-divider::before,
.hcf-wrap .hcf-divider::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--hcf-border);
}

.hcf-wrap .hcf-divider span {
	opacity: .6;
}

.hcf-wrap .hcf-line {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 64px;
	margin: 20px 0 0;
	padding: 12px 24px;
	font-size: 19px;
	font-weight: 700;
	color: var(--hcf-line);
	text-decoration: none;
	border: 1.5px solid var(--hcf-line);
	border-radius: 999px;
	transition: background-color .15s ease;
}

.hcf-wrap .hcf-line:hover,
.hcf-wrap .hcf-line:focus-visible {
	color: var(--hcf-line);
	background: color-mix(in srgb, var(--hcf-line) 10%, transparent);
}

.hcf-wrap .hcf-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

@media (max-width: 480px) {
	.hcf-wrap .hcf-input,
	.hcf-wrap .hcf-select {
		height: 54px;
		font-size: 16px;
		padding-left: 16px;
	}
	.hcf-wrap .hcf-submit {
		min-height: 56px;
		font-size: 18px;
	}
	.hcf-wrap .hcf-line {
		min-height: 50px;
		font-size: 17px;
	}
}

/* ---------- modal (ถูกย้ายไปไว้ใต้ <body> ด้วย JS) ---------- */
.hcf-modal[hidden] {
	display: none !important;
}

.hcf-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	font-family: inherit;
}

.hcf-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(10, 10, 12, .55);
	animation: hcf-fade .2s ease;
}

.hcf-modal__box {
	position: relative;
	width: 100%;
	max-width: 420px;
	padding: 36px 28px 28px;
	text-align: center;
	color: var(--hcf-text);
	background: var(--hcf-form-bg);
	border: 1px solid var(--hcf-border);
	border-radius: var(--hcf-radius);
	box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .45);
	animation: hcf-pop .22s cubic-bezier(.2, .9, .3, 1.2);
	outline: none;
}

.hcf-modal__icon {
	display: none;
	width: 64px;
	height: 64px;
	margin: 0 auto 16px;
	border-radius: 50%;
	align-items: center;
	justify-content: center;
}

.hcf-modal.is-success .hcf-modal__icon--success {
	display: flex;
	color: var(--hcf-success);
	background: color-mix(in srgb, var(--hcf-success) 15%, transparent);
}

.hcf-modal.is-error .hcf-modal__icon--error {
	display: flex;
	color: var(--hcf-error);
	background: color-mix(in srgb, var(--hcf-error) 15%, transparent);
}

.hcf-modal__title {
	margin: 0 0 8px;
	font-size: 22px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--hcf-text);
}

.hcf-modal__body {
	margin: 0 0 24px;
	font-size: 16px;
	line-height: 1.6;
	opacity: .85;
}

.hcf-modal__body p {
	margin: 0;
}

.hcf-modal__body ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.hcf-modal__body li + li {
	margin-top: 6px;
}

.hcf-modal__btn {
	width: 100%;
	min-height: 56px;
	padding: 10px 20px;
	font: inherit;
	font-size: 18px;
	font-weight: 700;
	color: var(--hcf-button-text);
	background: var(--hcf-button-bg);
	border: 0;
	border-radius: 999px;
	cursor: pointer;
}

.hcf-modal__btn:focus-visible {
	outline: 3px solid var(--hcf-text);
	outline-offset: 3px;
}

html.hcf-modal-open {
	overflow: hidden;
}

@keyframes hcf-fade {
	from { opacity: 0; }
}

@keyframes hcf-pop {
	from { opacity: 0; transform: translateY(12px) scale(.96); }
}

@media (prefers-reduced-motion: reduce) {
	.hcf-modal__backdrop,
	.hcf-modal__box,
	.hcf-wrap .hcf-spinner {
		animation: none;
	}
}
