/* WhatsApp Kontakt */
.sph-wa {
	--sph-wa-color: #25d366;
	--sph-wa-accent: #1c61e7;
	--sph-wa-bottom: 24px;
	--sph-wa-bottom-m: 80px;
	--sph-wa-ink: #1b2433;
	--sph-wa-muted: #6b7686;
	--sph-wa-font: var(--wd-text-font, "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif);
	--sph-wa-title: var(--wd-title-font, var(--sph-wa-font));
	position: fixed;
	bottom: var(--sph-wa-bottom);
	z-index: 9990;
	display: flex;
	flex-direction: column;
	gap: 14px;
	font-family: var(--sph-wa-font);
	pointer-events: none;
}
.sph-wa > * { pointer-events: auto; }
.sph-wa *, .sph-wa *::before, .sph-wa *::after { box-sizing: border-box; }
.sph-wa--right { right: 20px; align-items: flex-end; }
.sph-wa--left { left: 20px; align-items: flex-start; }

/* ---------- Schwebender Button ---------- */
.sph-wa__btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 9px;
	height: 56px;
	padding: 0 22px 0 16px;
	border-radius: 28px;
	background: var(--sph-wa-color);
	color: #fff !important;
	text-decoration: none !important;
	font-family: var(--sph-wa-title);
	font-size: 15px;
	font-weight: 600;
	letter-spacing: .01em;
	line-height: 1;
	box-shadow: 0 10px 24px -6px rgba(16, 24, 40, .35), 0 2px 6px rgba(16, 24, 40, .12);
	transition: transform .2s cubic-bezier(.2, .8, .2, 1), box-shadow .2s ease;
}
.sph-wa__btn:hover,
.sph-wa__btn:focus-visible {
	transform: translateY(-3px);
	box-shadow: 0 16px 30px -8px rgba(16, 24, 40, .4), 0 3px 8px rgba(16, 24, 40, .14);
	color: #fff !important;
}
.sph-wa__btn:focus-visible { outline: 3px solid rgba(28, 97, 231, .45); outline-offset: 3px; }
.sph-wa__btn--round { width: 56px; padding: 0; justify-content: center; }
.sph-wa__svg, .sph-wa__img { flex: 0 0 auto; width: 26px; height: 26px; display: block; }

/* Hinweis-Punkt mit „1“ und sanftem Puls, solange das Popup offen ist */
.sph-wa__badge {
	position: absolute;
	top: -5px;
	right: -3px;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: 10px;
	background: #ef4444;
	color: #fff;
	font: 700 11px/20px var(--sph-wa-font);
	text-align: center;
	box-shadow: 0 0 0 2px #fff;
	transform: scale(0);
	transition: transform .25s cubic-bezier(.2, 1.4, .4, 1);
}
.sph-wa.has-badge .sph-wa__badge { transform: scale(1); }
.sph-wa.has-badge .sph-wa__btn::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	box-shadow: 0 0 0 0 var(--sph-wa-color);
	animation: sph-wa-ring 2.2s ease-out 3;
	pointer-events: none;
}

/* ---------- Popup-Karte ---------- */
.sph-wa__card {
	width: 330px;
	max-width: calc(100vw - 32px);
	border-radius: 18px;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 24px 48px -12px rgba(16, 24, 40, .28), 0 4px 14px rgba(16, 24, 40, .1);
	opacity: 0;
	transform: translateY(14px) scale(.96);
	transform-origin: bottom right;
	transition: opacity .28s ease, transform .32s cubic-bezier(.2, .9, .25, 1.15);
}
.sph-wa--left .sph-wa__card { transform-origin: bottom left; }
.sph-wa__card[hidden] { display: none !important; }
.sph-wa.is-open .sph-wa__card { opacity: 1; transform: none; }
.sph-wa__card.is-leaving { opacity: 0; transform: translateY(10px) scale(.97); }

.sph-wa__head {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 48px 16px 16px;
	color: #fff;
	background:
		radial-gradient(120% 140% at 100% 0%, rgba(255, 255, 255, .22) 0%, rgba(255, 255, 255, 0) 55%),
		linear-gradient(135deg, var(--sph-wa-accent) 0%, color-mix(in srgb, var(--sph-wa-accent) 70%, #000) 100%);
}
.sph-wa__avatar {
	position: relative;
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: #fff;
	color: var(--sph-wa-accent);
	font: 700 16px/1 var(--sph-wa-title);
	box-shadow: 0 0 0 3px rgba(255, 255, 255, .28);
}
.sph-wa__avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.sph-wa__online {
	position: absolute;
	right: -1px;
	bottom: -1px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: #22c55e;
	border: 2px solid #fff;
}
.sph-wa__online::after {
	content: "";
	position: absolute;
	inset: -2px;
	border-radius: 50%;
	border: 2px solid #22c55e;
	animation: sph-wa-ping 1.8s ease-out infinite;
}
.sph-wa__who { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sph-wa__who strong { font: 600 15px/1.2 var(--sph-wa-title); color: #fff; }
.sph-wa__who small { font-size: 12px; line-height: 1.3; color: rgba(255, 255, 255, .85); }

.sph-wa .sph-wa__close {
	all: unset;
	position: absolute;
	top: 12px;
	right: 12px;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	color: #fff;
	background: rgba(255, 255, 255, .14);
	cursor: pointer;
	transition: background .15s ease, transform .15s ease;
}
.sph-wa .sph-wa__close:hover { background: rgba(255, 255, 255, .26); transform: rotate(90deg); }
.sph-wa .sph-wa__close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.sph-wa .sph-wa__close svg { display: block; }

.sph-wa__chat {
	padding: 18px 16px 16px;
	min-height: 92px;
	background-color: #f3f6fc;
	background-image: radial-gradient(rgba(28, 97, 231, .07) 1px, transparent 1px);
	background-size: 14px 14px;
}
.sph-wa__typing,
.sph-wa__msg {
	position: relative;
	display: inline-block;
	max-width: 92%;
	background: #fff;
	border-radius: 4px 14px 14px 14px;
	box-shadow: 0 1px 2px rgba(16, 24, 40, .08);
}
.sph-wa__typing::before,
.sph-wa__msg::before {
	content: "";
	position: absolute;
	top: 0;
	left: -7px;
	border: 7px solid transparent;
	border-top-color: #fff;
	border-right-color: #fff;
}
.sph-wa__typing { padding: 12px 14px; }
.sph-wa__typing i {
	display: inline-block;
	width: 7px;
	height: 7px;
	margin: 0 2px;
	border-radius: 50%;
	background: #9aa6b8;
	animation: sph-wa-dot 1.1s infinite ease-in-out;
}
.sph-wa__typing i:nth-child(2) { animation-delay: .15s; }
.sph-wa__typing i:nth-child(3) { animation-delay: .3s; }
.sph-wa__msg {
	display: none;
	padding: 10px 14px 20px;
	color: var(--sph-wa-ink);
	font-size: 14px;
	line-height: 1.5;
	min-width: 120px;
}
.sph-wa__time {
	position: absolute;
	right: 10px;
	bottom: 5px;
	font-size: 10.5px;
	color: var(--sph-wa-muted);
}
.sph-wa__card.is-typed .sph-wa__typing { display: none; }
.sph-wa__card.is-typed .sph-wa__msg { display: inline-block; animation: sph-wa-pop .3s cubic-bezier(.2, .9, .3, 1.2); }

.sph-wa .sph-wa__cta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin: 0;
	padding: 15px 18px;
	background: var(--sph-wa-accent);
	color: #fff !important;
	text-decoration: none !important;
	font: 600 15px/1.2 var(--sph-wa-title);
	transition: background .2s ease;
}
.sph-wa .sph-wa__cta:hover,
.sph-wa .sph-wa__cta:focus-visible { background: color-mix(in srgb, var(--sph-wa-accent) 85%, #000); color: #fff !important; }
.sph-wa__cta .sph-wa__svg, .sph-wa__cta .sph-wa__img { width: 22px; height: 22px; }
.sph-wa__arrow { transition: transform .2s ease; }
.sph-wa__cta:hover .sph-wa__arrow { transform: translateX(4px); }

@keyframes sph-wa-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes sph-wa-pop { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes sph-wa-ping { from { transform: scale(1); opacity: .9; } to { transform: scale(2.2); opacity: 0; } }
@keyframes sph-wa-ring { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--sph-wa-color) 55%, transparent); } to { box-shadow: 0 0 0 16px transparent; } }

/* Zusammen mit dem „Stegplatten24 Chat“: über dessen Knopf, bei offenem Chat ausgeblendet */
.sph-wa--ueber-chat { bottom: calc(var(--sph-wa-bottom) + 76px); }
.sph-wa--chat-offen { display: none !important; }
@media (max-width: 768px) {
	.sph-wa { bottom: var(--sph-wa-bottom-m); }
	.sph-wa--ueber-chat { bottom: calc(var(--sph-wa-bottom-m) + 70px); }
	.sph-wa--right { right: 14px; }
	.sph-wa--left { left: 14px; }
	.sph-wa__btn { height: 52px; font-size: 14px; }
	.sph-wa__btn--round { width: 52px; }
	.sph-wa__card { width: 310px; max-width: calc(100vw - 28px); }
	.sph-wa--no-mobile { display: none !important; }
}
@media (min-width: 769px) {
	.sph-wa--no-desktop { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
	.sph-wa *, .sph-wa *::before, .sph-wa *::after { animation: none !important; transition: none !important; }
}
@media print { .sph-wa { display: none !important; } }
