/* PC Precision — Assistente FAQ + WhatsApp (mobile-first) */

.pcp-chatbot {
	--pcp-cb-accent: #25d366;
	--pcp-cb-accent-dark: #1da851;
	--pcp-cb-ink: #0b1220;
	--pcp-cb-muted: #64748b;
	--pcp-cb-bg: #ffffff;
	--pcp-cb-soft: #f3f6f8;
	--pcp-cb-line: #e5eaf0;
	--pcp-cb-shadow: 0 16px 48px rgba(8, 20, 30, 0.28);
	--pcp-cb-safe-b: env(safe-area-inset-bottom, 0px);
	--pcp-cb-safe-r: env(safe-area-inset-right, 0px);
	--pcp-cb-lift: 16px;
	position: fixed;
	right: max(14px, var(--pcp-cb-safe-r));
	bottom: calc(var(--pcp-cb-lift) + var(--pcp-cb-safe-b));
	z-index: 100050;
	font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
	pointer-events: none;
	-webkit-tap-highlight-color: transparent;
}

.pcp-chatbot * {
	box-sizing: border-box;
}

.pcp-chatbot__launcher,
.pcp-chatbot__panel,
.pcp-chatbot__bubble,
.pcp-chatbot__backdrop {
	pointer-events: auto;
}

.pcp-chatbot__backdrop {
	position: fixed;
	inset: 0;
	background: rgba(8, 15, 25, 0.42);
	z-index: -1;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

.pcp-chatbot.is-open .pcp-chatbot__backdrop {
	opacity: 1;
	pointer-events: auto;
}

.pcp-chatbot__launcher {
	position: relative;
	width: 62px !important;
	height: 62px !important;
	min-width: 62px !important;
	min-height: 62px !important;
	padding: 0 !important;
	margin: 0 !important;
	border: 0 !important;
	border-radius: 18px !important;
	background: linear-gradient(145deg, #2fe574 0%, #25d366 42%, #128c7e 100%) !important;
	background-color: #25d366 !important;
	color: #fff !important;
	box-shadow:
		0 4px 0 rgba(10, 90, 70, 0.22),
		0 12px 28px rgba(18, 140, 126, 0.45),
		inset 0 1px 0 rgba(255, 255, 255, 0.35) !important;
	cursor: pointer;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
	z-index: 2;
	line-height: 1 !important;
	text-decoration: none !important;
	appearance: none !important;
	-webkit-appearance: none !important;
}

.pcp-chatbot__launcher::before {
	content: "";
	position: absolute;
	inset: -5px;
	border-radius: 22px;
	border: 2px solid rgba(37, 211, 102, 0.45);
	animation: pcp-cb-pulse 2.2s ease-out infinite;
	pointer-events: none;
}

.pcp-chatbot__launcher.is-open::before,
.pcp-chatbot__launcher.has-unread::before {
	display: none;
}

.pcp-chatbot__launcher:hover {
	transform: translateY(-2px) scale(1.04);
	box-shadow:
		0 6px 0 rgba(10, 90, 70, 0.18),
		0 16px 34px rgba(18, 140, 126, 0.5),
		inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
	color: #fff !important;
	background: linear-gradient(145deg, #3aee80 0%, #25d366 42%, #128c7e 100%) !important;
}

.pcp-chatbot__launcher:active {
	transform: scale(0.96);
}

.pcp-chatbot__launcher:focus,
.pcp-chatbot__launcher:focus-visible {
	outline: 2px solid #fff !important;
	outline-offset: 3px !important;
	color: #fff !important;
}

.pcp-chatbot__launcher svg {
	width: 30px !important;
	height: 30px !important;
	fill: #fff !important;
	color: #fff !important;
	filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18));
	position: relative;
	z-index: 1;
	display: block !important;
}

.pcp-chatbot__launcher svg path {
	fill: #fff !important;
}

.pcp-chatbot__badge {
	position: absolute !important;
	top: -7px !important;
	right: -7px !important;
	left: auto !important;
	bottom: auto !important;
	min-width: 22px !important;
	width: auto !important;
	height: 22px !important;
	padding: 0 6px !important;
	margin: 0 !important;
	border: 0 !important;
	border-radius: 999px !important;
	background: #ef4444 !important;
	color: #fff !important;
	font-size: 12px !important;
	font-weight: 800 !important;
	font-family: "Segoe UI", system-ui, sans-serif !important;
	line-height: 22px !important;
	text-align: center !important;
	box-shadow: 0 2px 8px rgba(239, 68, 68, 0.45), 0 0 0 2px #fff !important;
	z-index: 5 !important;
	pointer-events: none !important;
	display: inline-block !important;
	animation: pcp-cb-badge-pop 0.35s ease;
}

.pcp-chatbot__badge[hidden] {
	display: none !important;
}

@keyframes pcp-cb-badge-pop {
	0% {
		transform: scale(0.4);
		opacity: 0;
	}
	70% {
		transform: scale(1.12);
	}
	100% {
		transform: scale(1);
		opacity: 1;
	}
}

.pcp-chatbot__launcher.is-open svg.pcp-chatbot__icon-wa {
	display: none !important;
}

.pcp-chatbot__launcher:not(.is-open) svg.pcp-chatbot__icon-close {
	display: none !important;
}

.pcp-chatbot__bubble {
	/* fixed: evita clip da overflow-x su html/body (Woodmart) */
	position: fixed;
	right: max(14px, var(--pcp-cb-safe-r));
	left: auto;
	bottom: calc(62px + 14px + var(--pcp-cb-lift) + var(--pcp-cb-safe-b));
	width: min(360px, calc(100vw - 28px));
	max-width: calc(100vw - 28px);
	background: var(--pcp-cb-bg);
	color: var(--pcp-cb-ink);
	border-radius: 18px;
	padding: 14px 40px 14px 14px;
	box-shadow: var(--pcp-cb-shadow);
	font-size: 14px;
	line-height: 1.45;
	animation: pcp-cb-pop 0.3s ease;
	z-index: 100055;
	overflow: visible;
	display: flex;
	gap: 12px;
	align-items: flex-start;
	border: 1px solid rgba(15, 23, 42, 0.06);
}

.pcp-chatbot__bubble[hidden] {
	display: none !important;
}

.pcp-chatbot__bubble-avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	flex: 0 0 auto;
	background: linear-gradient(145deg, #25d366, #128c7e);
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 10px rgba(18, 140, 126, 0.3);
}

.pcp-chatbot__bubble-avatar svg {
	width: 20px;
	height: 20px;
	fill: currentColor;
}

.pcp-chatbot__bubble-body {
	min-width: 0;
	flex: 1 1 auto;
	padding-right: 0;
}

.pcp-chatbot__bubble strong {
	display: block;
	margin: 0 0 4px;
	font-size: 14px;
	font-weight: 750;
	color: #0b1220;
	letter-spacing: 0.01em;
}

.pcp-chatbot__bubble-text {
	display: block;
	margin: 0;
	color: #334155;
	font-size: 13.5px;
	line-height: 1.45;
	white-space: normal;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.pcp-chatbot__bubble-cta {
	display: inline-flex;
	margin-top: 8px;
	padding: 6px 11px;
	border-radius: 999px;
	background: #ecfdf5;
	color: #067647;
	font-size: 12px;
	font-weight: 700;
	border: 1px solid #a7f3d0;
}

.pcp-chatbot__bubble-close {
	position: absolute !important;
	top: 8px !important;
	right: 8px !important;
	left: auto !important;
	bottom: auto !important;
	width: 28px !important;
	height: 28px !important;
	min-width: 28px !important;
	padding: 0 !important;
	margin: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: #f1f5f9 !important;
	color: #64748b !important;
	font-size: 18px !important;
	line-height: 1 !important;
	cursor: pointer;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	box-shadow: none !important;
	float: none !important;
	z-index: 2;
}

.pcp-chatbot__bubble-close:hover {
	background: #e2e8f0;
	color: #0f172a;
}

@keyframes pcp-cb-pulse {
	0% {
		transform: scale(0.92);
		opacity: 0.75;
	}
	70% {
		transform: scale(1.18);
		opacity: 0;
	}
	100% {
		transform: scale(1.18);
		opacity: 0;
	}
}

.pcp-chatbot__panel {
	position: absolute;
	right: 0;
	bottom: calc(62px + 12px);
	width: min(392px, calc(100vw - 20px));
	height: min(620px, calc(100dvh - 100px - var(--pcp-cb-safe-b)));
	max-height: calc(100dvh - 88px - var(--pcp-cb-safe-b));
	background: var(--pcp-cb-bg);
	border-radius: 20px;
	box-shadow: var(--pcp-cb-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: pcp-cb-pop 0.24s ease;
	z-index: 3;
}

.pcp-chatbot__panel[hidden] {
	display: none !important;
}

.pcp-chatbot__head {
	background: linear-gradient(135deg, #0a1f18 0%, #0f766e 58%, #128c7e 100%);
	color: #fff;
	padding: 12px 12px 12px 14px;
	display: flex;
	gap: 10px;
	align-items: center;
	flex: 0 0 auto;
}

.pcp-chatbot__avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.16);
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
}

.pcp-chatbot__avatar svg {
	width: 20px;
	height: 20px;
	fill: #fff;
}

.pcp-chatbot__head-text {
	min-width: 0;
	flex: 1;
}

.pcp-chatbot__head-title {
	margin: 0;
	font-size: 14.5px;
	font-weight: 700;
	letter-spacing: 0.01em;
	color: #ffffff !important;
	-webkit-text-fill-color: #ffffff !important;
}

.pcp-chatbot__head-status {
	margin: 2px 0 0;
	font-size: 11.5px;
	opacity: 0.92;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: #ffffff !important;
	-webkit-text-fill-color: #ffffff !important;
}

.pcp-chatbot__head-close {
	width: 36px;
	height: 36px;
	border: 0 !important;
	border-radius: 50% !important;
	/* Dark chip on green header — avoids white-on-white when theme forces light buttons */
	background: rgba(0, 0, 0, 0.38) !important;
	background-color: rgba(0, 0, 0, 0.38) !important;
	color: #ffffff !important;
	-webkit-text-fill-color: #ffffff !important;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	flex: 0 0 auto;
	box-shadow: none !important;
	opacity: 1 !important;
}

.pcp-chatbot__messages {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 12px;
	background: var(--pcp-cb-soft);
	display: flex;
	flex-direction: column;
	gap: 8px;
	-webkit-overflow-scrolling: touch;
}

.pcp-chatbot__msg {
	max-width: 88%;
	padding: 9px 12px;
	border-radius: 14px;
	font-size: 13.5px;
	line-height: 1.45;
	white-space: pre-wrap;
	word-break: break-word;
}

.pcp-chatbot__msg--bot {
	align-self: flex-start;
	background: #fff;
	color: var(--pcp-cb-ink);
	border: 1px solid var(--pcp-cb-line);
	border-bottom-left-radius: 4px;
}

.pcp-chatbot__msg--user {
	align-self: flex-end;
	background: #d9fdd3;
	color: var(--pcp-cb-ink);
	border-bottom-right-radius: 4px;
}

.pcp-chatbot__msg--typing {
	display: inline-flex;
	gap: 4px;
	align-items: center;
	padding: 12px 14px;
}

.pcp-chatbot__msg--typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #94a3b8;
	animation: pcp-cb-dot 1s infinite ease-in-out;
}

.pcp-chatbot__msg--typing span:nth-child(2) {
	animation-delay: 0.15s;
}

.pcp-chatbot__msg--typing span:nth-child(3) {
	animation-delay: 0.3s;
}

.pcp-chatbot__quick {
	flex: 0 0 auto;
	background: var(--pcp-cb-soft);
	border-top: 1px solid var(--pcp-cb-line);
	padding: 8px 0 10px;
}

.pcp-chatbot__quick-label {
	margin: 0 12px 6px;
	font-size: 11px;
	font-weight: 700;
	color: var(--pcp-cb-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.pcp-chatbot__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 0 12px;
	max-height: none;
	overflow: visible;
}

.pcp-chatbot__chip {
	border: 1px solid var(--pcp-cb-line);
	background: #fff;
	color: var(--pcp-cb-ink);
	border-radius: 999px;
	padding: 8px 12px;
	font-size: 12.5px;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
	flex: 0 0 auto;
	touch-action: manipulation;
}

.pcp-chatbot__chip:hover {
	border-color: #25d366;
	background: #f0fdf4;
}

.pcp-chatbot__chip:active {
	background: #ecfdf5;
	border-color: #25d366;
}

.pcp-chatbot__chip--operator {
	border-color: #25d366;
	background: #25d366;
	color: #fff;
}

.pcp-chatbot__chip--operator:hover {
	background: #1da851;
	border-color: #1da851;
	color: #fff;
}

.pcp-chatbot__composer {
	border-top: 1px solid var(--pcp-cb-line);
	padding: 8px 10px calc(8px + var(--pcp-cb-safe-b));
	background: #fff;
	display: flex;
	gap: 8px;
	align-items: center;
	flex: 0 0 auto;
}

.pcp-chatbot__input {
	flex: 1;
	border: 1px solid var(--pcp-cb-line);
	border-radius: 999px;
	padding: 11px 14px;
	font-size: 16px; /* evita zoom iOS */
	outline: none;
	min-width: 0;
	background: var(--pcp-cb-soft);
}

.pcp-chatbot__input:focus {
	border-color: #25d366;
	background: #fff;
	box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.18);
}

.pcp-chatbot__send {
	border: 0;
	border-radius: 50%;
	background: var(--pcp-cb-accent);
	color: #fff;
	width: 44px;
	height: 44px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
}

.pcp-chatbot__send:active {
	background: var(--pcp-cb-accent-dark);
}

.pcp-chatbot__send svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.pcp-chatbot__operator {
	padding: 10px 12px calc(10px + var(--pcp-cb-safe-b));
	background: #fff;
	border-top: 1px solid var(--pcp-cb-line);
	display: flex;
	flex-direction: column;
	gap: 7px;
	flex: 0 0 auto;
	max-height: 55%;
	overflow-y: auto;
}

.pcp-chatbot__operator[hidden] {
	display: none !important;
}

.pcp-chatbot__operator-intro {
	margin: 0 0 2px;
	padding: 10px 12px;
	border-radius: 12px;
	background: #ecfdf5;
	border: 1px solid #a7f3d0;
	color: #065f46;
	font-size: 12.5px;
	line-height: 1.45;
}

.pcp-chatbot__operator-intro strong {
	display: block;
	margin-bottom: 2px;
	font-size: 13px;
}

.pcp-chatbot__operator label {
	font-size: 11.5px;
	font-weight: 700;
	color: var(--pcp-cb-muted);
}

.pcp-chatbot__operator input,
.pcp-chatbot__operator textarea {
	width: 100%;
	border: 1px solid var(--pcp-cb-line);
	border-radius: 12px;
	padding: 10px 12px;
	font-size: 16px;
	font-family: inherit;
	background: var(--pcp-cb-soft);
	outline: none;
}

.pcp-chatbot__operator input:focus,
.pcp-chatbot__operator textarea:focus {
	border-color: #25d366;
	background: #fff;
	box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.16);
}

.pcp-chatbot__operator textarea {
	min-height: 72px;
	resize: vertical;
}

.pcp-chatbot__wa-btn {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 8px;
	border: 0;
	border-radius: 14px;
	background: #25d366 !important;
	color: #fff !important;
	font-weight: 750;
	font-size: 14.5px;
	padding: 13px 14px;
	cursor: pointer;
	text-decoration: none !important;
	min-height: 48px;
	box-shadow: 0 8px 20px rgba(37, 211, 102, 0.35);
	margin-top: 4px;
}

.pcp-chatbot__wa-btn:hover {
	background: #1da851 !important;
	color: #fff !important;
}

.pcp-chatbot__wa-btn svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.pcp-chatbot__hint {
	font-size: 11px;
	color: var(--pcp-cb-muted);
	line-height: 1.4;
	margin: 0;
}

.pcp-chatbot__back {
	border: 0;
	background: transparent;
	color: #0f766e;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
	align-self: flex-start;
	padding: 4px 0;
}

@keyframes pcp-cb-pop {
	from {
		opacity: 0;
		transform: translateY(12px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@keyframes pcp-cb-dot {
	0%,
	80%,
	100% {
		opacity: 0.35;
		transform: translateY(0);
	}
	40% {
		opacity: 1;
		transform: translateY(-3px);
	}
}

/* Sticky toolbar WoodMart */
@media (max-width: 1024px) {
	body.sticky-toolbar-on .pcp-chatbot {
		--pcp-cb-lift: 72px;
	}
}

/* Mobile: sheet full-width dal basso */
@media (max-width: 767px) {
	.pcp-chatbot {
		right: max(10px, var(--pcp-cb-safe-r));
		--pcp-cb-lift: 12px;
	}

	body.sticky-toolbar-on .pcp-chatbot {
		--pcp-cb-lift: 72px;
	}

	.pcp-chatbot.is-open {
		inset: 0;
		width: 100%;
		height: 100%;
		right: 0;
		bottom: 0;
		left: 0;
		top: 0;
		pointer-events: none;
	}

	.pcp-chatbot.is-open .pcp-chatbot__backdrop,
	.pcp-chatbot.is-open .pcp-chatbot__panel {
		pointer-events: auto;
	}

	.pcp-chatbot__launcher {
		position: fixed !important;
		right: max(10px, var(--pcp-cb-safe-r));
		bottom: calc(var(--pcp-cb-lift) + var(--pcp-cb-safe-b));
		width: 58px !important;
		height: 58px !important;
		min-width: 58px !important;
		min-height: 58px !important;
		border-radius: 16px !important;
		z-index: 100060;
	}

	.pcp-chatbot__launcher svg {
		width: 26px !important;
		height: 26px !important;
		fill: #fff !important;
	}

	.pcp-chatbot__chips {
		flex-wrap: nowrap;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: thin;
		scrollbar-color: #cbd5e1 transparent;
		padding-bottom: 4px;
	}

	.pcp-chatbot__chips::-webkit-scrollbar {
		height: 4px;
		display: block;
	}

	.pcp-chatbot__chips::-webkit-scrollbar-thumb {
		background: #cbd5e1;
		border-radius: 999px;
	}

	.pcp-chatbot__bubble {
		position: fixed;
		right: max(10px, var(--pcp-cb-safe-r));
		left: max(10px, env(safe-area-inset-left, 0px));
		bottom: calc(60px + 22px + var(--pcp-cb-lift) + var(--pcp-cb-safe-b));
		width: auto;
		max-width: none;
		font-size: 13.5px;
		z-index: 100055;
		padding: 13px 38px 13px 12px;
		gap: 10px;
	}

	.pcp-chatbot__bubble-avatar {
		width: 34px;
		height: 34px;
	}

	.pcp-chatbot__bubble-avatar svg {
		width: 18px;
		height: 18px;
	}

	.pcp-chatbot__bubble strong {
		font-size: 13.5px;
	}

	.pcp-chatbot__bubble-text {
		font-size: 13px;
		line-height: 1.4;
	}

	.pcp-chatbot__bubble-cta {
		margin-top: 7px;
		padding: 5px 10px;
		font-size: 11.5px;
	}

	.pcp-chatbot.is-open .pcp-chatbot__launcher {
		opacity: 0;
		pointer-events: none;
		transform: scale(0.6);
	}

	.pcp-chatbot__panel {
		position: fixed !important;
		left: 0 !important;
		right: 0 !important;
		bottom: 0 !important;
		top: auto !important;
		width: 100% !important;
		max-width: 100% !important;
		height: min(90dvh, calc(100dvh - 36px)) !important;
		max-height: calc(100dvh - 28px) !important;
		border-radius: 18px 18px 0 0 !important;
		animation: pcp-cb-sheet 0.28s ease;
		z-index: 100070;
	}

	.pcp-chatbot__composer {
		padding-bottom: calc(10px + var(--pcp-cb-safe-b));
	}

	.pcp-chatbot__operator {
		padding-bottom: calc(12px + var(--pcp-cb-safe-b));
	}

	.pcp-chatbot__send {
		background: #25d366 !important;
		color: #fff !important;
	}

	.pcp-chatbot__send svg {
		fill: #fff !important;
	}
}

@keyframes pcp-cb-sheet {
	from {
		opacity: 0.6;
		transform: translateY(24px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

body.pcp-chatbot-lock {
	overflow: hidden !important;
	touch-action: none;
}

/* Link WhatsApp siti */
a.pcp-wa-link,
.pcp-footer__whatsapp,
.pcp-contact-whatsapp a,
a[href*="wa.me/393520476824"] {
	display: inline-flex !important;
}
