/* Botón flotante de WhatsApp "Asesor en vivo" (inc/whatsapp-button.php). */

.ms-wa {
	--ms-wa-brand: #05339a;
	position: fixed;
	right: 0;
	bottom: 0;
	z-index: 9999999;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	font-family: Inter, sans-serif;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.5;
	color: #000;
	text-align: left;
	pointer-events: none;
}

.ms-wa *,
.ms-wa *::before,
.ms-wa *::after {
	box-sizing: border-box;
}

.ms-wa p {
	margin: 0;
	padding: 0;
	font-family: inherit;
}

/* Botón */

.ms-wa__button {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	height: 40px;
	margin: 24px 20px;
	padding: 8px 24px;
	border: 0;
	border-radius: 50px;
	background: var(--ms-wa-brand);
	color: #fff;
	font: inherit;
	white-space: nowrap;
	box-shadow: 0 1px 6px 0 rgba(0, 0, 0, .06), 0 2px 32px 0 rgba(0, 0, 0, .16);
	cursor: pointer;
	pointer-events: auto;
}

.ms-wa__button:focus-visible,
.ms-wa__close:focus-visible,
.ms-wa__contact:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
	box-shadow: 0 0 0 4px var(--ms-wa-brand);
}

.ms-wa__icon {
	display: flex;
	width: 24px;
	height: 24px;
}

.ms-wa__icon svg {
	width: 100%;
	height: 100%;
}

.ms-wa__bubble {
	position: absolute;
	top: -4px;
	right: -4px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	border: 2px solid #fff;
	border-radius: 50%;
	background: #dc3545;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	box-shadow: 0 2px 4px rgba(0, 0, 0, .2);
	animation: ms-wa-pulse 1.5s ease-in 1;
}

.ms-wa__bubble[hidden] {
	display: none;
}

/* Caja */

.ms-wa__box {
	position: relative;
	width: 382px;
	margin: 24px 24px 12px;
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 8px 25px -5px rgba(45, 62, 79, .15);
	pointer-events: auto;
	animation: ms-wa-open .4s forwards;
}

.ms-wa__box[hidden] {
	display: none;
}

.ms-wa__box.is-closing {
	animation: ms-wa-close .3s forwards;
}

/* Flecha que apunta al botón */
.ms-wa__box::before {
	content: "";
	position: absolute;
	right: 24px;
	bottom: -6px;
	width: 13px;
	height: 13px;
	background: #fff;
	transform: rotate(45deg);
}

.ms-wa__header {
	position: relative;
	padding: 10px 32px;
	border-radius: 8px 8px 0 0;
	background: var(--ms-wa-brand);
	color: #fff;
}

.ms-wa .ms-wa__title {
	margin-bottom: .25em;
	font-size: 26px;
	font-weight: 700;
	line-height: 1.2;
	color: inherit;
}

.ms-wa .ms-wa__intro {
	font-size: 14px;
	line-height: 1.5;
	color: inherit;
}

.ms-wa__close {
	position: absolute;
	top: 0;
	right: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 32px;
	padding: 0;
	border: 0;
	background: none;
	color: #fff;
	font-family: "Source Serif Pro", serif, sans-serif;
	font-size: 18px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
}

.ms-wa__list {
	position: relative;
	max-height: min(400px, calc(100vh - 290px));
	overflow: auto;
	overscroll-behavior: contain;
	background: #fff;
}

.ms-wa__contact,
.ms-wa__contact:hover,
.ms-wa__contact:focus {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 16px 32px;
	color: #000;
	text-decoration: none;
}

.ms-wa__contact:not(:first-child) {
	border-top: 1px solid rgba(0, 0, 0, .1);
}

.ms-wa__contact:hover,
.ms-wa__contact:focus-visible {
	background: rgba(0, 0, 0, .05);
}

.ms-wa__contact:active {
	background: rgba(0, 0, 0, .1);
}

.ms-wa__contact:focus-visible {
	outline-offset: -2px;
	outline-color: var(--ms-wa-brand);
	box-shadow: none;
}

.ms-wa__avatar {
	position: relative;
	flex: 0 0 62px;
	width: 62px;
	height: 62px;
}

.ms-wa__avatar img {
	display: block;
	width: 62px;
	height: 62px;
	max-width: none;
	border-radius: 50%;
	box-shadow: 0 0 0 2px #eee;
	object-fit: cover;
}

.ms-wa__badge {
	position: absolute;
	top: -2px;
	right: -4px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--ms-wa-brand);
	color: #fff;
	box-shadow: 0 0 0 2px #fff;
}

.ms-wa__badge svg {
	width: 11px;
	height: 11px;
}

.ms-wa__info {
	display: block;
	min-width: 0;
}

.ms-wa__label,
.ms-wa__name {
	display: block;
}

.ms-wa__label {
	font-size: 12px;
	opacity: .6;
}

.ms-wa__name {
	font-weight: 700;
}

.ms-wa .ms-wa__footer {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 56px;
	padding: 16px 32px;
	border-top: 1px solid rgba(0, 0, 0, .075);
	border-radius: 0 0 8px 8px;
	background: #fff;
	color: #303030;
	font-size: 12px;
	line-height: 1.5;
	text-align: center;
}

/* En pantallas angostas la caja se ajusta al ancho en vez de salirse por la izquierda. */
@media (max-width: 429px) {
	.ms-wa {
		left: 0;
	}

	.ms-wa__box {
		align-self: stretch;
		width: auto;
		margin: 12px 12px 8px;
	}

	.ms-wa__box::before {
		right: 28px;
	}

	.ms-wa__header {
		padding: 12px 40px 12px 20px;
	}

	.ms-wa__contact,
	.ms-wa__contact:hover,
	.ms-wa__contact:focus,
	.ms-wa .ms-wa__footer {
		padding-left: 20px;
		padding-right: 20px;
	}

	.ms-wa__close {
		width: 40px;
		height: 40px;
		font-size: 24px;
	}
}

@keyframes ms-wa-open {
	0% {
		opacity: 0;
		transform: translateY(50px);
	}

	100% {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes ms-wa-close {
	0% {
		opacity: 1;
		transform: translateY(0);
	}

	100% {
		opacity: 0;
		transform: translateY(50px);
	}
}

@keyframes ms-wa-pulse {
	0% {
		box-shadow: 0 2px 4px rgba(0, 0, 0, .2), 0 0 0 0 rgba(220, 53, 69, .7);
	}

	70% {
		box-shadow: 0 2px 4px rgba(0, 0, 0, .2), 0 0 0 4px rgba(220, 53, 69, 0);
	}

	100% {
		box-shadow: 0 2px 4px rgba(0, 0, 0, .2), 0 0 0 0 rgba(220, 53, 69, 0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.ms-wa__box,
	.ms-wa__box.is-closing,
	.ms-wa__bubble {
		animation: none;
	}
}

@media print {
	.ms-wa {
		display: none;
	}
}
