/*
	chat/chatbot.css – Chat-Widget Gästehaus Lechner
	Farben oben in den Variablen an die Seite anpassen.
	Alle Buttons setzen ihre Werte selbst, weil faq.php ein globales
	button { display:block; margin:8px auto; … } hat.
*/

.chatbot-knopf,
.chatbot {
	--chatbot-akzent: #6c6f7c;		/* Hauptfarbe */
	--chatbot-akzent-text: #fff;
	--chatbot-grund: #fff;
	--chatbot-text: #222;
	--chatbot-gast: #e3eee8;
	--chatbot-bot: #f2f2ef;
	--chatbot-rand: #c9ccc7;
}

.chatbot-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}


/* ---------- Öffnen-Knopf ---------- */

.chatbot-knopf {
	position: fixed;
	right: max(1rem, env(safe-area-inset-right));
	bottom: max(1rem, env(safe-area-inset-bottom));
	z-index: 5;		/* über #kopf (4) */
	display: flex;
	align-items: center;
	gap: 0.4em;
	min-height: 48px;
	margin: 0;
	padding: 0.6em 1.1em;
	border: 1px solid #fff;
	border-radius: 2em;
	background: var(--chatbot-akzent);
	color: var(--chatbot-akzent-text);
	font: inherit;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.2;
	box-shadow: 0 2px 10px rgb(0 0 0 / 0.25);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.chatbot-knopf[hidden] {
	display: none;
}

/* Erstes Einblenden: von unten hereingleiten */
.chatbot-knopf-neu {
	animation: chatbot-rein 0.5s ease-out both;
}

@keyframes chatbot-rein {
	from {
		opacity: 0;
		transform: translateY(1.5rem);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.chatbot-knopf-neu {
		animation: none;
	}
}

.chatbot-knopf svg {
	flex: none;
	width: 1.3em;
	height: 1.3em;
}

.chatbot-knopf:focus-visible {
	outline: 3px solid var(--chatbot-akzent);
	outline-offset: 3px;
}

/* Hover nur bei echter Maus – auf iOS bleibt :hover sonst nach dem Tippen hängen */
@media (hover: hover) {
	.chatbot-knopf:hover,
	.chatbot .chatbot-start:hover,
	.chatbot .chatbot-senden:hover:not(:disabled) {
		background: #66b473;
	}
}

.chatbot-knopf:active {
	opacity: 0.8;
}


/* ---------- Dialog ---------- */

.chatbot {
	position: fixed;
	inset: auto max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) auto;
	box-sizing: border-box;
	width: var(--chatbot-w, min(26rem, calc(100vw - 2rem)));		/* --chatbot-w/-hd setzt der Griff */
	height: var(--chatbot-hd, min(38rem, calc(100dvh - 2rem)));
	max-width: calc(100vw - 2rem);
	max-height: calc(100dvh - 2rem);
	margin: 0;
	padding: 0;
	overflow: hidden;
	border: 1px solid var(--chatbot-rand);
	border-radius: 12px;
	background: var(--chatbot-grund);
	color: var(--chatbot-text);
	font-size: 1rem;
	line-height: 1.45;
	text-align: left;
	box-shadow: 0 6px 30px rgb(0 0 0 / 0.3);
}

.chatbot::backdrop {
	background: rgb(0 0 0 / 0.25);
}

/* Seite dahinter nicht mitscrollen (vor allem iOS) */
html:has(.chatbot[open]) {
	overflow: hidden;
}

.chatbot-innen {
	position: relative;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	height: 100%;
}

/* Mobil: ganzer Bildschirm. Höhe und Lage folgen per JS dem sichtbaren
   Bereich (visualViewport), damit die iOS-Tastatur nichts verdeckt. */
@media (max-width: 600px) {
	.chatbot {
		inset: var(--chatbot-top, 0px) 0 auto 0;
		width: 100%;
		height: var(--chatbot-h, 100dvh);
		max-width: none;
		max-height: none;
		border: 0;
		border-radius: 0;
	}

	.chatbot-innen {
		padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
	}
}


/* ---------- Kopf ---------- */

.chatbot-kopf {
	display: flex;
	flex: none;
	align-items: center;
	gap: 0.5em;
	padding: 0.4em;
	background: var(--chatbot-akzent);
	color: var(--chatbot-akzent-text);
}

.chatbot .chatbot-kopf h2 {
	flex: 1;
	margin: 0;
	padding: 0;
	color: inherit;
	font-family: inherit;
	font-size: 1.1em;
	line-height: 1.3;
	text-align: left;
}

.chatbot .chatbot-zu {
	display: grid;
	place-items: center;
	flex: none;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 1.8em;
	line-height: 1;
	cursor: pointer;
}

.chatbot .chatbot-zu:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: -4px;
}


/* Größenänderung: Griff links im Kopf, weil das Fenster unten rechts verankert ist */
.chatbot .chatbot-griff {
	display: grid;
	place-items: center;
	flex: none;
	width: 36px;
	height: 36px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: inherit;
	opacity: 0.75;
	cursor: nwse-resize;
	touch-action: none;
}

.chatbot .chatbot-griff svg {
	width: 20px;
	height: 20px;
}

.chatbot .chatbot-griff:hover {
	opacity: 1;
	background: rgb(255 255 255 / 0.15);
}

.chatbot .chatbot-griff:focus-visible {
	opacity: 1;
	outline: 2px solid currentColor;
	outline-offset: -2px;
}

@media (max-width: 600px), (pointer: coarse) {
	.chatbot .chatbot-griff {
		display: none;
	}

	.chatbot-kopf {
		padding-left: 1em;
	}
}


/* ---------- Verlauf ---------- */

.chatbot-verlauf {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 0.6em;
	min-height: 0;
	padding: 1em;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.chatbot-verlauf:focus-visible {
	outline: 3px solid var(--chatbot-akzent);
	outline-offset: -3px;
}

.chatbot-msg {
	max-width: 88%;
	padding: 0.55em 0.85em;
	border-radius: 12px;
}

.chatbot-msg p,
.chatbot-msg ul {
	margin: 0 0 0.5em;
}

.chatbot-msg > :last-child {
	margin-bottom: 0;
}

.chatbot-msg p {
	white-space: pre-line;
	overflow-wrap: break-word;
}

.chatbot-msg ul {
	padding: 0 0 0 1.1em;
	list-style: none;
}

.chatbot-msg li {
	position: relative;
	margin: 0.2em 0;
	padding: 0;
	background: none;
	overflow-wrap: break-word;
}

/* eigener Punkt, weil Seiten-CSS Listen oft umgestaltet */
.chatbot-msg li::before {
	content: "";
	position: absolute;
	top: 0.62em;
	left: -0.85em;
	width: 0.35em;
	height: 0.35em;
	border-radius: 50%;
	background: var(--chatbot-akzent);
}

.chatbot-msg a.chatbot-kontakt {
	white-space: nowrap;
}

.chatbot-gast {
	align-self: flex-end;
	background: var(--chatbot-gast);
	border-bottom-right-radius: 3px;
}

.chatbot-bot {
	align-self: flex-start;
	background: var(--chatbot-bot);
	border-bottom-left-radius: 3px;
}

.chatbot-fehler {
	align-self: flex-start;
	background: #fdecea;
	color: #8a1c12;
}

.chatbot-msg a {
	color: #3F51B5;
	text-decoration: none;
	font-size: .9em;
	font-weight: bold;
}

.chatbot-fehler a {
	color: inherit;
}

.chatbot-warte p {
	animation: chatbot-puls 1.2s ease-in-out infinite;
}

@keyframes chatbot-puls {
	50% {
		opacity: 0.35;
	}
}

@media (prefers-reduced-motion: reduce) {
	.chatbot-warte p {
		animation: none;
	}
}


/* ---------- Datenschutzhinweis ---------- */

.chatbot-hinweis {
	flex: none;
	padding: 1em;
	border-top: 1px solid var(--chatbot-rand);
	font-size: 0.9em;
}

.chatbot-hinweis[hidden] {
	display: none;
}

.chatbot-hinweis p {
	margin: 0 0 0.75em;
}

.chatbot-hinweis a {
	color: var(--chatbot-akzent);
}

.chatbot .chatbot-start {
	display: block;
	width: 100%;
	min-height: 44px;
	margin: 0;
	padding: 0.5em 1em;
	border: 0;
	border-radius: 8px;
	background: var(--chatbot-akzent);
	color: var(--chatbot-akzent-text);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}


/* ---------- Eingabe ---------- */

.chatbot-form {
	display: flex;
	flex: none;
	align-items: flex-end;
	gap: 0.5em;
	margin: 0;
	padding: 0.6em;
	border-top: 1px solid var(--chatbot-rand);
}

.chatbot-form[hidden] {
	display: none;
}

.chatbot-form textarea {
	flex: 1;
	box-sizing: border-box;
	min-width: 0;
	min-height: 44px;
	max-height: 8em;
	field-sizing: content;
	margin: 0;
	padding: 0.55em 0.7em;
	border: 1px solid #767676;
	border-radius: 8px;
	background: #fff;
	color: inherit;
	font: inherit;
	font-size: 16px;		/* verhindert Auto-Zoom auf iOS */
	resize: none;
}

.chatbot-form textarea:focus-visible {
	outline: 2px solid var(--chatbot-akzent);
	outline-offset: 1px;
}

.chatbot .chatbot-senden {
	flex: none;
	min-height: 44px;
	margin: 0;
	padding: 0.5em 1em;
	border: 0;
	border-radius: 8px;
	background: var(--chatbot-akzent);
	color: var(--chatbot-akzent-text);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.chatbot .chatbot-senden:disabled {
	opacity: 0.5;
	cursor: wait;
}

.chatbot .chatbot-start:focus-visible,
.chatbot .chatbot-senden:focus-visible,
.chatbot .chatbot-neu:focus-visible {
	outline: 3px solid var(--chatbot-akzent);
	outline-offset: 2px;
}


/* ---------- Fuß ---------- */

.chatbot-fuss {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: space-between;
	gap: 0.5em;
	margin: 0;
	padding: 0 0.8em 0.3em;
	color: #555;
	font-size: 0.8em;
}

.chatbot .chatbot-neu {
	min-height: 32px;
	margin: 0;
	padding: 0.3em;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}