/* Brita Chatbot – Frontend Widget v2.2.3 */

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

.brita-bot {
	--brita-bot-accent: #2563eb;
	--brita-bot-accent-2: #1e40af;
	position: fixed;
	bottom: 24px;
	z-index: 99990;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.brita-bot[data-position="right"] { right: 24px; }
.brita-bot[data-position="left"]  { left: 24px; }

/* ── Launcher ─────────────────────────────────────────────────────────── */
.brita-bot__launcher {
	width: 72px; height: 72px; 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 8px 30px rgba(0,0,0,.32), 0 2px 8px rgba(0,0,0,.18);
	display: flex; align-items: center; justify-content: center;
	transition: transform .2s, box-shadow .2s;
	position: relative;
	/* Puls-Animation startet sofort */
	animation: britaPulse 3s ease-in-out infinite;
}
.brita-bot__launcher:hover {
	transform: translateY(-3px) scale(1.06);
	box-shadow: 0 14px 36px rgba(0,0,0,.36), 0 2px 8px rgba(0,0,0,.18);
	animation: none;
}

/* Zwei Pulsringe hinter dem Button */
.brita-bot__launcher::before,
.brita-bot__launcher::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--brita-bot-accent);
	opacity: 0;
	z-index: -1;
}
.brita-bot__launcher::before { animation: britaRing 3s ease-out infinite; }
.brita-bot__launcher::after  { animation: britaRing 3s ease-out .9s infinite; }

@keyframes britaRing {
	0%   { transform: scale(1);   opacity: .55; }
	100% { transform: scale(2.1); opacity: 0;   }
}
@keyframes britaPulse {
	0%, 100% { box-shadow: 0 8px 30px rgba(0,0,0,.32), 0 0 0  0px rgba(37,99,235,.55); }
	50%       { box-shadow: 0 8px 30px rgba(0,0,0,.32), 0 0 0 10px rgba(37,99,235,0);   }
}

.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; }

/* ── Sprech-Label (erscheint nach 1,8 s, verschwindet nach 7 s) ──────── */
.brita-bot__label {
	position: absolute;
	bottom: 16px;
	background: #fff;
	color: #1f2330;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	padding: 10px 15px;
	border-radius: 22px;
	box-shadow: 0 6px 24px rgba(0,0,0,.20), 0 1px 4px rgba(0,0,0,.10);
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	/* Einblenden bei 1,8 s, Ausblenden bei 7 s */
	animation: britaLabelIn .4s ease 1.8s forwards, britaLabelOut .4s ease 7s forwards;
}

/* Pfeil-Spitze zeigt zur Schaltfläche */
.brita-bot[data-position="right"] .brita-bot__label {
	right: 84px;
	transform: translateX(10px);
	animation: britaLabelInR .4s ease 1.8s forwards, britaLabelOutR .4s ease 7s forwards;
}
.brita-bot[data-position="right"] .brita-bot__label::after {
	content: '';
	position: absolute;
	right: -10px; top: 50%; transform: translateY(-50%);
	border: 10px solid transparent;
	border-right: 0;
	border-left-color: #fff;
}

.brita-bot[data-position="left"] .brita-bot__label {
	left: 84px;
	transform: translateX(-10px);
	animation: britaLabelInL .4s ease 1.8s forwards, britaLabelOutL .4s ease 7s forwards;
}
.brita-bot[data-position="left"] .brita-bot__label::after {
	content: '';
	position: absolute;
	left: -10px; top: 50%; transform: translateY(-50%);
	border: 10px solid transparent;
	border-left: 0;
	border-right-color: #fff;
}

@keyframes britaLabelInR  { to { opacity: 1; transform: translateX(0); } }
@keyframes britaLabelOutR { to { opacity: 0; transform: translateX(10px); } }
@keyframes britaLabelInL  { to { opacity: 1; transform: translateX(0); } }
@keyframes britaLabelOutL { to { opacity: 0; transform: translateX(-10px); } }

/* Alias für den seltenen Fall ohne data-position */
@keyframes britaLabelIn  { to { opacity: 1; transform: translateX(0); } }
@keyframes britaLabelOut { to { opacity: 0; } }

/* Label verstecken, sobald Chat offen */
.brita-bot.is-open .brita-bot__label { display: none; }

/* ── Window ───────────────────────────────────────────────────────────── */
.brita-bot__window {
	position: absolute; bottom: 82px;
	width: 360px; max-width: calc(100vw - 32px);
	height: 520px;
	max-height: calc(100vh - 120px);
	max-height: calc(100dvh - 120px);
	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; }

/* ── 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;
}
.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__msg p { margin: 0 0 8px; }
.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 ─────────────────────────────────────── */
.brita-bot__suggestions {
	flex-shrink: 0;
	display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 6px; background: #f7f8fc;
}
.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; cursor: pointer; transition: all .15s;
}
.brita-bot__chip:hover { background: var(--brita-bot-accent); color: #fff; }

/* ── Form ─────────────────────────────────────────────────────────────── */
.brita-bot__form { flex-shrink: 0; display: flex; gap: 8px; padding: 12px 14px 6px; border-top: 1px solid #eceef5; background: #fff; }
.brita-bot__input {
	flex: 1 1 auto; min-width: 0; border: 1px solid #dfe2ec; border-radius: 22px; padding: 10px 16px; font-size: 16px; outline: none;
}
.brita-bot__input:focus { border-color: var(--brita-bot-accent); }
.brita-bot__send {
	width: 42px; height: 42px; 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__footnote { font-size: 11px; color: #9aa0ad; text-align: center; margin: 4px 0 10px; padding: 0 14px; }

/* ── Mobil ────────────────────────────────────────────────────────────── */
@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: 96px;
		width: auto;
		max-width: none;
		height: calc(100vh - 112px);
		height: calc(100dvh - 112px);
		max-height: none;
		border-radius: 16px;
	}
}
