#pbc-widget {
	position: fixed;
	bottom: 24px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
#pbc-widget.pbc-bottom-right { right: 24px; }
#pbc-widget.pbc-bottom-left { left: 24px; }

#pbc-toggle-btn {
	width: 60px; height: 60px; border-radius: 50%; border: none;
	background: var(--pbc-color, #2563eb);
	box-shadow: 0 6px 16px rgba(0,0,0,.2);
	cursor: pointer; display: flex; align-items: center; justify-content: center;
	transition: transform .15s ease;
}
#pbc-toggle-btn:hover { transform: scale(1.06); }
.pbc-icon { width: 26px; height: 26px; }
.pbc-icon-close { display: none; }
#pbc-widget.pbc-open .pbc-icon-chat { display: none; }
#pbc-widget.pbc-open .pbc-icon-close { display: block; }

.pbc-panel {
	position: absolute; bottom: 76px; width: 380px; height: 600px; max-height: calc(100vh - 120px);
	background: #fff; border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.25);
	overflow: hidden; display: flex; flex-direction: column;
	opacity: 0; transform: translateY(16px) scale(.98); pointer-events: none;
	transition: opacity .18s ease, transform .18s ease;
}
#pbc-widget.pbc-bottom-right .pbc-panel { right: 0; }
#pbc-widget.pbc-bottom-left .pbc-panel { left: 0; }
#pbc-widget.pbc-open .pbc-panel { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.pbc-header { background: var(--pbc-color, #2563eb); color: #fff; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 15px; flex-shrink: 0; }
.pbc-header-actions { display: flex; align-items: center; gap: 4px; }
.pbc-header-actions button { background: transparent; border: none; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 7px; padding: 0; -webkit-tap-highlight-color: transparent; }
.pbc-header-actions button:hover, .pbc-header-actions button:focus-visible { background: rgba(255,255,255,.15); outline: none; }
.pbc-header-actions button svg { width: 18px; height: 18px; display: block; }

.pbc-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.pbc-msg { max-width: 85%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.45; word-wrap: break-word; }
.pbc-msg p { margin: 0 0 6px; }
.pbc-msg p:last-child { margin-bottom: 0; }
.pbc-msg ul, .pbc-msg ol { margin: 4px 0; padding-left: 20px; }
.pbc-msg a { color: inherit; text-decoration: underline; }
.pbc-msg-user { align-self: flex-end; background: var(--pbc-color, #2563eb); color: #fff; border-bottom-right-radius: 4px; }
.pbc-msg-assistant { align-self: flex-start; background: #f1f3f5; color: #1a1a1a; border-bottom-left-radius: 4px; }
.pbc-msg-system { align-self: center; background: transparent; color: #999; font-size: 12px; font-style: italic; }

.pbc-typing { padding: 0 14px 8px; display: flex; gap: 4px; }
.pbc-typing[hidden] { display: none; }
.pbc-typing span { width: 6px; height: 6px; border-radius: 50%; background: #bbb; animation: pbc-bounce 1.2s infinite; }
.pbc-typing span:nth-child(2) { animation-delay: .15s; }
.pbc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes pbc-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.pbc-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #eee; flex-shrink: 0; }
.pbc-form textarea {
	flex: 1; resize: none; border: 1px solid #ddd; border-radius: 10px; padding: 9px 12px;
	font-size: 14px; font-family: inherit; max-height: 90px;
}
.pbc-form textarea:focus { outline: none; border-color: var(--pbc-color, #2563eb); }
.pbc-form button {
	width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--pbc-color, #2563eb); color:#fff;
	display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; padding:0;
	-webkit-tap-highlight-color: transparent;
}
.pbc-form button svg { width: 19px; height: 19px; display:block; }
.pbc-form button:disabled { opacity: .5; cursor: default; }

#pbc-input { scrollbar-width: none; -ms-overflow-style: none; }
#pbc-input::-webkit-scrollbar { display: none !important; width: 0; height: 0; }

@media (max-width: 480px) {
	#pbc-widget { left:0; right:0; bottom:0; width:100%; }
	#pbc-widget.pbc-bottom-right, #pbc-widget.pbc-bottom-left { left:0; right:0; }
	.pbc-panel {
		position: fixed;
		top: var(--pbc-vv-top, 0px);
		left: 0;
		right: 0;
		bottom: auto;
		width: 100%;
		height: var(--pbc-vv-height, 100dvh);
		max-height: var(--pbc-vv-height, 100dvh);
		border-radius: 0;
		transition: opacity .18s ease, transform .18s ease;
	}
	.pbc-header { min-height: 54px; padding: 10px 14px; box-sizing:border-box; }
	.pbc-header-actions button { width:34px; height:34px; }
	.pbc-form { padding: 8px 10px max(8px, env(safe-area-inset-bottom)); }
	.pbc-form textarea { min-height:40px; }
}
