/* AI Chatbot for WordPress – Frontend widget */
#acfw-chat-widget {
	position: fixed;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	font-size: 15px;
	line-height: 1.5;
	box-sizing: border-box;
}

#acfw-chat-widget *,
#acfw-chat-widget *::before,
#acfw-chat-widget *::after {
	box-sizing: border-box;
}

/* Toggle button */
.acfw-widget.acfw-position-bottom-right {
	bottom: 20px;
	right: 20px;
}

.acfw-widget.acfw-position-bottom-left {
	bottom: 20px;
	left: 20px;
}

.acfw-toggle {
	height: 56px;
	min-width: 56px;
	padding: 0 20px;
	border-radius: 28px;
	border: none;
	background: var(--acfw-primary, #2271b1);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
	transition: transform 0.2s, box-shadow 0.2s;
	font-size: 15px;
	font-weight: 600;
	font-family: inherit;
}

.acfw-toggle .acfw-toggle-icon {
	flex-shrink: 0;
}

.acfw-toggle .acfw-toggle-label {
	white-space: nowrap;
}

/* Icon-only (no label): keep circular */
.acfw-widget:not(.acfw-has-label) .acfw-toggle {
	width: 56px;
	padding: 0;
}

.acfw-toggle:hover {
	transform: scale(1.05);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.acfw-toggle:focus {
	outline: 2px solid var(--acfw-primary);
	outline-offset: 2px;
}

/* Chat window */
.acfw-window {
	position: absolute;
	bottom: 70px;
	width: 380px;
	max-width: calc(100vw - 40px);
	height: 520px;
	max-height: calc(100vh - 120px);
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.acfw-position-bottom-right .acfw-window {
	right: 0;
}

.acfw-position-bottom-left .acfw-window {
	left: 0;
}

.acfw-window[hidden] {
	display: none !important;
}

/* Header */
.acfw-header {
	background: var(--acfw-primary, #2271b1);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}

.acfw-header .acfw-title,
.acfw-header .acfw-close {
	color: #fff;
}

.acfw-title {
	margin: 0;
	font-size: 1.1em;
	font-weight: 600;
	color: #fff;
}

.acfw-close {
	background: transparent;
	border: none;
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	opacity: 0.9;
	padding: 0 4px;
}

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

/* Messages area */
.acfw-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: #f5f5f5;
}

.acfw-message {
	display: flex;
	align-items: flex-end;
}

.acfw-message.acfw-user {
	justify-content: flex-end;
}

.acfw-message.acfw-bot {
	justify-content: flex-start;
}

.acfw-bubble {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 16px;
	word-wrap: break-word;
	white-space: pre-wrap;
}

.acfw-user .acfw-bubble {
	background: var(--acfw-primary, #2271b1);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.acfw-bot .acfw-bubble {
	background: #fff;
	color: #1e1e1e;
	border: 1px solid #e0e0e0;
	border-bottom-left-radius: 4px;
}

/* Highlighted links (emails, URLs, phone numbers) inside bot replies */
.acfw-bot .acfw-bubble .acfw-chat-link {
	color: var(--acfw-primary, #2271b1);
	font-weight: 600;
	text-decoration: underline;
}

.acfw-bot .acfw-bubble .acfw-chat-link:hover {
	text-decoration: none;
}

.acfw-typing .acfw-bubble {
	display: flex;
	gap: 4px;
	align-items: center;
}

.acfw-typing .acfw-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #888;
	animation: acfw-blink 1.4s ease-in-out infinite both;
}

.acfw-typing .acfw-dot:nth-child(2) { animation-delay: 0.2s; }
.acfw-typing .acfw-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes acfw-blink {
	0%, 80%, 100% { opacity: 0.3; }
	40% { opacity: 1; }
}

/* Input area */
.acfw-input-wrap {
	display: flex;
	gap: 8px;
	padding: 12px 16px;
	background: #fff;
	border-top: 1px solid #e0e0e0;
	flex-shrink: 0;
}

.acfw-input {
	flex: 1;
	padding: 10px 14px;
	border: 1px solid #c3c4c7;
	border-radius: 24px;
	font-size: 15px;
}

.acfw-input:focus {
	border-color: var(--acfw-primary);
	outline: none;
}

.acfw-send {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: none;
	background: var(--acfw-primary, #2271b1);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.acfw-send:hover {
	opacity: 0.9;
}

.acfw-send:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* Responsive */
@media (max-width: 480px) {
	.acfw-window {
		width: calc(100vw - 24px);
		height: 70vh;
		left: 12px !important;
		right: 12px !important;
		bottom: 68px;
	}
}
