/* Brita Chatbot – Frontend Widget */

.brita-bot, .brita-bot * { box-sizing: border-box; }

.brita-bot {
	--brita-bot-accent: #2563eb;
	--brita-bot-accent-2: #1e40af;
	position: fixed;
	bottom: 24px;
	/* Gemessen auf der Zielseite (05.10.2026): hoechster Divi-Wert 999999
	   (#et-ajax-saving, et-safe-mode-indicator), wpadminbar 110000, SureCookie
	   Overlay 2147483645, Banner 2147483646, Modal 2147483647. 999000 liegt ueber
	   dem Seitenaufbau und der Admin-Bar, unter dem SureCookie-Banner. */
	z-index: 999000;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	/* Nicht die Zeilenhöhe des Themes erben (Divi: ca. 1,9). */
	line-height: 1.45;
}
.brita-bot[data-position="right"] { right: 24px; }
.brita-bot[data-position="left"]  { left: 24px; }

/* Launcher */
.brita-bot__launcher {
	position: relative;
	width: 64px; height: 64px; border-radius: 50%; border: none; cursor: pointer;
	background: linear-gradient(135deg, var(--brita-bot-accent), var(--brita-bot-accent-2));
	color: #fff; box-shadow: 0 10px 26px rgba(143,51,87,.4);
	display: flex; align-items: center; justify-content: center;
	transition: transform .2s, box-shadow .2s;
}
.brita-bot__launcher:hover { transform: translateY(-2px) scale(1.04); }
/* Vor der JS-Initialisierung (z. B. Delay-JS) wäre der Button wirkungslos: unsichtbar, aber Platz bleibt reserviert. */
.brita-bot:not(.brita-bot--ready) .brita-bot__launcher { visibility: hidden; }
.brita-bot__icon-close { display: none; }
.brita-bot.is-open .brita-bot__icon-chat { display: none; }
.brita-bot.is-open .brita-bot__icon-close { display: block; }

/* Hinweis: Sprechblase und Puls (nur mit .brita-bot--hint) */
.brita-bot__label {
	position: absolute; bottom: 12px;
	max-width: calc(100vw - 120px); width: max-content;
	background: #fff; color: #1f2330;
	font-size: 14px; font-weight: 600; line-height: 1.35;
	padding: 10px 15px; border-radius: 18px;
	box-shadow: 0 6px 24px rgba(0,0,0,.2), 0 1px 4px rgba(0,0,0,.1);
	white-space: normal; pointer-events: none;
	opacity: 0; visibility: hidden;
	/* Erscheint nach 1,8 s, blendet nach 8 s aus (Gesamtdauer 8 s). */
}
.brita-bot--hint.brita-bot--ready .brita-bot__label { animation: britaLabel 8s linear 1 both; }
.brita-bot[data-position="right"] .brita-bot__label { right: 76px; --brita-shift: 10px; }
.brita-bot[data-position="left"]  .brita-bot__label { left: 76px;  --brita-shift: -10px; }
.brita-bot__label::after {
	content: ""; position: absolute; top: 50%; transform: translateY(-50%);
	border: 8px solid transparent;
}
.brita-bot[data-position="right"] .brita-bot__label::after { right: -8px; border-right: 0; border-left-color: #fff; }
.brita-bot[data-position="left"]  .brita-bot__label::after { left: -8px;  border-left: 0;  border-right-color: #fff; }
@keyframes britaLabel {
	0%, 22.5% { opacity: 0; visibility: visible; transform: translateX(var(--brita-shift, 10px)); }
	27.5%, 94.9% { opacity: 1; visibility: visible; transform: none; }
	99.9% { opacity: 0; visibility: visible; transform: none; }
	100% { opacity: 0; visibility: hidden; transform: none; }
}
/* Ein einziger Ring, höchstens drei Durchläufe. Start erst nach JS-Init. */
.brita-bot--hint .brita-bot__launcher::before {
	content: ""; position: absolute; inset: 0; border-radius: 50%;
	border: 2px solid var(--brita-bot-accent);
	pointer-events: none; opacity: 0;
}
.brita-bot--hint.brita-bot--ready .brita-bot__launcher::before { animation: britaRing 2.4s ease-out 1.8s 3 both; }
@keyframes britaRing {
	0% { opacity: .55; transform: scale(1); }
	100% { opacity: 0; transform: scale(1.55); }
}
.brita-bot.is-open .brita-bot__label,
.brita-bot.is-seen .brita-bot__label { display: none; }
.brita-bot.is-open .brita-bot__launcher::before,
.brita-bot.is-seen .brita-bot__launcher::before { animation: none; opacity: 0; }

/* Window */
.brita-bot__window {
	position: absolute; bottom: 78px;
	width: 360px; max-width: calc(100vw - 32px);
	/* Höhe nie größer als der sichtbare Bereich; dvh berücksichtigt mobile Browserleisten. */
	height: 520px;
	max-height: calc(100vh - 114px);
	max-height: calc(100dvh - 114px);
	background: #fff; border-radius: 18px; overflow: hidden;
	box-shadow: 0 24px 64px rgba(0,0,0,.22);
	display: flex; flex-direction: column;
	opacity: 0; transform: translateY(16px) scale(.97); pointer-events: none;
	transition: opacity .22s, transform .22s;
}
.brita-bot[data-position="right"] .brita-bot__window { right: 0; }
.brita-bot[data-position="left"]  .brita-bot__window { left: 0; }
.brita-bot.is-open .brita-bot__window { opacity: 1; transform: none; pointer-events: auto; }
/* display:flex oben würde das hidden-Attribut sonst überstimmen. */
.brita-bot__window[hidden] { display: none; }

/* Head */
.brita-bot__head {
	flex-shrink: 0;
	display: flex; align-items: center; gap: 12px; padding: 16px 18px;
	background: linear-gradient(135deg, var(--brita-bot-accent), var(--brita-bot-accent-2));
	color: #fff;
}
.brita-bot__avatar {
	width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.22);
	display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px;
}
.brita-bot__head-text { flex: 1; line-height: 1.3; }
.brita-bot__head-text strong { display: block; font-size: 15px; }
.brita-bot__status { font-size: 11px; opacity: .85; }
.brita-bot__status::before { content: "●"; color: #7bed9f; margin-right: 5px; font-size: 9px; vertical-align: middle; }
.brita-bot__min { background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; line-height: 1; opacity: .9; }
.brita-bot__min:hover { opacity: 1; }

/* Messages */
.brita-bot__messages {
	flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
	padding: 18px; display: flex; flex-direction: column; gap: 10px;
	background: #f7f8fc;
	position: relative; overscroll-behavior: contain;
	/* Dünne, aber erkennbare Scrollleiste. */
	scrollbar-width: thin; scrollbar-color: #8f97ad #e6e9f2;
}
.brita-bot__messages:focus { outline: none; }
.brita-bot__messages::-webkit-scrollbar { width: 8px; }
.brita-bot__messages::-webkit-scrollbar-track { background: #e6e9f2; border-radius: 4px; }
.brita-bot__messages::-webkit-scrollbar-thumb { background: #8f97ad; border-radius: 4px; }
.brita-bot__messages::-webkit-scrollbar-thumb:hover { background: #6b7390; }
.brita-bot__msg {
	max-width: 85%; padding: 11px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5;
	animation: britaMsg .2s ease;
}
@keyframes britaMsg { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.brita-bot__msg--bot { background: #fff; border: 1px solid #eceef5; align-self: flex-start; border-bottom-left-radius: 5px; color: #1f2330; }
.brita-bot__msg--user { background: var(--brita-bot-accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 5px; }
.brita-bot .brita-bot__msg p { margin: 0 0 .5em; padding: 0; }
.brita-bot .brita-bot__msg p:last-child { margin: 0; }
.brita-bot__msg a { color: inherit; text-decoration: underline; }

.brita-bot__typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.brita-bot__typing span { width: 7px; height: 7px; border-radius: 50%; background: #c2c5d2; animation: britaBlink 1.2s infinite; }
.brita-bot__typing span:nth-child(2){ animation-delay: .2s; }
.brita-bot__typing span:nth-child(3){ animation-delay: .4s; }
@keyframes britaBlink { 0%,60%,100% { opacity: .3; } 30% { opacity: 1; } }

/* Suggestions / Quick replies */
/* Der feste Bereich wird nicht mehr befüllt (Markup bleibt aus Kompatibilität). */
.brita-bot__suggestions {
	flex-shrink: 0;
	display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 6px; background: #f7f8fc;
}
.brita-bot .brita-bot__suggestions:empty { display: none; }
.brita-bot .brita-bot__chips { display: flex; flex-wrap: wrap; gap: 6px; flex-shrink: 0; margin: 0; padding: 0; }
.brita-bot button.brita-bot__chip {
	background: #fff; border: 1px solid var(--brita-bot-accent);
	color: var(--brita-bot-accent); border-radius: 99px; padding: 6px 12px;
	font-size: 12px; line-height: 1.3; text-align: left; white-space: normal;
	cursor: pointer; transition: all .15s;
}
.brita-bot button.brita-bot__chip:hover { background: var(--brita-bot-accent); color: #fff; }

/* Form */
.brita-bot__form { flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 12px 14px 6px; border-top: 1px solid #eceef5; background: #fff; }
/* Spezifität 0,3,1: schlägt Theme-Regeln wie input[type="text"] (0,1,1). */
.brita-bot input.brita-bot__input[type="text"] {
	/* Mindestens 16px verhindert das automatische Hineinzoomen von iOS Safari
	   beim Antippen des Feldes. Kleinere Werte lösen den Zoom zwingend aus. */
	flex: 1 1 auto; min-width: 0; height: 44px; margin: 0; padding: 10px 16px;
	font-size: 16px; line-height: 1.4; background: #fff; color: #1f2330;
	border: 1px solid #dfe2ec; border-radius: 22px; box-shadow: none;
	-webkit-appearance: none; appearance: none; outline: none;
}
.brita-bot input.brita-bot__input[type="text"]:focus { border-color: var(--brita-bot-accent); }
.brita-bot__send {
	width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
	background: var(--brita-bot-accent); color: #fff; display: flex; align-items: center; justify-content: center;
	flex-shrink: 0;
}
.brita-bot__send:hover { background: var(--brita-bot-accent-2); }
.brita-bot p.brita-bot__footnote { font-size: 11px; line-height: 1.4; color: #5b6270; text-align: center; margin: 4px 0 10px; padding: 0 14px; }

/* Mobil: Fenster mit FESTER Höhe am unteren Bildschirmrand verankern.
   Eine definierte Höhe (statt height:auto) verhindert, dass das Fenster beim
   Absenden mitwächst – so bleiben Kopf oben und Eingabefeld unten immer sichtbar,
   und nur die Nachrichtenliste scrollt innen.
   Die Selektoren sprechen beide Positions-Varianten direkt an, damit sie
   die data-position-Regeln (right:0 / left:0) sicher überschreiben.
   dvh = tatsächlich sichtbarer Bereich auf Mobilgeräten (ohne Browserleisten). */
@media (max-width: 600px) {
	.brita-bot[data-position="right"] .brita-bot__window,
	.brita-bot[data-position="left"]  .brita-bot__window {
		position: fixed;
		top: auto;
		left: 10px;
		right: 10px;
		bottom: 100px;
		width: auto;
		max-width: none;
		/* Feste, an die Bildschirmhöhe gebundene Höhe statt auto. */
		height: calc(100vh - 116px);
		height: calc(100dvh - 116px);
		max-height: none;
		border-radius: 16px;
	}
}

/* Sichtbarer Tastaturfokus */
.brita-bot__launcher:focus-visible { outline: 3px solid var(--brita-bot-accent); outline-offset: 3px; box-shadow: 0 0 0 3px #fff, 0 10px 26px rgba(0,0,0,.3); }
.brita-bot__min:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 4px; }
.brita-bot button.brita-bot__chip:focus-visible,
.brita-bot button.brita-bot__send:focus-visible { outline: 2px solid var(--brita-bot-accent); outline-offset: 2px; }
.brita-bot input.brita-bot__input[type="text"]:focus-visible { outline: 2px solid var(--brita-bot-accent); outline-offset: 1px; }

/* Bewegung reduzieren: keine Animationen und Übergänge, kein Hinweis-Effekt. */
@media (prefers-reduced-motion: reduce) {
	.brita-bot, .brita-bot *, .brita-bot *::before, .brita-bot *::after {
		animation: none !important;
		transition: none !important;
	}
	/* Label ohne Bewegung: JS setzt is-hint-on von 1,8 s bis 8 s nach Init. */
	.brita-bot--hint.is-hint-on .brita-bot__label { opacity: 1; visibility: visible; transform: none; }
	.brita-bot__launcher:hover { transform: none; }
}
