/* PS Chat Bridge - FAB and chat panel */

.ps-chat-bridge {
	position: fixed;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, sans-serif;
	font-size: 16px;
	box-sizing: border-box;
}

.ps-chat-bridge *,
.ps-chat-bridge *::before,
.ps-chat-bridge *::after {
	box-sizing: border-box;
}

/* Floating Action Button */
.ps-chat-bridge-fab {
	position: fixed;
	bottom: 20px;
	right: 20px;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	border: none;
	background-color: #152d4d;
	color: #fff;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s, box-shadow 0.2s;
}

.ps-chat-bridge-fab:hover {
	transform: scale(1.05);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.ps-chat-bridge-fab:focus {
	outline: 2px solid #152d4d;
	outline-offset: 2px;
}

.ps-chat-bridge-fab-icon {
	flex-shrink: 0;
}

/* Panel */
.ps-chat-bridge-panel {
	position: fixed;
	bottom: 84px;
	right: 20px;
	width: 360px;
	max-width: calc(100vw - 40px);
	max-height: 70vh;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.ps-chat-bridge-panel[hidden] {
	display: none !important;
}

.ps-chat-bridge-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	background: #152d4d;
	color: #fff;
	flex-shrink: 0;
}

.ps-chat-bridge-panel-title {
	margin: 0;
	font-size: 1rem;
	font-weight: 600;
}

.ps-chat-bridge-close {
	background: none;
	border: none;
	color: #fff;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
	opacity: 0.9;
}

.ps-chat-bridge-close:hover {
	opacity: 1;
}

.ps-chat-bridge-close:focus {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* Messages list */
.ps-chat-bridge-messages {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	min-height: 200px;
	max-height: 400px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.ps-chat-bridge-msg {
	display: flex;
	align-items: flex-end;
}

.ps-chat-bridge-msg--visitor {
	justify-content: flex-end;
}

.ps-chat-bridge-msg--agent {
	justify-content: flex-start;
}

.ps-chat-bridge-msg--system {
	justify-content: center;
}

.ps-chat-bridge-msg-bubble {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 14px;
	line-height: 1.4;
	word-wrap: break-word;
}

.ps-chat-bridge-msg--visitor .ps-chat-bridge-msg-bubble {
	background: #152d4d;
	color: #fff;
	border-bottom-right-radius: 4px;
}

.ps-chat-bridge-msg--agent .ps-chat-bridge-msg-bubble {
	background: #e8e8e8;
	color: #1a1a1a;
	border-bottom-left-radius: 4px;
}

.ps-chat-bridge-msg--system .ps-chat-bridge-msg-bubble {
	background: #f5f5f5;
	color: #666;
	font-size: 0.875rem;
}

/* Form */
.ps-chat-bridge-form {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid #e0e0e0;
	background: #fff;
	flex-shrink: 0;
}

.ps-chat-bridge-input {
	flex: 1;
	min-width: 0;
	padding: 10px 12px;
	border: 1px solid #ccc;
	border-radius: 8px;
	font-size: 0.9375rem;
}

.ps-chat-bridge-input:focus {
	border-color: #152d4d;
	outline: none;
}

.ps-chat-bridge-send {
	padding: 10px 16px;
	background: #152d4d;
	color: #fff;
	border: none;
	border-radius: 8px;
	font-size: 0.9375rem;
	cursor: pointer;
	font-weight: 500;
}

.ps-chat-bridge-send:hover {
	background: #0f2240;
}

.ps-chat-bridge-send:focus {
	outline: 2px solid #152d4d;
	outline-offset: 2px;
}

/* Honeypot: hidden from humans */
.ps-chat-bridge-hp-label {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
}

.ps-chat-bridge-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.screen-reader-text {
	clip: rect(1px, 1px, 1px, 1px);
	height: 1px;
	width: 1px;
	overflow: hidden;
	position: absolute;
}

@media (max-width: 480px) {
	.ps-chat-bridge-panel {
		right: 10px;
		bottom: 76px;
		width: calc(100vw - 20px);
	}
	.ps-chat-bridge-fab {
		right: 10px;
		bottom: 16px;
	}
}
