/* 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;
	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: 60px; height: 60px; 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); }
.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; }

/* Window */
.brita-bot__window {
	position: absolute; bottom: 74px;
	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 - 110px);
	max-height: calc(100dvh - 110px);
	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 {
	/* 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; 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: 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: 88px;
		width: auto;
		max-width: none;
		/* Feste, an die Bildschirmhöhe gebundene Höhe statt auto. */
		height: calc(100vh - 104px);
		height: calc(100dvh - 104px);
		max-height: none;
		border-radius: 16px;
	}
}
