/* Xat de VR Tecnologies */

#chatbot-toggler {
	position: fixed;
	right: 30px;
	bottom: 30px;
	z-index: 9997;
	display: -webkit-flex;
	display: flex;
	-webkit-align-items: center;
	align-items: center;
	-webkit-justify-content: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: #0eb2e7;
	box-shadow: 0 4px 14px rgba(14, 178, 231, 0.45);
	cursor: pointer;
	-webkit-transition: all .3s ease;
	transition: all .3s ease;
}

#chatbot-toggler:hover {
	background: #0a9ccb;
	-webkit-transform: scale(1.08);
	transform: scale(1.08);
}

#chatbot-toggler svg {
	width: 28px;
	height: 28px;
	fill: #fff;
}

body.show-chatbot #chatbot-toggler {
	-webkit-transform: rotate(90deg);
	transform: rotate(90deg);
}

.chatbot-local {
	position: fixed;
	right: 25px;
	bottom: 100px;
	z-index: 10001;
	width: 400px;
	max-width: calc(100vw - 50px);
	overflow: hidden;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 0 60px rgba(0, 0, 0, 0.1), 0 32px 64px -48px rgba(0, 0, 0, 0.5);
	opacity: 0;
	pointer-events: none;
	-webkit-transform: scale(0.2);
	transform: scale(0.2);
	-webkit-transform-origin: bottom right;
	transform-origin: bottom right;
	-webkit-transition: all .3s ease;
	transition: all .3s ease;
	font-family: 'Raleway', sans-serif;
}

body.show-chatbot .chatbot-local {
	opacity: 1;
	pointer-events: auto;
	-webkit-transform: scale(1);
	transform: scale(1);
}

/* Capçalera */
.chatbot-local .chat-header {
	display: -webkit-flex;
	display: flex;
	-webkit-align-items: center;
	align-items: center;
	-webkit-justify-content: space-between;
	justify-content: space-between;
	padding: 14px 20px;
	background: #0eb2e7;
}

.chatbot-local .header-info {
	display: -webkit-flex;
	display: flex;
	-webkit-align-items: center;
	align-items: center;
}

.chatbot-local .header-info .chatbot-logo {
	width: 36px;
	height: 36px;
	margin-right: 10px;
	border-radius: 50%;
	object-fit: cover;
	background: #fff;
}

.chatbot-local .header-info .logo-text {
	margin: 0;
	color: #fff;
	font-size: 17px;
	font-weight: 700;
	letter-spacing: .5px;
	line-height: 1.2;
	text-transform: none;
}

.chatbot-local #close-chatbot {
	display: -webkit-flex;
	display: flex;
	-webkit-align-items: center;
	align-items: center;
	-webkit-justify-content: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	margin-right: -8px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: none;
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
}

.chatbot-local #close-chatbot:hover {
	background: #0a9ccb;
}

/* Missatges */
.chatbot-local .chat-body {
	display: -webkit-flex;
	display: flex;
	-webkit-flex-direction: column;
	flex-direction: column;
	height: 420px;
	margin-bottom: 78px;
	padding: 22px 20px;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: #bfe9f7 transparent;
}

.chatbot-local .chat-body .message {
	display: -webkit-flex;
	display: flex;
	-webkit-align-items: flex-start;
	align-items: flex-start;
	margin-bottom: 16px;
}

.chatbot-local .chat-body .bot-avatar {
	-webkit-flex-shrink: 0;
	flex-shrink: 0;
	width: 34px;
	height: 34px;
	margin: 2px 10px 0 0;
	border-radius: 50%;
	object-fit: cover;
}

.chatbot-local .chat-body .user-message {
	-webkit-flex-direction: row-reverse;
	flex-direction: row-reverse;
}

.chatbot-local .chat-body .message-text {
	max-width: 78%;
	padding: 11px 15px;
	font-size: 15px;
	line-height: 1.5;
	word-wrap: break-word;
}

.chatbot-local .chat-body .bot-message .message-text {
	background: #eef9fd;
	border-radius: 13px 13px 13px 3px;
	color: #333;
}

.chatbot-local .chat-body .user-message .message-text {
	background: #0eb2e7;
	border-radius: 13px 13px 3px 13px;
	color: #fff;
}

.chatbot-local .chat-body .bot-message .message-text a {
	color: #0a9ccb;
	font-weight: 600;
	text-decoration: underline;
}

.chatbot-local .chat-body .bot-message .message-text strong {
	color: #0a9ccb;
	font-weight: 700;
}

.chatbot-local .chat-body .bot-message .message-text a.wa-btn {
	display: inline-block;
	margin-top: 10px;
	padding: 9px 18px;
	border-radius: 8px;
	background: #25d366;
	color: #fff;
	font-weight: 700;
	text-decoration: none;
}

.chatbot-local .chat-body .bot-message .message-text a.wa-btn:hover {
	background: #1fb857;
}

.chatbot-local .chat-body .bot-message .message-text a.call-btn {
	display: inline-block;
	margin-top: 10px;
	padding: 9px 18px;
	border-radius: 8px;
	background: #0eb2e7;
	color: #fff;
	font-weight: 700;
	text-decoration: none;
}

.chatbot-local .chat-body .bot-message .message-text a.call-btn:hover {
	background: #0a9ccb;
}

/* Indicador de «pensant» */
.chatbot-local .chat-body .bot-message.thinking .message-text {
	padding: 2px 15px;
	background: transparent;
}

.chatbot-local .thinking-indicator {
	display: -webkit-flex;
	display: flex;
	padding: 14px 0;
}

.chatbot-local .thinking-indicator .dot {
	width: 7px;
	height: 7px;
	margin-right: 4px;
	border-radius: 50%;
	background: #0eb2e7;
	opacity: .7;
	-webkit-animation: vrtDot 1.8s ease-in-out infinite;
	animation: vrtDot 1.8s ease-in-out infinite;
}

.chatbot-local .thinking-indicator .dot:nth-child(2) {
	-webkit-animation-delay: .15s;
	animation-delay: .15s;
}

.chatbot-local .thinking-indicator .dot:nth-child(3) {
	-webkit-animation-delay: .3s;
	animation-delay: .3s;
}

@-webkit-keyframes vrtDot {
	0%, 44% { -webkit-transform: translateY(0); }
	28% { opacity: .4; -webkit-transform: translateY(-4px); }
}

@keyframes vrtDot {
	0%, 44% { transform: translateY(0); }
	28% { opacity: .4; transform: translateY(-4px); }
}

/* Peu amb el quadre de text */
.chatbot-local .chat-footer {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 14px 20px 18px;
	background: #fff;
	border-top: 1px solid #f0f0f0;
}

.chatbot-local .chat-form {
	display: -webkit-flex;
	display: flex;
	-webkit-align-items: flex-end;
	align-items: flex-end;
	margin: 0;
	padding: 4px;
	border: 1px solid #cfe9f3;
	border-radius: 28px;
	background: #fff;
}

.chatbot-local .chat-form:focus-within {
	border-color: #0eb2e7;
}

.chatbot-local .chat-form .message-input {
	width: 100%;
	height: 44px;
	min-height: 44px;
	max-height: 140px;
	padding: 11px 14px;
	border: none;
	outline: none;
	resize: none;
	background: transparent;
	color: #333;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.45;
}

.chatbot-local .chat-form #send-message {
	display: none;
	-webkit-flex-shrink: 0;
	flex-shrink: 0;
	-webkit-align-items: center;
	align-items: center;
	-webkit-justify-content: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	margin: 0 3px 3px 0;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: #0eb2e7;
	color: #fff;
	cursor: pointer;
}

.chatbot-local .chat-form .message-input:valid ~ #send-message {
	display: -webkit-flex;
	display: flex;
}

.chatbot-local .chat-form #send-message:hover {
	background: #0a9ccb;
}

/* Mòbil: el xat ocupa tota la pantalla */
@media (max-width: 600px) {
	#chatbot-toggler {
		right: 18px;
		bottom: 18px;
		width: 54px;
		height: 54px;
	}

	.chatbot-local {
		right: 0;
		bottom: 0;
		width: 100%;
		max-width: 100%;
		height: 100%;
		border-radius: 0;
	}

	.chatbot-local .chat-body {
		height: calc(100% - 144px);
		margin-bottom: 0;
	}

	.chatbot-local .chat-body .message-text {
		max-width: 85%;
	}

	body.show-chatbot #chatbot-toggler {
		display: none;
	}
}

/* ===== Veu: micròfon i trucada ===== */
.chatbot-local { position: fixed; }
.chatbot-local .chat-form #vr-mic { flex: none; width: 38px; height: 38px; border: 0; border-radius: 50%; background: transparent; color: inherit; opacity: .75; cursor: pointer; display: flex; align-items: center; justify-content: center; margin-right: 4px; }
.chatbot-local .chat-form #vr-mic:hover { opacity: 1; }
.chatbot-local .chat-form #vr-mic.gravant { background: #e53935; color: #fff; opacity: 1; animation: vr-batec 1s infinite; }
@keyframes vr-batec { 50% { box-shadow: 0 0 0 8px rgba(229, 57, 53, .2); } }
.chatbot-local .vr-gravant { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 13px; }
.chatbot-local .vr-punt { width: 10px; height: 10px; border-radius: 50%; background: #e53935; animation: vr-pampalluga 1s infinite; }
@keyframes vr-pampalluga { 50% { opacity: .2; } }
.chatbot-local .vr-temps { font-weight: 700; font-variant-numeric: tabular-nums; }
.chatbot-local .vr-gravant-text { flex: 1; opacity: .7; }
.chatbot-local .vr-cancel { border: 0; background: transparent; font-size: 16px; cursor: pointer; opacity: .7; }
.chatbot-local .vr-audio { display: block; width: 100%; max-width: 240px; height: 36px; margin-bottom: 6px; }
.chatbot-local .chat-header #vr-trucar { border: 0; background: rgba(255, 255, 255, .18); color: inherit; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; margin-left: auto; margin-right: 8px; }
.chatbot-local .chat-header #vr-trucar:hover { background: rgba(255, 255, 255, .32); }
.chatbot-local .vr-trucada { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; color: #fff; background: radial-gradient(circle at 50% 30%, #2b2f6b, #0d0f24); border-radius: inherit; }
.chatbot-local .vr-trucada-cercle { width: 120px; height: 120px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; }
.chatbot-local .vr-trucada.parlant .vr-trucada-cercle { animation: vr-ona 1.2s infinite; }
@keyframes vr-ona { 0% { box-shadow: 0 0 0 0 rgba(120, 160, 255, .6); } 100% { box-shadow: 0 0 0 28px rgba(120, 160, 255, 0); } }
.chatbot-local .vr-trucada-cercle img { width: 80%; height: 80%; object-fit: contain; border-radius: 50%; }
.chatbot-local .vr-trucada-nom { font-size: 20px; font-weight: 700; }
.chatbot-local .vr-trucada-estat { font-size: 15px; opacity: .85; min-height: 22px; }
.chatbot-local .vr-penjar { display: flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 12px 26px; background: #e53935; color: #fff; font-weight: 700; font-size: 15px; cursor: pointer; margin-top: 10px; }
.chatbot-local .vr-penjar svg { transform: rotate(135deg); }
.chatbot-local .vr-trucada-avis { font-size: 12px; opacity: .6; margin: 6px 0 0; }
