/* ============================================================
   STICKY WHATSAPP CHAT WIDGET
   Floating launcher + branded chat popup. Uses --bms-* tokens.
   ============================================================ */

:root { --bm-wa-green: #25d366; --bm-wa-green-dark: #1ebe5d; --bm-wa-teal: #075e54; }

.bm-wa {
	position: fixed;
	bottom: 24px;
	z-index: 9500;
	font-family: var(--bms-font-body, sans-serif);
}
.bm-wa--right { right: 24px; }
.bm-wa--left { left: 24px; }

/* ---------- Launcher button ---------- */
.bm-wa-launcher {
	position: relative;
	width: 60px;
	height: 60px;
	border: 0;
	border-radius: 50%;
	background: var(--bm-wa-green);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(37, 211, 102, .45);
	display: grid;
	place-items: center;
	transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
	-webkit-appearance: none;
	appearance: none;
}
.bm-wa-launcher:hover { background: var(--bm-wa-green-dark); transform: scale(1.06); }
.bm-wa-launcher:active { transform: scale(.98); }
.bm-wa-launcher-icon { width: 34px; height: 34px; display: block; }
.bm-wa-launcher-icon svg { width: 100%; height: 100%; display: block; }

/* Gentle attention pulse (stops once opened) */
.bm-wa-launcher::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	box-shadow: 0 0 0 0 rgba(37, 211, 102, .5);
	animation: bm-wa-pulse 2.4s ease-out infinite;
}
.bm-wa.is-open .bm-wa-launcher::after,
.bm-wa.is-engaged .bm-wa-launcher::after { animation: none; }
@keyframes bm-wa-pulse {
	0%   { box-shadow: 0 0 0 0 rgba(37, 211, 102, .5); }
	70%  { box-shadow: 0 0 0 16px rgba(37, 211, 102, 0); }
	100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}
@media (prefers-reduced-motion: reduce) {
	.bm-wa-launcher::after { animation: none; }
	.bm-wa-launcher, .bm-wa-popup { transition: none; }
}

/* Unread-style badge */
.bm-wa-badge {
	position: absolute;
	top: -3px;
	right: -3px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 10px;
	background: var(--bms-red, #e1251b);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
	box-shadow: 0 0 0 2px #fff;
}
.bm-wa.is-open .bm-wa-badge,
.bm-wa.is-engaged .bm-wa-badge { display: none; }

/* Launcher swaps to an × when open */
.bm-wa.is-open .bm-wa-launcher-icon { transform: rotate(90deg); opacity: 0; }

/* ---------- Chat popup ---------- */
.bm-wa-popup {
	position: absolute;
	bottom: 76px;
	width: 320px;
	max-width: calc(100vw - 40px);
	background: #fff;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
	transform: translateY(12px) scale(.96);
	transform-origin: bottom right;
	opacity: 0;
	pointer-events: none;
	transition: transform .2s ease, opacity .2s ease;
}
.bm-wa--right .bm-wa-popup { right: 0; }
.bm-wa--left .bm-wa-popup { left: 0; transform-origin: bottom left; }
.bm-wa-popup[hidden] { display: none; }
.bm-wa.is-open .bm-wa-popup {
	opacity: 1;
	pointer-events: auto;
	transform: none;
}

/* Header */
.bm-wa-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	background: var(--bm-wa-teal);
	color: #fff;
}
.bm-wa-avatar {
	position: relative;
	flex: none;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .15);
	display: grid;
	place-items: center;
	overflow: hidden;
}
.bm-wa-avatar-img { width: 100%; height: 100%; object-fit: cover; }
.bm-wa-avatar-glyph svg { width: 26px; height: 26px; color: #fff; }
.bm-wa-online {
	position: absolute;
	right: 0;
	bottom: 0;
	width: 11px;
	height: 11px;
	border-radius: 50%;
	background: #4ade80;
	box-shadow: 0 0 0 2px var(--bm-wa-teal);
}
.bm-wa-id { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.bm-wa-name { font-size: 15px; font-weight: 700; }
.bm-wa-reply { font-size: 12px; opacity: .85; }
.bm-wa-close {
	margin-left: auto;
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	opacity: .8;
	padding: 0 2px;
}
.bm-wa-close:hover { opacity: 1; }

/* Body — chat bubble on a subtle WhatsApp-style backdrop */
.bm-wa-body {
	padding: 20px 16px 16px;
	background: #e5ddd5;
	background-image: linear-gradient(rgba(229, 221, 213, .6), rgba(229, 221, 213, .6));
	min-height: 90px;
}
.bm-wa-bubble {
	position: relative;
	background: #fff;
	border-radius: 0 10px 10px 10px;
	padding: 10px 12px 20px;
	font-size: 13.5px;
	line-height: 1.5;
	color: var(--bms-text, #1a1a1a);
	box-shadow: 0 1px 1px rgba(0, 0, 0, .12);
	max-width: 90%;
	animation: bm-wa-bubble-in .3s ease .15s both;
}
.bm-wa-bubble::before {
	content: "";
	position: absolute;
	top: 0;
	left: -7px;
	border: 7px solid transparent;
	border-top-color: #fff;
	border-right-color: #fff;
}
.bm-wa-bubble-name { display: block; font-size: 12px; font-weight: 700; color: var(--bm-wa-teal); margin-bottom: 2px; }
.bm-wa-time { position: absolute; right: 10px; bottom: 6px; font-size: 10px; color: var(--bms-text-light, #9ca3af); }
@keyframes bm-wa-bubble-in {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: none; }
}

/* CTA */
.bm-wa-cta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 14px;
	background: #fff;
	color: var(--bm-wa-green-dark);
	font-size: 15px;
	font-weight: 700;
	text-decoration: none;
	border-top: 1px solid #ece5df;
	transition: background .15s ease;
}
.bm-wa-cta svg { width: 22px; height: 22px; }
.bm-wa-cta:hover { background: #f3faf5; color: var(--bm-wa-green-dark); }

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
	.bm-wa { bottom: 16px; }
	.bm-wa--right { right: 16px; }
	.bm-wa--left { left: 16px; }
	.bm-wa-launcher { width: 54px; height: 54px; }
	.bm-wa-launcher-icon { width: 30px; height: 30px; }
	.bm-wa-popup { width: calc(100vw - 32px); }
}
