/**
 * DS Elements — CTA nổi (hotline · Zalo · báo giá)
 *
 * Desktop: cột viên thuốc góc phải dưới. ≤768px: thanh sát đáy màn hình.
 */

.ds-fcta,
.ds-fcta *,
.ds-fcta *::before,
.ds-fcta *::after {
	box-sizing: border-box;
}

.ds-fcta {
	position: fixed;
	right: var(--ds-fcta-right, 24px);
	bottom: var(--ds-fcta-bottom, 24px);
	z-index: 90;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: var(--ds-space-3);

	/* Ẩn cho tới khi JS thấy người dùng đã cuộn qua ngưỡng. */
	opacity: 0;
	transform: translateY(12px);
	visibility: hidden;
	pointer-events: none;
	transition: opacity .25s ease, transform .25s ease, visibility 0s linear .25s;
}

.ds-fcta.is-visible {
	opacity: 1;
	transform: none;
	visibility: visible;
	pointer-events: auto;
	transition-delay: 0s;
}

/* Trong editor: nằm trong luồng để còn bấm chọn được widget. */
.ds-fcta--static {
	position: static;
	opacity: 1;
	transform: none;
	visibility: visible;
	pointer-events: auto;
	align-items: flex-start;
}

.ds-fcta__item {
	display: inline-flex;
	align-items: center;
	gap: var(--ds-space-3);
	width: 224px;
	height: 56px;
	padding: 0 var(--ds-space-4) 0 var(--ds-space-2);
	border: 1px solid transparent;
	border-radius: var(--ds-radius-pill);
	box-shadow: var(--ds-shadow-raised);
	font-size: var(--ds-fs-button);
	font-weight: var(--ds-fw-bold);
	line-height: 1.15;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

.ds-fcta__ico {
	position: relative;
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: var(--ds-radius-pill);
}

.ds-fcta__ico svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

/* --- Hotline: nền navy, hiện số --- */
.ds-fcta__item--call {
	background: var(--ds-color-brand);
	color: var(--ds-color-white);
}

.ds-fcta__ico--call {
	background: color-mix(in srgb, var(--ds-color-white) 16%, transparent);
	color: var(--ds-color-white);
}

/* Chấm "đang trực" + vòng sáng nhấp nháy. */
.ds-fcta__ico--call::before,
.ds-fcta__ico--call::after {
	content: "";
	position: absolute;
	right: -1px;
	bottom: -1px;
	width: 10px;
	height: 10px;
	border-radius: var(--ds-radius-pill);
	background: var(--ds-color-online);
}

.ds-fcta__ico--call::before {
	border: 2px solid var(--ds-fcta-call-bg, var(--ds-color-brand));
	width: 14px;
	height: 14px;
	right: -3px;
	bottom: -3px;
	background: var(--ds-color-online);
}

.ds-fcta__ico--call::after {
	right: -1px;
	bottom: -1px;
	background: none;
	animation: ds-fcta-pulse 1.8s ease-out infinite;
}

@keyframes ds-fcta-pulse {
	0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ds-color-online) 60%, transparent); }
	100% { box-shadow: 0 0 0 10px transparent; }
}

.ds-fcta__txt--call {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.ds-fcta__txt--call small {
	font-size: 11px;
	font-weight: var(--ds-fw-regular);
	color: var(--ds-color-on-dark-muted);
}

.ds-fcta__txt--call b {
	font-size: var(--ds-fs-h4);
	font-weight: var(--ds-fw-black);
	letter-spacing: .02em;
}

.ds-fcta__short {
	display: none;
}

/* --- Zalo: nền trắng, dấu xanh Zalo --- */
.ds-fcta__item--zalo {
	background: var(--ds-color-white);
	border-color: var(--ds-color-border);
	color: var(--ds-color-brand);
}

.ds-fcta__ico--zalo {
	background: var(--ds-color-zalo);
	color: var(--ds-color-white);
	font-size: 11px;
	font-weight: var(--ds-fw-black);
	letter-spacing: -.02em;
}

/* --- Báo giá: nền vàng đồng, chữ navy (trắng trên vàng không đủ tương phản) --- */
.ds-fcta__item--quote {
	background: var(--ds-color-accent);
	color: var(--ds-color-brand);
}

.ds-fcta__item--quote .ds-fcta__ico {
	background: var(--ds-color-brand);
	color: var(--ds-color-white);
}

/* Mũi tên gửi: lệch nhẹ sang phải cho cân mắt. */
.ds-fcta__item--quote .ds-fcta__ico svg {
	margin-left: 2px;
}

/* Mọi trạng thái đặt màu chữ tường minh: theme/reset đổi màu link khi rê chuột
   (làm chữ chìm vào nền) nếu để nó tự kế thừa. Chỉ đổi nền/viền — không dịch chuyển. */
.ds-fcta .ds-fcta__item:link,
.ds-fcta .ds-fcta__item:visited,
.ds-fcta .ds-fcta__item:hover,
.ds-fcta .ds-fcta__item:focus,
.ds-fcta .ds-fcta__item:active {
	text-decoration: none;
	transform: none;
}

.ds-fcta .ds-fcta__item--call:link,
.ds-fcta .ds-fcta__item--call:visited,
.ds-fcta .ds-fcta__item--call:hover,
.ds-fcta .ds-fcta__item--call:focus {
	color: var(--ds-color-white);
}

.ds-fcta .ds-fcta__item--zalo:link,
.ds-fcta .ds-fcta__item--zalo:visited,
.ds-fcta .ds-fcta__item--zalo:hover,
.ds-fcta .ds-fcta__item--zalo:focus,
.ds-fcta .ds-fcta__item--quote:link,
.ds-fcta .ds-fcta__item--quote:visited,
.ds-fcta .ds-fcta__item--quote:hover,
.ds-fcta .ds-fcta__item--quote:focus {
	color: var(--ds-color-brand);
}

.ds-fcta .ds-fcta__item--call:hover,
.ds-fcta .ds-fcta__item--call:focus {
	--ds-fcta-call-bg: var(--ds-color-brand-light);
	background: var(--ds-color-brand-light);
}

.ds-fcta .ds-fcta__item--zalo:hover,
.ds-fcta .ds-fcta__item--zalo:focus {
	background: var(--ds-color-surface);
	border-color: var(--ds-color-zalo);
}

.ds-fcta .ds-fcta__item--quote:hover,
.ds-fcta .ds-fcta__item--quote:focus {
	background: var(--ds-color-accent-dark);
}

.ds-fcta .ds-fcta__txt--call small {
	color: var(--ds-color-on-dark-muted);
}

.ds-fcta .ds-fcta__txt--call b {
	color: var(--ds-color-white);
}

.ds-fcta__item:focus-visible {
	outline: 2px solid var(--ds-color-brand-light);
	outline-offset: 3px;
}

/* Desktop: footer đã có thông tin liên hệ, CTA nhường chỗ. */
@media (min-width: 769px) {
	.ds-fcta.is-over-footer:not(.ds-fcta--static) {
		opacity: 0;
		transform: translateY(12px);
		visibility: hidden;
		pointer-events: none;
	}
}

/* ===== Mobile: thanh sát đáy ===== */
@media (max-width: 768px) {
	.ds-fcta:not(.ds-fcta--static) {
		left: 0;
		right: 0;
		bottom: 0;
		flex-direction: row-reverse;
		align-items: stretch;
		gap: 0;
		padding-bottom: env(safe-area-inset-bottom, 0px);
		background: var(--ds-color-white);
		border-top: 1px solid var(--ds-color-border);
		box-shadow: 0 -4px 16px color-mix(in srgb, var(--ds-color-brand) 10%, transparent);
	}

	/* Chạm đáy trang: nhường chỗ cho chữ bản quyền. */
	.ds-fcta.is-end:not(.ds-fcta--static) {
		opacity: 0;
		transform: translateY(100%);
		visibility: hidden;
		pointer-events: none;
	}

	.ds-fcta:not(.ds-fcta--static) .ds-fcta__item {
		flex: 1 1 0;
		width: auto;
		min-width: 0;
		height: auto;
		flex-direction: column;
		justify-content: center;
		gap: 3px;
		padding: var(--ds-space-2) var(--ds-space-1);
		border: 0;
		border-radius: 0;
		box-shadow: none;
		background: transparent;
		color: var(--ds-color-brand);
		font-size: 12px;
	}

	.ds-fcta:not(.ds-fcta--static) .ds-fcta__item:hover {
		transform: none;
	}

	.ds-fcta:not(.ds-fcta--static) .ds-fcta__item--quote {
		background: var(--ds-color-accent);
	}

	.ds-fcta:not(.ds-fcta--static) .ds-fcta__item--call {
		background: transparent;
	}

	.ds-fcta:not(.ds-fcta--static) .ds-fcta__ico {
		width: 30px;
		height: 30px;
	}

	.ds-fcta:not(.ds-fcta--static) .ds-fcta__ico--call {
		background: var(--ds-color-brand);
	}

	.ds-fcta:not(.ds-fcta--static) .ds-fcta__ico--call::before {
		border-color: var(--ds-color-white);
	}

	.ds-fcta:not(.ds-fcta--static) .ds-fcta__ico svg {
		width: 16px;
		height: 16px;
	}

	/* Thanh hẹp: chỉ hiện nhãn ngắn, số điện thoại nằm trong link gọi. */
	.ds-fcta:not(.ds-fcta--static) .ds-fcta__txt--call {
		display: none;
	}

	.ds-fcta:not(.ds-fcta--static) .ds-fcta__short {
		display: inline;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ds-fcta,
	.ds-fcta__item {
		transition: none;
	}

	.ds-fcta__ico--call::after {
		animation: none;
	}
}
