/* Apo-Chat – Widget */

.apoc {
	/* Farben von allefarben-apotheke.de. --apoc-color kommt aus den Einstellungen (Standard Grün #5b945e). */
	--apoc-color: #5b945e;
	--apoc-strong: color-mix(in srgb, var(--apoc-color) 78%, #000); /* dunkler, damit weiße Schrift gut lesbar ist */
	--apoc-head: #1e293b;
	--apoc-ink: #1e293b;
	--apoc-muted: #5f6b7d;
	--apoc-line: #ece5d9;
	--apoc-bg: #fffcf7;
	--apoc-bot: #f3ede2;
	--apoc-rainbow: linear-gradient(90deg, #a8cbdc 0%, #c9b8d8 22%, #f99a99 45%, #fbb994 68%, #fde895 100%);
	--apoc-radius: 16px;
	position: fixed;
	bottom: 20px;
	z-index: 99990;
	font-size: 15px;
	line-height: 1.45;
	font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
	color: var(--apoc-ink);
}
.apoc--right { right: 20px; }
.apoc--left { left: 20px; }
/* Offenes Fenster liegt über schwebenden Theme-Elementen (Warenkorb-Button, Cookie-Banner-Icons). */
.apoc--open { z-index: 2147483000; }

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

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

/* Startknopf */
.apoc-launcher {
	display: grid;
	place-items: center;
	width: 58px;
	height: 58px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--apoc-color);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(30, 41, 59, .22);
	transition: transform .15s ease;
}
.apoc--left .apoc-launcher { margin-right: auto; }
.apoc--right .apoc-launcher { margin-left: auto; }
.apoc-launcher:hover { transform: translateY(-2px); }
.apoc-launcher:focus-visible,
.apoc button:focus-visible,
.apoc input:focus-visible,
.apoc textarea:focus-visible {
	outline: 3px solid color-mix(in srgb, var(--apoc-color) 45%, transparent);
	outline-offset: 2px;
}

/* Fenster */
.apoc-panel {
	display: flex;
	flex-direction: column;
	width: 370px;
	height: min(600px, calc(100vh - 110px));
	margin-bottom: 14px;
	background: var(--apoc-bg);
	border: 1px solid var(--apoc-line);
	border-radius: var(--apoc-radius);
	box-shadow: 0 18px 50px rgba(30, 41, 59, .18);
	overflow: hidden;
}
.apoc-panel[hidden] { display: none; }

.apoc-head {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 10px 14px 16px;
	background: var(--apoc-head);
	color: #fff;
}
/* Regenbogen-Streifen wie im Logo "Alle Farben" */
.apoc-head::after {
	content: "";
	position: absolute;
	inset: auto 0 0 0;
	height: 4px;
	background: var(--apoc-rainbow);
}
.apoc-title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-family: Nunito, inherit;
	font-size: 16px;
	font-weight: 800;
}
.apoc-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #9ad59b;
}
.apoc-test {
	padding: 2px 8px;
	border-radius: 999px;
	background: #efb036;
	color: #3b2a05;
	font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-size: 11.5px;
	font-weight: 700;
	line-height: 1.4;
}
.apoc-close {
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: inherit;
	cursor: pointer;
}
.apoc-close:hover { background: rgba(255, 255, 255, .15); }

.apoc-notice {
	margin: 0;
	padding: 8px 16px;
	font-size: 12.5px;
	line-height: 1.4;
	color: var(--apoc-muted);
	background: #faf5ec;
	border-bottom: 1px solid var(--apoc-line);
}
.apoc-notice a { color: inherit; }

/* Verlauf */
.apoc-log {
	position: relative;
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 14px 14px 6px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	overscroll-behavior: contain;
}
.apoc-msg {
	max-width: 86%;
	padding: 9px 12px;
	border-radius: 12px;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}
.apoc-msg p { margin: 0 0 6px; }
.apoc-msg p:last-child { margin-bottom: 0; }
.apoc-msg ul, .apoc-msg ol { margin: 4px 0 6px 18px; padding: 0; }
.apoc-msg a { color: var(--apoc-strong); text-decoration: underline; }
.apoc-msg--bot {
	align-self: flex-start;
	background: var(--apoc-bot);
	border-bottom-left-radius: 4px;
}
.apoc-msg--user {
	align-self: flex-end;
	background: var(--apoc-strong);
	color: #fff;
	border-bottom-right-radius: 4px;
	white-space: pre-wrap;
}

.apoc-msg--note {
	align-self: center;
	max-width: 100%;
	padding: 2px 10px;
	background: none;
	color: var(--apoc-muted);
	font-size: 12.5px;
}
.apoc-msg__placeholder { color: var(--apoc-muted); font-style: italic; }

.apoc-typing { display: flex; gap: 4px; padding: 12px 14px; }
.apoc-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--apoc-muted);
	animation: apoc-blink 1.2s infinite ease-in-out;
}
.apoc-typing span:nth-child(2) { animation-delay: .15s; }
.apoc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes apoc-blink {
	0%, 80%, 100% { opacity: .25; }
	40% { opacity: 1; }
}

/* Aktionen */
.apoc-actions {
	flex: 0 0 auto;
	max-height: 55%;
	overflow-y: auto;
	padding: 0 14px;
}
.apoc-actions:not(:empty) { padding-bottom: 10px; }
.apoc-row {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}
.apoc-ask {
	width: 100%;
	font-size: 13px;
	color: var(--apoc-muted);
}
.apoc-chip {
	margin: 0;
	padding: 7px 12px;
	font: inherit;
	font-size: 13.5px;
	line-height: 1.2;
	color: var(--apoc-strong);
	background: #fff;
	border: 1px solid color-mix(in srgb, var(--apoc-color) 50%, #fff);
	border-radius: 999px;
	cursor: pointer;
}
.apoc-chip:hover { background: color-mix(in srgb, var(--apoc-color) 10%, #fff); }
.apoc-chip--primary {
	color: #fff;
	background: var(--apoc-head);
	border-color: var(--apoc-head);
}
.apoc-chip--primary:hover { background: #334155; border-color: #334155; }

.apoc-formwrap {
	align-self: stretch;
	margin: 2px 0 4px;
}
.apoc-nl {
	display: grid;
	gap: 8px;
	margin-bottom: 8px;
	padding: 12px;
	border-radius: 12px;
	background: #fff;
	border: 1px solid var(--apoc-line);
	position: relative;
	overflow: hidden;
}
.apoc-nl::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 3px;
	background: var(--apoc-rainbow);
}
.apoc-nl__text { margin: 2px 0 0; font-size: 14px; }
.apoc-consent {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 8px;
	align-items: start;
	font-size: 12.5px;
	line-height: 1.45;
	color: var(--apoc-ink);
}
.apoc-consent input { margin: 2px 0 0; width: 16px; height: 16px; accent-color: var(--apoc-strong); }
.apoc-consent a { color: var(--apoc-strong); }
.apoc-form {
	display: grid;
	gap: 8px;
	padding: 12px;
	background: #faf5ec;
	border: 1px solid var(--apoc-line);
	border-radius: 12px;
}
.apoc-field { display: grid; gap: 3px; }
.apoc-field label {
	font-size: 12.5px;
	font-weight: 600;
	color: var(--apoc-muted);
}
.apoc-field input,
.apoc-field textarea {
	width: 100%;
	margin: 0;
	padding: 8px 10px;
	font: inherit;
	font-size: 14px;
	color: var(--apoc-ink);
	background: #fff;
	border: 1px solid #d9d0c0;
	border-radius: 8px;
}
.apoc-field textarea { resize: vertical; }
.apoc-hint {
	margin: 0;
	font-size: 12px;
	color: var(--apoc-muted);
}
.apoc-hint a { color: inherit; }

/* Eingabe */
.apoc-compose {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	margin: 0;
	padding: 10px 10px 10px 14px;
	border-top: 1px solid var(--apoc-line);
}
.apoc-compose textarea {
	flex: 1 1 auto;
	min-height: 40px;
	max-height: 120px;
	margin: 0;
	padding: 9px 12px;
	font: inherit;
	font-size: 15px;
	color: var(--apoc-ink);
	background: #fff;
	border: 1px solid #d9d0c0;
	border-radius: 10px;
	resize: none;
}
.apoc-send {
	display: grid;
	place-items: center;
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: var(--apoc-strong);
	color: #fff;
	cursor: pointer;
}
.apoc-send:disabled { opacity: .5; cursor: default; }

/* Smartphone: Vollbild */
@media (max-width: 480px) {
	.apoc { bottom: 14px; }
	.apoc--right { right: 14px; }
	.apoc--left { left: 14px; }
	.apoc--open { inset: 0; }
	.apoc--open .apoc-launcher { display: none; }
	.apoc-panel {
		width: 100vw;
		height: 100dvh;
		margin: 0;
		border: 0;
		border-radius: 0;
	}
	.apoc-compose textarea { font-size: 16px; } /* verhindert Zoom auf iOS */
}

@media (prefers-reduced-motion: reduce) {
	.apoc-launcher { transition: none; }
	.apoc-typing span { animation: none; opacity: .6; }
}
