/**
 * assets/css/floating-social.css
 * Floating Social Action Button — Light Medical / Glassmorphism, chuẩn Apple.
 */

:root {
	--fp-fsab-size: 64px;
	--fp-fsab-icon-color: #0f766e;
	--fp-fsab-bg: rgba(255, 255, 255, 0.72);
	--fp-fsab-border: rgba(255, 255, 255, 0.6);
}

.fp-fsab {
	position: fixed;
	z-index: 99990;
	bottom: 32px;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
}
.fp-fsab[data-position="bottom-right"] {
	right: 32px;
	align-items: flex-end;
}
.fp-fsab[data-position="bottom-left"] {
	left: 32px;
	align-items: flex-start;
}

/* ===== Kích thước theo size_preference (nhân thêm trên nền tảng breakpoint) ===== */
.fp-fsab[data-size="small"] {
	--fp-fsab-size: 52px;
}
.fp-fsab[data-size="medium"] {
	--fp-fsab-size: 64px;
}
.fp-fsab[data-size="large"] {
	--fp-fsab-size: 72px;
}

/* ===== Nút Trigger (Capsule) ===== */
.fp-fsab__trigger {
	display: flex;
	align-items: center;
	gap: 10px;
	height: var(--fp-fsab-size);
	padding: 0 20px 0 0;
	border-radius: 999px;
	border: 1px solid var(--fp-fsab-border);
	background: var(--fp-fsab-bg);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.08);
	cursor: pointer;
	color: var(--fp-fsab-icon-color);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), padding 0.35s ease, box-shadow 0.2s ease, transform 0.2s ease;
	animation: fp-fsab-breathe 4s ease-in-out infinite;
}
.fp-fsab__trigger:hover {
	box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18), 0 3px 10px rgba(15, 23, 42, 0.1);
	/* KHÔNG dùng scale() ở hover — chỉ shadow, tránh xung đột với animation breathing cũng dùng transform. */
}
.fp-fsab__trigger:active {
	filter: brightness(0.97);
}

.fp-fsab__trigger-icon {
	flex-shrink: 0;
	width: var(--fp-fsab-size);
	height: var(--fp-fsab-size);
	display: flex;
	align-items: center;
	justify-content: center;
}
.fp-fsab__trigger-icon svg {
	width: 46%;
	height: 46%;
}

.fp-fsab__trigger-badge {
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
	color: #0f172a;
	opacity: 1;
	transition: opacity 0.2s ease;
}

/* ===== Hiệu ứng "Thở" — chỉ scale, không đổi màu/độ mờ để giữ tối giản ===== */
@keyframes fp-fsab-breathe {
	0% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.05);
	}
	100% {
		transform: scale(1);
	}
}
@media (prefers-reduced-motion: reduce) {
	.fp-fsab__trigger {
		animation: none;
	}
}

/* ===== Trạng thái thu gọn khi cuộn > 250px ===== */
.fp-fsab.is-collapsed .fp-fsab__trigger {
	width: var(--fp-fsab-size);
	padding: 0;
	justify-content: center;
	animation: none; /* Dừng "thở" khi đã thu gọn — tránh rung giật khó chịu ở kích thước nhỏ. */
}
.fp-fsab.is-collapsed .fp-fsab__trigger-badge {
	opacity: 0;
	width: 0;
	overflow: hidden;
	position: absolute;
	pointer-events: none;
}

/* ===== Popover kiểu Apple Popup ===== */
.fp-fsab__popover {
	position: absolute;
	bottom: calc(var(--fp-fsab-size) + 14px);
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 220px;
	padding: 8px;
	border-radius: 18px;
	background: rgba(255, 255, 255, 0.86);
	-webkit-backdrop-filter: blur(18px);
	backdrop-filter: blur(18px);
	border: 1px solid var(--fp-fsab-border);
	box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08);
	opacity: 0;
	transform: translateY(8px) scale(0.96);
	transform-origin: bottom right;
	transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
	pointer-events: none;
}
.fp-fsab[data-position="bottom-right"] .fp-fsab__popover {
	right: 0;
	transform-origin: bottom right;
}
.fp-fsab[data-position="bottom-left"] .fp-fsab__popover {
	left: 0;
	transform-origin: bottom left;
}
.fp-fsab__popover.is-open {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}
.fp-fsab__popover[hidden] {
	display: flex; /* Ghi đè hành vi mặc định của [hidden] để transition opacity/transform hoạt động — ẩn/hiện thật sự do JS toggle thuộc tính `hidden` TRƯỚC/SAU transition, không dựa vào display. */
}

.fp-fsab__item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 14px;
	border-radius: 12px;
	text-decoration: none;
	color: #0f172a;
	font-size: 14.5px;
	font-weight: 500;
	transition: background 0.15s ease;
}
.fp-fsab__item:hover {
	background: rgba(15, 118, 110, 0.08);
}
.fp-fsab__item-icon {
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(15, 118, 110, 0.1);
	color: var(--fp-fsab-icon-color);
}
.fp-fsab__item[data-fp-fsab-channel="hotline"] .fp-fsab__item-icon {
	background: rgba(220, 38, 38, 0.12);
	color: #dc2626;
}
.fp-fsab__item[data-fp-fsab-channel="hotline"] {
	color: #dc2626;
	font-weight: 700;
}
.fp-fsab__item[data-fp-fsab-channel="ai_assistant"] .fp-fsab__item-icon {
	background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(15, 118, 110, 0.15));
	color: #7c3aed;
}
.fp-fsab__item[data-fp-fsab-channel="ai_assistant"] {
	font-weight: 700;
}

/* ===== Responsive — Desktop 64px / Tablet 56px / Mobile 52px ===== */
@media (max-width: 1024px) {
	.fp-fsab:not([data-size]) ,
	.fp-fsab[data-size="medium"] {
		--fp-fsab-size: 56px;
	}
}

@media (max-width: 480px) {
	.fp-fsab {
		bottom: 80px !important; /* Tránh đè lên thanh Chatbot AI Gemini ở đáy màn hình Mobile. */
	}
	.fp-fsab[data-position="bottom-right"] {
		right: 16px;
	}
	.fp-fsab[data-position="bottom-left"] {
		left: 16px;
	}
	.fp-fsab[data-size="medium"],
	.fp-fsab[data-size="large"] {
		--fp-fsab-size: 52px;
	}
	.fp-fsab__trigger-badge {
		font-size: 13px;
	}
	.fp-fsab__popover {
		min-width: 200px;
	}
}
