/**
 * AI Chatbot Styles
 *
 * @package BCP_Theme
 * @since 2.0.0
 */

/* === Chatbot Container === */
.bcp-ai-chatbot {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* === Toggle Button === */
.bcp-ai-chatbot-toggle {
	position: relative;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: linear-gradient(135deg, #2271b1 0%, #135e96 100%);
	border: none;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(34, 113, 177, 0.4);
	transition: all 0.3s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #ffffff;
}

.bcp-ai-chatbot-toggle:hover {
	transform: scale(1.1);
	box-shadow: 0 6px 16px rgba(34, 113, 177, 0.5);
}

.bcp-ai-chatbot-toggle:active {
	transform: scale(0.95);
}

.bcp-ai-chatbot-toggle:disabled,
.bcp-ai-chatbot-toggle.bcp-ai-chatbot-disabled {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
}

.bcp-ai-chatbot-toggle:disabled:hover,
.bcp-ai-chatbot-toggle.bcp-ai-chatbot-disabled:hover {
	transform: none;
	box-shadow: 0 4px 12px rgba(34, 113, 177, 0.4);
}

.bcp-ai-chatbot-toggle svg {
	width: 28px;
	height: 28px;
	transition: opacity 0.2s ease;
}

.bcp-ai-icon-chat {
	opacity: 1;
}

.bcp-ai-icon-close {
	position: absolute;
	opacity: 0;
}

.bcp-ai-chatbot-toggle.active .bcp-ai-icon-chat {
	opacity: 0;
}

.bcp-ai-chatbot-toggle.active .bcp-ai-icon-close {
	opacity: 1;
}

.bcp-ai-badge {
	position: absolute;
	top: -5px;
	right: -5px;
	background: #d63638;
	color: #ffffff;
	border-radius: 50%;
	width: 20px;
	height: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: 600;
	border: 2px solid #ffffff;
}

/* === Chat Window === */
.bcp-ai-chatbot-window {
	position: absolute;
	bottom: 80px;
	right: 0;
	width: 380px;
	height: 600px;
	max-height: calc(100vh - 120px);
	background: #ffffff;
	border-radius: 16px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

/* === Header === */
.bcp-ai-chatbot-header {
	background: linear-gradient(135deg, #2271b1 0%, #135e96 100%);
	color: #ffffff;
	padding: 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}

.bcp-ai-header-content {
	display: flex;
	align-items: center;
	gap: 12px;
	flex: 1;
}

.bcp-ai-header-icon {
	width: 40px;
	height: 40px;
	background: rgba(255, 255, 255, 0.2);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.bcp-ai-header-icon svg {
	width: 24px;
	height: 24px;
}

.bcp-ai-header-text h3 {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
}

.bcp-ai-status {
	margin: 2px 0 0;
	font-size: 12px;
	opacity: 0.9;
}

.bcp-ai-close-btn {
	background: transparent;
	border: none;
	color: #ffffff;
	cursor: pointer;
	padding: 8px;
	border-radius: 4px;
	transition: background 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
}

.bcp-ai-close-btn:hover {
	background: rgba(255, 255, 255, 0.1);
}

.bcp-ai-close-btn svg {
	width: 20px;
	height: 20px;
}

/* === Messages Container === */
.bcp-ai-chatbot-messages {
	flex: 1;
	overflow-y: auto;
	padding: 20px;
	background: #f9fafb;
	scroll-behavior: smooth;
}

.bcp-ai-message {
	display: flex;
	margin-bottom: 16px;
	animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

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

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

.bcp-ai-message-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: linear-gradient(135deg, #2271b1 0%, #135e96 100%);
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	margin-right: 12px;
}

.bcp-ai-message-avatar svg {
	width: 18px;
	height: 18px;
}

.bcp-ai-message-content {
	max-width: 75%;
	display: flex;
	flex-direction: column;
}

.bcp-ai-message-bubble {
	padding: 12px 16px;
	border-radius: 12px;
	word-wrap: break-word;
	line-height: 1.5;
	font-size: 14px;
}

.bcp-ai-message-bot .bcp-ai-message-bubble {
	background: #ffffff;
	border: 1px solid #e5e7eb;
	color: #1f2937;
}

.bcp-ai-message-user .bcp-ai-message-bubble {
	background: #2271b1;
	color: #ffffff;
	border-bottom-right-radius: 4px;
}

.bcp-ai-message-time {
	font-size: 11px;
	color: #9ca3af;
	margin-top: 4px;
	padding: 0 4px;
}

/* === Sources === */
.bcp-ai-message-sources {
	margin-top: 8px;
	padding: 8px 12px;
	background: #f3f4f6;
	border-radius: 8px;
	font-size: 12px;
}

.bcp-ai-sources-label {
	font-weight: 600;
	color: #6b7280;
	margin: 0 0 4px;
}

.bcp-ai-sources-list {
	margin: 0;
	padding-left: 16px;
	list-style: disc;
}

.bcp-ai-sources-list li {
	margin: 4px 0;
}

.bcp-ai-sources-list a {
	color: #2271b1;
	text-decoration: none;
}

.bcp-ai-sources-list a:hover {
	text-decoration: underline;
}

/* === Typing Indicator === */
.bcp-ai-typing-indicator {
	display: flex;
	gap: 4px;
	padding: 4px 0;
}

.bcp-ai-typing-indicator span {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #9ca3af;
	animation: typing 1.4s infinite;
}

.bcp-ai-typing-indicator span:nth-child(2) {
	animation-delay: 0.2s;
}

.bcp-ai-typing-indicator span:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes typing {
	0%, 60%, 100% {
		transform: translateY(0);
		opacity: 0.7;
	}
	30% {
		transform: translateY(-8px);
		opacity: 1;
	}
}

/* === Input Form === */
.bcp-ai-chatbot-input {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 16px;
	background: #ffffff;
	border-top: 1px solid #e5e7eb;
	flex-shrink: 0;
}

.bcp-ai-input-field {
	flex: 1;
	padding: 12px 16px;
	border: 1px solid #d1d5db;
	border-radius: 24px;
	font-size: 14px;
	outline: none;
	transition: border-color 0.2s ease;
}

.bcp-ai-input-field:focus {
	border-color: #2271b1;
}

.bcp-ai-send-btn {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #2271b1;
	border: none;
	color: #ffffff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	flex-shrink: 0;
}

.bcp-ai-send-btn:hover:not(:disabled) {
	background: #135e96;
	transform: scale(1.05);
}

.bcp-ai-send-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.bcp-ai-send-btn svg {
	width: 20px;
	height: 20px;
}

/* === Scrollbar === */
.bcp-ai-chatbot-messages::-webkit-scrollbar {
	width: 6px;
}

.bcp-ai-chatbot-messages::-webkit-scrollbar-track {
	background: #f3f4f6;
}

.bcp-ai-chatbot-messages::-webkit-scrollbar-thumb {
	background: #d1d5db;
	border-radius: 3px;
}

.bcp-ai-chatbot-messages::-webkit-scrollbar-thumb:hover {
	background: #9ca3af;
}

/* === Mobile Responsive === */
@media (max-width: 640px) {
	.bcp-ai-chatbot {
		bottom: 10px;
		right: 10px;
		left: 10px;
	}

	.bcp-ai-chatbot-window {
		width: 100%;
		height: 500px;
		max-height: calc(100vh - 100px);
		right: 0;
	}

	.bcp-ai-message-content {
		max-width: 85%;
	}
}

/* === Admin Area Adjustments === */
body.wp-admin .bcp-ai-chatbot {
	bottom: 40px;
}

/* === Print Styles === */
@media print {
	.bcp-ai-chatbot {
		display: none !important;
	}
}
