/* Easy Peasy Chatbot – Widget. Farbe über --epc-accent (Einstellungen). */
.epc {
	--epc-accent-2: color-mix(in oklab, var(--epc-accent) 75%, #000);
	--epc-accent-soft: color-mix(in oklab, var(--epc-accent) 10%, #fff);
	--epc-accent-line: color-mix(in oklab, var(--epc-accent) 22%, #fff);
	--epc-bg: #fff;
	--epc-surface: #f6f7fb;
	--epc-text: #111827;
	--epc-muted: #5b6475;
	--epc-border: #e6e8ef;
	--epc-radius: 22px;
	--epc-shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 12px 24px -6px rgb(16 24 40 / 14%), 0 32px 64px -12px rgb(16 24 40 / 22%);
	--epc-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 14px;
	font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	color: var(--epc-text);
	-webkit-font-smoothing: antialiased;
}

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

.epc button {
	font: inherit;
	-webkit-tap-highlight-color: transparent;
}

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

.epc button:focus-visible,
.epc a:focus-visible,
.epc-log:focus-visible {
	outline: 3px solid color-mix(in oklab, var(--epc-accent) 55%, #fff);
	outline-offset: 2px;
}

/* ---------- Bubble ---------- */

.epc-toggle {
	position: relative;
	display: grid;
	place-items: center;
	width: 60px;
	height: 60px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--epc-accent), var(--epc-accent-2));
	color: #fff;
	box-shadow: 0 8px 24px -4px color-mix(in oklab, var(--epc-accent) 55%, transparent), inset 0 1px 0 rgb(255 255 255 / 25%);
	cursor: pointer;
	transition: transform 0.25s var(--epc-ease), box-shadow 0.25s var(--epc-ease);
}

.epc-toggle:hover {
	transform: translateY(-2px) scale(1.04);
	box-shadow: 0 14px 30px -6px color-mix(in oklab, var(--epc-accent) 65%, transparent), inset 0 1px 0 rgb(255 255 255 / 25%);
}

.epc-toggle:active {
	transform: scale(0.96);
}

.epc-toggle-icon {
	grid-area: 1 / 1;
	display: grid;
	transition: transform 0.3s var(--epc-ease), opacity 0.2s;
}

.epc-toggle-icon--close,
.epc.is-open .epc-toggle-icon--chat {
	opacity: 0;
	transform: rotate(-90deg) scale(0.6);
}

.epc.is-open .epc-toggle-icon--close {
	opacity: 1;
	transform: none;
}

/* ---------- Panel ---------- */

.epc-panel {
	display: flex;
	flex-direction: column;
	width: 400px;
	max-width: calc(100vw - 40px);
	height: min(640px, calc(100vh - 120px));
	background: var(--epc-bg);
	border: 1px solid var(--epc-border);
	border-radius: var(--epc-radius);
	box-shadow: var(--epc-shadow);
	overflow: hidden;
	transform-origin: bottom right;
	animation: epc-pop 0.32s var(--epc-ease);
}

.epc-panel[hidden] {
	display: none;
}

@keyframes epc-pop {
	from {
		opacity: 0;
		transform: translateY(12px) scale(0.96);
	}
}

.epc-head {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 14px 16px 18px;
	background:
		radial-gradient(120% 140% at 0% 0%, rgb(255 255 255 / 18%), transparent 55%),
		linear-gradient(135deg, var(--epc-accent), var(--epc-accent-2));
	color: #fff;
}

.epc-avatar {
	display: grid;
	flex: none;
	place-items: center;
	width: 42px;
	height: 42px;
	border-radius: 14px;
	background: rgb(255 255 255 / 18%);
	box-shadow: inset 0 0 0 1px rgb(255 255 255 / 25%);
	backdrop-filter: blur(6px);
}

.epc-head-text {
	flex: 1;
	min-width: 0;
}

.epc-title {
	margin: 0;
	font-size: 16px;
	font-weight: 650;
	line-height: 1.3;
	letter-spacing: -0.01em;
	color: inherit;
}

.epc-subtitle {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 2px 0 0;
	font-size: 12.5px;
	opacity: 0.9;
}

.epc-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #4ade80;
	box-shadow: 0 0 0 3px rgb(74 222 128 / 25%);
}

.epc-close {
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: 12px;
	background: transparent;
	color: inherit;
	cursor: pointer;
	transition: background 0.2s;
}

.epc-close:hover {
	background: rgb(255 255 255 / 16%);
}

.epc-close svg {
	width: 20px;
	height: 20px;
}

.epc-close:focus-visible {
	outline-color: #fff;
}

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

.epc-log {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 10px;
	padding: 18px 16px 8px;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: linear-gradient(var(--epc-bg), var(--epc-surface));
	scrollbar-width: thin;
}

.epc-msg {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 18px;
	white-space: pre-line;
	overflow-wrap: anywhere;
	animation: epc-in 0.28s var(--epc-ease);
}

@keyframes epc-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
}

.epc-msg--assistant {
	align-self: flex-start;
	border: 1px solid var(--epc-border);
	border-bottom-left-radius: 6px;
	background: var(--epc-bg);
	box-shadow: 0 1px 2px rgb(16 24 40 / 5%);
}

.epc-msg--user {
	align-self: flex-end;
	border-bottom-right-radius: 6px;
	background: linear-gradient(135deg, var(--epc-accent), var(--epc-accent-2));
	color: #fff;
}

/* Tipp-Animation */
.epc-typing {
	display: inline-flex;
	gap: 5px;
	align-items: center;
	padding: 14px 16px;
}

.epc-typing[hidden] {
	display: none;
}

.epc-typing-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--epc-muted);
	opacity: 0.4;
	animation: epc-bounce 1.2s infinite ease-in-out;
}

.epc-typing-dot:nth-child(3) {
	animation-delay: 0.15s;
}

.epc-typing-dot:nth-child(4) {
	animation-delay: 0.3s;
}

@keyframes epc-bounce {
	0%, 60%, 100% {
		opacity: 0.35;
		transform: translateY(0);
	}

	30% {
		opacity: 1;
		transform: translateY(-4px);
	}
}

/* Chips: Vorschläge und Quellen */
.epc-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
	white-space: normal;
}

.epc-suggestions {
	align-self: flex-start;
	max-width: 95%;
	animation: epc-in 0.35s var(--epc-ease) 0.1s backwards;
}

.epc-chip {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 7px 12px;
	border: 1px solid var(--epc-accent-line);
	border-radius: 999px;
	background: var(--epc-accent-soft);
	color: color-mix(in oklab, var(--epc-accent) 85%, #000);
	font-size: 13.5px;
	font-weight: 500;
	line-height: 1.3;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.2s, border-color 0.2s, transform 0.2s var(--epc-ease);
}

.epc-chip:hover {
	border-color: var(--epc-accent);
	background: color-mix(in oklab, var(--epc-accent) 16%, #fff);
	transform: translateY(-1px);
}

.epc-sources {
	margin-top: 10px;
}

.epc-chip--link {
	padding: 4px 10px;
	font-size: 12.5px;
}

.epc-feedback {
	display: flex;
	align-items: center;
	gap: 4px;
	margin-top: 8px;
	white-space: normal;
}

.epc .epc-feedback-btn {
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 6px;
	background: transparent;
	color: #8a93a5;
	cursor: pointer;
}

.epc .epc-feedback-btn:hover:not(:disabled) {
	border-color: var(--epc-border);
	color: var(--epc-text);
}

.epc .epc-feedback-btn--down svg {
	transform: rotate(180deg);
}

.epc .epc-feedback-btn:disabled {
	cursor: default;
	opacity: 0.45;
}

.epc .epc-feedback-btn.is-chosen {
	opacity: 1;
	color: var(--epc-accent);
}

.epc-feedback-thanks {
	margin-left: 6px;
	font-size: 12.5px;
	color: var(--epc-muted);
}

.epc-cta {
	display: inline-flex;
	margin-top: 10px;
	padding: 8px 14px;
	border-radius: 999px;
	background: var(--epc-accent);
	color: #fff;
	font-size: 13.5px;
	font-weight: 600;
	text-decoration: none;
	transition: filter 0.2s;
}

.epc-cta:hover {
	filter: brightness(1.08);
	color: #fff;
}

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

.epc-form {
	padding: 10px 14px 12px;
	background: var(--epc-surface);
	border-top: 1px solid var(--epc-border);
}

.epc-field {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 6px 6px 6px 16px;
	border: 1px solid var(--epc-border);
	border-radius: 18px;
	background: var(--epc-bg);
	box-shadow: 0 1px 2px rgb(16 24 40 / 5%);
	transition: border-color 0.2s, box-shadow 0.2s;
}

.epc-field:focus-within {
	border-color: var(--epc-accent);
	box-shadow: 0 0 0 4px color-mix(in oklab, var(--epc-accent) 18%, transparent);
}

.epc-input {
	flex: 1;
	min-height: 36px;
	max-height: 120px;
	padding: 7px 0;
	border: 0;
	outline: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	line-height: 1.45;
	resize: none;
}

.epc .epc-input:focus,
.epc .epc-input:focus-visible {
	border: 0;
	outline: 0;
	box-shadow: none;
}

.epc-input::placeholder {
	color: #8a93a5;
}

.epc-send {
	display: grid;
	flex: none;
	place-items: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: 13px;
	background: linear-gradient(135deg, var(--epc-accent), var(--epc-accent-2));
	color: #fff;
	cursor: pointer;
	transition: transform 0.2s var(--epc-ease), opacity 0.2s;
}

.epc-send:hover {
	transform: scale(1.06);
}

.epc-send:disabled {
	opacity: 0.45;
	cursor: wait;
	transform: none;
}

.epc-notice {
	margin: 8px 4px 0;
	font-size: 11.5px;
	line-height: 1.4;
	text-align: center;
	color: var(--epc-muted);
}

/* ---------- Mobil: Vollbild ---------- */

@media (max-width: 480px) {
	.epc {
		right: 16px;
		bottom: 16px;
	}

	.epc.is-open .epc-toggle {
		display: none;
	}

	.epc-panel {
		position: fixed;
		inset: 0;
		width: auto;
		max-width: none;
		height: 100%;
		height: 100dvh;
		border: 0;
		border-radius: 0;
		animation-name: epc-slide;
	}

	.epc-head {
		padding-top: max(16px, env(safe-area-inset-top));
	}

	.epc-form {
		padding-bottom: max(12px, env(safe-area-inset-bottom));
	}

	.epc-input {
		font-size: 16px; /* verhindert Zoom auf iOS */
	}
}

@keyframes epc-slide {
	from {
		transform: translateY(24px);
		opacity: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.epc *,
	.epc *::before,
	.epc *::after {
		transition: none !important;
		animation: none !important;
	}
}
