/**
 * Cửa sổ đăng ký tư vấn.
 *
 * Bám brand guideline "Navy nền tảng — Vàng đồng điểm nhấn — Cam hành động":
 * đầu cửa sổ nền navy với nhãn vàng đồng, thân nền kem để chữ nhập vào đọc
 * bằng mực navy, và đúng một nút cam — nút gửi. Cửa sổ che gần hết màn hình
 * nên nút cam của trang bên dưới không tính vào "một nút cam mỗi màn hình".
 *
 * Không bo góc, không đổ bóng đậm, không gradient — theo mục "Không nên".
 *
 * @package flatsome-child
 */

.ttd-modal {
	--ttd-navy: #0F1E33;
	--ttd-navy-900: #0A1626;
	--ttd-navy-700: #16283F;
	--ttd-ink: #1C2B3F;
	--ttd-cream: #F7F5F0;
	/* Hai nấc cam nhấn: sáng cho nền navy (đầu cửa sổ), nung cho nền kem
	   (thân form). `--ttd-gold` là nấc đang hiệu lực, đổi theo nền bên dưới. */
	--ttd-gold-lit: #F0A45E;
	--ttd-gold-dark: #A85B0E;
	--ttd-gold: var(--ttd-gold-lit);
	--ttd-orange: #F98E30;
	--ttd-orange-dark: #D9720F;
	--ttd-mist: #D7DEE8;
	--ttd-line: #E4DFD4;
	--ttd-muted: #6B7686;

	/* Đỏ báo lỗi là màu chức năng, không nằm trong bảng màu thương hiệu —
	   chỉ dùng cho dòng nhắc dưới ô nhập sai. */
	--ttd-error: #B3382C;

	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.ttd-modal[hidden] {
	display: none;
}

/* -------------------------------------------------------------------------
 * Nền mờ
 * ---------------------------------------------------------------------- */

.ttd-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(10, 22, 38, 0.78);
	animation: ttd-fade 0.2s ease-out;
}

/* -------------------------------------------------------------------------
 * Khung cửa sổ
 * ---------------------------------------------------------------------- */

.ttd-modal__dialog {
	/* Thân cửa sổ nền kem: cam sáng chỉ 1.9:1 nên hạ xuống cam nung 4.6:1. */
	--ttd-gold: var(--ttd-gold-dark);
	position: relative;
	width: 100%;
	max-width: 620px;
	max-height: calc(100vh - 48px);
	display: flex;
	flex-direction: column;
	background: var(--ttd-cream);
	border-top: 3px solid var(--ttd-gold-lit);
	animation: ttd-rise 0.24s ease-out;
}

.ttd-modal .ttd-modal__close {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--ttd-mist);
	cursor: pointer;
	transition: color 0.16s ease;
}

.ttd-modal .ttd-modal__close:hover,
.ttd-modal .ttd-modal__close:focus-visible {
	color: var(--ttd-gold);
}

/* -------------------------------------------------------------------------
 * Đầu cửa sổ
 * ---------------------------------------------------------------------- */

.ttd-modal__head {
	--ttd-gold: var(--ttd-gold-lit);
	flex: none;
	padding: 26px 56px 24px 32px;
	background: var(--ttd-navy);
}

.ttd-eyebrow {
	margin: 0 0 8px;
	color: var(--ttd-gold);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 2.5px;
	text-transform: uppercase;
}

.ttd-modal__title {
	margin: 0;
	color: #FFFFFF;
	font-size: 25px;
	font-weight: 600;
	line-height: 1.28;
}

.ttd-modal__desc {
	margin: 10px 0 0;
	color: var(--ttd-mist);
	font-size: 14px;
	font-weight: 300;
	line-height: 1.6;
}

/* -------------------------------------------------------------------------
 * Thân — form
 * ---------------------------------------------------------------------- */

.ttd-modal__body {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 26px 32px 30px;
	-webkit-overflow-scrolling: touch;
}

/* Flatsome đặt `form { margin-bottom: 1.3em }` và `button { margin: 0 13px 13px 0 }`
   ở cấp thẻ — trong modal thì đó chỉ là khoảng trống thừa, dọn sạch. */
.ttd-modal .ttd-form {
	margin: 0;
}

.ttd-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
}

.ttd-field {
	flex: 1 1 100%;
	min-width: 0;
}

.ttd-field--half {
	flex: 1 1 calc(50% - 8px);
	min-width: 190px;
}

.ttd-modal .ttd-label {
	display: block;
	margin-bottom: 6px;
	color: var(--ttd-ink);
	font-size: 13px;
	font-weight: 500;
}

.ttd-req {
	color: var(--ttd-gold-dark);
}

.ttd-modal .ttd-input {
	display: block;
	width: 100%;
	box-sizing: border-box;
	height: auto;
	margin: 0;
	padding: 11px 14px;
	border: 1px solid var(--ttd-line);
	border-radius: 0;
	background: #FFFFFF;
	box-shadow: none;
	color: var(--ttd-ink);
	font-family: inherit;
	font-size: 15px;
	font-weight: 400;
	line-height: 1.45;
	transition: border-color 0.16s ease;
}

.ttd-modal .ttd-input::placeholder {
	color: #9AA3B0;
}

.ttd-modal .ttd-input:focus {
	outline: none;
	border-color: var(--ttd-gold);
	box-shadow: none;
}

.ttd-modal .ttd-textarea {
	resize: vertical;
	min-height: 84px;
}

/* Mũi tên của ô chọn — vẽ bằng nền để không lệ thuộc giao diện hệ điều hành. */
.ttd-modal .ttd-select {
	appearance: none;
	-webkit-appearance: none;
	padding-right: 38px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%231C2B3F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 9 7 7 7-7'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
}

/* Ô nhập sai */
.ttd-modal .ttd-field.is-invalid .ttd-input {
	border-color: var(--ttd-error);
}

.ttd-error {
	margin: 6px 0 0;
	color: var(--ttd-error);
	font-size: 12.5px;
	line-height: 1.4;
}

.ttd-error[hidden] {
	display: none;
}

/* Lỗi chung của cả form */
.ttd-alert {
	margin: 0 0 18px;
	padding: 12px 16px;
	border-left: 3px solid var(--ttd-error);
	background: #FBEEEC;
	color: var(--ttd-error);
	font-size: 13.5px;
	line-height: 1.5;
}

.ttd-alert[hidden] {
	display: none;
}

/* Ô bẫy bot — giấu khỏi mắt người nhưng không dùng `display:none` để bot
   không lọc ra được bằng cách đọc style. */
.ttd-trap {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* -------------------------------------------------------------------------
 * Nút gửi
 * ---------------------------------------------------------------------- */

.ttd-form__foot {
	margin-top: 22px;
}

.ttd-modal .ttd-submit {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 13px 26px;
	border: 0;
	border-radius: 0;
	background: var(--ttd-orange);
	color: #FFFFFF;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 1px;
	line-height: 1;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color 0.16s ease;
}

.ttd-modal .ttd-submit:hover,
.ttd-modal .ttd-submit:focus-visible {
	background: var(--ttd-orange-dark);
	color: #FFFFFF;
}

.ttd-modal .ttd-submit[disabled] {
	cursor: default;
	opacity: 0.72;
}

.ttd-modal .ttd-submit__spinner {
	display: none;
	width: 15px;
	height: 15px;
	border: 2px solid rgba(255, 255, 255, 0.45);
	border-top-color: #FFFFFF;
	border-radius: 50%;
	animation: ttd-spin 0.7s linear infinite;
}

.ttd-modal .ttd-form.is-sending .ttd-submit__spinner {
	display: block;
}

.ttd-note {
	margin: 14px 0 0;
	color: var(--ttd-muted);
	font-size: 12.5px;
	font-weight: 300;
	line-height: 1.55;
}

/* -------------------------------------------------------------------------
 * Màn hình sau khi gửi xong
 * ---------------------------------------------------------------------- */

.ttd-done {
	padding: 14px 0 8px;
	text-align: center;
}

.ttd-done[hidden] {
	display: none;
}

.ttd-done__mark {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 62px;
	height: 62px;
	margin-bottom: 18px;
	border: 1px solid var(--ttd-gold);
	border-radius: 50%;
	color: var(--ttd-gold-dark);
}

.ttd-done__title {
	margin: 0 0 10px;
	color: var(--ttd-ink);
	font-size: 22px;
	font-weight: 600;
	line-height: 1.3;
}

.ttd-done__desc {
	margin: 0 auto;
	max-width: 400px;
	color: var(--ttd-muted);
	font-size: 14.5px;
	font-weight: 300;
	line-height: 1.65;
}

.ttd-modal .ttd-done__close {
	margin: 24px 0 0;
	padding: 12px 26px;
	border: 1px solid var(--ttd-gold);
	border-radius: 0;
	background: transparent;
	color: var(--ttd-gold-dark);
	font-family: inherit;
	font-size: 12.5px;
	font-weight: 600;
	letter-spacing: 1px;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color 0.16s ease, color 0.16s ease;
}

.ttd-modal .ttd-done__close:hover,
.ttd-modal .ttd-done__close:focus-visible {
	background: var(--ttd-gold);
	color: #fff;
}

/* -------------------------------------------------------------------------
 * Khoá cuộn trang nền khi cửa sổ mở
 * ---------------------------------------------------------------------- */

html.ttd-locked,
html.ttd-locked body {
	overflow: hidden;
}

/* -------------------------------------------------------------------------
 * Màn hẹp — cửa sổ trượt lên từ đáy, chiếm gần hết chiều cao
 * ---------------------------------------------------------------------- */

@media (max-width: 600px) {
	.ttd-modal {
		padding: 0;
		align-items: flex-end;
	}

	.ttd-modal__dialog {
		max-width: none;
		max-height: 94vh;
		animation-name: ttd-slide;
	}

	.ttd-modal__head {
		padding: 22px 52px 20px 22px;
	}

	.ttd-modal__title {
		font-size: 21px;
	}

	.ttd-modal__body {
		padding: 22px 22px 26px;
	}

	.ttd-field--half {
		flex: 1 1 100%;
	}

	/* iOS phóng to trang khi ô nhập nhỏ hơn 16px. */
	.ttd-modal .ttd-input {
		font-size: 16px;
	}

	.ttd-modal .ttd-submit {
		width: 100%;
		justify-content: center;
	}
}

/* -------------------------------------------------------------------------
 * Chuyển động
 * ---------------------------------------------------------------------- */

@keyframes ttd-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes ttd-rise {
	from { opacity: 0; transform: translateY(14px); }
	to   { opacity: 1; transform: none; }
}

@keyframes ttd-slide {
	from { transform: translateY(100%); }
	to   { transform: none; }
}

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

@media (prefers-reduced-motion: reduce) {
	.ttd-modal__backdrop,
	.ttd-modal__dialog {
		animation: none;
	}

	.ttd-modal .ttd-submit__spinner {
		animation-duration: 2s;
	}
}

/* -------------------------------------------------------------------------
 * Nút nổi góc màn hình
 *
 * Xếp ngay trên nút liên hệ (nút đó: bottom 18px, cao 56px) nên đáy nút này
 * là 18 + 56 + 12 = 86px. Không có nút liên hệ thì nó về đúng chỗ nút kia hay
 * đứng.
 *
 * Vàng đồng chứ không cam: guideline cho đúng một nút cam mỗi màn hình, và
 * suất đó là của nút liên hệ.
 * ---------------------------------------------------------------------- */

.ttd-float {
	--ttd-f-bg: #F0A45E;
	--ttd-f-bg-hover: #A85B0E;
	--ttd-f-icon: #0F1E33;

	position: fixed;
	bottom: 18px;
	z-index: 9998;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background-color: var(--ttd-f-bg);
	color: var(--ttd-f-icon);
	box-shadow: 0 2px 10px rgba(15, 30, 51, 0.25);
	text-decoration: none;
	transition: transform 0.18s ease, background-color 0.18s ease;
}

.ttd-float.is-right {
	right: 20px;
}

.ttd-float.is-left {
	left: 20px;
}

/* Có nút liên hệ bên dưới thì nhích lên một tầng. */
.ttd-float.is-stacked {
	bottom: 86px;
}

.ttd-float:hover,
.ttd-float:focus {
	background-color: var(--ttd-f-bg-hover);
	color: var(--ttd-f-icon);
	transform: scale(1.06);
}

.ttd-float:focus-visible {
	outline: 2px solid #FFFFFF;
	outline-offset: 3px;
}

.ttd-float .ttd-icon {
	display: block;
	width: 26px;
	height: 26px;
}

/* Nhãn chỉ hiện khi rê chuột hoặc focus — hai nhãn thường trực chồng nhau ở
   góc màn hình là quá nhiều chữ cho một thứ chỉ cần nhận ra bằng icon.
   Người dùng trình đọc màn hình vẫn nghe được qua aria-label của thẻ. */
.ttd-float__label {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	padding: 8px 12px;
	border-radius: 2px;
	background-color: #0F1E33;
	color: #D7DEE8;
	font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	font-size: 13px;
	font-weight: 400;
	line-height: 1;
	white-space: nowrap;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.16s ease;
}

.ttd-float.is-right > .ttd-float__label {
	right: calc(100% + 10px);
}

.ttd-float.is-left > .ttd-float__label {
	left: calc(100% + 10px);
}

.ttd-float:hover > .ttd-float__label,
.ttd-float:focus-visible > .ttd-float__label {
	opacity: 1;
	visibility: visible;
}

/* Nút liên hệ đặt "chỉ điện thoại/tablet": từ 850px nó biến mất (breakpoint
   của Flatsome) nên nút này tụt xuống đáy thay chỗ. */
@media (min-width: 850px) {
	.ttd-float.is-stacked-mobile {
		bottom: 18px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ttd-float {
		transition: none;
	}
}

@media print {
	.ttd-float {
		display: none;
	}
}
