/* Pine360 Chat Bot */
.p360cb {
	--p360cb-accent: #0087e0;
	position: fixed;
	bottom: 20px;
	z-index: 99999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
}
.p360cb--right { right: 20px; }
.p360cb--left { left: 20px; }

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

/* Launcher */
.p360cb-launcher {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	border: 0;
	padding: 0;
	cursor: pointer;
	background: var(--p360cb-accent);
	color: #fff;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .22);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform .2s ease;
}
.p360cb-launcher { position: relative; animation: p360cb-pop .5s cubic-bezier(.34, 1.56, .64, 1) backwards; }
.p360cb--left .p360cb-launcher { margin-right: auto; }
.p360cb--right .p360cb-launcher { margin-left: auto; }
.p360cb-launcher:hover { transform: scale(1.06); }
.p360cb-launcher svg { width: 28px; height: 28px; }
.p360cb-icon-chat { fill: currentColor; }
.p360cb-icon-close { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; display: none; }
.p360cb--open .p360cb-icon-chat { display: none; }
.p360cb--open .p360cb-icon-close { display: block; }

/* Attention cues (until the visitor opens or dismisses the chat) */
.p360cb-pulse {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--p360cb-accent);
	z-index: -1;
	opacity: 0;
	pointer-events: none;
}
.p360cb--attention .p360cb-pulse { animation: p360cb-pulse 2s ease-out infinite; }
.p360cb--attention .p360cb-icon-chat { animation: p360cb-wiggle 4s ease-in-out 1s infinite; transform-origin: 50% 90%; }
.p360cb-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 10px;
	background: #ef4444;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 16px;
	text-align: center;
	border: 2px solid #fff;
	transform: scale(0);
	transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}
.p360cb--attention .p360cb-badge { transform: scale(1); transition-delay: 2.5s; }

/* Greeting bubble next to the button */
.p360cb-teaser {
	position: absolute;
	bottom: 8px;
	display: flex;
	align-items: flex-start;
	gap: 4px;
	max-width: 260px;
	width: max-content;
	padding: 12px 10px 12px 16px;
	background: #fff;
	color: #1d2327;
	border-radius: 16px;
	box-shadow: 0 8px 28px rgba(0, 0, 0, .22);
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px) scale(.9);
	transition: opacity .3s ease, transform .35s cubic-bezier(.34, 1.56, .64, 1), visibility .3s;
}
.p360cb--right .p360cb-teaser { right: 76px; border-bottom-right-radius: 4px; transform-origin: 100% 100%; }
.p360cb--left .p360cb-teaser { left: 76px; border-bottom-left-radius: 4px; transform-origin: 0 100%; }
.p360cb-teaser--show { opacity: 1; visibility: visible; transform: none; animation: p360cb-float 3s ease-in-out .6s infinite; }
.p360cb--open .p360cb-teaser { display: none; }
.p360cb-teaser__text {
	background: none;
	border: 0;
	padding: 0;
	margin: 0;
	font: inherit;
	font-size: 14px;
	color: inherit;
	text-align: left;
	cursor: pointer;
}
.p360cb-teaser__close {
	flex: none;
	background: none;
	border: 0;
	padding: 0 2px;
	margin: -4px 0 0;
	font-size: 18px;
	line-height: 1;
	color: #8a949b;
	cursor: pointer;
}
.p360cb-teaser__close:hover { color: #1d2327; }
.p360cb-dots { display: inline-flex; gap: 4px; padding: 4px 0; }
.p360cb-dots span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #9aa5a0;
	animation: p360cb-dot 1s infinite ease-in-out;
}
.p360cb-dots span:nth-child(2) { animation-delay: .15s; }
.p360cb-dots span:nth-child(3) { animation-delay: .3s; }

/* Panel */
.p360cb-panel {
	position: absolute;
	bottom: 76px;
	width: 360px;
	max-width: calc(100vw - 40px);
	height: 520px;
	max-height: calc(100vh - 120px);
	background: #fff;
	color: #1d2327;
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, .2);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	transform: translateY(12px);
	transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
.p360cb--right .p360cb-panel { right: 0; }
.p360cb--left .p360cb-panel { left: 0; }
.p360cb--open .p360cb-panel { opacity: 1; visibility: visible; transform: none; }

.p360cb-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	background: var(--p360cb-accent);
	color: #fff;
}
.p360cb-avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .2);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	flex: none;
}
.p360cb-avatar img { width: 24px; height: 24px; object-fit: contain; display: block; }
.p360cb-title { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.p360cb-title strong { font-size: 16px; }
.p360cb-title span { font-size: 12px; opacity: .85; }
.p360cb-close {
	background: none;
	border: 0;
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	padding: 4px 6px;
	opacity: .85;
}
.p360cb-close:hover { opacity: 1; }

/* Messages */
.p360cb-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background: #f5f7f6;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.p360cb-msg {
	max-width: 82%;
	padding: 9px 13px;
	border-radius: 14px;
	word-wrap: break-word;
	animation: p360cb-in .2s ease;
}
.p360cb-msg--bot {
	align-self: flex-start;
	background: #fff;
	border: 1px solid #e3e7e5;
	border-bottom-left-radius: 4px;
}
.p360cb-msg--user {
	align-self: flex-end;
	background: var(--p360cb-accent);
	color: #fff;
	border-bottom-right-radius: 4px;
}
.p360cb-msg a { color: inherit; text-decoration: underline; }

.p360cb-typing { display: flex; gap: 4px; padding: 12px 14px; }
.p360cb-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #9aa5a0;
	animation: p360cb-dot 1s infinite ease-in-out;
}
.p360cb-typing span:nth-child(2) { animation-delay: .15s; }
.p360cb-typing span:nth-child(3) { animation-delay: .3s; }

/* Quick replies */
.p360cb-quick {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0 16px;
	background: #f5f7f6;
}
.p360cb-quick:not(:empty) { padding-bottom: 12px; }
.p360cb-chip {
	border: 1px solid var(--p360cb-accent);
	color: var(--p360cb-accent);
	background: #fff;
	border-radius: 999px;
	padding: 6px 12px;
	font-size: 13px;
	cursor: pointer;
	font-family: inherit;
}
.p360cb-chip:hover { background: var(--p360cb-accent); color: #fff; }

/* Input */
.p360cb-form {
	display: flex;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid #e3e7e5;
	background: #fff;
	margin: 0;
}
.p360cb-input {
	flex: 1;
	border: 1px solid #d0d6d3;
	border-radius: 999px;
	padding: 10px 14px;
	font-size: 15px;
	font-family: inherit;
	outline: none;
	min-width: 0;
	background: #fff;
	color: #1d2327;
}
.p360cb-input:focus { border-color: var(--p360cb-accent); }
.p360cb-send {
	width: 42px;
	height: 42px;
	flex: none;
	border-radius: 50%;
	border: 0;
	padding: 0;
	background: var(--p360cb-accent);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
.p360cb-send svg { width: 20px; height: 20px; fill: currentColor; }

@keyframes p360cb-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes p360cb-pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes p360cb-pulse { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes p360cb-wiggle {
	0%, 80%, 100% { transform: rotate(0); }
	84% { transform: rotate(-14deg); }
	88% { transform: rotate(12deg); }
	92% { transform: rotate(-8deg); }
	96% { transform: rotate(4deg); }
}
@keyframes p360cb-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }
@keyframes p360cb-dot { 0%, 80%, 100% { opacity: .3; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }

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

@media (max-width: 480px) {
	.p360cb-teaser { max-width: calc(100vw - 110px); }
	.p360cb { bottom: 14px; }
	.p360cb--right { right: 14px; }
	.p360cb--left { left: 14px; }
	.p360cb-panel { width: calc(100vw - 28px); max-width: none; height: calc(100vh - 110px); }
}
