/* Focus WA Button for Elementor */

/* Widget wrapper tidak boleh punya transform/animation, karena akan
   membuat position:fixed relatif terhadap wrapper, bukan viewport. */
.elementor-widget-fwa_whatsapp,
.elementor-widget-fwa_whatsapp > .elementor-widget-container {
	transform: none !important;
	animation: none !important;
	filter: none !important;
	margin: 0 !important;
	padding: 0 !important;
	min-height: 0 !important;
}

/* Netralkan style tombol dari tema (mis. Hello Elementor: button:hover { background:#c36 }) */
.fwa button.fwa-launcher,
.fwa button.fwa-launcher:hover,
.fwa button.fwa-launcher:focus,
.fwa button.fwa-launcher:active {
	background: transparent !important;
	border: 0 !important;
	box-shadow: none !important;
	padding: 0 !important;
	color: inherit !important;
	outline: none;
}
.fwa button.fwa-close:focus,
.fwa button.fwa-greeting-close:focus {
	background: transparent !important;
	border: 0 !important;
	color: inherit;
}
.fwa button.fwa-close:hover { background: rgba(255, 255, 255, .15) !important; border: 0 !important; color: inherit !important; }
.fwa button.fwa-greeting-close,
.fwa button.fwa-greeting-close:hover { border: 0 !important; color: #9ca3af !important; }
.fwa button.fwa-greeting-close:hover { background: rgba(0, 0, 0, .05) !important; color: #374151 !important; }

.fwa {
	--fwa-x: 20px;
	--fwa-y: 20px;
	--fwa-z: 9999;
	--fwa-size: 60px;
	--fwa-icon: 32px;
	--fwa-bg: #25d366;
	--fwa-bg-hover: #1ebe5b;
	--fwa-fg: #fff;
	--fwa-radius: 50%;
	--fwa-img-border: 3px;
	--fwa-panel-w: 340px;
	--fwa-greet-bg: #fff;

	position: fixed;
	bottom: var(--fwa-y);
	z-index: var(--fwa-z);
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
	font-family: inherit;
	line-height: 1.4;
	transition: opacity .35s ease, transform .35s ease, visibility .35s;
}
.fwa--right { right: var(--fwa-x); }
.fwa--left  { left: var(--fwa-x); align-items: flex-start; }

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

/* ---------- Kondisi sebelum muncul (delay/scroll) ---------- */
.fwa.is-pending,
.fwa.is-offline-hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}
.fwa.is-pending.fwa-enter-slide { transform: translateY(24px); }
.fwa.is-pending.fwa-enter-zoom  { transform: scale(.6); }
.fwa.fwa-enter-zoom.fwa--right  { transform-origin: bottom right; }
.fwa.fwa-enter-zoom.fwa--left   { transform-origin: bottom left; }
.fwa.fwa-enter-none { transition: none; }

/* ---------- Launcher ---------- */
.fwa-launcher {
	all: unset;
	display: flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.fwa--left .fwa-launcher { flex-direction: row-reverse; }
.fwa-launcher:focus-visible .fwa-launcher-icon { outline: 3px solid rgba(37, 211, 102, .5); outline-offset: 3px; }

.fwa-launcher-icon {
	position: relative;
	width: var(--fwa-size);
	height: var(--fwa-size);
	border-radius: var(--fwa-radius);
	background: var(--fwa-bg);
	color: var(--fwa-fg);
	display: grid;
	place-items: center;
	flex-shrink: 0;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
	transition: background-color .2s ease, transform .2s ease;
}
.fwa-launcher:hover .fwa-launcher-icon { background: var(--fwa-bg-hover); transform: scale(1.05); }
.fwa-launcher-icon i { font-size: var(--fwa-icon); line-height: 1; color: inherit; }
.fwa-launcher-icon svg { width: var(--fwa-icon); height: var(--fwa-icon); fill: currentColor; }
.fwa-launcher-icon.is-image { padding: var(--fwa-img-border); }
.fwa-launcher-icon.is-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: var(--fwa-radius);
	display: block;
}

.fwa-launcher-label {
	background: #fff;
	color: #1f2937;
	font-size: 14px;
	font-weight: 600;
	padding: 9px 16px;
	border-radius: 999px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
	white-space: nowrap;
}
@media (max-width: 767px) {
	.fwa--label-desktop-only .fwa-launcher-label { display: none; }
}

/* ---------- Animasi perhatian ---------- */
.fwa-attn-pulse .fwa-launcher-icon::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: var(--fwa-bg);
	z-index: -1;
	animation: fwa-pulse 2s ease-out infinite;
}
.fwa-attn-bounce .fwa-launcher-icon { animation: fwa-bounce 3s ease-in-out infinite; }
.fwa-attn-shake  .fwa-launcher-icon { animation: fwa-shake 4s ease-in-out infinite; }
.fwa.is-open .fwa-launcher-icon,
.fwa.is-open .fwa-launcher-icon::after { animation: none; }

@keyframes fwa-pulse {
	0%   { transform: scale(1);   opacity: .55; }
	80%  { transform: scale(1.6); opacity: 0; }
	100% { transform: scale(1.6); opacity: 0; }
}
@keyframes fwa-bounce {
	0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
	10% { transform: translateY(-12px); }
	15% { transform: translateY(-6px); }
}
@keyframes fwa-shake {
	0%, 12%, 100% { transform: rotate(0); }
	2%  { transform: rotate(-14deg); }
	4%  { transform: rotate(12deg); }
	6%  { transform: rotate(-10deg); }
	8%  { transform: rotate(8deg); }
	10% { transform: rotate(-4deg); }
}

/* ---------- Bubble sapaan ---------- */
.fwa-greeting {
	width: max-content;
	max-width: min(280px, calc(100vw - var(--fwa-x) * 2));
	background: var(--fwa-greet-bg);
	color: #1f2937;
	padding: 12px 34px 12px 14px;
	border-radius: 14px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
	font-size: 14px;
	cursor: pointer;
	animation: fwa-pop .3s ease both;
}
.fwa-greeting[hidden] { display: none; }
.fwa-greeting::after {
	content: "";
	position: absolute;
	bottom: -6px;
	width: 14px;
	height: 14px;
	background: inherit;
	transform: rotate(45deg);
	box-shadow: 3px 3px 6px rgba(0, 0, 0, .05);
}
.fwa--right .fwa-greeting::after { right: calc(var(--fwa-size) / 2 - 7px); }
.fwa--left  .fwa-greeting::after { left: calc(var(--fwa-size) / 2 - 7px); }
.fwa-greeting-close {
	all: unset;
	position: absolute;
	top: 6px;
	right: 8px;
	width: 22px;
	height: 22px;
	display: grid;
	place-items: center;
	font-size: 18px;
	color: #9ca3af;
	cursor: pointer;
	border-radius: 50%;
}
.fwa-greeting-close:hover { color: #374151; background: rgba(0, 0, 0, .05); }

@keyframes fwa-pop {
	from { opacity: 0; transform: translateY(8px) scale(.96); }
	to   { opacity: 1; transform: none; }
}

/* ---------- Panel ---------- */
.fwa-panel,
.fwa-greeting {
	position: absolute;
	bottom: calc(100% + 14px);
}
.fwa--right .fwa-panel, .fwa--right .fwa-greeting { right: 0; }
.fwa--left .fwa-panel,  .fwa--left .fwa-greeting  { left: 0; }

.fwa-panel {
	width: min(var(--fwa-panel-w), calc(100vw - var(--fwa-x) * 2));
	background: #fff;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 16px 48px rgba(0, 0, 0, .2);
	opacity: 0;
	visibility: hidden;
	transform: translateY(12px) scale(.98);
	transform-origin: bottom right;
	transition: opacity .25s ease, transform .25s ease, visibility .25s;
	pointer-events: none;
}
.fwa--left .fwa-panel { transform-origin: bottom left; }
.fwa.is-open .fwa-panel {
	opacity: 1;
	visibility: visible;
	transform: none;
	pointer-events: auto;
}

.fwa-panel-head {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 18px 18px 16px;
	background: #075e54;
	color: #fff;
}
.fwa-panel-head-text { flex: 1; min-width: 0; }
.fwa-panel-title { font-size: 17px; font-weight: 700; line-height: 1.3; }
.fwa-panel-subtitle { font-size: 13px; opacity: .85; margin-top: 4px; }
.fwa-close {
	all: unset;
	width: 28px;
	height: 28px;
	display: grid;
	place-items: center;
	font-size: 22px;
	line-height: 1;
	border-radius: 50%;
	cursor: pointer;
	color: inherit;
	opacity: .85;
	flex-shrink: 0;
}
.fwa-close:hover { opacity: 1; background: rgba(255, 255, 255, .15); }

.fwa-panel-body {
	padding: 8px;
	max-height: min(360px, 60vh);
	overflow-y: auto;
	background: #fff;
}

.fwa-agent {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px;
	border-radius: 12px;
	text-decoration: none !important;
	color: inherit;
	transition: background-color .15s ease;
}
.fwa-agent:not(.is-disabled):hover { background: #f3f4f6; }
.fwa-agent[hidden] { display: none; }
.fwa-agent.is-disabled { cursor: not-allowed; opacity: .55; }

.fwa-agent-avatar {
	position: relative;
	width: 48px;
	height: 48px;
	flex-shrink: 0;
}
.fwa-agent-avatar img,
.fwa-agent-initials {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	object-fit: cover;
	display: grid;
	place-items: center;
}
.fwa-agent-initials { background: #dcf8c6; color: #075e54; font-weight: 700; font-size: 16px; }
.fwa-agent-dot {
	position: absolute;
	right: 1px;
	bottom: 1px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	border: 2px solid #fff;
	background: #9ca3af;
}
.fwa-agent.is-online .fwa-agent-dot { background: #22c55e; }

.fwa-agent-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fwa-agent-name { font-size: 15px; font-weight: 600; color: #111827; }
.fwa-agent-role { font-size: 13px; color: #6b7280; }
.fwa-agent-status { font-size: 12px; color: #9ca3af; margin-top: 2px; }
.fwa-agent.is-online .fwa-agent-status { color: #16a34a; }
.fwa-agent-arrow { color: #25d366; display: grid; place-items: center; }

.fwa-all-offline { padding: 14px; font-size: 14px; color: #6b7280; text-align: center; }
.fwa-all-offline[hidden] { display: none; }
.fwa-agent-warning { padding: 10px; font-size: 12px; color: #b45309; background: #fffbeb; border-radius: 8px; margin: 4px; }

@media (prefers-reduced-motion: reduce) {
	.fwa, .fwa *, .fwa *::after { animation: none !important; transition: none !important; }
}
