/**
 * HCMC Dental — Floating CTA (FB / Messenger / WhatsApp).
 * Desktop: nút tròn gọn, bóng mềm, halo WhatsApp tinh tế.
 * Mobile: thanh thấp (~1/2 trước), icon + nhãn cân đối; Messenger = tia sét (không dùng blob lỗi).
 */

:root {
	/* Above sticky masthead (99990) so bar stays usable; below ASL/modals if any */
	--hcmc-float-z: 99995;
	--hcmc-float-desktop-size: 44px;
	--hcmc-float-gap: 10px;
	--hcmc-float-fb: #0866ff;
	--hcmc-float-fb-dark: #044bd1;
	--hcmc-float-ms: #0094ff;
	--hcmc-float-ms-dark: #006edc;
	--hcmc-float-wa: #2fe078;
	--hcmc-float-wa-dark: #128c7e;
	--hcmc-float-mobile-h: 42px;
}

.hcmc-float-cta {
	position: fixed;
	z-index: var(--hcmc-float-z);
	pointer-events: none;
}

.hcmc-float-cta__inner {
	pointer-events: auto;
	display: flex;
	align-items: stretch;
}

/* ── Desktop ─ */
@media (min-width: 783px) {
	.hcmc-float-cta {
		/* Cao hơn + lùi vào trong khỏi sát mép phải */
		right: max(28px, env(safe-area-inset-right, 0px));
		bottom: max(40px, env(safe-area-inset-bottom, 0px));
	}

	.hcmc-float-cta__inner {
		flex-direction: column;
		align-items: center;
		gap: var(--hcmc-float-gap);
		width: auto;
	}

	.hcmc-float-cta__btn {
		display: inline-flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		width: var(--hcmc-float-desktop-size);
		height: var(--hcmc-float-desktop-size);
		min-width: var(--hcmc-float-desktop-size);
		min-height: var(--hcmc-float-desktop-size);
		border-radius: 50%;
		color: #fff;
		text-decoration: none !important;
		border: 1px solid rgba(255, 255, 255, 0.1);
		box-shadow:
			inset 0 1px 0 rgba(255, 255, 255, 0.18),
			0 1px 2px rgba(0, 0, 0, 0.08),
			0 6px 16px rgba(15, 23, 42, 0.18);
		transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
		-webkit-tap-highlight-color: transparent;
	}

	/* WhatsApp giữ animation box-shadow — không ghi đè ở đây */
	.hcmc-float-cta__btn:not(.hcmc-float-cta__btn--wa):hover {
		transform: translateY(-2px);
		filter: brightness(1.05);
		box-shadow:
			inset 0 1px 0 rgba(255, 255, 255, 0.22),
			0 2px 4px rgba(0, 0, 0, 0.1),
			0 10px 22px rgba(15, 23, 42, 0.22);
	}

	.hcmc-float-cta__btn--wa:hover {
		transform: translateY(-2px);
		filter: brightness(1.06);
	}

	.hcmc-float-cta__btn:focus {
		outline: none;
	}

	.hcmc-float-cta__btn:focus-visible {
		outline: 2px solid #e2e8f0;
		outline-offset: 3px;
	}

	.hcmc-float-cta__label {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}

	.hcmc-float-cta__btn--fb {
		background: linear-gradient(165deg, #1a7cff 0%, var(--hcmc-float-fb-dark) 100%);
	}

	.hcmc-float-cta__btn--ms {
		background: linear-gradient(165deg, #1aa3ff 0%, var(--hcmc-float-ms-dark) 100%);
	}

	.hcmc-float-cta__btn--wa {
		position: relative;
		overflow: visible;
		background: linear-gradient(165deg, #3ee689 0%, var(--hcmc-float-wa-dark) 100%);
		/* Bỏ inset + giảm bóng slate — tránh viền trong tối/gần đen ở mép trên */
		border: 1px solid rgba(255, 255, 255, 0.38);
		box-shadow:
			0 4px 16px rgba(18, 140, 126, 0.48),
			0 8px 22px rgba(15, 23, 42, 0.08),
			0 0 0 2px rgba(187, 247, 208, 0.55),
			0 0 22px rgba(74, 222, 128, 0.52);
		animation: hcmcFloatWaHalo 2.2s ease-in-out infinite;
	}

	.hcmc-float-cta__icon {
		display: flex;
		align-items: center;
		justify-content: center;
		line-height: 0;
		flex-shrink: 0;
	}

	.hcmc-float-cta__icon svg {
		display: block;
		flex-shrink: 0;
		overflow: visible;
	}

	/* Cố định kích thước giống mobile — tránh SVG bị co/mất do flex/theme */
	.hcmc-float-cta__btn--fb .hcmc-float-cta__icon svg,
	.hcmc-float-cta__btn--wa .hcmc-float-cta__icon svg {
		width: 22px;
		height: 22px;
	}

	.hcmc-float-cta__svg-ms {
		width: 20px;
		height: 20px;
		transform: translate(0.5px, -0.5px);
	}

	/* Căn quang học trong nút tròn; tách layer nhẹ tránh artefact khi có animation box-shadow */
	.hcmc-float-cta__svg-wa {
		transform: translate(0, 0.5px);
	}

	.hcmc-float-cta__btn--wa .hcmc-float-cta__icon {
		position: relative;
		z-index: 1;
	}
}

@keyframes hcmcFloatWaHalo {
	0%,
	100% {
		box-shadow:
			0 4px 16px rgba(18, 140, 126, 0.48),
			0 8px 22px rgba(15, 23, 42, 0.08),
			0 0 0 3px rgba(187, 247, 208, 0.65),
			0 0 20px rgba(74, 222, 128, 0.55);
	}
	50% {
		box-shadow:
			0 6px 22px rgba(18, 140, 126, 0.58),
			0 12px 28px rgba(15, 23, 42, 0.1),
			0 0 0 11px rgba(74, 222, 128, 0),
			0 0 36px rgba(52, 211, 153, 0.85);
	}
}

/* ── Mobile: thanh thấp, tinh chỉnh typography & gradient ─ */
@media (max-width: 782px) {
	.hcmc-float-cta {
		left: 0;
		right: 0;
		bottom: 0;
		padding: 0;
		padding-bottom: env(safe-area-inset-bottom, 0px);
		background: rgba(15, 23, 42, 0.92);
		backdrop-filter: blur(10px);
		-webkit-backdrop-filter: blur(10px);
		box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.06), 0 -12px 32px rgba(0, 0, 0, 0.28);
	}

	.hcmc-float-cta__inner {
		flex-direction: row;
		width: 100%;
		max-width: 100%;
		margin: 0;
		min-height: var(--hcmc-float-mobile-h);
	}

	.hcmc-float-cta__btn {
		flex: 1;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 2px;
		min-height: var(--hcmc-float-mobile-h);
		padding: 5px 3px 6px;
		color: #f8fafc;
		text-decoration: none !important;
		border: none;
		border-radius: 0;
		box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
		min-width: 0;
		width: auto;
		height: auto;
		transition: filter 0.15s ease, opacity 0.15s ease;
		-webkit-tap-highlight-color: transparent;
	}

	.hcmc-float-cta__btn:active {
		filter: brightness(0.9);
	}

	.hcmc-float-cta__btn:focus {
		outline: none;
	}

	.hcmc-float-cta__btn:focus-visible {
		outline: 2px solid rgba(248, 250, 252, 0.9);
		outline-offset: -3px;
		z-index: 1;
	}

	/* Thứ tự hiển thị: Messenger → Facebook → WhatsApp (DOM vẫn MS–WA–FB) */
	.hcmc-float-cta__btn--ms {
		order: 1;
		background: linear-gradient(180deg, #0d9dff 0%, #006edc 100%);
		border-right: 1px solid rgba(255, 255, 255, 0.08);
	}

	.hcmc-float-cta__btn--fb {
		order: 2;
		background: linear-gradient(180deg, #1877f2 0%, #0d5cbf 100%);
		border-right: 1px solid rgba(255, 255, 255, 0.08);
	}

	.hcmc-float-cta__btn--wa {
		order: 3;
		background: linear-gradient(180deg, #2fe078 0%, #0f9d58 100%);
		animation: none;
	}

	.hcmc-float-cta__icon {
		display: flex;
		align-items: center;
		justify-content: center;
		line-height: 0;
	}

	.hcmc-float-cta__icon svg {
		display: block;
		width: 17px;
		height: 17px;
	}

	.hcmc-float-cta__svg-ms {
		width: 16px;
		height: 16px;
		transform: translate(0.5px, -0.5px);
	}

	.hcmc-float-cta__label {
		position: static;
		width: 100%;
		margin: 0;
		padding: 0 2px;
		clip: auto;
		font-size: 0.6875rem;
		font-weight: 600;
		letter-spacing: 0.02em;
		line-height: 1.15;
		text-align: center;
		text-overflow: ellipsis;
		overflow: hidden;
		white-space: nowrap;
		opacity: 0.95;
	}

	body {
		padding-bottom: calc(var(--hcmc-float-mobile-h) + env(safe-area-inset-bottom, 0px));
	}

	body.ast-main-header-nav-open .hcmc-float-cta {
		display: none !important;
	}
}

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

	.hcmc-float-cta__btn--wa {
		animation: none !important;
		box-shadow:
			0 4px 16px rgba(18, 140, 126, 0.45),
			0 0 0 2px rgba(187, 247, 208, 0.5),
			0 0 18px rgba(74, 222, 128, 0.4);
	}

	.hcmc-float-cta__btn:hover {
		transform: none;
	}
}

@media print {
	.hcmc-float-cta {
		display: none !important;
	}

	body {
		padding-bottom: 0 !important;
	}
}
