/**
 * Oracom Chat-Launcher, fixed bottom-right widget.
 */

.oracom-chat-root {
	--oracom-panel-max-width: 380px;
	--oracom-launcher-size: 64px;
	--oracom-greeting-tail-svg-width: 27px;
	--oracom-launcher-enter-delay: 2s;
	--oracom-launcher-enter-duration: 0.55s;
	--oracom-greeting-after-launcher-pause: 2s;
	--oracom-greeting-enter-delay: calc(
		var(--oracom-launcher-enter-delay) + var(--oracom-launcher-enter-duration) +
			var(--oracom-greeting-after-launcher-pause)
	);
	--oracom-greeting-enter-duration: 0.55s;
	--oracom-greeting-bubble-width: min(340px, calc(100vw - 40px));
	/* Reserviert Zeilen für Typewriter, damit die Bubble nicht mitwächst */
	--oracom-greeting-text-min-height: calc(1.35em * 4);
	position: fixed;
	right: 0;
	bottom: 0;
	z-index: 99999;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	pointer-events: none;
	box-sizing: border-box;
}

.oracom-chat-root *,
.oracom-chat-root *::before,
.oracom-chat-root *::after {
	box-sizing: border-box;
}

@media screen and (min-width: 783px) {
	body.admin-bar .oracom-chat-root {
		bottom: 32px;
	}
}

@media screen and (max-width: 782px) {
	body.admin-bar .oracom-chat-root {
		bottom: 46px;
	}
}

.oracom-chat-backdrop {
	position: fixed;
	inset: 0;
	z-index: 1;
	background: rgba(15, 23, 42, 0.35);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.28s ease, visibility 0s linear 0.28s;
}

.oracom-chat-root.is-panel-open .oracom-chat-backdrop {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transition: opacity 0.28s ease;
}

.oracom-chat-inner {
	position: relative;
	z-index: 2;
	padding: 0 20px 20px 0;
	pointer-events: none;
}

.oracom-chat-panel {
	width: min(var(--oracom-panel-max-width), calc(100vw - 32px));
	height: min(70vh, 560px);
	max-height: min(70vh, 560px);
	margin-bottom: 12px;
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08);
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.28s ease, visibility 0s linear 0.28s;
}

.oracom-chat-root.is-panel-open .oracom-chat-panel {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transition: opacity 0.28s ease;
}

.oracom-chat-panel.oracom-chat-panel-off-flow {
	display: none;
}

.oracom-chat-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	background: linear-gradient(180deg, #f0f4ff 0%, #e8eeff 100%);
	border-bottom: 1px solid rgba(48, 58, 178, 0.12);
	flex-shrink: 0;
}

.oracom-chat-panel-title {
	margin: 0;
	font-size: 1.125rem;
	font-weight: 700;
	color: #1e1b4b;
	line-height: 1.25;
}

.oracom-chat-panel-close {
	flex-shrink: 0;
	width: 36px;
	height: 36px;
	border: none;
	border-radius: 10px;
	padding: 0;
	background: rgba(48, 58, 178, 0.1);
	color: #303ab2;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.oracom-chat-panel-close:hover {
	background: rgba(48, 58, 178, 0.18);
}

.oracom-chat-panel-close:focus-visible {
	outline: 2px solid #303ab2;
	outline-offset: 2px;
}

.oracom-chat-panel-body {
	padding: 0;
	overflow: hidden;
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	font-size: 15px;
	line-height: 1.5;
	color: #334155;
}

.oracom-chat-panel-body a {
	color: #303ab2;
}

/* Nimmt alle verbleibende Höhe unter der Kopfzeile ein */
.oracom-chat-panel-iframe-wrap {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	width: 100%;
}

.oracom-chat-panel-iframe {
	display: block;
	flex: 1 1 auto;
	width: 100%;
	min-height: 0;
	height: 100%;
	border: 0;
	background: #f8fafc;
}

.oracom-chat-panel-fallback {
	margin: 0 0 12px;
}

.oracom-chat-panel-fallback-link-wrap {
	flex-shrink: 0;
	margin: 0;
	padding: 12px 16px 16px;
}

.oracom-chat-panel-fallback-link {
	font-weight: 600;
}

.oracom-chat-stack {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 0;
	pointer-events: none;
}

.oracom-chat-greeting-wrap {
	position: relative;
	filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.15));
	margin-bottom: 22px;
	width: var(--oracom-greeting-bubble-width);
	max-width: var(--oracom-greeting-bubble-width);
	box-sizing: border-box;
	pointer-events: auto;
	transform-origin: calc(100% - 32px) 100%;
	animation: oracom-chat-greeting-pop-in var(--oracom-greeting-enter-duration) cubic-bezier(0.33, 1.15, 0.52, 1)
		var(--oracom-greeting-enter-delay) both;
}

.oracom-chat-greeting-wrap.is-hidden {
	display: none;
}

.oracom-chat-root.is-panel-open .oracom-chat-greeting-wrap {
	display: none;
}

.oracom-chat-root.oracom-chat-panel-is-closing .oracom-chat-greeting-wrap {
	display: none;
}

.oracom-chat-greeting {
	display: flex;
	align-items: center;
	gap: 12px;
	background: #fff;
	border-radius: 25px;
	padding: 12px 40px 12px 14px;
	min-height: 64px;
	width: 100%;
	box-sizing: border-box;
}

.oracom-chat-greeting-avatar {
	flex-shrink: 0;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	overflow: hidden;
	background: #e8e8e8;
}

.oracom-chat-greeting-avatar img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.oracom-chat-greeting-text {
	margin: 0;
	padding: 0;
	flex: 1;
	min-width: 0;
	min-height: var(--oracom-greeting-text-min-height);
	align-self: stretch;
	display: flex;
	flex-direction: column;
	justify-content: center;
	font-size: 15px;
	line-height: 1.35;
	font-weight: 500;
	color: #111;
}

.oracom-chat-greeting-text-inner {
	display: block;
	opacity: 1;
	transform: translateY(0);
	transition: opacity 0.22s ease, transform 0.22s ease;
	position: relative;
	text-align: left;
	width: 100%;
	box-sizing: border-box;
}

.oracom-chat-greeting-text-inner.is-greeting-text-changing {
	opacity: 0;
	transform: translateY(4px);
}

/* Unsichtbarer Volltext: fixiert Höhe und Zeilenumbruch, verhindert Springen beim Wort-Fade */
.oracom-chat-greeting-layout-ghost {
	display: block;
	visibility: hidden;
	white-space: normal;
	word-wrap: break-word;
	overflow-wrap: break-word;
	pointer-events: none;
	user-select: none;
}

.oracom-chat-greeting-layout-visible {
	display: block;
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	box-sizing: border-box;
	white-space: normal;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

.oracom-chat-greeting-word {
	display: inline-block;
	vertical-align: baseline;
	opacity: 0;
	transform: translate3d(0, 0.08em, 0);
	transition:
		opacity 0.62s cubic-bezier(0.16, 1, 0.32, 1),
		transform 0.62s cubic-bezier(0.16, 1, 0.32, 1);
	will-change: opacity, transform;
}

.oracom-chat-greeting-word.is-visible {
	opacity: 1;
	transform: translate3d(0, 0, 0);
}

@media (prefers-reduced-motion: reduce) {
	.oracom-chat-greeting-text-inner {
		transition: none;
	}

	.oracom-chat-greeting-text-inner.is-greeting-text-changing {
		opacity: 1;
		transform: none;
	}

	.oracom-chat-greeting-word {
		opacity: 1;
		transform: none;
		transition: none;
		will-change: auto;
	}
}

.oracom-chat-greeting-close {
	position: absolute;
	top: -6px;
	right: -6px;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	border: none;
	padding: 0;
	background: #2a2f76;
	color: #fff;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 1px 4px rgba(42, 47, 118, 0.35);
}

.oracom-chat-greeting-close:hover {
	background: #222860;
}

.oracom-chat-greeting-close:focus-visible {
	outline: 2px solid #2a2f76;
	outline-offset: 2px;
}

@keyframes oracom-chat-launcher-enter {
	from {
		opacity: 0;
		transform: translateX(calc(var(--oracom-launcher-size) + 28px));
		pointer-events: none;
	}
	to {
		opacity: 1;
		transform: translateX(0);
		pointer-events: auto;
	}
}

@keyframes oracom-chat-greeting-pop-in {
	from {
		opacity: 0;
		transform: translateY(22px) scale(0.94);
		pointer-events: none;
	}
	65% {
		opacity: 1;
		transform: translateY(-6px) scale(1.02);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
		pointer-events: auto;
	}
}

/* Zipfel: Mitte des SVG auf Mitte des Launchers (beide rechtsbündig im Stack) */
.oracom-chat-greeting-tail {
	position: absolute;
	right: calc(var(--oracom-launcher-size) / 2 - var(--oracom-greeting-tail-svg-width) / 2);
	bottom: -10px;
	line-height: 0;
	pointer-events: none;
}

/* An Salient-Kacheln angelehnt (z. B. Karriere-Spalten #303ab2), etwas heller als Grundton */
.oracom-chat-launcher {
	--oracom-launcher-blue: #303ab2;
	--oracom-launcher-blue-light: #4a56d9;
	pointer-events: auto;
	width: var(--oracom-launcher-size);
	height: var(--oracom-launcher-size);
	border-radius: 50%;
	border: none;
	padding: 0;
	background: var(--oracom-launcher-blue-light);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 18px rgba(48, 58, 178, 0.45);
	transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

/* Nur einmal beim ersten Seitenaufruf, nicht erneut beim Schließen des Panels */
.oracom-chat-root:not(.oracom-launcher-intro-done) .oracom-chat-launcher {
	animation: oracom-chat-launcher-enter var(--oracom-launcher-enter-duration) cubic-bezier(0.22, 1, 0.36, 1)
		var(--oracom-launcher-enter-delay) both;
}

@media (prefers-reduced-motion: reduce) {
	.oracom-chat-launcher {
		animation: none !important;
		opacity: 1;
		transform: none;
	}

	.oracom-chat-greeting-wrap {
		animation: none;
		opacity: 1;
		transform: none;
	}

	.oracom-chat-panel {
		transition: none;
	}

	.oracom-chat-backdrop {
		transition: none;
	}
}

.oracom-chat-launcher:hover {
	transform: scale(1.04);
	background: var(--oracom-launcher-blue);
	box-shadow: 0 6px 22px rgba(48, 58, 178, 0.55);
}

.oracom-chat-launcher:active {
	transform: scale(0.98);
}

.oracom-chat-launcher:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

.oracom-chat-launcher-icon {
	display: flex;
	align-items: center;
	justify-content: center;
}

.oracom-chat-launcher-icon--close {
	display: none;
}

.oracom-chat-root.is-panel-open .oracom-chat-launcher-icon--chat {
	display: none;
}

.oracom-chat-root.is-panel-open .oracom-chat-launcher-icon--close {
	display: flex;
}

.oracom-chat-launcher-img {
	display: block;
	width: 36px;
	height: 36px;
	object-fit: contain;
	/* Schwarze SVG-Pfade auf weiß für den schwarzen Launcher-Button */
	filter: brightness(0) invert(1);
}
