/* Beseha Pharmacist Chat */
:root {
	--bph-brand: #2e7d4f;
	--bph-ink: #1d2b23;
	--bph-muted: #5d6d64;
	--bph-online: #22c55e;
	--bph-offline: #f59e0b;
	--bph-bottom-offset: 0px;
}

.bph-float *, .bph-card *, .bph-topbar *, .bph-line * { box-sizing: border-box; }
.bph-float svg, .bph-card svg, .bph-line svg, .bph-bubble svg { display: block; }

/* ---------- avatar + live dot ---------- */
.bph-avatars { position: relative; display: inline-flex; flex: 0 0 auto; direction: ltr; }
.bph-avatar {
	position: relative;
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 0 0 2px #fff;
	overflow: hidden;
}
.bph-avatar + .bph-avatar { margin-left: -12px; }
.bph-avatar > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.bph-avatars--sm .bph-avatar { width: 32px; height: 32px; }
.bph-avatars--sm .bph-avatar + .bph-avatar { margin-left: -9px; }
.bph-avatars--md .bph-avatar { width: 50px; height: 50px; }
.bph-avatars--md .bph-avatar + .bph-avatar { margin-left: -14px; }
.bph-dot {
	position: absolute;
	inset-inline-end: 0;
	bottom: 1px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--bph-online);
	border: 2px solid #fff;
}
.bph-dot::after {
	content: "";
	position: absolute;
	inset: -2px;
	border-radius: 50%;
	background: var(--bph-online);
	animation: bph-ping 1.8s ease-out infinite;
}
.bph-offline .bph-dot, .bph-offline .bph-dot::after { background: var(--bph-offline); }
.bph-offline .bph-dot::after { animation: none; opacity: 0; }
@keyframes bph-ping { 0% { transform: scale(1); opacity: .55; } 80%, 100% { transform: scale(2.2); opacity: 0; } }

/* ---------- floating button ---------- */
.bph-float {
	position: fixed;
	right: 24px;
	bottom: calc(24px + var(--bph-bottom-offset));
	z-index: 99990;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
	direction: ltr;
	font-family: inherit;
	transition: bottom .2s ease;
}
.bph-fab {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 7px 8px 7px 8px;
	padding-inline-end: 16px;
	border-radius: 999px;
	background: var(--bph-brand);
	color: #fff !important;
	text-decoration: none !important;
	box-shadow: 0 10px 28px rgba(16, 60, 34, .28), 0 2px 6px rgba(0, 0, 0, .12);
	transition: transform .15s ease, box-shadow .15s ease;
	animation: bph-pop .5s ease-out .6s both, bph-pulse 1.6s ease-out 1.2s 2;
}
.bph-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(16, 60, 34, .34), 0 2px 6px rgba(0, 0, 0, .12); }
.bph-fab:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px var(--bph-brand); }
.bph-fab__text { display: flex; flex-direction: column; line-height: 1.25; }
.bph-fab__text strong { font-size: 16px; font-weight: 700; color: #fff; }
.bph-fab__text small { font-size: 12px; opacity: .92; color: #fff; white-space: nowrap; }
.bph-status { font-weight: 700; }
.bph-fab__wa {
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .16);
	color: #fff;
}
.bph-fab__wa svg { width: 18px; height: 18px; }

@keyframes bph-pop { from { opacity: 0; transform: translateY(16px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes bph-pulse { 0% { box-shadow: 0 10px 28px rgba(16, 60, 34, .28), 0 0 0 0 rgba(46, 125, 79, .45); } 100% { box-shadow: 0 10px 28px rgba(16, 60, 34, .28), 0 0 0 16px rgba(46, 125, 79, 0); } }

/* ---------- contextual bubble ---------- */
.bph-bubble {
	position: relative;
	width: 300px;
	max-width: calc(100vw - 32px);
	background: #fff;
	color: var(--bph-ink);
	border-radius: 16px;
	box-shadow: 0 14px 40px rgba(0, 0, 0, .18);
	animation: bph-pop .35s ease-out both;
}
.bph-bubble[hidden] { display: none; }
.bph-bubble::after {
	content: "";
	position: absolute;
	bottom: -7px;
	right: 34px;
	width: 14px;
	height: 14px;
	background: #fff;
	transform: rotate(45deg);
	box-shadow: 3px 3px 6px rgba(0, 0, 0, .06);
}
.bph-bubble__body {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	padding: 14px 16px;
	padding-inline-end: 34px;
	color: var(--bph-ink) !important;
	text-decoration: none !important;
}
.bph-bubble__text { display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.55; }
.bph-bubble__cta {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	align-self: flex-start;
	font-size: 13px;
	font-weight: 700;
	color: var(--bph-brand);
}
.bph-bubble__cta svg { width: 16px; height: 16px; }
.bph-bubble__close {
	position: absolute;
	top: 6px;
	inset-inline-end: 6px;
	width: 26px;
	height: 26px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--bph-muted);
	font-size: 20px;
	line-height: 26px;
	cursor: pointer;
}
.bph-bubble__close:hover { background: #f1f4f2; }

/* ---------- product page card ---------- */
.bph-card {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px 14px;
	margin: 16px 0;
	padding: 14px 16px;
	border: 1px solid color-mix(in srgb, var(--bph-brand) 25%, #fff);
	border-radius: 14px;
	background: color-mix(in srgb, var(--bph-brand) 6%, #fff);
	color: var(--bph-ink);
	clear: both;
}
.bph-card__body { flex: 1 1 180px; display: flex; flex-direction: column; gap: 2px; line-height: 1.45; }
.bph-card__body strong { font-size: 15px; color: var(--bph-ink); }
.bph-card__body span { font-size: 13px; color: var(--bph-muted); }
.bph-card__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	flex: 0 0 auto;
	min-height: 44px;
	padding: 10px 18px;
	border-radius: 999px;
	background: var(--bph-brand);
	color: #fff !important;
	font-weight: 700;
	font-size: 14px;
	text-decoration: none !important;
	white-space: nowrap;
}
.bph-card__btn:hover { filter: brightness(1.08); }
.bph-card__btn svg { width: 18px; height: 18px; }

/* quick questions under the product card */
.bph-chips { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 4px; border-top: 1px dashed color-mix(in srgb, var(--bph-brand) 25%, #fff); }
.bph-chips__label { font-size: 13px; color: var(--bph-muted); }
.bph-chip {
	display: inline-flex;
	align-items: center;
	min-height: 36px;
	padding: 6px 14px;
	border: 1px solid color-mix(in srgb, var(--bph-brand) 40%, #fff);
	border-radius: 999px;
	background: #fff;
	color: var(--bph-brand) !important;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none !important;
	transition: background .15s ease;
}
.bph-chip:hover { background: color-mix(in srgb, var(--bph-brand) 8%, #fff); }

/* out-of-stock + empty search variants */
.bph-card--oos { border-color: #f1c27d; background: #fff8ec; }
.bph-card--search { margin: 18px 0 24px; }

/* ---------- inline lines (warnings/faq/cart/checkout) ---------- */
.bph-line, .bph-context { margin: 10px 0 14px; }
.bph-line a, .bph-context a {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 14px;
	border-radius: 10px;
	background: color-mix(in srgb, var(--bph-brand) 8%, #fff);
	color: var(--bph-brand) !important;
	font-weight: 700;
	font-size: 14px;
	line-height: 1.4;
	text-decoration: none !important;
}
.bph-line a:hover, .bph-context a:hover { background: color-mix(in srgb, var(--bph-brand) 14%, #fff); }
.bph-line svg, .bph-context svg { width: 18px; height: 18px; flex: 0 0 auto; }

/* ---------- top bar ---------- */
.bph-topbar {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 36px;
	padding: 6px 44px;
	background: var(--bph-brand);
	color: #fff;
	font-size: 13px;
	line-height: 1.4;
	text-align: center;
}
.bph-tb-off .bph-topbar { display: none; }
.bph-topbar__link { display: inline-flex; align-items: center; gap: 8px; color: #fff !important; text-decoration: none !important; font-weight: 600; }
.bph-topbar__link:hover span:last-child { text-decoration: underline; }
.bph-topbar .bph-dot { position: relative; inset: auto; flex: 0 0 auto; width: 9px; height: 9px; border-width: 0; }
.bph-topbar__close {
	position: absolute;
	inset-inline-end: 8px;
	top: 50%;
	transform: translateY(-50%);
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 20px;
	line-height: 28px;
	opacity: .8;
	cursor: pointer;
}
.bph-topbar__close:hover { opacity: 1; }

/* ---------- motion level 2: typing dots, wave, single pulse, mobile peek ---------- */
.bph-typing { display: none; align-items: center; gap: 4px; height: 22px; }
.bph-typing i { width: 7px; height: 7px; border-radius: 50%; background: #9aa8a0; animation: bph-dots 1s ease-in-out infinite; }
.bph-typing i:nth-child(2) { animation-delay: .15s; }
.bph-typing i:nth-child(3) { animation-delay: .3s; }
.bph-bubble--typing .bph-typing { display: inline-flex; }
.bph-bubble--typing [data-bph-text="bubble"], .bph-bubble--typing .bph-bubble__cta { display: none; }
@keyframes bph-dots { 0%, 80%, 100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-4px); opacity: 1; } }

.bph-wave .bph-avatar { animation: bph-wave .8s ease-in-out 1; transform-origin: 50% 90%; }
.bph-wave .bph-avatar + .bph-avatar { animation-delay: .12s; }
@keyframes bph-wave { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-10deg); } 60% { transform: rotate(8deg); } }

.bph-fab.bph-nudge { animation: bph-pulse 1.4s ease-out 1; }

.bph-fab__peek { display: none; }

/* ---------- motion level 3: bounce every 5 s (test group only) ---------- */
.bph-m3 .bph-fab { animation: bph-pop .5s ease-out .6s both, bph-bounce 5s ease-in-out 3s infinite; }
@keyframes bph-bounce { 0%, 12%, 100% { transform: translateY(0); } 4% { transform: translateY(-10px); } 8% { transform: translateY(0); } 10% { transform: translateY(-4px); } }

/* ---------- mobile ---------- */
@media (max-width: 767px) {
	.bph-float { right: 14px; bottom: calc(14px + var(--bph-bottom-offset)); gap: 10px; }
	.bph-fab { padding: 4px; border-radius: 999px; gap: 0; }
	.bph-fab__text { display: none; }
	.bph-fab .bph-avatar { width: 48px; height: 48px; }
	.bph-fab .bph-avatar + .bph-avatar { margin-left: -14px; }
	.bph-fab__wa {
		position: absolute;
		top: -4px;
		inset-inline-start: -4px;
		width: 22px;
		height: 22px;
		background: #25d366;
		box-shadow: 0 0 0 2px #fff;
	}
	.bph-fab__wa svg { width: 13px; height: 13px; }
	.bph-fab__peek {
		display: inline-block;
		max-width: 0;
		overflow: hidden;
		white-space: nowrap;
		color: #fff;
		font-size: 14px;
		font-weight: 700;
		padding-inline: 0;
		transition: max-width .35s ease, padding .35s ease;
	}
	.bph-fab--peek .bph-fab__peek { max-width: 240px; padding-inline: 8px 12px; }
	.bph-fab { position: relative; }
	.bph-bubble { width: 270px; }
	.bph-bubble::after { right: 22px; }
	.bph-card__btn { flex: 1 1 100%; }
	.bph-topbar { font-size: 12px; padding: 6px 38px; }
}

@media (prefers-reduced-motion: reduce) {
	.bph-fab, .bph-bubble, .bph-m3 .bph-fab, .bph-fab.bph-nudge, .bph-wave .bph-avatar, .bph-typing i { animation: none; }
	.bph-fab__peek { transition: none; }
	.bph-dot::after { animation: none; opacity: 0; }
}

@media (max-width: 767px) { .bph-chip { flex: 1 1 auto; justify-content: center; } }

@media print { .bph-float, .bph-topbar, .bph-card, .bph-line, .bph-context { display: none !important; } }
