/* ==========================================================================
   LSM - WhatsApp Chat – Frontend
   Alle Regeln sind mit .lsm-wac.lsm-wac (bzw. .lsm-wac-*) abgesichert, damit
   Theme-/Elementor-Styles für button, a, [type=button] nicht durchschlagen.
   ========================================================================== */

.lsm-wac {
	--lsm-wac-color: #25D366;
	--lsm-wac-color-soft: color-mix(in srgb, var(--lsm-wac-color) 10%, #fff);
	--lsm-wac-color-line: color-mix(in srgb, var(--lsm-wac-color) 35%, #fff);
	--lsm-wac-color-dark: color-mix(in srgb, var(--lsm-wac-color) 80%, #000);
	--lsm-wac-text: #1d1d1f;
	--lsm-wac-muted: #6e6e73;
	--lsm-wac-line: #e8e8ed;
	--lsm-wac-bg: #f5f5f7;
	--lsm-wac-offset: 20px;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.45;
	letter-spacing: normal;
	text-transform: none;
	color: var(--lsm-wac-text);
	-webkit-font-smoothing: antialiased;
}
.lsm-wac *,
.lsm-wac *::before,
.lsm-wac *::after { box-sizing: border-box; }
.lsm-wac p { margin: 0; }

/* Harter Reset für Buttons & Links innerhalb des Widgets */
.lsm-wac.lsm-wac button {
	all: unset;
	box-sizing: border-box;
	cursor: pointer;
	font-family: inherit;
	-webkit-tap-highlight-color: transparent;
}
.lsm-wac.lsm-wac a { text-decoration: none; }
.lsm-wac.lsm-wac button:focus-visible,
.lsm-wac.lsm-wac a:focus-visible {
	outline: 2px solid var(--lsm-wac-color);
	outline-offset: 2px;
}

.lsm-wac .screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Floating-Container
   -------------------------------------------------------------------------- */
.lsm-wac--right,
.lsm-wac--left {
	position: fixed;
	bottom: var(--lsm-wac-offset);
	z-index: 2147483000;
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.lsm-wac--right.is-open,
.lsm-wac--left.is-open { z-index: 2147483647; }
.lsm-wac--right { right: 20px; align-items: flex-end; }
.lsm-wac--left  { left: 20px;  align-items: flex-start; }

/* --------------------------------------------------------------------------
   Toggle-Button
   -------------------------------------------------------------------------- */
.lsm-wac.lsm-wac .lsm-wac-toggle {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	height: 56px;
	padding: 0 22px 0 16px;
	border-radius: 999px;
	background: var(--lsm-wac-color);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	box-shadow: 0 8px 24px color-mix(in srgb, var(--lsm-wac-color) 35%, transparent), 0 2px 6px rgba(0, 0, 0, .12);
	transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.lsm-wac.lsm-wac .lsm-wac-toggle:hover {
	background: var(--lsm-wac-color-dark);
	color: #fff;
	transform: translateY(-2px);
}
.lsm-wac.lsm-wac .lsm-wac-toggle.is-icon-only { width: 60px; height: 60px; padding: 0; justify-content: center; }
.lsm-wac .lsm-wac-toggle-icon { width: 26px; height: 26px; flex: none; }

/* Pulsierender Punkt als Aufmerksamkeit */
.lsm-wac .lsm-wac-toggle { position: relative; }
.lsm-wac .lsm-wac-toggle::after {
	content: "";
	position: absolute;
	top: 2px; right: 6px;
	width: 12px; height: 12px;
	border-radius: 50%;
	background: #ff3b30;
	border: 2px solid #fff;
}
.lsm-wac .lsm-wac-toggle[aria-expanded="true"]::after,
.lsm-wac.is-seen .lsm-wac-toggle::after { display: none; }

/* --------------------------------------------------------------------------
   Panel
   -------------------------------------------------------------------------- */
.lsm-wac .lsm-wac-panel {
	display: flex;
	flex-direction: column;
	width: min(380px, calc(100vw - 32px));
	max-height: min(640px, calc(100vh - var(--lsm-wac-offset) - 100px));
	background: #fff;
	border-radius: 20px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, .18), 0 4px 14px rgba(0, 0, 0, .08);
	overflow: hidden;
	transform-origin: bottom right;
	animation: lsm-wac-in .22s cubic-bezier(.2, .9, .3, 1.2);
}
.lsm-wac--left .lsm-wac-panel { transform-origin: bottom left; }
.lsm-wac .lsm-wac-panel[hidden] { display: none; }

@keyframes lsm-wac-in {
	from { opacity: 0; transform: translateY(10px) scale(.96); }
	to   { opacity: 1; transform: none; }
}
@keyframes lsm-wac-msg {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: none; }
}

/* Header */
.lsm-wac .lsm-wac-header {
	position: relative;
	display: flex;
	gap: 12px;
	align-items: center;
	padding: 18px 56px 18px 18px;
	background: linear-gradient(135deg, var(--lsm-wac-color) 0%, var(--lsm-wac-color-dark) 100%);
	color: #fff;
}
.lsm-wac .lsm-wac-header-icon {
	flex: none;
	width: 44px; height: 44px;
	padding: 9px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .18);
}
.lsm-wac .lsm-wac-title { font-size: 17px; font-weight: 700; line-height: 1.25; color: #fff; }
.lsm-wac .lsm-wac-intro { margin-top: 3px; font-size: 13px; line-height: 1.4; color: rgba(255, 255, 255, .9); }
.lsm-wac.lsm-wac .lsm-wac-close {
	position: absolute;
	top: 14px; right: 14px;
	display: grid;
	place-items: center;
	width: 32px; height: 32px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .16);
	color: #fff;
	font-size: 22px;
	line-height: 1;
	transition: background .15s ease;
}
.lsm-wac.lsm-wac .lsm-wac-close:hover { background: rgba(255, 255, 255, .3); color: #fff; }

/* Body */
.lsm-wac .lsm-wac-body {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	padding: 16px;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--lsm-wac-bg);
	scrollbar-width: thin;
}

/* --------------------------------------------------------------------------
   Wizard: Nachrichten
   -------------------------------------------------------------------------- */
.lsm-wac .lsm-wac-log { display: flex; flex-direction: column; gap: 10px; }
.lsm-wac .lsm-wac-msg {
	max-width: 88%;
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 14.5px;
	line-height: 1.45;
	word-wrap: break-word;
	animation: lsm-wac-msg .25s ease-out;
}
.lsm-wac .lsm-wac-msg--bot {
	align-self: flex-start;
	background: #fff;
	color: var(--lsm-wac-text);
	border-bottom-left-radius: 4px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}
.lsm-wac .lsm-wac-msg--user {
	align-self: flex-end;
	background: var(--lsm-wac-color);
	color: #fff;
	border-bottom-right-radius: 4px;
}

/* Wizard: Antwortmöglichkeiten */
.lsm-wac .lsm-wac-choices {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 2px;
	animation: lsm-wac-msg .3s ease-out;
}
.lsm-wac.lsm-wac .lsm-wac-choice {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	padding: 12px 14px;
	border: 1px solid var(--lsm-wac-line);
	border-radius: 12px;
	background: #fff;
	color: var(--lsm-wac-text);
	font-size: 14.5px;
	font-weight: 500;
	line-height: 1.35;
	text-align: left;
	white-space: normal;
	transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.lsm-wac.lsm-wac .lsm-wac-choice::after {
	content: "";
	flex: none;
	width: 8px; height: 8px;
	border-top: 2px solid currentColor;
	border-right: 2px solid currentColor;
	transform: rotate(45deg);
	opacity: .35;
	transition: opacity .15s ease, transform .15s ease;
}
.lsm-wac.lsm-wac .lsm-wac-choice:hover,
.lsm-wac.lsm-wac .lsm-wac-choice:focus-visible {
	border-color: var(--lsm-wac-color-line);
	background: var(--lsm-wac-color-soft);
	color: var(--lsm-wac-text);
}
.lsm-wac.lsm-wac .lsm-wac-choice:hover::after { opacity: .8; transform: translateX(2px) rotate(45deg); }
.lsm-wac.lsm-wac .lsm-wac-choice:active { transform: scale(.99); }

/* Wizard: Link-Button im Ergebnis */
.lsm-wac.lsm-wac .lsm-wac-cta {
	align-self: flex-start;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 18px;
	border-radius: 999px;
	background: var(--lsm-wac-text);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	animation: lsm-wac-msg .3s ease-out;
	transition: background .15s ease;
}
.lsm-wac.lsm-wac .lsm-wac-cta::after { content: "→"; }
.lsm-wac.lsm-wac .lsm-wac-cta:hover { background: #000; color: #fff; }

/* --------------------------------------------------------------------------
   Ansprechpartner-Liste (Panel, Wizard, Shortcode)
   -------------------------------------------------------------------------- */
.lsm-wac .lsm-wac-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lsm-wac .lsm-wac-list li { margin: 0; padding: 0; list-style: none; }
.lsm-wac .lsm-wac-agents-wrap { animation: lsm-wac-msg .3s ease-out; }

.lsm-wac.lsm-wac .lsm-wac-agent {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	border: 1px solid var(--lsm-wac-line);
	border-radius: 14px;
	background: #fff;
	color: var(--lsm-wac-text);
	transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.lsm-wac.lsm-wac .lsm-wac-agent:hover,
.lsm-wac.lsm-wac .lsm-wac-agent:focus-visible {
	border-color: var(--lsm-wac-color-line);
	box-shadow: 0 4px 14px rgba(0, 0, 0, .07);
	transform: translateY(-1px);
	color: var(--lsm-wac-text);
}

.lsm-wac .lsm-wac-avatar { position: relative; width: 46px; height: 46px; flex: none; }
.lsm-wac .lsm-wac-avatar img,
.lsm-wac .lsm-wac-initial {
	width: 46px; height: 46px;
	border-radius: 50%;
	object-fit: cover;
	display: block;
	margin: 0;
}
.lsm-wac .lsm-wac-initial {
	display: grid;
	place-items: center;
	background: var(--lsm-wac-color-soft);
	color: var(--lsm-wac-color-dark);
	font-weight: 700;
	font-size: 18px;
}
.lsm-wac .lsm-wac-dot {
	position: absolute; right: 0; bottom: 0;
	width: 13px; height: 13px;
	border-radius: 50%;
	border: 2.5px solid #fff;
	background: #34c759;
}
.lsm-wac .is-offline .lsm-wac-dot { background: #aeaeb2; }

.lsm-wac .lsm-wac-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.lsm-wac .lsm-wac-info strong { font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--lsm-wac-text); }
.lsm-wac .lsm-wac-role { font-size: 12.5px; line-height: 1.35; color: var(--lsm-wac-muted); }
.lsm-wac .lsm-wac-status { margin-top: 3px; font-size: 12px; font-weight: 500; color: #248a3d; }
.lsm-wac .is-offline .lsm-wac-status { color: var(--lsm-wac-muted); }

.lsm-wac .lsm-wac-agent-icon {
	flex: none;
	width: 36px; height: 36px;
	padding: 8px;
	border-radius: 50%;
	background: var(--lsm-wac-color);
	color: #fff;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.lsm-wac .lsm-wac-footer {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 12px 16px;
	border-top: 1px solid var(--lsm-wac-line);
	background: #fff;
}
.lsm-wac.lsm-wac .lsm-wac-link-btn {
	padding: 6px 4px;
	color: var(--lsm-wac-muted);
	font-size: 13px;
	font-weight: 500;
	white-space: nowrap;
	transition: color .15s ease;
}
.lsm-wac.lsm-wac .lsm-wac-link-btn:hover { color: var(--lsm-wac-text); background: none; }
.lsm-wac.lsm-wac .lsm-wac-direct {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 9px 14px;
	border-radius: 999px;
	background: var(--lsm-wac-color);
	color: #fff;
	font-size: 13.5px;
	font-weight: 600;
	white-space: nowrap;
	transition: background .15s ease;
}
.lsm-wac.lsm-wac .lsm-wac-direct:hover { background: var(--lsm-wac-color-dark); color: #fff; }
.lsm-wac .lsm-wac-direct-icon { width: 18px; height: 18px; flex: none; }

/* --------------------------------------------------------------------------
   Shortcode
   -------------------------------------------------------------------------- */
.lsm-wac--inline { max-width: 480px; }

/* --------------------------------------------------------------------------
   Mobil
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
	.lsm-wac--right, .lsm-wac--left { bottom: max(14px, calc(var(--lsm-wac-offset) - 6px)); }
	.lsm-wac--right { right: 14px; }
	.lsm-wac--left  { left: 14px; }
	.lsm-wac.lsm-wac .lsm-wac-toggle { width: 58px; height: 58px; padding: 0; justify-content: center; }
	.lsm-wac .lsm-wac-toggle > span:not(.screen-reader-text) { display: none; }
	.lsm-wac .lsm-wac-panel {
		width: calc(100vw - 28px);
		max-height: calc(100dvh - var(--lsm-wac-offset) - 96px);
	}
}

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