/* ==========================================================
   Toni mobil (bis 1023 px) nach Prototyp A1
   Leiste „Toni fragen“, Plus-Schnellwahl, „Nach oben“ und Bottom-Sheet.
   Die Toni-Leiste ersetzt mobil die Flybar.
   ========================================================== */
.px-ai,
.px-ai-dial,
.px-sheet,
.px-sheet-overlay {
	display: none;
}

@media (max-width: 1023px) {
	:root {
		--px-gap: 12px;
		--px-bar-h: 68px;
		--px-sq: 56px;
		--px-safe-b: env(safe-area-inset-bottom, 0px);
	}

	/* Seitliche Flybar und runder Toni weichen der Leiste (Toni-Button bleibt für den Chat im DOM) */
	body:has(.px-ai--bar) .flybar-canvas .flybar,
	body:has(.px-ai--bar) .plchat-modal-trigger {
		display: none !important;
	}

	/* Platz am Seitenende, damit die Leiste nichts verdeckt */
	body:has(.px-ai--bar) {
		padding-bottom: calc(var(--px-bar-h) + 2 * var(--px-gap) + var(--px-safe-b));
	}

	.px-ai {
		display: flex;
		position: fixed;
		z-index: 999995;
		font-family: Barlow, sans-serif;
		transition: opacity .25s, visibility .25s;
	}

	/* ---------- Leiste „Toni fragen“ ---------- */
	.px-ai--bar {
		left: var(--px-gap);
		bottom: calc(var(--px-gap) + var(--px-safe-b));
	}
	.px-ai-bar {
		--w: min(400px, calc(100vw - 2 * var(--px-gap) - var(--px-sq) - 10px));
		position: relative;
		isolation: isolate;
		overflow: hidden;
		display: flex;
		align-items: center;
		gap: 10px;
		width: var(--w);
		height: var(--px-bar-h);
		padding: 0 18px 0 5px;
		border: 0;
		border-radius: 999px;
		background: #fff;
		color: #323232;
		box-shadow: 0 14px 40px rgba(15, 35, 70, .14), 0 2px 6px rgba(15, 35, 70, .05), inset 0 0 0 1px rgba(15, 35, 70, .1);
		font: inherit;
		text-align: left;
		cursor: pointer;
		transition: width .55s cubic-bezier(.22, .61, .36, 1), padding .45s;
	}
	.px-ai-bar:hover,
	.px-ai-bar:focus {
		background: #fff;
		color: #323232;
	}
	.px-ai-bar:focus-visible {
		outline: 2px solid var(--color-blue);
		outline-offset: 3px;
	}

	/* Lichtpunkt im Markenverlauf läuft um die Kante */
	.px-ai-border {
		position: absolute;
		inset: 0;
		z-index: 3;
		padding: 1.5px;
		border-radius: inherit;
		pointer-events: none;
		-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
		-webkit-mask-composite: xor;
		mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
	}
	.px-ai-spinner {
		position: absolute;
		left: 50%;
		top: 50%;
		width: 134%;
		aspect-ratio: 1;
		transform: translate(-50%, -50%);
		background: conic-gradient(rgba(0, 229, 82, .95) 0deg, rgba(0, 229, 82, 0) 60deg, rgba(0, 229, 82, 0) 310deg, rgba(0, 229, 82, .95) 360deg);
		animation: px-ai-turn 2.5s linear infinite;
		pointer-events: none;
	}
	@keyframes px-ai-turn {
		from {
			transform: translate(-50%, -50%) rotate(0deg);
		}
		to {
			transform: translate(-50%, -50%) rotate(360deg);
		}
	}

	/* Avatar rund */
	.px-ai-orb {
		position: relative;
		z-index: 2;
		flex: none;
		width: 58px;
		height: 58px;
		border-radius: 50%;
		background: #fff;
	}
	.px-ai-orb-face {
		position: absolute;
		inset: 2px;
		overflow: hidden;
		border-radius: 50%;
		background: var(--color-blue);
	}
	.px-ai-orb-face img {
		position: absolute;
		inset: 0;
		width: 100%;
		height: 100%;
		object-fit: cover;
		object-position: 50% 30%;
		transform: scale(1.85);
		transform-origin: 50% 28%;
	}

	.px-ai-text {
		position: relative;
		z-index: 2;
		display: flex;
		flex: 1;
		flex-direction: column;
		justify-content: center;
		gap: 2px;
		min-width: 0;
	}
	.px-ai-eyebrow {
		font-size: 11px;
		font-weight: 600;
		line-height: 1.2;
		letter-spacing: .14em;
		text-transform: uppercase;
		white-space: nowrap;
		color: var(--color-blue);
	}
	.px-ai-prompt {
		min-height: 1.3em;
		overflow: hidden;
		font-size: 15px;
		font-weight: 500;
		line-height: 1.3;
		color: #4b5563;
		white-space: nowrap;
		text-overflow: ellipsis;
	}
	/* Blinkender Cursor hinter der Beispielfrage */
	.px-ai-prompt::after {
		content: "";
		display: inline-block;
		width: 1.5px;
		height: 1.05em;
		margin-left: 2px;
		vertical-align: -3px;
		background: var(--color-blue);
		animation: px-ai-caret 1s steps(1) infinite;
	}
	@keyframes px-ai-caret {
		50% {
			opacity: 0;
		}
	}
	.px-ai-label {
		position: relative;
		z-index: 2;
		display: none;
		font: 600 16px Montserrat, sans-serif;
		white-space: nowrap;
	}

	/* Kompakt beim Runterscrollen: nur „Toni fragen“ */
	.px-ai--bar.is-compact .px-ai-bar {
		--w: 200px;
		gap: 12px;
	}
	.px-ai--bar.is-compact .px-ai-text {
		display: none;
	}
	.px-ai--bar.is-compact .px-ai-label {
		display: block;
	}

	/* ---------- Plus und „Nach oben“ rechts ---------- */
	.px-ai--side {
		right: 0;
		bottom: calc(var(--px-gap) + (var(--px-bar-h) - var(--px-sq)) / 2 + var(--px-safe-b));
		flex-direction: column;
		align-items: flex-end;
		gap: 10px;
	}
	.px-ai-sq {
		display: grid;
		place-items: center;
		width: var(--px-sq);
		height: var(--px-sq);
		padding: 0;
		border: 0;
		border-radius: 0;
		color: #fff;
		cursor: pointer;
		transition: transform .3s, background-color .3s, opacity .3s, visibility .3s;
	}
	.px-ai-plus,
	.px-ai-plus:hover,
	.px-ai-plus:focus {
		background: var(--color-green);
		color: #fff;
	}
	.px-ai-plus svg {
		width: 26px;
		height: 26px;
		transition: transform .4s cubic-bezier(.34, 1.56, .64, 1);
	}
	.px-ai-plus[aria-expanded="true"] {
		background: #00b264;
	}
	.px-ai-plus[aria-expanded="true"] svg {
		transform: rotate(45deg);
	}
	.px-ai-top,
	.px-ai-top:hover,
	.px-ai-top:focus {
		height: 48px;
		background: #303030;
		color: #fff;
	}
	.px-ai-top svg {
		width: 16px;
		height: 16px;
	}
	body:not(.to-top) .px-ai-top,
	.px-ai--side.dial-open .px-ai-top {
		opacity: 0;
		visibility: hidden;
		transform: translateX(20px);
		pointer-events: none;
	}

	/* ---------- Schnellwahl ---------- */
	.px-ai-dial {
		position: fixed;
		right: 0;
		z-index: 999996;
		flex-direction: column;
		align-items: flex-end;
		gap: 12px;
		font-family: Barlow, sans-serif;
	}
	.px-ai-dial.is-open {
		display: flex;
	}
	.px-ai-dial-item {
		display: inline-flex;
		align-items: stretch;
		height: 50px;
		padding: 0;
		border: 0;
		border-radius: 0;
		background: #fff;
		color: #323232;
		box-shadow: 2px 2px 20px rgba(0, 0, 0, .1);
		text-decoration: none;
		cursor: pointer;
		transition: transform .3s, color .2s;
	}
	.px-ai-dial-item:hover,
	.px-ai-dial-item:focus-visible {
		background: #fff;
		color: var(--color-blue);
		transform: translateX(-6px);
	}
	.px-ai-dial-label {
		display: flex;
		align-items: center;
		padding: 0 16px;
		font: 600 14px/1 Barlow, sans-serif;
		letter-spacing: 1.44px;
		text-transform: uppercase;
		white-space: nowrap;
	}
	.px-ai-dial-ico {
		display: grid;
		place-items: center;
		flex: none;
		width: var(--px-sq);
		background: var(--color-green);
		color: #fff;
	}
	.px-ai-dial-ico.is-blue {
		background: var(--color-blue);
	}
	.px-ai-dial-ico svg {
		width: 22px;
		height: 22px;
	}
	.px-ai-ico {
		display: inline-block;
		width: 26px;
		height: 26px;
		background-color: currentColor;
		-webkit-mask: center / contain no-repeat;
		mask: center / contain no-repeat;
	}
	.px-ai-ico--360 {
		width: 30px;
		-webkit-mask-image: url("/wp-content/uploads/360_grad_icon.svg");
		mask-image: url("/wp-content/uploads/360_grad_icon.svg");
	}
	.px-ai-ico--podcast {
		-webkit-mask-image: url("/wp-content/uploads/podcast_icon.svg");
		mask-image: url("/wp-content/uploads/podcast_icon.svg");
	}
	.px-ai-ico--contact {
		width: 24px;
		-webkit-mask-image: url("/wp-content/uploads/icon-sidebar-phone.svg");
		mask-image: url("/wp-content/uploads/icon-sidebar-phone.svg");
	}

	/* ---------- Bottom-Sheet für Podcast und Kontakt ---------- */
	.px-sheet-overlay {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 999997;
		background: rgba(50, 50, 50, .35);
		opacity: 0;
		visibility: hidden;
		transition: opacity .3s, visibility 0s linear .3s;
	}
	.px-sheet-overlay.is-open {
		opacity: 1;
		visibility: visible;
		transition-delay: 0s;
	}
	.px-sheet {
		display: block;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 999998;
		max-height: calc(100dvh - 80px);
		overflow: auto;
		padding: 28px 25px calc(28px + var(--px-safe-b));
		background: #fff;
		box-shadow: 2px 2px 20px rgba(0, 0, 0, .1);
		transform: translateY(100%);
		visibility: hidden;
		transition: transform .4s cubic-bezier(.22, .61, .36, 1), visibility 0s linear .4s;
	}
	.px-sheet.is-open {
		transform: none;
		visibility: visible;
		transition-delay: 0s;
	}
	.px-sheet::before {
		content: "";
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		height: 6px;
		background: linear-gradient(90deg, var(--color-blue) 0%, var(--color-green) 100%);
	}
	.px-sheet-head {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 14px;
	}
	.px-sheet-title {
		font-family: Montserrat, sans-serif;
		font-size: 20px;
		font-weight: 600;
		color: #323232;
	}
	.px-sheet-close {
		display: inline-flex;
		align-items: center;
		gap: 8px;
		padding: 6px 0;
		border: 0;
		background: transparent;
		color: #878787;
		font-family: Barlow, sans-serif;
		font-size: 15px;
		cursor: pointer;
	}
	.px-sheet-close:hover,
	.px-sheet-close:focus {
		background: transparent;
		color: #323232;
	}
	.px-sheet .addressblock {
		width: auto;
		margin: 0;
		padding: 0;
		font-size: 1.125rem;
	}
	.px-sheet .addressblock .textgroup {
		margin: 14px 0;
	}
	.px-sheet .addressblock .textgroup:first-child {
		margin-top: 0;
	}
	.px-sheet .addressblock .textgroup:last-child {
		margin-bottom: 0;
	}
	.px-sheet .addressblock .textgroup span {
		display: flex;
		align-items: center;
		width: 100%;
		min-height: 34px;
	}
	.px-sheet .addressblock .textgroup span a {
		width: 100%;
	}
	.px-sheet .addressblock .textgroup span a:hover {
		color: var(--color-blue);
	}
	/* Länderflaggen vor den Telefonnummern (wie in der Flybar) */
	.px-sheet .addressblock span.textline.phone::before {
		content: "";
		display: block;
		flex: none;
		width: 18px;
		height: 18px;
		margin-right: 10px;
		background: center / 100% auto no-repeat;
	}
	.px-sheet .addressblock span.textline.phone.de::before {
		background-image: url("/wp-content/uploads/prologistik-flagge-de.svg");
	}
	.px-sheet .addressblock span.textline.phone.at::before {
		background-image: url("/wp-content/uploads/prologistik-flagge-schw.svg");
	}
	.px-sheet .addressblock span.textline.phone.fr::before {
		background-image: url("/wp-content/uploads/prologistik-flagge-fr.svg");
	}
	.px-sheet .podcast-content {
		display: flex;
		flex-direction: column;
		gap: 18px;
	}
	.px-sheet .podcast-content .wp-block-button__link {
		display: inline-block;
		padding: .875rem 2rem;
		font-size: .9rem;
		color: #fff;
	}

	/* Leiste, Plus und Schnellwahl treten zurück, solange Menü, Chat oder Sheet offen sind */
	body.slide-opened .px-ai,
	body.slide-opened .px-ai-dial,
	body.px-chat-open .px-ai,
	body.px-chat-open .px-ai-dial,
	body.px-sheet-open .px-ai {
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.px-ai-spinner,
	.px-ai-prompt::after {
		animation: none !important;
	}
}
