/* ===== AZ Vehicle Finder: nút header + popup + thanh menu mobile =====
   Màu lấy từ biến --xe-from / --xe-to / --xe-text (tab Giao diện của plugin). */

/* ---------- Nút mở popup (header) ---------- */
a.xe-pop-btn {
	--xe-from: #f0283c;
	--xe-to: #f46d0a;
	--xe-text: #fff;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 8px;
	box-sizing: border-box;
	min-width: 40px;
	height: 40px;
	margin: 0;
	padding: 0 !important;
	border: 0;
	border-radius: 10px;
	background: rgba(127, 127, 127, .18);
	box-shadow: none;
	line-height: 1;
	text-decoration: none;
	text-transform: none;
	letter-spacing: 0;
	vertical-align: middle;
	cursor: pointer;
	transition: background-color .15s, transform .15s, opacity .15s;
	-webkit-tap-highlight-color: transparent;
}
a.xe-pop-btn:hover { background: rgba(127, 127, 127, .3); }
a.xe-pop-btn:active { transform: scale(.96); }
a.xe-pop-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
a.xe-pop-btn .xe-ico { width: 22px; height: 22px; flex: none; }
a.xe-pop-btn.xe-pop-btn--text { padding: 0 14px !important; }
a.xe-pop-btn .xe-pop-btn__label { font-size: 14px; font-weight: 700; white-space: nowrap; }

a.xe-pop-btn.xe-pop-btn--solid {
	background: linear-gradient(135deg, var(--xe-from), var(--xe-to));
	color: var(--xe-text) !important;
}
a.xe-pop-btn.xe-pop-btn--solid:hover { background: linear-gradient(135deg, var(--xe-from), var(--xe-to)); opacity: .9; }
a.xe-pop-btn.xe-pop-btn--plain { background: transparent; }
a.xe-pop-btn.xe-pop-btn--plain:hover { background: rgba(127, 127, 127, .14); }

/* Khi nằm trong <li> của Header Builder (Flatsome) */
li.xe-header-finder { display: flex; align-items: center; }
.xe-pop-inline { display: inline-block; }

/* ---------- Popup ---------- */
html.xe-pop-lock { overflow: hidden; }

dialog.xe-pop {
	--xe-from: #f0283c;
	--xe-to: #f46d0a;
	--xe-text: #fff;
	position: fixed;
	inset: 0;
	box-sizing: border-box;
	width: 520px;
	max-width: calc(100vw - 24px);
	height: fit-content;
	max-height: none;
	margin: auto;
	padding: 0;
	border: 0;
	background: transparent;
	color: #2b2b2b;
	overflow: visible;
	font-family: inherit;
}
dialog.xe-pop:not([open]) { display: none; }
dialog.xe-pop::backdrop { background: rgba(15, 18, 24, .6); }
dialog.xe-pop.xe-pop--fb { z-index: 100000; box-shadow: 0 0 0 100vmax rgba(15, 18, 24, .6); }
dialog.xe-pop *,
dialog.xe-pop *::before,
dialog.xe-pop *::after { box-sizing: border-box; }

.xe-pop__box {
	position: relative;
	max-height: calc(100vh - 24px);
	max-height: calc(100dvh - 24px);
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 28px 30px 24px;
	border-radius: 22px;
	background: #fff;
	box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}

.xe-pop__close {
	position: absolute;
	top: 18px;
	right: 18px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: #f1f2f4;
	box-shadow: none;
	color: #2b2b2b;
	line-height: 1;
	cursor: pointer;
	transition: background-color .15s;
}
.xe-pop__close:hover { background: #e4e6ea; }
.xe-pop__close:focus-visible { outline: 2px solid var(--xe-from); outline-offset: 2px; }
.xe-pop__close .xe-ico { width: 18px; height: 18px; }

.xe-pop .xe-pop__title {
	margin: 0 44px 14px 0;
	padding: 0;
	color: #1f2227;
	font-size: 1.3em;
	font-weight: 800;
	line-height: 1.25;
	text-transform: none;
	letter-spacing: 0;
}
.xe-pop__art { margin: 0 0 14px; text-align: center; }
.xe-pop__art img,
.xe-pop__art .xe-pop__svg { display: block; width: 100%; max-width: 380px; height: auto; margin: 0 auto; border-radius: 12px; }
.xe-pop .xe-pop__desc {
	margin: 0 0 18px;
	color: #555b66;
	font-size: .93em;
	line-height: 1.55;
}
.xe-pop .xe-pop__hint {
	margin: 12px 0 0;
	color: #8a8f98;
	font-size: .82em;
	text-align: center;
}

/* Form [xe_finder layout="vertical"] bên trong popup: bỏ khung thẻ riêng, chỉ giữ nội dung */
.xe-pop .xe-finder.xe-finder--vertical {
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
}
.xe-pop .xe-finder.xe-finder--vertical { container-type: normal; width: auto; }
.xe-pop .xe-finder.xe-finder--vertical .xe-finder__title { color: #2b2b2b; }
.xe-pop .xe-finder.xe-finder--vertical .xe-finder__desc { color: #666; }
.xe-pop .xe-finder.xe-finder--vertical .xe-finder__head { margin-bottom: 12px; }
/* Máy tính: các nút loại xe luôn nằm trên một hàng (điện thoại giữ lưới 2 cột như cũ) */
@media (min-width: 550px) {
	.xe-pop .xe-finder.xe-finder--vertical .xe-finder__tabs {
		display: flex !important;
		flex-flow: row nowrap !important;
		gap: 6px;
	}
	.xe-pop .xe-finder.xe-finder--vertical .xe-finder__tabs .xe-tab {
		display: block !important;
		flex: 1 1 0 !important;
		width: auto !important;
		min-width: 0 !important;
		margin: 0 !important;
		padding: 0 !important;
	}
	.xe-pop .xe-finder.xe-finder--vertical .xe-tab span {
		padding: 0 4px;
		gap: 4px;
		font-size: 13px;
		overflow: hidden;
		text-overflow: ellipsis;
	}
}
/* Danh sách thả xuống của selectWoo nằm trong popup: luôn nằm trên nội dung khác */
.xe-pop .select2-container { z-index: 5; }
.xe-pop .select2-dropdown { z-index: 6; }

@keyframes xe-pop-in {
	from { opacity: 0; transform: translateY(14px) scale(.97); }
	to { opacity: 1; transform: none; }
}
@keyframes xe-pop-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}
dialog.xe-pop[open] .xe-pop__box { animation: xe-pop-in .22s ease-out; }
dialog.xe-pop[open]::backdrop { animation: xe-pop-fade .22s ease-out; }
@media (prefers-reduced-motion: reduce) {
	dialog.xe-pop[open] .xe-pop__box,
	dialog.xe-pop[open]::backdrop { animation: none; }
}

@media (max-width: 549px) {
	.xe-pop__box { padding: 22px 18px 18px; border-radius: 18px; }
	.xe-pop__close { top: 14px; right: 14px; }
	.xe-pop .xe-pop__title { font-size: 1.15em; }
	/* 16px để iPhone không tự phóng to khi bấm vào ô chọn */
	.xe-pop select.xe-f,
	.xe-pop .select2-selection__rendered,
	.xe-pop .select2-search--dropdown .select2-search__field { font-size: 16px !important; }
}

/* ---------- Thanh menu dưới cùng (chỉ mobile / tablet, trùng điểm ngắt của Flatsome) ---------- */
.xe-mbar { display: none; }

@media (max-width: 849px) {
	body.xe-has-mbar { padding-bottom: calc(var(--xe-mbar-h, 62px) + env(safe-area-inset-bottom, 0px)); }

	.xe-mbar {
		--xe-from: #f0283c;
		--xe-to: #f46d0a;
		--xe-text: #fff;
		--xe-mbar-h: 62px;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 990;
		display: flex;
		align-items: stretch;
		box-sizing: border-box;
		height: calc(var(--xe-mbar-h) + env(safe-area-inset-bottom, 0px));
		padding: 0 4px env(safe-area-inset-bottom, 0px);
		background: #fff;
		border-top: 1px solid #ececec;
		box-shadow: 0 -6px 20px rgba(0, 0, 0, .08);
		transition: transform .25s ease;
	}
	body.xe-has-mbar { --xe-mbar-h: 62px; }

	.xe-mbar a.xe-mbar__item {
		flex: 1 1 0;
		min-width: 0;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 4px;
		margin: 0;
		padding: 6px 2px 4px;
		color: #5c6370;
		font-size: 11px;
		font-weight: 600;
		line-height: 1.1;
		text-align: center;
		text-decoration: none;
		text-transform: none;
		letter-spacing: 0;
		-webkit-tap-highlight-color: transparent;
	}
	.xe-mbar a.xe-mbar__item:active { opacity: .7; }
	.xe-mbar a.xe-mbar__item:focus-visible { outline: 2px solid var(--xe-from); outline-offset: -2px; border-radius: 8px; }
	.xe-mbar a.xe-mbar__item.is-active { color: var(--xe-from); }
	.xe-mbar .xe-mbar__ico { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; }
	.xe-mbar .xe-mbar__ico .xe-ico { width: 24px; height: 24px; }
	.xe-mbar .xe-mbar__label {
		max-width: 100%;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	/* Nút tìm xe: tròn nổi lên giữa thanh */
	.xe-mbar a.xe-mbar__item--finder { color: var(--xe-from); font-weight: 800; }
	.xe-mbar .xe-mbar__item--finder .xe-mbar__ico {
		width: 50px;
		height: 50px;
		margin-top: -24px;
		border: 4px solid #fff;
		border-radius: 50%;
		background: linear-gradient(135deg, var(--xe-from), var(--xe-to));
		box-shadow: 0 6px 16px rgba(0, 0, 0, .22);
		color: var(--xe-text);
	}
	.xe-mbar .xe-mbar__item--finder .xe-mbar__ico .xe-ico { width: 26px; height: 26px; }

	/* Nhường chỗ cho nút "lên đầu trang" của Flatsome và ẩn thanh khi menu trượt đang mở */
	body.xe-has-mbar .back-to-top,
	body.xe-has-mbar #top-link { bottom: calc(var(--xe-mbar-h, 62px) + 16px + env(safe-area-inset-bottom, 0px)) !important; }
	html.has-off-canvas .xe-mbar,
	html.off-canvas-active .xe-mbar { transform: translateY(110%); }
}
@media print { .xe-mbar, dialog.xe-pop { display: none !important; } }
