/* 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;
	position: fixed; right: 20px; bottom: 20px; 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; }

.wbk-chat-bubble {
	display: inline-flex; align-items: center; gap: 8px;
	border: 0; border-radius: 999px; padding: 12px 18px;
	background: var(--c-primary); color: #fff; 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 { background: #1d4166; }
.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: #fff; }
.wbk-chat-head strong { display: block; font-size: 15px; }
.wbk-chat-ai { font-size: 12px; opacity: .8; }
.wbk-chat-head-actions button { background: transparent; border: 0; color: #fff; 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-accent); }
.wbk-chat-msg.assistant { align-self: flex-start; background: #fff; border: 1px solid var(--c-line); border-bottom-left-radius: 4px; }
.wbk-chat-msg.user { align-self: flex-end; background: var(--c-accent); color: #fff; 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: #fff; }
.wbk-chat-form textarea { flex: 1; resize: none; border: 1px solid #cfd6e0; 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: #fff; font-size: 16px; cursor: pointer; }
.wbk-chat-form button:disabled { opacity: .5; cursor: default; }

.wbk-chat-foot { padding: 8px 14px 12px; background: #fff; 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-accent); 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: #fff; }
.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-accent); font-weight: 600; }

@media (max-width: 480px) {
	.wbk-chat:not(.is-embedded) { right: 12px; bottom: 12px; }
	.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; } }
