/**
 * WP AI Site Assistant - Frontend Chat Widget Stylesheet
 */

/* Container */
.wp-ai-widget-container {
	position: fixed;
	bottom: 25px;
	right: 25px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Floating Trigger Button */
.wp-ai-trigger-btn {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
	border: none;
	color: #ffffff;
	cursor: pointer;
	box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.wp-ai-trigger-btn:hover {
	transform: scale(1.08) rotate(5deg);
	box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5);
}

.wp-ai-trigger-icon {
	font-size: 26px;
	line-height: 1;
}

/* Chat Dialog Window */
.wp-ai-chat-box {
	width: 370px;
	height: 520px;
	background: rgba(255, 255, 255, 0.9);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border: 1px solid rgba(255, 255, 255, 0.4);
	border-radius: 16px;
	box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: wpAiFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
	transform-origin: bottom right;
}

/* Header */
.wp-ai-chat-header {
	background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
	padding: 16px;
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.wp-ai-chat-header-identity {
	display: flex;
	align-items: center;
	gap: 12px;
}

.wp-ai-chat-avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.2);
	font-size: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wp-ai-chat-header h3 {
	font-size: 15px;
	font-weight: 700;
	margin: 0 0 2px 0;
	color: #ffffff;
}

.wp-ai-status-indicator {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
	opacity: 0.9;
}

.wp-ai-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #22c55e;
	box-shadow: 0 0 6px #22c55e;
}

.wp-ai-close-btn {
	background: transparent;
	border: none;
	color: #ffffff;
	font-size: 18px;
	cursor: pointer;
	opacity: 0.8;
	transition: opacity 0.2s;
	padding: 4px;
	line-height: 1;
}

.wp-ai-close-btn:hover {
	opacity: 1;
}

/* Messages panel */
.wp-ai-chat-messages {
	flex: 1;
	padding: 16px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 14px;
	background: rgba(248, 250, 252, 0.5);
}

/* Scrollbar styles */
.wp-ai-chat-messages::-webkit-scrollbar {
	width: 5px;
}

.wp-ai-chat-messages::-webkit-scrollbar-track {
	background: transparent;
}

.wp-ai-chat-messages::-webkit-scrollbar-thumb {
	background: #cbd5e1;
	border-radius: 4px;
}

.wp-ai-message-row {
	display: flex;
	width: 100%;
}

.wp-ai-message-bubble {
	max-width: 80%;
	padding: 12px 16px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.5;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.wp-ai-message-bubble p {
	margin: 0;
	word-break: break-word;
}

/* AI response bubble */
.wp-ai-message-ai {
	justify-content: flex-start;
}

.wp-ai-message-ai .wp-ai-message-bubble {
	background: #ffffff;
	color: #1e293b;
	border-bottom-left-radius: 3px;
	border: 1px solid #e2e8f0;
}

/* User response bubble */
.wp-ai-message-user {
	justify-content: flex-end;
}

.wp-ai-message-user .wp-ai-message-bubble {
	background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
	color: #ffffff;
	border-bottom-right-radius: 3px;
	box-shadow: 0 4px 10px rgba(124, 58, 237, 0.15);
}

/* Source references */
.wp-ai-references {
	margin-top: 10px;
	padding-top: 8px;
	border-top: 1px dashed #cbd5e1;
	font-size: 11px;
	color: #64748b;
}

.wp-ai-ref-title {
	font-weight: 700;
}

.wp-ai-ref-link {
	display: inline-block;
	background: #f1f5f9;
	color: #4f46e5;
	text-decoration: none;
	padding: 2px 6px;
	border-radius: 4px;
	margin-left: 4px;
	margin-top: 4px;
	font-weight: 600;
	transition: background 0.2s;
	border: 1px solid #e2e8f0;
}

.wp-ai-ref-link:hover {
	background: #e2e8f0;
	text-decoration: underline;
}

/* Footer Input Area */
.wp-ai-chat-footer {
	padding: 12px;
	background: #ffffff;
	border-top: 1px solid #e2e8f0;
	display: flex;
	gap: 8px;
	align-items: center;
}

.wp-ai-chat-footer input {
	flex: 1;
	border: 1px solid #cbd5e1;
	border-radius: 20px;
	padding: 8px 16px;
	font-size: 14px;
	outline: none;
	transition: border-color 0.2s;
}

.wp-ai-chat-footer input:focus {
	border-color: #7c3aed;
}

.wp-ai-chat-footer button {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #7c3aed;
	border: none;
	color: #ffffff;
	font-size: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.2s;
}

.wp-ai-chat-footer button:hover {
	background: #5b21b6;
}

.wp-ai-chat-footer button:disabled {
	background: #cbd5e1;
	cursor: not-allowed;
}

/* Typing indicator */
.wp-ai-typing-bubble {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 12px 18px;
}

.wp-ai-typing-dot {
	width: 6px;
	height: 6px;
	background: #94a3b8;
	border-radius: 50%;
	display: inline-block;
	animation: wpAiBlink 1.4s infinite both;
}

.wp-ai-typing-dot:nth-child(2) {
	animation-delay: .2s;
}

.wp-ai-typing-dot:nth-child(3) {
	animation-delay: .4s;
}

/* Animations */
@keyframes wpAiFadeIn {
	from {
		opacity: 0;
		transform: scale(0.9) translateY(20px);
	}
	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

@keyframes wpAiBlink {
	0% {
		opacity: .2;
	}
	20% {
		opacity: 1;
	}
	100% {
		opacity: .2;
	}
}
