/**
 * M2W Leads — style form. Bám design token của theme M2W (tông cam, font Jakarta,
 * radius/shadow chung); có fallback để vẫn đẹp khi chạy độc lập không có theme.
 */
.m2w-lead-form {
	/* Map token theme -> biến nội bộ, kèm fallback */
	--lf-accent:     var(--c-accent, #F26A1F);
	--lf-accent-2:   var(--c-accent-2, #FF8A3D);
	--lf-accent-soft:var(--c-accent-soft, #FCE6D4);
	--lf-ink:        var(--c-ink, #0F1B2D);
	--lf-ink-soft:   var(--c-ink-soft, #3C4654);
	--lf-muted:      var(--c-muted, #6B7382);
	--lf-line:       var(--c-line, #E6DFD2);
	--lf-surface:    var(--c-surface, #fff);
	--lf-bg-deep:    var(--c-bg-deep, #F1EBE0);
	--lf-radius:     var(--radius, 10px);
	--lf-radius-lg:  var(--radius-lg, 16px);
	--lf-shadow:     var(--shadow, 0 10px 30px -16px rgba(15,27,45,.22), 0 2px 6px -3px rgba(15,27,45,.08));

	display: flex;
	flex-direction: column;
	gap: 18px;
	max-width: 720px;
	margin: 0;
	padding: clamp(20px, 3.2vw, 34px);
	background: var(--lf-surface);
	border: 1px solid var(--lf-line);
	border-radius: var(--lf-radius-lg);
	box-shadow: var(--lf-shadow);
	position: relative;
}

/* Vạch cam mảnh ở mép trên cho ra brand */
.m2w-lead-form::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 4px;
	border-radius: var(--lf-radius-lg) var(--lf-radius-lg) 0 0;
	background: linear-gradient(90deg, var(--lf-accent), var(--lf-accent-2));
}

.m2w-lead-form__title {
	margin: 0;
	font-size: clamp(19px, 2vw, 23px);
	font-weight:500;
	line-height: 1.2;
	letter-spacing: -0.01em;
	color: var(--lf-ink);
}

.m2w-lead-form__intro {
	margin: -6px 0 0;
	color: var(--lf-ink-soft);
	font-size: 14.5px;
	line-height: 1.6;
}

/* Honeypot — ẩn hoàn toàn */
.m2w-lead-form__hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.m2w-lead-form__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

.m2w-lead-form__field {
	display: flex;
	flex-direction: column;
	gap: 7px;
	min-width: 0;
}

.m2w-lead-form__field.is-wide {
	grid-column: 1 / -1;
}

.m2w-lead-form__field label,
.m2w-lead-form__grouplabel {
	font-size: 13px;
	font-weight:500;
	letter-spacing: 0.01em;
	color: var(--lf-ink);
}

/* ── Dropdown "chọn nhiều" ────────────────────────────────────────────────────
   <details> đóng vai ô select: nút bấm trông y hệt select bên cạnh, panel lựa chọn
   thả xuống — form giữ được nhịp lưới 2 cột thay vì phình ra vì 7 chip trải ngang. */
.m2w-lead-form__multi { position: relative; }

.m2w-lead-form__multi-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	width: 100%;
	min-height: 46px;                /* bằng chiều cao ô nhập/select cạnh nó */
	padding: 12px 14px;
	font: 400 15px/1.45 var(--font-sans, system-ui, sans-serif);
	color: var(--lf-ink);
	background: var(--lf-surface);
	border: 1px solid var(--lf-line);
	border-radius: var(--lf-radius);
	cursor: pointer;
	list-style: none;                /* bỏ tam giác mặc định của <summary> */
	transition: border-color .18s ease, box-shadow .18s ease;
}

.m2w-lead-form__multi-toggle::-webkit-details-marker { display: none; }
.m2w-lead-form__multi-toggle:hover { border-color: color-mix(in oklab, var(--lf-accent), var(--lf-line) 55%); }

.m2w-lead-form__multi-toggle:focus-visible {
	outline: none;
	border-color: var(--lf-accent);
	box-shadow: 0 0 0 3px color-mix(in oklab, var(--lf-accent), transparent 82%);
}

/* Chưa chọn gì → chữ mờ như placeholder của select. Chọn rồi (JS gắn .has-value) → mực thường. */
.m2w-lead-form__multi-text { color: var(--lf-muted); }
.m2w-lead-form__multi-text.has-value { color: var(--lf-ink); }

/* Mũi tên chevron, xoay khi mở — cùng ngôn ngữ với accordion FAQ của theme. */
.m2w-lead-form__multi-toggle::after {
	content: "";
	flex: none;
	width: 9px; height: 9px;
	border-right: 2px solid var(--lf-muted);
	border-bottom: 2px solid var(--lf-muted);
	transform: translateY(-2px) rotate(45deg);
	transition: transform .18s ease;
}
.m2w-lead-form__multi[open] .m2w-lead-form__multi-toggle::after { transform: translateY(1px) rotate(-135deg); }
.m2w-lead-form__multi[open] .m2w-lead-form__multi-toggle { border-color: var(--lf-accent); }

/* Panel: absolute để KHÔNG đẩy các ô bên dưới nhảy xuống khi mở (đúng hành vi của select). */
.m2w-lead-form__checks {
	position: absolute;
	z-index: 20;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	max-height: 260px;
	overflow-y: auto;
	padding: 12px;
	background: var(--lf-surface);
	border: 1px solid var(--lf-line);
	border-radius: var(--lf-radius);
	box-shadow: var(--lf-shadow);
}

.m2w-lead-form__check {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	/* flex:none = chip rộng theo NHÃN rồi xuống dòng, thay vì co lại bóp chữ (mặc định
	   flex-shrink:1). max-width:100% chặn nhãn dài hơn cả form tràn ra ngoài thẻ. */
	flex: none;
	max-width: 100%;
	min-height: 44px;
	padding: 8px 14px 8px 12px;
	border: 1px solid var(--lf-line);
	border-radius: 999px;
	background: var(--lf-surface);
	cursor: pointer;
	transition: border-color .16s ease, background-color .16s ease;
}

.m2w-lead-form__check span {
	font-size: 14px;
	color: var(--lf-ink-soft);
	line-height: 1.3;
}

.m2w-lead-form__check input {
	width: 16px;
	height: 16px;
	flex: none;          /* không cho ô tick co lại khi nhãn dài */
	margin: 0;
	accent-color: var(--lf-accent);
	cursor: pointer;
}

.m2w-lead-form__check:hover {
	border-color: color-mix(in oklab, var(--lf-accent), transparent 55%);
}

/* Đã chọn = nền tint + viền cam: trạng thái đọc được bằng MÀU NỀN, không chỉ dấu tick nhỏ. */
.m2w-lead-form__check:has(input:checked) {
	border-color: var(--lf-accent);
	background: color-mix(in oklab, var(--lf-accent), #fff 92%);
}

.m2w-lead-form__check:has(input:checked) span {
	color: var(--lf-ink);
}

/* Focus bàn phím hiện trên CHIP (ô tick nhỏ, ring quanh nó gần như vô hình). */
.m2w-lead-form__check:has(input:focus-visible) {
	border-color: var(--lf-accent);
	box-shadow: 0 0 0 3px color-mix(in oklab, var(--lf-accent), transparent 82%);
}

.m2w-lead-form__field .req {
	color: var(--lf-accent);
	margin-left: 2px;
}

/* :not(checkbox/radio) — kiểu Ô NHẬP (rộng 100%, padding 12/14, viền) chỉ đúng với ô gõ chữ.
   Áp cả cho checkbox thì ô tick 16px bị thổi thành khối rộng 100% + padding → chip "chọn nhiều"
   vỡ, chữ tràn ra ngoài. Loại trừ tại GỐC thay vì tăng specificity ở nơi khác, để checkbox/radio
   thêm về sau không dính lại lỗi này. */
.m2w-lead-form__field input:not([type="checkbox"]):not([type="radio"]),
.m2w-lead-form__field select,
.m2w-lead-form__field textarea {
	width: 100%;
	padding: 12px 14px;
	font: 400 15px/1.45 var(--font-sans, system-ui, sans-serif);
	color: var(--lf-ink);
	background: var(--lf-surface);
	border: 1px solid var(--lf-line);
	border-radius: var(--lf-radius);
	box-sizing: border-box;
	transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.m2w-lead-form__field input::placeholder,
.m2w-lead-form__field textarea::placeholder {
	color: var(--lf-muted);
}

/* Hover/focus của Ô NHẬP: cũng loại checkbox/radio — chip .m2w-lead-form__check tự lo 2 trạng
   thái này, để cả hai cùng vẽ thì ô tick 16px lãnh thêm một vòng ring nữa nằm trong ring chip. */
.m2w-lead-form__field input:not([type="checkbox"]):not([type="radio"]):hover,
.m2w-lead-form__field select:hover,
.m2w-lead-form__field textarea:hover {
	border-color: color-mix(in oklab, var(--lf-accent), var(--lf-line) 55%);
}

.m2w-lead-form__field input:not([type="checkbox"]):not([type="radio"]):focus,
.m2w-lead-form__field select:focus,
.m2w-lead-form__field textarea:focus {
	outline: none;
	border-color: var(--lf-accent);
	box-shadow: 0 0 0 3px color-mix(in oklab, var(--lf-accent), transparent 82%);
}

.m2w-lead-form__field textarea {
	resize: vertical;
	min-height: 120px;
}

/* Mũi tên select tự vẽ cho gọn (ẩn arrow mặc định) */
.m2w-lead-form__field select {
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236B7382' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	padding-right: 38px;
}

.m2w-lead-form__consent {
	margin: 2px 0 0;
	color: var(--lf-ink-soft);
	font-size: 12px;
	line-height: 1.5;
}

.m2w-lead-form__consent a {
	color: var(--lf-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.m2w-lead-form__actions {
	margin-top: 2px;
}

/* Nút: ưu tiên kế thừa .btn .btn-primary của theme; đây là fallback đồng tông */
.m2w-lead-form__submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 9px;
	padding: 14px 28px;
	border: 0;
	border-radius: 999px;
	background: var(--lf-accent);
	color: #fff;
	font-size: 15px;
	font-weight:500;
	letter-spacing: 0.01em;
	cursor: pointer;
	transition: transform .18s ease, box-shadow .18s ease, background .18s ease, opacity .18s ease;
}

.m2w-lead-form__submit:hover {
	transform: translateY(-1px);
	box-shadow: 0 10px 22px -10px color-mix(in oklab, var(--lf-accent), transparent 35%);
}

.m2w-lead-form__submit:disabled {
	opacity: .6;
	cursor: progress;
	transform: none;
	box-shadow: none;
}

.m2w-lead-form__submit .arr {
	display: inline-block;
	transition: transform .18s ease;
}

.m2w-lead-form__submit:hover .arr {
	transform: translateX(3px);
}

.m2w-lead-form__status {
	margin: 0;
	padding: 13px 16px;
	border-radius: var(--lf-radius);
	font-size: 14px;
	line-height: 1.5;
	display: flex;
	gap: 9px;
	align-items: flex-start;
}

.m2w-lead-form__status::before {
	font-size: 15px;
	line-height: 1.45;
	flex: 0 0 auto;
}

.m2w-lead-form__status.is-success {
	background: #E8F6EC;
	color: #15703A;
	border: 1px solid #BCE3C7;
}

.m2w-lead-form__status.is-success::before { content: "✓"; }

.m2w-lead-form__status.is-error {
	background: #FCEBEA;
	color: #B3261E;
	border: 1px solid #F2C3BF;
}

.m2w-lead-form__status.is-error::before { content: "!"; font-weight:500; }

@media (max-width: 560px) {
	.m2w-lead-form__grid {
		grid-template-columns: 1fr;
	}
	.m2w-lead-form__submit {
		width: 100%;
	}
}
