/* Webbaukasten – Support-Chat */
.wbk-chat {
	--c-primary: #16324f;
	--c-accent: #1f7a6d;
	--c-ink: #1d2433;
	--c-muted: #5b6577;
	--c-line: #e3e8ef;
	--c-bg: #ffffff;
	--c-soft: #f3f6f9;
	--c-on: #fff;
	--c-on2: #fff;
	--c-offx: 20px;
	--c-offy: 20px;
	position: fixed; right: var(--c-offx); bottom: var(--c-offy); z-index: 99990;
	font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--c-ink);
}
.wbk-chat *, .wbk-chat *::before, .wbk-chat *::after { box-sizing: border-box; }
.wbk-chat.is-embedded { position: static; transform: none !important; top: auto !important; left: auto !important; right: auto !important; bottom: auto !important; }

.wbk-chat-bubble {
	display: inline-flex; align-items: center; gap: 8px;
	border: 0; border-radius: 999px; padding: 12px 18px;
	background: var(--c-primary); color: var(--c-on); font-weight: 600; font-size: 15px; cursor: pointer;
	box-shadow: 0 8px 24px rgba(22, 50, 79, .28);
}
.wbk-chat-bubble svg { width: 20px; height: 20px; }
.wbk-chat-bubble:hover { filter: brightness(1.12); }
.wbk-chat-bubble:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; }
.wbk-chat.is-open:not(.is-embedded) .wbk-chat-bubble { display: none; }

.wbk-chat-panel {
	display: none; flex-direction: column;
	width: 380px; max-width: calc(100vw - 32px); height: 580px; max-height: calc(100vh - 40px);
	background: var(--c-bg); border: 1px solid var(--c-line); border-radius: 16px; overflow: hidden;
	box-shadow: 0 16px 48px rgba(16, 24, 40, .22);
}
.wbk-chat.is-open .wbk-chat-panel { display: flex; }
.wbk-chat.is-embedded .wbk-chat-panel { width: 100%; max-width: 760px; height: 560px; box-shadow: none; }

.wbk-chat-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: var(--c-primary); color: var(--c-on); }
.wbk-chat-head strong { display: block; font-size: 15px; }
.wbk-chat-ai { font-size: 12px; opacity: .8; }
.wbk-chat-head-actions { display: flex; gap: 2px; }
.wbk-chat-head-actions button { background: transparent; border: 0; color: inherit; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; cursor: pointer; width: 32px; height: 32px; border-radius: 8px; line-height: 1; }
.wbk-chat-head-actions button:hover { background: rgba(255, 255, 255, .15); }

.wbk-chat-body { flex: 1; overflow-y: auto; padding: 16px; background: var(--c-soft); display: flex; flex-direction: column; gap: 10px; }
.wbk-chat-msg { max-width: 86%; padding: 10px 14px; border-radius: 14px; word-wrap: break-word; }
.wbk-chat-msg p { margin: 0 0 6px; }
.wbk-chat-msg p:last-child { margin-bottom: 0; }
.wbk-chat-msg ul, .wbk-chat-msg ol { margin: 4px 0 6px 18px; padding: 0; }
.wbk-chat-msg a { color: var(--c-primary); }
.wbk-chat-msg.assistant { align-self: flex-start; background: var(--c-bg); border: 1px solid var(--c-line); border-bottom-left-radius: 4px; }
.wbk-chat-msg.user { align-self: flex-end; background: var(--c-accent); color: var(--c-on2); border-bottom-right-radius: 4px; }
.wbk-chat-msg.typing p { animation: wbk-pulse 1s infinite; letter-spacing: 2px; }
.wbk-chat-msg.error { background: #fdecea; border-color: #f5c2bd; color: #8a1c12; }
@keyframes wbk-pulse { 50% { opacity: .3; } }

.wbk-chat-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--c-line); background: var(--c-bg); }
.wbk-chat-form textarea { flex: 1; resize: none; border: 1px solid var(--c-line); background: var(--c-bg); color: var(--c-ink); border-radius: 10px; padding: 9px 12px; font: inherit; max-height: 120px; }
.wbk-chat-form textarea:focus { outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 2px rgba(31, 122, 109, .15); }
.wbk-chat-form button { width: 42px; border: 0; border-radius: 10px; background: var(--c-accent); color: var(--c-on2); font-size: 16px; cursor: pointer; }
.wbk-chat-form button:disabled { opacity: .5; cursor: default; }

.wbk-chat-foot { padding: 8px 14px 12px; background: var(--c-bg); font-size: 11px; color: var(--c-muted); line-height: 1.4; }
.wbk-chat-foot a { color: var(--c-muted); }
.wbk-chat-human { display: block; background: none; border: 0; padding: 0 0 6px; color: var(--c-primary); font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: underline; }

.wbk-chat-handover { padding: 12px 14px; border-top: 1px solid var(--c-line); background: #fffaf0; }
.wbk-ho-form { display: flex; flex-direction: column; gap: 6px; }
.wbk-ho-form input, .wbk-ho-form textarea { border: 1px solid #cfd6e0; border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 14px; }
.wbk-ho-actions { display: flex; gap: 8px; }
.wbk-ho-actions button { border: 0; border-radius: 8px; padding: 8px 12px; cursor: pointer; font-weight: 600; }
.wbk-ho-actions button[type=submit] { background: var(--c-primary); color: var(--c-on); }
.wbk-ho-actions .wbk-ho-cancel { background: #eef1f5; color: var(--c-ink); }
.wbk-ho-form small { color: var(--c-muted); }
.wbk-ho-ok { margin: 0; color: var(--c-primary); font-weight: 600; }

/* Positionen */
.wbk-chat--bl { right: auto; left: var(--c-offx); }
.wbk-chat--mr, .wbk-chat--ml { bottom: auto; top: 50%; transform: translateY(-50%); }
.wbk-chat--mr { right: 0; }
.wbk-chat--ml { right: auto; left: 0; }
.wbk-chat--mr.is-open, .wbk-chat--ml.is-open { right: 12px; }
.wbk-chat--ml.is-open { right: auto; left: 12px; }
.wbk-chat--mr:not(.is-open) .wbk-chat-bubble, .wbk-chat--ml:not(.is-open) .wbk-chat-bubble { writing-mode: vertical-rl; padding: 16px 11px; border-radius: 12px 0 0 12px; }
.wbk-chat--ml:not(.is-open) .wbk-chat-bubble { border-radius: 0 12px 12px 0; transform: rotate(180deg); }
.wbk-chat--mr .wbk-chat-bubble svg, .wbk-chat--ml .wbk-chat-bubble svg { transform: rotate(90deg); }
.wbk-chat--ml .wbk-chat-panel { order: -1; }
/* Knopf-Formen */
.wbk-chat--btn-round .wbk-chat-bubble { width: 60px; height: 60px; padding: 0; justify-content: center; }
.wbk-chat--btn-round .wbk-chat-bubble span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.wbk-chat--btn-round .wbk-chat-bubble svg { width: 26px; height: 26px; }
.wbk-chat--btn-square .wbk-chat-bubble { border-radius: 8px; }
.wbk-chat-no { font-weight: 600; letter-spacing: .5px; }

@media (max-width: 480px) {
	.wbk-chat--br:not(.is-embedded) { right: 12px; bottom: 12px; }
	.wbk-chat--bl:not(.is-embedded) { left: 12px; bottom: 12px; }
	.wbk-chat:not(.is-embedded).is-open { transform: none; }
	.wbk-chat:not(.is-embedded).is-open { left: 0; right: 0; bottom: 0; top: 0; }
	.wbk-chat:not(.is-embedded) .wbk-chat-panel { width: 100%; max-width: none; height: 100%; max-height: none; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) { .wbk-chat-msg.typing p { animation: none; } }

/* Chat in der Sticky-Bar (FischerS WP-Tool): eigener Knopf entfällt, Fenster öffnet neben der Leiste */
.wbk-chat.in-sticky .wbk-chat-bubble { display: none; }
.wbk-chat.in-sticky.wbk-chat--mr, .wbk-chat.in-sticky.wbk-chat--ml { top: auto; bottom: var(--c-offy); transform: none; }
.wbk-chat.in-sticky.wbk-chat--mr { right: var(--c-offx); }
.wbk-chat.in-sticky.wbk-chat--ml { left: var(--c-offx); right: auto; }
.wbk-chat.in-sticky.is-open .wbk-chat-panel { animation: wbk-chat-pop .18s ease-out; }
.wbk-chat.is-open { z-index: 2147482000; }
@keyframes wbk-chat-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.fomrl-sticky a[href$="#ki-chat"] { position: relative; }
.fomrl-sticky a[href$="#ki-chat"]::after { content: ""; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 2px rgba(255, 255, 255, .9); }
.fomrl-sticky a[href$="#ki-chat"].is-chat-open::after { display: none; }
@media (prefers-reduced-motion: reduce) { .wbk-chat.in-sticky.is-open .wbk-chat-panel { animation: none; } }
.fomrl-sticky .fomrl-ico.wbk-ico-ki { background-color: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h11a1 1 0 0 1 0 2H5v10h1a1 1 0 0 1 1 1v1.6l2.4-2.3a1 1 0 0 1 .7-.3H19v-4a1 1 0 1 1 2 0v5a1 1 0 0 1-1 1h-9.5l-3.8 3.6A1 1 0 0 1 5 21v-3H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1z'/%3E%3Cpath d='M18 1.5l1 2.5 2.5 1-2.5 1-1 2.5-1-2.5-2.5-1 2.5-1z'/%3E%3Ccircle cx='9' cy='11' r='1.3'/%3E%3Ccircle cx='13' cy='11' r='1.3'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h11a1 1 0 0 1 0 2H5v10h1a1 1 0 0 1 1 1v1.6l2.4-2.3a1 1 0 0 1 .7-.3H19v-4a1 1 0 1 1 2 0v5a1 1 0 0 1-1 1h-9.5l-3.8 3.6A1 1 0 0 1 5 21v-3H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1z'/%3E%3Cpath d='M18 1.5l1 2.5 2.5 1-2.5 1-1 2.5-1-2.5-2.5-1 2.5-1z'/%3E%3Ccircle cx='9' cy='11' r='1.3'/%3E%3Ccircle cx='13' cy='11' r='1.3'/%3E%3C/svg%3E") center / contain no-repeat; }
