/* chatbot.css */

:root {
	--mq-navy: #1a2336;
	--mq-accent: #0066cc; /* Professional standard blue */
	--mq-white: #ffffff;
	--mq-bg: #f5f7f9;
	--mq-text: #2c3e50;
	--mq-border: #e1e8ed;
	--mq-radius: 12px;
	--mq-shadow: 0 10px 30px rgba(0,0,0,0.12);
	--mq-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.metrologiq-chatbot-container {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 99999;
	font-family: var(--mq-font);
}

.metrologiq-chatbot-trigger {
	background-color: var(--mq-accent);
	color: var(--mq-white);
	width: 60px;
	height: 60px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	box-shadow: var(--mq-shadow);
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	transition: transform 0.2s ease, background-color 0.2s ease;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}

.mq-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	display: block;
}

.metrologiq-chatbot-trigger:hover {
	transform: scale(1.05);
	background-color: #005bb5;
}

.metrologiq-notification-dot {
	position: absolute;
	top: 4px;
	right: 4px;
	width: 14px;
	height: 14px;
	background-color: #ff3b30;
	border-radius: 50%;
	border: 2px solid var(--mq-accent);
	display: none;
}

@keyframes mq-pulse {
	0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7); }
	70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(255, 59, 48, 0); }
	100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); }
}

.metrologiq-notification-dot.pulsing {
	display: block;
	animation: mq-pulse 2s infinite;
}

.metrologiq-chatbot-window {
	position: absolute;
	bottom: 80px;
	right: 0;
	width: 370px;
	height: 560px;
	background-color: var(--mq-bg);
	border-radius: var(--mq-radius);
	box-shadow: var(--mq-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	transform: translateY(20px);
	transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
	border: 1px solid var(--mq-border);
}

.metrologiq-chatbot-window.open {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.metrologiq-chatbot-header {
	background-color: var(--mq-navy);
	color: var(--mq-white);
	padding: 18px 20px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.metrologiq-chatbot-title {
	font-weight: 600;
	font-size: 15px;
	display: flex;
	align-items: center;
	letter-spacing: 0.3px;
}

.metrologiq-chatbot-close {
	background: none;
	border: none;
	color: var(--mq-white);
	cursor: pointer;
	padding: 4px;
	opacity: 0.7;
	transition: opacity 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
}

.metrologiq-chatbot-close:hover {
	opacity: 1;
}

.metrologiq-chatbot-messages {
	flex: 1;
	padding: 20px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 16px;
	background-color: var(--mq-white);
	scrollbar-width: thin;
	scrollbar-color: #d1d9e0 transparent;
}

.metrologiq-chatbot-messages::-webkit-scrollbar {
	width: 6px;
}
.metrologiq-chatbot-messages::-webkit-scrollbar-thumb {
	background-color: #d1d9e0;
	border-radius: 3px;
}

/* Messages */
.mq-msg {
	display: flex;
	max-width: 88%;
	animation: mq-fade-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes mq-fade-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

.mq-msg-bot {
	align-self: flex-start;
}

.mq-msg-user {
	align-self: flex-end;
	flex-direction: row-reverse;
}

.mq-avatar {
	width: 32px;
	height: 32px;
	background-color: var(--mq-navy);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-right: 12px;
	flex-shrink: 0;
	color: var(--mq-white);
}

.mq-msg-user .mq-avatar {
	display: none;
}

.mq-bubble {
	padding: 12px 16px;
	border-radius: 18px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--mq-text);
}

.mq-msg-bot .mq-bubble {
	background-color: var(--mq-bg);
	border-bottom-left-radius: 4px;
	border: 1px solid var(--mq-border);
}

.mq-msg-user .mq-bubble {
	background-color: var(--mq-accent);
	color: var(--mq-white);
	border-bottom-right-radius: 4px;
}

/* Options */
.mq-options {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 8px;
	margin-left: 44px; /* Align with bot bubble */
}

.mq-option-btn {
	background-color: var(--mq-white);
	border: 1px solid var(--mq-accent);
	color: var(--mq-accent);
	padding: 10px 16px;
	border-radius: 20px;
	font-size: 13px;
	cursor: pointer;
	text-align: left;
	transition: background-color 0.2s, color 0.2s;
	font-weight: 500;
	font-family: inherit;
}

.mq-option-btn:hover {
	background-color: var(--mq-accent);
	color: var(--mq-white);
}

/* Chat Input Row (mid-flow text input) */
.mq-chat-input-row {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 8px;
	margin-left: 0; /* Full width for better input space */
	padding: 5px;
	animation: mq-fade-in 0.3s ease;
	width: 100%;
	box-sizing: border-box;
}

.mq-chat-text-input {
	flex: 1;
	padding: 12px 16px;
	border: 1px solid var(--mq-border);
	border-radius: 25px;
	font-size: 14px;
	outline: none;
	font-family: inherit;
	background: #fff;
	box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.mq-chat-text-input:focus {
	border-color: var(--mq-accent);
}

.mq-chat-send-btn {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background-color: var(--mq-accent);
	color: var(--mq-white);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background-color 0.2s;
}

.mq-chat-send-btn:hover {
	background-color: #005bb5;
}

/* Form Area */
.metrologiq-chatbot-input-area {
	padding: 20px;
	background-color: var(--mq-white);
	border-top: 1px solid var(--mq-border);
}

.mq-form-group {
	margin-bottom: 12px;
}

.mq-form-input {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--mq-border);
	border-radius: 6px;
	font-size: 13px;
	box-sizing: border-box;
	font-family: inherit;
	background-color: #fafbfc;
}

.mq-form-input:focus {
	outline: none;
	border-color: var(--mq-accent);
	background-color: var(--mq-white);
	box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.15);
}

.mq-submit-btn {
	width: 100%;
	background: linear-gradient(135deg, #0d7b6e 0%, #1a2336 100%);
	color: var(--mq-white);
	border: none;
	padding: 14px;
	border-radius: 8px;
	font-weight: 700;
	font-size: 15px;
	cursor: pointer;
	transition: all 0.2s;
	font-family: inherit;
	margin-top: 10px;
	box-shadow: 0 4px 12px rgba(13, 123, 110, 0.35);
	letter-spacing: 0.3px;
}

.mq-submit-btn:hover {
	background: linear-gradient(135deg, #0a6960 0%, #111c2b 100%);
	transform: translateY(-1px);
	box-shadow: 0 6px 18px rgba(13, 123, 110, 0.45);
}

.mq-submit-btn:disabled {
	background: #8bb6ae;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

/* Loading dots */
.mq-typing {
	display: flex;
	gap: 4px;
	padding: 12px 16px;
	background-color: var(--mq-bg);
	border-radius: 18px;
	border-bottom-left-radius: 4px;
	width: fit-content;
	margin-left: 44px;
	margin-bottom: 16px;
	border: 1px solid var(--mq-border);
}

.mq-typing-dot {
	width: 6px;
	height: 6px;
	background-color: #8c9ea8;
	border-radius: 50%;
	animation: mq-typing 1.4s infinite ease-in-out both;
}

.mq-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.mq-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes mq-typing {
	0%, 80%, 100% { transform: scale(0); }
	40% { transform: scale(1); }
}

/* Mobile Responsive */
@media (max-width: 480px) {
	.metrologiq-chatbot-window {
		position: fixed;
		bottom: 0;
		right: 0;
		width: 100%;
		height: 85vh;
		border-radius: 20px 20px 0 0;
		border: none;
		border-top: 1px solid var(--mq-border);
		transform: translateY(100%);
	}

	.metrologiq-chatbot-container {
		bottom: 16px;
		right: 16px;
	}
}

/* Mobile: ensure open state overrides the translateY(100%) */
@media (max-width: 480px) {
	.metrologiq-chatbot-window.open {
		transform: translateY(0);
	}
}

/* Tighten form area max-height for very short screens */
@media (max-height: 600px) {
	.metrologiq-chatbot-window {
		height: 90vh;
	}
}
