/* WhatsApp Button – Frontend */

.wab-wrap {
	position: fixed;
	z-index: 99998;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
	/* Der Wrapper selbst darf keine Klicks abfangen (die geschlossene Sprechblase belegt Platz darüber). */
	pointer-events: none;
}
.wab-wrap > * { pointer-events: auto; }
.wab-wrap.wab-left {
	align-items: flex-start;
}

/* Button */
.wab-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: var(--wab-size, 60px);
	height: var(--wab-size, 60px);
	border-radius: 50%;
	background: var(--wab-bg, #25D366);
	color: var(--wab-icon, #fff);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
	text-decoration: none;
	transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
	cursor: pointer;
	position: relative;
	box-sizing: border-box;
}
.wab-btn:hover,
.wab-btn:focus {
	background: var(--wab-hover, #1ebe5d);
	transform: scale(1.06);
	color: var(--wab-icon, #fff);
	box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}
.wab-btn .wab-icon {
	width: calc(var(--wab-size, 60px) * 0.55);
	height: calc(var(--wab-size, 60px) * 0.55);
	display: block;
}
.wab-custom-icon {
	width: calc(var(--wab-size, 60px) * 0.6);
	height: calc(var(--wab-size, 60px) * 0.6);
	object-fit: contain;
	border-radius: 50%;
}

/* Button mit Text-Label wird zur Pille (Klasse serverseitig gesetzt – kein :has() nötig) */
.wab-btn.wab-has-label {
	width: auto;
	padding: 0 22px 0 18px;
	border-radius: 40px;
}
.wab-label {
	font-size: 15px;
	font-weight: 600;
	white-space: nowrap;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Puls */
.wab-pulse::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: var(--wab-bg, #25D366);
	z-index: -1;
	animation: wab-pulse 2.2s ease-out infinite;
}
@keyframes wab-pulse {
	0%   { transform: scale(1);   opacity: .6; }
	70%  { transform: scale(1.6); opacity: 0; }
	100% { transform: scale(1.6); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
	.wab-pulse::before { animation: none; }
	.wab-btn, .wab-bubble, .wab-cta { transition: none; }
}

/* Sprechblase */
.wab-bubble {
	width: 300px;
	max-width: calc(100vw - 40px);
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
	padding: 16px;
	position: relative;
	opacity: 0;
	visibility: hidden; /* geschlossen: nicht fokussierbar, nicht klickbar, für Screenreader unsichtbar */
	transform: translateY(12px) scale(.96);
	pointer-events: none;
	transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: #1f2937;
	box-sizing: border-box;
}
.wab-bubble.is-open {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
	pointer-events: auto;
	transition: opacity .22s ease, transform .22s ease, visibility 0s;
}
.wab-bubble-close {
	position: absolute;
	top: 8px;
	right: 10px;
	background: none;
	border: none;
	font-size: 22px;
	line-height: 1;
	color: #9ca3af;
	cursor: pointer;
	padding: 2px 6px;
}
.wab-bubble-close:hover { color: #4b5563; }

.wab-bubble-head {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 10px;
}
.wab-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--wab-bg, #25D366);
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
.wab-bubble-head-txt { display: flex; flex-direction: column; line-height: 1.3; }
.wab-bubble-head-txt strong { font-size: 15px; }
.wab-status { font-size: 12px; display: inline-flex; align-items: center; gap: 5px; }
.wab-status::before {
	content: "";
	width: 8px; height: 8px;
	border-radius: 50%;
	display: inline-block;
}
.wab-status.is-online { color: #16a34a; }
.wab-status.is-online::before { background: #16a34a; }
.wab-status.is-offline { color: #9ca3af; }
.wab-status.is-offline::before { background: #9ca3af; }

.wab-bubble-text { font-size: 14px; margin: 6px 0; line-height: 1.45; }
.wab-bubble-text p { margin: 0 0 8px; }
.wab-bubble-text p:last-child { margin-bottom: 0; }
.wab-bubble-text a { color: var(--wab-bg, #25D366); text-decoration: underline; }
.wab-bubble-sub { font-size: 13px; color: #6b7280; margin: 4px 0 10px; }
.wab-gdpr {
	font-size: 11px;
	color: #9ca3af;
	line-height: 1.4;
	margin: 8px 0;
	border-top: 1px solid #f1f1f1;
	padding-top: 8px;
}
.wab-gdpr a { color: var(--wab-bg, #25D366); }

.wab-cta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background: var(--wab-bg, #25D366);
	color: #fff;
	text-decoration: none;
	padding: 11px 16px;
	border-radius: 10px;
	font-size: 14px;
	font-weight: 600;
	margin-top: 6px;
	transition: background .18s ease;
}
.wab-cta:hover { background: var(--wab-hover, #1ebe5d); color: #fff; }
.wab-cta .wab-icon { width: 18px; height: 18px; }

/* Agenten-Liste in der Sprechblase */
.wab-agents { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 4px; }
.wab-agent {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px;
	border-radius: 10px;
	text-decoration: none;
	color: #1f2937;
	transition: background .15s ease;
}
.wab-agent:hover { background: #f3f4f6; color: #1f2937; }
.wab-agent-av {
	width: 40px; height: 40px;
	border-radius: 50%;
	background: var(--wab-bg, #25D366);
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	overflow: hidden;
}
.wab-agent-av img { width: 100%; height: 100%; object-fit: cover; }
.wab-agent-info { display: flex; flex-direction: column; line-height: 1.3; flex: 1 1 auto; }
.wab-agent-info strong { font-size: 14px; }
.wab-agent-info small { font-size: 12px; color: #6b7280; }
.wab-agent-go { color: var(--wab-bg, #25D366); flex-shrink: 0; }

/* Shortcode: Inline-Button / Link */
.wab-inline-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--wab-bg, #25D366);
	color: #fff !important;
	text-decoration: none;
	padding: 10px 18px;
	border-radius: 8px;
	font-weight: 600;
	line-height: 1;
	transition: background .18s ease;
}
.wab-inline-btn:hover { background: var(--wab-hover, #1ebe5d); color: #fff !important; }
.wab-inline-btn .wab-icon { width: 20px; height: 20px; }
.wab-inline-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--wab-bg, #25D366);
	text-decoration: none;
	font-weight: 600;
}
.wab-inline-link:hover { text-decoration: underline; }
.wab-inline-link .wab-icon { width: 18px; height: 18px; }

/* Außerhalb der Öffnungszeiten ausblenden (Klassen serverseitig gesetzt, JS aktualisiert bei gecachten Seiten) */
.wab-wrap.wab-hide-offline.wab-is-offline { display: none !important; }

/* Geräte-Regeln (Klasse serverseitig gesetzt, Breite ≤ 768 px gilt als mobil) */
@media (min-width: 769px) {
	.wab-wrap.wab-only-mobile { display: none !important; }
}
@media (max-width: 768px) {
	.wab-wrap.wab-only-desktop { display: none !important; }
}

@media (max-width: 600px) {
	.wab-bubble { width: 280px; }
}
