/* Proflow Chat — widget */
:root {
	--pfchat-color: #7B3F9E;
	--pfchat-bottom: 24px;
	--pfchat-right: 24px;
	--pfchat-radius: 18px;
	--pfchat-font: inherit;
}

#pfchat-root,
#pfchat-root * {
	box-sizing: border-box;
}

#pfchat-root {
	font-family: var(--pfchat-font);
	font-size: 15px;
	line-height: 1.45;
	color: #1f1f23;
	position: fixed;
	z-index: 99990;
	bottom: 0;
	right: 0;
	width: 0;
	height: 0;
}

/* Przycisk */
.pfchat-launcher {
	position: fixed;
	bottom: var(--pfchat-bottom);
	right: var(--pfchat-right);
	width: 58px;
	height: 58px;
	border-radius: 50%;
	border: 0;
	background: var(--pfchat-color);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform .18s ease, box-shadow .18s ease, opacity .2s ease;
	padding: 0;
	outline-offset: 3px;
}
.pfchat-launcher:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 12px 28px rgba(0, 0, 0, .26); }
.pfchat-launcher svg { width: 28px; height: 28px; display: block; }
.pfchat-launcher .pfchat-ic-close { display: none; }
.pfchat-open .pfchat-launcher .pfchat-ic-chat { display: none; }
.pfchat-open .pfchat-launcher .pfchat-ic-close { display: block; }
.pfchat-launcher .pfchat-badge {
	position: absolute;
	top: -3px;
	right: -3px;
	min-width: 20px;
	height: 20px;
	border-radius: 10px;
	background: #e5484d;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 0 6px;
	border: 2px solid #fff;
}
.pfchat-launcher .pfchat-badge.is-on { display: flex; }

/* Dymek zachęty */
.pfchat-teaser {
	position: fixed;
	bottom: calc(var(--pfchat-bottom) + 72px);
	right: var(--pfchat-right);
	max-width: 260px;
	background: #fff;
	color: #1f1f23;
	border-radius: 14px;
	padding: 12px 36px 12px 14px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
	font-size: 14px;
	cursor: pointer;
	animation: pfchat-pop .25s ease;
}
.pfchat-teaser button {
	position: absolute;
	top: 6px;
	right: 6px;
	border: 0;
	background: transparent;
	color: #888;
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
	padding: 4px;
}

/* Panel */
.pfchat-panel {
	position: fixed;
	bottom: calc(var(--pfchat-bottom) + 72px);
	right: var(--pfchat-right);
	width: 390px;
	max-width: calc(100vw - 2 * var(--pfchat-right));
	height: 620px;
	max-height: calc(100vh - var(--pfchat-bottom) - 96px);
	background: #fff;
	border-radius: var(--pfchat-radius);
	box-shadow: 0 18px 60px rgba(0, 0, 0, .26);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px) scale(.98);
	pointer-events: none;
	transition: opacity .2s ease, transform .2s ease;
}
.pfchat-open .pfchat-panel {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}

.pfchat-head {
	background: var(--pfchat-color);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	gap: 12px;
	flex: 0 0 auto;
}
.pfchat-avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .18);
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
}
.pfchat-avatar svg { width: 22px; height: 22px; }
.pfchat-head-text { flex: 1 1 auto; min-width: 0; }
.pfchat-head-title { font-weight: 700; font-size: 15px; line-height: 1.2; }
.pfchat-head-sub { font-size: 12px; opacity: .85; margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.pfchat-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; display: inline-block; }
.pfchat-head button {
	border: 0;
	background: transparent;
	color: #fff;
	cursor: pointer;
	padding: 6px;
	border-radius: 8px;
	opacity: .9;
	display: flex;
}
.pfchat-head button:hover { background: rgba(255, 255, 255, .15); opacity: 1; }
.pfchat-head button svg { width: 20px; height: 20px; }

.pfchat-body {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px 14px 8px;
	background: #f7f5fa;
	scroll-behavior: smooth;
	overscroll-behavior: contain;
}

.pfchat-msg {
	display: flex;
	margin: 0 0 10px;
	animation: pfchat-pop .2s ease;
}
.pfchat-msg.is-user { justify-content: flex-end; }
.pfchat-bubble {
	max-width: 86%;
	padding: 10px 13px;
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
	word-wrap: break-word;
	overflow-wrap: anywhere;
}
.pfchat-msg.is-user .pfchat-bubble {
	background: var(--pfchat-color);
	color: #fff;
	border-bottom-right-radius: 6px;
}
.pfchat-msg.is-bot .pfchat-bubble { border-bottom-left-radius: 6px; }
.pfchat-msg.is-system .pfchat-bubble {
	background: transparent;
	box-shadow: none;
	color: #6b6b75;
	font-size: 13px;
	text-align: center;
	max-width: 100%;
	margin: 0 auto;
}
.pfchat-bubble p { margin: 0 0 8px; }
.pfchat-bubble p:last-child { margin-bottom: 0; }
.pfchat-bubble ul, .pfchat-bubble ol { margin: 4px 0 8px 18px; padding: 0; }
.pfchat-bubble li { margin: 2px 0; }
.pfchat-bubble a { color: var(--pfchat-color); text-decoration: underline; font-weight: 600; }
.pfchat-msg.is-user .pfchat-bubble a { color: #fff; }
.pfchat-bubble strong { font-weight: 700; }

/* Karty produktów */
.pfchat-products {
	display: flex;
	gap: 10px;
	overflow-x: auto;
	padding: 2px 2px 8px;
	margin: -2px 0 10px;
	scrollbar-width: thin;
}
.pfchat-card {
	flex: 0 0 170px;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: inherit;
}
.pfchat-card-img {
	height: 120px;
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	border-bottom: 1px solid #f0edf3;
}
.pfchat-card-img img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.pfchat-card-body { padding: 9px 10px 10px; display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; }
.pfchat-card-name {
	font-size: 12.5px;
	line-height: 1.3;
	font-weight: 600;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 2.6em;
}
.pfchat-card-price { font-weight: 700; color: var(--pfchat-color); font-size: 14px; }
.pfchat-card-actions { display: flex; gap: 6px; margin-top: auto; }
.pfchat-card-actions a,
.pfchat-card-actions button {
	flex: 1 1 auto;
	font-size: 12px;
	font-weight: 600;
	padding: 7px 6px;
	border-radius: 9px;
	text-align: center;
	cursor: pointer;
	border: 1.5px solid var(--pfchat-color);
	background: #fff;
	color: var(--pfchat-color);
	text-decoration: none;
	line-height: 1.1;
	font-family: inherit;
}
.pfchat-card-actions button.pfchat-add { background: var(--pfchat-color); color: #fff; }
.pfchat-card-actions button.pfchat-add[disabled] { opacity: .6; cursor: default; }

/* Podpowiedzi */
.pfchat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 12px; }
.pfchat-chip {
	border: 1.5px solid var(--pfchat-color);
	color: var(--pfchat-color);
	background: #fff;
	border-radius: 999px;
	padding: 6px 12px;
	font-size: 13px;
	cursor: pointer;
	font-family: inherit;
	line-height: 1.2;
}
.pfchat-chip:hover { background: var(--pfchat-color); color: #fff; }

/* Przekazanie do człowieka */
.pfchat-handoff {
	background: #fff;
	border: 1.5px dashed var(--pfchat-color);
	border-radius: 14px;
	padding: 12px;
	margin: 0 0 12px;
	animation: pfchat-pop .2s ease;
}
.pfchat-handoff h4 { margin: 0 0 6px; font-size: 14px; font-weight: 700; }
.pfchat-handoff p { margin: 0 0 8px; font-size: 13px; color: #55555e; }
.pfchat-handoff .pfchat-contact-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.pfchat-handoff .pfchat-contact-row a {
	font-size: 12.5px;
	font-weight: 600;
	color: var(--pfchat-color);
	border: 1.5px solid var(--pfchat-color);
	border-radius: 999px;
	padding: 5px 10px;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 5px;
}
.pfchat-handoff .pfchat-contact-row a svg { width: 14px; height: 14px; }
.pfchat-handoff .pfchat-contact-row a.pfchat-wa { color: #128c7e; border-color: #128c7e; }
.pfchat-handoff input,
.pfchat-handoff textarea {
	width: 100%;
	border: 1.5px solid #ddd6e4;
	border-radius: 10px;
	padding: 8px 10px;
	font-size: 14px;
	font-family: inherit;
	margin: 0 0 8px;
	background: #fff;
	color: #1f1f23;
}
.pfchat-handoff input:focus,
.pfchat-handoff textarea:focus { outline: none; border-color: var(--pfchat-color); }
.pfchat-handoff textarea { min-height: 70px; resize: vertical; }
.pfchat-handoff label.pfchat-consent { display: flex; gap: 8px; font-size: 12px; color: #55555e; align-items: flex-start; margin: 0 0 10px; line-height: 1.35; }
.pfchat-handoff label.pfchat-consent input { width: auto; margin: 2px 0 0; }
.pfchat-handoff .pfchat-hp { position: absolute; left: -9999px; }
.pfchat-handoff .pfchat-btn {
	width: 100%;
	border: 0;
	border-radius: 10px;
	background: var(--pfchat-color);
	color: #fff;
	padding: 10px;
	font-weight: 700;
	font-size: 14px;
	cursor: pointer;
	font-family: inherit;
}
.pfchat-handoff .pfchat-btn[disabled] { opacity: .6; cursor: default; }
.pfchat-handoff .pfchat-err { color: #b3261e; font-size: 12.5px; margin: -4px 0 8px; }

/* Lista rezerwowa (v1.2) */
.pfchat-waitlist { border-style: solid; box-shadow: 0 6px 18px rgba(0, 0, 0, .06); }
.pfchat-handoff select {
	width: 100%;
	border: 1.5px solid #ddd6e4;
	border-radius: 10px;
	padding: 8px 10px;
	font-size: 14px;
	font-family: inherit;
	margin: 0 0 8px;
	background: #fff;
	color: #1f1f23;
}
.pfchat-handoff select:focus { outline: none; border-color: var(--pfchat-color); }
.pfchat-handoff .pfchat-row { display: flex; gap: 8px; }
.pfchat-handoff .pfchat-row select { flex: 1.4; }
.pfchat-handoff .pfchat-row input { flex: 1; }
.pfchat-handoff .pfchat-radio { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 12.5px; color: #3c3c44; margin: 0 0 10px; }
.pfchat-handoff .pfchat-radio span { color: #55555e; }
.pfchat-handoff .pfchat-radio label { display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }
.pfchat-handoff .pfchat-radio input { width: auto; margin: 0; accent-color: var(--pfchat-color); }
.pfchat-handoff label.pfchat-consent input { accent-color: var(--pfchat-color); }
.pfchat-handoff label.pfchat-consent a { color: var(--pfchat-color); }
a.pfchat-chip { text-decoration: none; display: inline-block; }
.pfchat-quick .pfchat-chip:first-child { background: var(--pfchat-color); color: #fff; }

/* Pisanie */
.pfchat-typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 2px; }
.pfchat-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #b9a7c8;
	animation: pfchat-blink 1.2s infinite ease-in-out;
}
.pfchat-typing span:nth-child(2) { animation-delay: .15s; }
.pfchat-typing span:nth-child(3) { animation-delay: .3s; }

/* Stopka / wejście */
.pfchat-foot {
	flex: 0 0 auto;
	background: #fff;
	border-top: 1px solid #ece8f0;
	padding: 10px 12px 8px;
}
.pfchat-form { display: flex; gap: 8px; align-items: flex-end; }
.pfchat-input {
	flex: 1 1 auto;
	border: 1.5px solid #ddd6e4;
	border-radius: 14px;
	padding: 10px 12px;
	font-size: 15px;
	font-family: inherit;
	line-height: 1.35;
	resize: none;
	max-height: 120px;
	min-height: 42px;
	background: #fff;
	color: #1f1f23;
	margin: 0;
}
.pfchat-input:focus { outline: none; border-color: var(--pfchat-color); box-shadow: 0 0 0 3px rgba(123, 63, 158, .12); }
.pfchat-send {
	width: 42px;
	height: 42px;
	flex: 0 0 auto;
	border: 0;
	border-radius: 12px;
	background: var(--pfchat-color);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}
.pfchat-send[disabled] { opacity: .5; cursor: default; }
.pfchat-send svg { width: 20px; height: 20px; }
.pfchat-note {
	font-size: 11px;
	color: #8a8a94;
	text-align: center;
	margin: 7px 0 0;
	display: flex;
	justify-content: center;
	gap: 6px;
	flex-wrap: wrap;
}
.pfchat-note button {
	border: 0;
	background: transparent;
	color: var(--pfchat-color);
	font-weight: 600;
	cursor: pointer;
	padding: 0;
	font-size: 11px;
	font-family: inherit;
	text-decoration: underline;
}

@keyframes pfchat-pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pfchat-blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

@media (prefers-reduced-motion: reduce) {
	#pfchat-root * { animation: none !important; transition: none !important; }
}

/* Mobile: pełny ekran */
@media (max-width: 600px) {
	.pfchat-panel {
		bottom: 0;
		right: 0;
		width: 100vw;
		max-width: 100vw;
		height: 100%;
		height: 100dvh;
		max-height: none;
		border-radius: 0;
	}
	.pfchat-open .pfchat-launcher { display: none; }
	.pfchat-teaser { max-width: calc(100vw - 2 * var(--pfchat-right) - 70px); }
	.pfchat-input { font-size: 16px; } /* bez zoomu na iOS */
}

/* v1.1 — odpowiedzi zespołu (Proflow) */
.pfchat-msg.is-op .pfchat-bubble { border-left: 3px solid var(--pfchat-color); background: #fff; }
.pfchat-op-name { font-size: 11px; font-weight: 700; color: var(--pfchat-color); margin: 0 0 4px; letter-spacing: .02em; }
.pfchat-human .pfchat-dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .25); }
.pfchat-link { border: 0; background: transparent; color: var(--pfchat-color); font-weight: 600; cursor: pointer; padding: 0; font: inherit; font-size: 13px; text-decoration: underline; }
.pfchat-msg.is-system .pfchat-bubble .pfchat-link { display: inline; }
