/* Orphit Chatbot – Branding. Theme-Tokens aus orphit-lp/theme.json, keine externen Fonts. */

.orphit-chat {
	--oc-primary: #3c8c8c;
	--oc-cta: #36787b;
	--oc-accent: #f59962;
	--oc-bg: #fff8f0;
	--oc-surface: #faf7f2;
	--oc-border: #e2ddd5;
	--oc-text: #25211f;
	--oc-muted: #5e676b;
	--oc-radius: 16px;
	--oc-shadow: 0 18px 50px rgba(37, 33, 31, 0.18);
	--oc-font: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
	--oc-display: "Signika", "Golos Text", system-ui, sans-serif;

	position: fixed;
	inset-inline-end: max(20px, env(safe-area-inset-right));
	bottom: max(20px, env(safe-area-inset-bottom));
	z-index: 9990;
	font-family: var(--oc-font);
	color: var(--oc-text);
	font-size: 16px;
	line-height: 1.55;
}

.orphit-chat[data-position="left"] {
	inset-inline-end: auto;
	inset-inline-start: max(20px, env(safe-area-inset-left));
}

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

/* ── Launcher ─────────────────────────────────────────────────────────── */
.orphit-chat__launcher {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 10px 18px 10px 12px;
	border: 0;
	border-radius: 999px;
	background: var(--oc-cta);
	color: #fff;
	font: 600 15px/1 var(--oc-font);
	cursor: pointer;
	box-shadow: 0 10px 30px rgba(54, 120, 123, 0.35);
	transition: transform 0.18s ease, background 0.18s ease;
}

.orphit-chat__launcher:hover {
	background: var(--oc-primary);
	transform: translateY(-2px);
}

.orphit-chat__launcher img {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: var(--oc-bg);
	object-fit: cover;
}

.orphit-chat[data-inline="1"] .orphit-chat__close {
	display: none;
}

.orphit-chat[data-inline="1"] {
	position: static;
	font-size: 15px;
}

.orphit-chat[data-inline="1"] .orphit-chat__panel {
	position: static;
	width: 100%;
	max-width: 720px;
	height: 560px;
	max-height: 80vh;
	box-shadow: 0 8px 30px rgba(37, 33, 31, 0.08);
}

/* ── Proaktive Bubble ─────────────────────────────────────────────────── */
.orphit-chat__proactive {
	display: flex;
	align-items: flex-start;
	gap: 6px;
	max-width: 290px;
	margin-bottom: 10px;
	padding: 12px 14px;
	background: #fff;
	border: 1px solid var(--oc-border);
	border-radius: var(--oc-radius) var(--oc-radius) 4px var(--oc-radius);
	box-shadow: 0 10px 28px rgba(37, 33, 31, 0.12);
	animation: oc-rise 0.3s ease;
}

.orphit-chat__proactive-text {
	flex: 1;
	border: 0;
	background: none;
	padding: 0;
	text-align: start;
	color: var(--oc-text);
	font: 400 14px/1.45 var(--oc-font);
	cursor: pointer;
}

.orphit-chat__proactive-close {
	border: 0;
	background: none;
	color: var(--oc-muted);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	padding: 0 2px;
}

/* ── Panel ────────────────────────────────────────────────────────────── */
.orphit-chat__panel {
	position: absolute;
	inset-inline-end: 0;
	bottom: 76px;
	display: flex;
	flex-direction: column;
	width: 380px;
	max-width: calc(100vw - 40px);
	height: 620px;
	max-height: calc(100dvh - 130px);
	background: var(--oc-bg);
	border: 1px solid var(--oc-border);
	border-radius: 20px;
	box-shadow: var(--oc-shadow);
	overflow: hidden;
	animation: oc-rise 0.22s ease;
}

.orphit-chat[data-position="left"] .orphit-chat__panel {
	inset-inline-end: auto;
	inset-inline-start: 0;
}

.orphit-chat__panel[hidden],
.orphit-chat__proactive[hidden],
.orphit-chat__prechat[hidden],
.orphit-chat__log[hidden],
.orphit-chat__form[hidden] {
	display: none !important;
}

.orphit-chat__header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	background: var(--oc-primary);
	color: #fff;
}

.orphit-chat__avatar img {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--oc-bg);
	object-fit: cover;
	display: block;
}

.orphit-chat__heading {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1;
}

.orphit-chat__heading strong {
	font-family: var(--oc-display);
	font-weight: 600;
	font-size: 18px;
	line-height: 1.25;
}

.orphit-chat__status {
	font-size: 12px;
	opacity: 0.85;
}

.orphit-chat__close {
	border: 0;
	background: none;
	color: #fff;
	padding: 6px;
	border-radius: 8px;
	cursor: pointer;
	opacity: 0.85;
}

.orphit-chat__close:hover,
.orphit-chat__close:focus-visible {
	opacity: 1;
	background: rgba(255, 255, 255, 0.14);
}

/* ── Prechat ──────────────────────────────────────────────────────────── */
.orphit-chat__prechat {
	padding: 22px 20px;
	overflow-y: auto;
	background: var(--oc-surface);
	flex: 1;
}

.orphit-chat__prechat h3 {
	margin: 0 0 6px;
	font-family: var(--oc-display);
	font-size: 20px;
	font-weight: 600;
	color: var(--oc-text);
}

.orphit-chat__prechat > p {
	margin: 0 0 16px;
	color: var(--oc-muted);
	font-size: 14px;
}

.orphit-chat__field {
	display: block;
	margin-bottom: 12px;
}

.orphit-chat__field span {
	display: block;
	margin-bottom: 4px;
	font-size: 13px;
	font-weight: 500;
	color: var(--oc-text);
}

.orphit-chat__field em {
	font-style: normal;
	font-weight: 400;
	color: var(--oc-muted);
}

.orphit-chat__field input {
	width: 100%;
	height: 44px;
	padding: 0 12px;
	border: 1px solid var(--oc-border);
	border-radius: 10px;
	background: var(--oc-surface);
	color: var(--oc-text);
	font: 400 15px var(--oc-font);
}

.orphit-chat__field input:focus {
	outline: 2px solid var(--oc-primary);
	outline-offset: 1px;
	background: #fff;
}

.orphit-chat__consent {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 14px 0 6px;
	font-size: 13px;
	line-height: 1.45;
	color: var(--oc-muted);
}

.orphit-chat__consent input {
	margin-top: 2px;
	width: 18px;
	height: 18px;
	accent-color: var(--oc-cta);
	flex: 0 0 auto;
}

.orphit-chat__consent a {
	color: var(--oc-cta);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.orphit-chat__start {
	width: 100%;
	height: 48px;
	margin-top: 12px;
	border: 0;
	border-radius: 12px;
	background: var(--oc-cta);
	color: #fff;
	font: 600 15px var(--oc-font);
	cursor: pointer;
}

.orphit-chat__start:hover {
	background: var(--oc-primary);
}

.orphit-chat__fineprint {
	margin: 10px 0 0;
	font-size: 11px;
	line-height: 1.4;
	color: var(--oc-muted);
}

.orphit-chat__error {
	margin: 6px 0 0;
	color: #b3261e;
	font-size: 13px;
}

/* ── Log ──────────────────────────────────────────────────────────────── */
.orphit-chat__log {
	flex: 1;
	overflow-y: auto;
	padding: 18px 16px 8px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	scroll-behavior: smooth;
	background:
		radial-gradient(120% 60% at 100% 0%, rgba(60, 140, 140, 0.08), transparent 60%),
		var(--oc-bg);
}

.orphit-chat__msg {
	display: flex;
	flex-direction: column;
	max-width: 88%;
}

.orphit-chat__msg--bot {
	align-self: flex-start;
}

.orphit-chat__msg--user {
	align-self: flex-end;
}

.orphit-chat__bubble {
	padding: 10px 13px;
	border-radius: 14px;
	font-size: 15px;
	line-height: 1.55;
	white-space: pre-wrap;
	word-break: break-word;
}

.orphit-chat__msg--bot .orphit-chat__bubble {
	background: var(--oc-surface);
	border: 1px solid var(--oc-border);
	border-bottom-left-radius: 4px;
}

.orphit-chat__msg--user .orphit-chat__bubble {
	background: var(--oc-cta);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.orphit-chat__bubble strong {
	font-weight: 600;
}

.orphit-chat__bubble code {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 0.92em;
	background: rgba(60, 140, 140, 0.1);
	padding: 1px 4px;
	border-radius: 4px;
}

.orphit-chat__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-top: 6px;
	font-size: 12px;
	color: var(--oc-muted);
}

.orphit-chat__source {
	color: var(--oc-cta);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.orphit-chat__rate {
	display: inline-flex;
	gap: 2px;
	margin-inline-start: auto;
}

.orphit-chat__rate button {
	border: 1px solid var(--oc-border);
	background: #fff;
	border-radius: 6px;
	padding: 2px 6px;
	font-size: 13px;
	cursor: pointer;
	line-height: 1.2;
}

.orphit-chat__rate button[aria-pressed="true"] {
	border-color: var(--oc-cta);
	background: rgba(60, 140, 140, 0.12);
}

/* Typing */
.orphit-chat__typing {
	display: inline-flex;
	gap: 4px;
	padding: 12px 14px;
	background: #fff;
	border: 1px solid var(--oc-border);
	border-radius: 14px;
	border-bottom-left-radius: 4px;
}

.orphit-chat__typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--oc-muted);
	animation: oc-blink 1.2s infinite ease-in-out;
}

.orphit-chat__typing span:nth-child(2) { animation-delay: 0.15s; }
.orphit-chat__typing span:nth-child(3) { animation-delay: 0.3s; }

/* ── Formular ─────────────────────────────────────────────────────────── */
.orphit-chat__form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 12px 12px 8px;
	background: var(--oc-bg);
	border-top: 1px solid var(--oc-border);
}

.orphit-chat__form textarea {
	flex: 1;
	min-height: 44px;
	max-height: 120px;
	padding: 11px 12px;
	border: 1px solid var(--oc-border);
	border-radius: 12px;
	background: #fff;
	color: var(--oc-text);
	font: 400 15px/1.4 var(--oc-font);
	resize: none;
}

.orphit-chat__form textarea:focus {
	outline: 2px solid var(--oc-primary);
	outline-offset: 1px;
}

.orphit-chat__send {
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 12px;
	background: var(--oc-cta);
	color: #fff;
	cursor: pointer;
	display: grid;
	place-items: center;
}

.orphit-chat__send:hover {
	background: var(--oc-primary);
}

.orphit-chat__send:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.orphit-chat__stop {
	flex: 0 0 auto;
	height: 44px;
	padding: 0 12px;
	border: 1px solid var(--oc-border);
	border-radius: 12px;
	background: #fff;
	color: var(--oc-text);
	font: 500 13px var(--oc-font);
	cursor: pointer;
}

.orphit-chat__footer {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	padding: 8px 16px 12px;
	background: var(--oc-bg);
	font-size: 11px;
	color: var(--oc-muted);
}

.orphit-chat__footer a {
	color: var(--oc-cta);
	text-decoration: underline;
	text-underline-offset: 2px;
	white-space: nowrap;
}

.orphit-chat__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ── Mobil ────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
	.orphit-chat {
		inset-inline: 0;
		bottom: max(14px, env(safe-area-inset-bottom));
		display: flex;
		justify-content: flex-end;
		padding-inline: 14px;
		pointer-events: none;
	}

	.orphit-chat > * {
		pointer-events: auto;
	}

	.orphit-chat__launcher {
		padding: 0;
		width: 56px;
		height: 56px;
		justify-content: center;
	}

	.orphit-chat__launcher-label {
		display: none;
	}

	.orphit-chat__launcher img {
		width: 34px;
		height: 34px;
	}

	.orphit-chat__panel {
		position: fixed;
		inset: 0;
		width: 100%;
		max-width: none;
		height: 100dvh;
		max-height: none;
		border: 0;
		border-radius: 0;
		box-shadow: none;
	}

	.orphit-chat__proactive {
		position: fixed;
		inset-inline: 14px;
		bottom: calc(84px + env(safe-area-inset-bottom));
		max-width: none;
	}

	.orphit-chat[data-inline="1"] .orphit-chat__panel {
		height: 70vh;
		border-radius: var(--oc-radius);
	}
}

@media (prefers-reduced-motion: reduce) {
	.orphit-chat *,
	.orphit-chat *::before,
	.orphit-chat *::after {
		animation: none !important;
		transition: none !important;
		scroll-behavior: auto !important;
	}
}

@keyframes oc-rise {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

@keyframes oc-blink {
	0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-2px); }
}

/* ── Turnstile ────────────────────────────────────────────────────────── */
.orphit-chat__turnstile {
	margin: 12px 0 6px;
	min-height: 0;
}

.orphit-chat__turnstile .cf-turnstile {
	display: flex;
	justify-content: flex-start;
}
