#wcw-widget-root {
	--wcw-brand-color: #25d366;
	position: fixed;
	bottom: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#wcw-widget-root.wcw-position-right {
	right: 20px;
}

#wcw-widget-root.wcw-position-left {
	left: 20px;
}

.wcw-toggle-btn {
	position: relative;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var( --wcw-brand-color );
	border: none;
	box-shadow: 0 4px 14px rgba( 0, 0, 0, 0.25 );
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	opacity: 0;
	transform: scale( 0.4 );
	transition: transform 0.2s cubic-bezier( 0.34, 1.56, 0.64, 1 ), opacity 0.2s ease, box-shadow 0.2s ease;
}

.wcw-toggle-btn.wcw-in {
	opacity: 1;
	transform: scale( 1 );
}

.wcw-toggle-btn:hover {
	transform: scale( 1.06 );
}

.wcw-toggle-btn:active {
	transform: scale( 0.94 );
}

.wcw-toggle-btn svg {
	position: relative;
	z-index: 1;
	transition: transform 0.2s ease;
}

.wcw-toggle-btn.wcw-active svg {
	transform: rotate( 90deg );
}

.wcw-pulse-ring {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	box-shadow: 0 0 0 0 rgba( 37, 211, 102, 0.55 );
	animation: wcw-pulse 2.2s ease-out infinite;
}

.wcw-toggle-btn.wcw-active .wcw-pulse-ring {
	display: none;
}

@keyframes wcw-pulse {
	0% {
		box-shadow: 0 0 0 0 rgba( 37, 211, 102, 0.45 );
	}
	70% {
		box-shadow: 0 0 0 14px rgba( 37, 211, 102, 0 );
	}
	100% {
		box-shadow: 0 0 0 0 rgba( 37, 211, 102, 0 );
	}
}

.wcw-panel {
	position: absolute;
	bottom: 76px;
	width: 340px;
	max-width: calc( 100vw - 40px );
	height: 500px;
	max-height: 70vh;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 8px 30px rgba( 0, 0, 0, 0.25 );
	overflow: hidden;
	display: flex;
	flex-direction: column;
	opacity: 0;
	transform: translateY( 16px ) scale( 0.96 );
	pointer-events: none;
	transform-origin: bottom;
	transition: opacity 0.25s ease, transform 0.3s cubic-bezier( 0.34, 1.56, 0.64, 1 );
}

#wcw-widget-root.wcw-position-right .wcw-panel {
	right: 0;
}

#wcw-widget-root.wcw-position-left .wcw-panel {
	left: 0;
}

.wcw-panel.wcw-open {
	opacity: 1;
	transform: translateY( 0 ) scale( 1 );
	pointer-events: auto;
}

.wcw-view-stack {
	position: relative;
	flex: 1;
	min-height: 0;
	overflow: hidden;
}

.wcw-view {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	min-height: 0;
	background: #fff;
	transition: transform 0.3s cubic-bezier( 0.34, 1.56, 0.64, 1 );
}

.wcw-view-slide-in-forward {
	transform: translateX( 100% );
}

.wcw-view-slide-in-back {
	transform: translateX( -100% );
}

.wcw-view-active {
	transform: translateX( 0 );
}

.wcw-view-slide-out-forward {
	transform: translateX( -100% );
}

.wcw-view-slide-out-back {
	transform: translateX( 100% );
}

.wcw-header {
	background: var( --wcw-brand-color );
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	gap: 10px;
}

.wcw-back-btn {
	background: transparent;
	border: none;
	color: #fff;
	font-size: 18px;
	cursor: pointer;
	padding: 0 4px;
}

.wcw-header-titles {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.wcw-header-title {
	font-weight: 600;
	font-size: 15px;
}

.wcw-header-subtitle {
	font-size: 12px;
	opacity: 0.85;
}

.wcw-agent-list {
	overflow-y: auto;
	padding: 6px 0;
}

.wcw-agent-row {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 10px 16px;
	background: none;
	border: none;
	border-bottom: 1px solid #f0f0f0;
	cursor: pointer;
	text-align: left;
	opacity: 0;
	transform: translateY( 6px );
	animation: wcw-row-in 0.25s ease forwards;
	animation-delay: calc( var( --wcw-row-index, 0 ) * 0.05s );
}

@keyframes wcw-row-in {
	to {
		opacity: 1;
		transform: translateY( 0 );
	}
}

.wcw-agent-row:hover {
	background: #f7f7f7;
}

.wcw-agent-avatar {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	object-fit: cover;
	background: #e5e5e5;
	flex-shrink: 0;
}

.wcw-agent-info {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.wcw-agent-name {
	font-size: 14px;
	font-weight: 600;
	color: #111;
}

.wcw-agent-title {
	font-size: 12px;
	color: #667781;
}

.wcw-chat-body {
	flex: 1;
	padding: 16px;
	overflow-y: auto;
	background-color: #e5ddd5;
	background-image: radial-gradient( rgba( 0, 0, 0, 0.04 ) 1px, transparent 1px );
	background-size: 16px 16px;
}

.wcw-chat-bubble {
	background: #fff;
	border-radius: 8px;
	padding: 10px 12px;
	font-size: 13.5px;
	line-height: 1.4;
	color: #111;
	max-width: 85%;
	box-shadow: 0 1px 1px rgba( 0, 0, 0, 0.1 );
}

.wcw-bubble-in {
	animation: wcw-bubble-in 0.25s ease both;
}

@keyframes wcw-bubble-in {
	from {
		opacity: 0;
		transform: translateY( 8px ) scale( 0.96 );
	}
	to {
		opacity: 1;
		transform: translateY( 0 ) scale( 1 );
	}
}

.wcw-typing-indicator {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	width: fit-content;
	background: #fff;
	border-radius: 14px;
	padding: 10px 14px;
	box-shadow: 0 1px 1px rgba( 0, 0, 0, 0.1 );
}

.wcw-typing-indicator span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #9aa5ab;
	animation: wcw-typing-bounce 1s ease-in-out infinite;
}

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

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

@keyframes wcw-typing-bounce {
	0%,
	60%,
	100% {
		transform: translateY( 0 );
		opacity: 0.6;
	}
	30% {
		transform: translateY( -4px );
		opacity: 1;
	}
}

.wcw-chat-footer {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px;
	background: #f0f0f0;
	border-top: 1px solid #e2e2e2;
}

.wcw-chat-input {
	flex: 1;
	resize: none;
	border: none;
	border-radius: 20px;
	padding: 10px 14px;
	font-size: 13.5px;
	line-height: 1.3;
	max-height: 80px;
	font-family: inherit;
}

.wcw-chat-input:focus {
	outline: none;
	box-shadow: 0 0 0 2px rgba( 37, 211, 102, 0.35 );
}

.wcw-send-btn {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var( --wcw-brand-color );
	color: #fff;
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
}

.wcw-send-btn:hover {
	filter: brightness( 0.95 );
}

.wcw-send-btn.wcw-sent {
	animation: wcw-send-pop 0.3s ease;
}

@keyframes wcw-send-pop {
	0% {
		transform: scale( 1 );
	}
	40% {
		transform: scale( 0.85 );
	}
	100% {
		transform: scale( 1 );
	}
}

@media ( max-width: 480px ) {
	.wcw-panel {
		width: calc( 100vw - 24px );
		bottom: 76px;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.wcw-toggle-btn,
	.wcw-panel,
	.wcw-view,
	.wcw-agent-row,
	.wcw-chat-bubble,
	.wcw-send-btn {
		animation: none !important;
		transition: opacity 0.15s linear !important;
		transform: none !important;
	}

	.wcw-pulse-ring {
		display: none;
	}

	.wcw-toggle-btn {
		opacity: 1;
	}
}
