/**
 * Omnia Salus Chatbot Styles
 */

.omnia-chatbot {
	--chatbot-primary: #78837a;
	--chatbot-primary-dark: #5a6a5c;
	--chatbot-bg: #ffffff;
	--chatbot-text: #333333;
	--chatbot-light: #f5f5f5;
	--chatbot-border: #e0e0e0;
	--chatbot-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);

	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 9999;
	font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Toggle Button */
.chatbot-toggle {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--chatbot-primary);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--chatbot-shadow);
	transition: transform 0.3s ease, background 0.3s ease;
}

.chatbot-toggle:hover {
	transform: scale(1.05);
	background: var(--chatbot-primary-dark);
}

.chatbot-toggle svg {
	width: 28px;
	height: 28px;
	color: white;
}

.chatbot-toggle .icon-close {
	display: none;
}

.omnia-chatbot.open .chatbot-toggle .icon-chat {
	display: none;
}

.omnia-chatbot.open .chatbot-toggle .icon-close {
	display: block;
}

/* Chat Window */
.chatbot-window {
	position: absolute;
	bottom: 75px;
	right: 0;
	width: 370px;
	max-width: calc(100vw - 40px);
	height: 500px;
	max-height: calc(100vh - 150px);
	background: var(--chatbot-bg);
	border-radius: 16px;
	box-shadow: var(--chatbot-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	transform: translateY(20px) scale(0.95);
	transition: all 0.3s ease;
}

.omnia-chatbot.open .chatbot-window {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
}

/* Header */
.chatbot-header {
	background: var(--chatbot-primary);
	color: white;
	padding: 15px 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.chatbot-header-info {
	display: flex;
	align-items: center;
	gap: 12px;
}

.chatbot-avatar {
	width: 40px;
	height: 40px;
	background: rgba(255, 255, 255, 0.2);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
	font-size: 14px;
}

.chatbot-header-info div {
	display: flex;
	flex-direction: column;
}

.chatbot-header-info strong {
	font-size: 14px;
}

.chatbot-header-info small {
	font-size: 11px;
	opacity: 0.8;
}

.chatbot-close {
	background: none;
	border: none;
	color: white;
	font-size: 28px;
	cursor: pointer;
	opacity: 0.8;
	transition: opacity 0.2s;
	line-height: 1;
	padding: 0;
	width: 30px;
	height: 30px;
}

.chatbot-close:hover {
	opacity: 1;
}

/* Messages Area */
.chatbot-messages {
	flex: 1;
	overflow-y: auto;
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.chatbot-message {
	max-width: 85%;
	padding: 12px 16px;
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.5;
	animation: messageIn 0.3s ease;
}

@keyframes messageIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.chatbot-message.bot {
	background: var(--chatbot-light);
	color: var(--chatbot-text);
	border-bottom-left-radius: 4px;
	align-self: flex-start;
}

.chatbot-message.user {
	background: var(--chatbot-primary);
	color: white;
	border-bottom-right-radius: 4px;
	align-self: flex-end;
}

.chatbot-message.typing {
	background: var(--chatbot-light);
	padding: 16px 20px;
}

.chatbot-message.typing::after {
	content: '';
	display: inline-block;
	width: 8px;
	height: 8px;
	background: var(--chatbot-primary);
	border-radius: 50%;
	animation: typing 1s infinite;
	margin-left: 4px;
}

@keyframes typing {
	0%, 100% { opacity: 0.3; }
	50% { opacity: 1; }
}

/* Disclaimer */
.chatbot-disclaimer {
	background: #fff3cd;
	color: #856404;
	padding: 8px 15px;
	font-size: 11px;
	text-align: center;
	border-top: 1px solid #ffc107;
}

/* Input Area */
.chatbot-input {
	display: flex;
	padding: 15px;
	border-top: 1px solid var(--chatbot-border);
	gap: 10px;
}

.chatbot-input input {
	flex: 1;
	border: 1px solid var(--chatbot-border);
	border-radius: 24px;
	padding: 12px 18px;
	font-size: 14px;
	outline: none;
	transition: border-color 0.2s;
}

.chatbot-input input:focus {
	border-color: var(--chatbot-primary);
}

.chatbot-input button {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--chatbot-primary);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
}

.chatbot-input button:hover {
	background: var(--chatbot-primary-dark);
}

.chatbot-input button svg {
	width: 20px;
	height: 20px;
	color: white;
}

/* Mobile Responsive */
@media (max-width: 480px) {
	.omnia-chatbot {
		bottom: 10px;
		right: 10px;
	}

	.chatbot-toggle {
		width: 55px;
		height: 55px;
	}

	.chatbot-window {
		width: calc(100vw - 20px);
		height: calc(100vh - 100px);
		bottom: 70px;
		right: -5px;
		border-radius: 12px;
	}
}

/* Scrollbar */
.chatbot-messages::-webkit-scrollbar {
	width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
	background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
	background: var(--chatbot-border);
	border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
	background: #ccc;
}

/* Quick Replies */
.quick-replies {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 8px;
	animation: messageIn 0.3s ease;
}

.quick-reply-btn {
	background: white;
	border: 1px solid var(--chatbot-primary);
	color: var(--chatbot-primary);
	padding: 8px 14px;
	border-radius: 18px;
	font-size: 13px;
	cursor: pointer;
	transition: all 0.2s;
	text-decoration: none;
	display: inline-block;
}

.quick-reply-btn:hover {
	background: var(--chatbot-primary);
	color: white;
}

.quick-reply-book {
	background: var(--chatbot-primary);
	color: white;
	font-weight: 600;
}

.quick-reply-book:hover {
	background: var(--chatbot-primary-dark);
}

/* Pulsante prenotazione inline */
.chatbot-book-btn {
	display: inline-block;
	background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-primary-dark));
	color: white !important;
	padding: 10px 20px;
	border-radius: 25px;
	text-decoration: none;
	font-weight: 600;
	font-size: 14px;
	transition: all 0.3s ease;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.chatbot-book-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   Pulsante WhatsApp
   ========================================================================== */

.omnia-whatsapp-btn {
	position: fixed;
	bottom: 90px;
	right: 20px;
	z-index: 9998;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: #25D366;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	text-decoration: none;
}

.omnia-whatsapp-btn:hover {
	transform: scale(1.08);
	box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
	color: #fff;
}

.omnia-whatsapp-btn svg {
	width: 30px;
	height: 30px;
}

/* Quando il chatbot è aperto, sposta WhatsApp più in alto per non sovrapporsi */
.omnia-chatbot.open ~ .omnia-whatsapp-btn {
	bottom: 90px;
	opacity: 0.6;
	pointer-events: none;
}

@media (max-width: 480px) {
	.omnia-whatsapp-btn {
		bottom: 78px;
		right: 10px;
		width: 55px;
		height: 55px;
	}

	.omnia-whatsapp-btn svg {
		width: 26px;
		height: 26px;
	}

	.omnia-chatbot.open ~ .omnia-whatsapp-btn {
		opacity: 0;
		pointer-events: none;
	}
}
