/**
 * Frontend Styles - Premium Glassmorphism UI
 */

/* Widget Container */
.awfb-widget {
	position: fixed;
	bottom: 30px;
	z-index: 99999999;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	right: 10px !important;
	bottom: 110px !important;
}

.awfb-widget.awfb-pos-right {

	right: 10px !important;
	bottom: 110px !important;

	/* Offset to prevent overlap with typical scroll-to-top buttons */
}

.awfb-widget.awfb-pos-left {
	left: 20px;
	align-items: flex-start;
}

/* Floating Button */
.awfb-floating-btn {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background-color: var(--awfb-color, #25D366);
	color: #fff;
	border: none;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	cursor: pointer;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s;
	animation: awfb-pulse 2s infinite;
	padding: 0 !important;
}

.awfb-floating-btn:hover {
	transform: scale(1.1);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.awfb-floating-btn svg {
	width: 32px !important;
	height: 32px !important;
	fill: #ffffff !important;
	display: block !important;
	margin: 0 !important;
}

/* Popup Box - Glassmorphism */
.awfb-popup {
	width: 350px;
	background: rgba(255, 255, 255, 0.85);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 16px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
	margin-bottom: 20px;
	opacity: 0;
	transform: translateY(20px) scale(0.95);
	transform-origin: bottom right;
	transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
	pointer-events: none;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.awfb-pos-left .awfb-popup {
	transform-origin: bottom left;
}

.awfb-popup.awfb-show {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

/* Header */
.awfb-popup-header {
	background: var(--awfb-color, #25D366);
	color: #fff;
	padding: 20px;
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
}

.awfb-popup-header-content {
	display: flex;
	align-items: center;
	gap: 15px;
}

.awfb-avatar img {
	width: 50px;
	height: 50px;
	border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, 0.5);
	background: #fff;
}

.awfb-agent-info {
	display: flex;
	flex-direction: column;
}

.awfb-agent-info strong {
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
}

.awfb-agent-info span {
	font-size: 12px;
	opacity: 0.8;
	margin-top: 4px;
}

.awfb-close {
	background: none;
	border: none;
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	opacity: 0.7;
	transition: opacity 0.2s;
}

.awfb-close:hover {
	opacity: 1;
}

/* Body */
.awfb-popup-body {
	padding: 20px;
	background: rgba(255, 255, 255, 0.5);
}

/* Pre-chat Form */
#awfb-prechat-form p {
	margin: 0 0 15px;
	font-size: 14px;
	color: #555;
}

#awfb-prechat-form input,
#awfb-prechat-form textarea {
	width: 100%;
	box-sizing: border-box;
	padding: 10px 12px;
	margin-bottom: 12px;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.8);
	font-family: inherit;
	font-size: 14px;
	outline: none;
	transition: border-color 0.2s, box-shadow 0.2s;
}

#awfb-prechat-form input:focus,
#awfb-prechat-form textarea:focus {
	border-color: var(--awfb-color, #25D366);
	box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

#awfb-prechat-form textarea {
	resize: vertical;
	min-height: 80px;
}

#awfb-start-chat-btn {
	width: 100%;
	padding: 12px;
	background: var(--awfb-color, #25D366);
	color: #fff;
	border: none;
	border-radius: 8px;
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	transition: opacity 0.2s;
}

#awfb-start-chat-btn:hover {
	opacity: 0.9;
}

/* Chat Welcome */
.awfb-chat-welcome {
	display: flex;
	flex-direction: column;
	gap: 15px;
}

.awfb-message-bubble {
	background: #f1f1f1;
	color: #333;
	padding: 12px 16px;
	border-radius: 16px;
	border-top-left-radius: 4px;
	font-size: 14px;
	line-height: 1.4;
	position: relative;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
	animation: awfb-fade-in 0.3s ease;
}

.awfb-direct-link {
	display: inline-block;
	text-align: center;
	padding: 12px;
	background: var(--awfb-color, #25D366);
	color: #fff;
	text-decoration: none;
	border-radius: 8px;
	font-weight: 600;
	font-size: 14px;
	transition: opacity 0.2s;
}

.awfb-direct-link:hover {
	opacity: 0.9;
	color: #fff;
}

/* Typing Indicator */
.awfb-typing-indicator {
	background: #f1f1f1;
	padding: 12px 16px;
	border-radius: 16px;
	border-top-left-radius: 4px;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	width: fit-content;
}

.awfb-typing-indicator span {
	width: 6px;
	height: 6px;
	background: #999;
	border-radius: 50%;
	animation: awfb-bounce 1.4s infinite ease-in-out both;
}

.awfb-typing-indicator span:nth-child(1) {
	animation-delay: -0.32s;
}

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

/* Animations */
@keyframes awfb-pulse {
	0% {
		box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.4);
	}

	70% {
		box-shadow: 0 0 0 15px rgba(37, 211, 102, 0);
	}

	100% {
		box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
	}
}

@keyframes awfb-bounce {

	0%,
	80%,
	100% {
		transform: scale(0);
	}

	40% {
		transform: scale(1);
	}
}

@keyframes awfb-fade-in {
	from {
		opacity: 0;
		transform: translateY(10px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
	.awfb-popup {
		width: calc(100vw - 40px);
	}
}