/**
 * Asistente Fifty — estilos del widget.
 *
 * Todo cuelga de .fa-root y usa reset propio en cada elemento: el theme del
 * cliente (MasterLife/Elementor) mete estilos agresivos en botones e inputs y
 * no queremos heredarlos ni pelearnos a base de !important por todos lados.
 */

.fa-root {
	--fa-accent: #2f6fb8;
	--fa-accent-ink: #ffffff;
	--fa-ink: #17222e;
	--fa-muted: #64748b;
	--fa-line: #e2e9f1;
	--fa-bg: #ffffff;
	--fa-soft: #f2f6fb;
	--fa-radius: 16px;
	--fa-shadow: 0 18px 48px rgba(15, 35, 60, .18);

	position: fixed;
	bottom: 22px;
	z-index: 99990;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: var(--fa-ink);
}

.fa-root.fa-pos-right { right: 22px; }
.fa-root.fa-pos-left { left: 22px; }

.fa-root *,
.fa-root *::before,
.fa-root *::after { box-sizing: border-box; }

/* ---------------------------------------------------- Blindaje frente al tema
 * Hello Elementor (reset.css), Astra, etc. pintan todos los <button>, <input>
 * y <a> con sus propios colores y bordes. Todo lo del widget cuelga de .fa-root
 * y tiene mas especificidad que cualquier regla por etiqueta del tema. Aqui
 * ademas neutralizamos lo que el tema suele tocar antes de aplicar lo nuestro.
 */
.fa-root button,
.fa-root [type="button"],
.fa-root [type="submit"] {
	appearance: none;
	-webkit-appearance: none;
	background-image: none;
	border-style: solid;
	border-width: 0;
	box-shadow: none;
	text-shadow: none;
	text-transform: none;
	letter-spacing: normal;
	text-decoration: none;
	font-family: inherit;
	line-height: 1.35;
	white-space: normal;
	min-height: 0;
	min-width: 0;
}
.fa-root input[type="text"],
.fa-root input[type="tel"],
.fa-root input[type="email"] {
	appearance: none;
	-webkit-appearance: none;
	box-shadow: none;
	height: auto;
	min-height: 0;
	line-height: 1.4;
	font-family: inherit;
}
.fa-root a { text-decoration: none; box-shadow: none; }
/* Font Awesome y otros iconos por CSS inyectan contenido en ::before/::after de
 * cualquier clase que coincida (p. ej. .fa-reply). El widget no usa
 * pseudoelementos, asi que los anulamos todos. */
.fa-root *::before,
.fa-root *::after { content: none !important; }
.fa-root ul { list-style: disc; }
.fa-root form { margin: 0; }
.fa-root p { margin: 0; }
.fa-root svg { display: block; fill: none; }

/* ---------------------------------------------------------------- Lanzador */

.fa-root .fa-launcher {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--fa-accent);
	color: var(--fa-accent-ink);
	box-shadow: 0 10px 26px rgba(15, 35, 60, .28);
	cursor: pointer;
	transition: transform .18s ease, box-shadow .18s ease;
}

.fa-root .fa-launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(15, 35, 60, .34); }
.fa-root .fa-launcher:focus-visible { outline: 3px solid var(--fa-accent); outline-offset: 3px; }
.fa-root .fa-launcher.is-open .fa-launcher__pulse { display: none; }

.fa-root .fa-launcher__icon { display: flex; }
.fa-root .fa-launcher__badge {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: 999px;
	background: #c2410c;
	color: #fff;
	font-size: 11.5px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
	box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}

.fa-root .fa-launcher__pulse {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 2px solid var(--fa-accent);
	animation: fifty-pulse 2.6s ease-out infinite;
}

@keyframes fifty-pulse {
	0% { transform: scale(1);    opacity: .55; }
	70% { transform: scale(1.45); opacity: 0; }
	100% { transform: scale(1.45); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.fa-root .fa-launcher__pulse { animation: none; display: none; }
	.fa-root .fa-launcher { transition: none; }
}

/* ------------------------------------------------------------------ Panel */

.fa-root .fa-panel {
	position: absolute;
	bottom: 76px;
	width: 384px;
	max-width: calc(100vw - 32px);
	height: 590px;
	max-height: calc(100vh - 130px);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--fa-bg);
	border-radius: var(--fa-radius);
	box-shadow: var(--fa-shadow);
	animation: fifty-in .22s ease-out;
}

.fa-root.fa-pos-right .fa-panel { right: 0; }
.fa-root.fa-pos-left  .fa-panel { left: 0; }

@keyframes fifty-in {
	from { opacity: 0; transform: translateY(12px) scale(.985); }
	to { opacity: 1; transform: none; }
}

/* Incrustado con el shortcode: el root deja de flotar y el panel ocupa el hueco. */
.fa-root.fa-root--inline {
	position: static;
	width: 100%;
	bottom: auto;
	right: auto;
	left: auto;
	z-index: auto;
	min-height: inherit;
	display: block;
}
.fa-root.fa-root--inline .fa-panel {
	position: static;
	width: 100%;
	max-width: none;
	height: 100%;
	min-height: inherit;
	animation: none;
	border: 1px solid var(--fa-line);
}
.fa-root.fa-root--inline .fa-launcher { display: none; }

/* ---------------------------------------------------------------- Cabecera */

.fa-root .fa-head {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 18px;
	background: var(--fa-accent);
	color: #fff;
}

.fa-root .fa-head__ring {
	flex: 0 0 auto;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	border: 3px solid rgba(255, 255, 255, .95);
	border-right-color: rgba(255, 255, 255, .4);
}

.fa-root .fa-head__id { flex: 1 1 auto; min-width: 0; }
.fa-root .fa-head__id strong { display: block; font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; }
.fa-root .fa-head__id em {
	display: flex;
	align-items: center;
	gap: 6px;
	font-style: normal;
	font-size: 12px;
	opacity: .88;
}

.fa-root .fa-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #6ee7a8;
	box-shadow: 0 0 0 3px rgba(110, 231, 168, .25);
}

.fa-root .fa-head__close {
	flex: 0 0 auto;
	display: flex;
	padding: 6px;
	margin: 0;
	border: 0;
	border-radius: 8px;
	background: rgba(255, 255, 255, .14);
	color: #fff;
	cursor: pointer;
}

.fa-root .fa-head__close:hover { background: rgba(255, 255, 255, .26); }

/* ------------------------------------------------------------------- Log */

.fa-root .fa-log {
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 18px 16px 6px;
	background: var(--fa-soft);
	scrollbar-width: thin;
}

.fa-root .fa-msg { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 12px; }
.fa-root .fa-msg--me { justify-content: flex-end; }

.fa-root .fa-msg__avatar {
	flex: 0 0 auto;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	border: 2.5px solid var(--fa-accent);
	border-right-color: #b9d3ea;
	background: #fff;
}

/* Mensajes escritos por una persona del equipo desde el panel */
.fa-root .fa-msg__avatar--human {
	border-color: #17794f;
	border-right-color: #a7e3c4;
	background: #e4f3ec;
}
.fa-root .fa-msg--human .fa-msg__body { border-color: #bfe3d0; background: #f3faf6; }
.fa-root .fa-msg__author {
	display: block;
	margin-bottom: 3px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .02em;
	text-transform: uppercase;
	color: #17794f;
}
.fa-root .fa-dot--human { background: #17794f; box-shadow: 0 0 0 3px rgba(23, 121, 79, .25); }
.fa-root .fa-note {
	margin: -4px 0 12px 32px;
	font-size: 11.5px;
	color: var(--fa-muted);
}

.fa-root .fa-msg__body {
	max-width: 78%;
	padding: 11px 14px;
	border-radius: 16px;
	background: #fff;
	border: 1px solid var(--fa-line);
	border-bottom-left-radius: 5px;
	font-size: 14.5px;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.fa-root .fa-msg__body strong { font-weight: 650; }

.fa-root .fa-msg--me .fa-msg__body {
	background: var(--fa-accent);
	border-color: var(--fa-accent);
	color: #fff;
	border-bottom-left-radius: 16px;
	border-bottom-right-radius: 5px;
}

.fa-root .fa-msg__body--plain { padding: 0; border: 0; background: none; max-width: 88%; }

/* ------------------------------------------------------------ Estimación */

.fa-root .fa-quote {
	padding: 16px 18px;
	border: 1px solid #cfe0f1;
	border-radius: 14px;
	background: linear-gradient(180deg, #f6fafe, #ffffff);
}

.fa-root .fa-quote__figure {
	font-size: 25px;
	font-weight: 700;
	letter-spacing: -.02em;
	color: var(--fa-accent);
	line-height: 1.2;
}

.fa-root .fa-quote__net { margin-top: 3px; font-size: 12.5px; color: var(--fa-muted); }

.fa-root .fa-quote__notes {
	margin: 11px 0 0;
	padding: 11px 0 0 16px;
	border-top: 1px solid #e4edf6;
	font-size: 11.5px;
	color: var(--fa-muted);
}

.fa-root .fa-quote__notes li { margin-bottom: 3px; }

/* --------------------------------------------------------------- Typing */

.fa-root .fa-dots { display: inline-flex; gap: 4px; align-items: center; padding: 2px 0; }
.fa-root .fa-dots i {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #9fb3c8;
	animation: fifty-blink 1.3s infinite ease-in-out;
}
.fa-root .fa-dots i:nth-child(2) { animation-delay: .18s; }
.fa-root .fa-dots i:nth-child(3) { animation-delay: .36s; }

@keyframes fifty-blink {
	0%, 60%, 100% { opacity: .3; transform: translateY(0); }
	30% { opacity: 1; transform: translateY(-2px); }
}

/* ------------------------------------------------------- Respuestas rápidas */

.fa-root .fa-opts {
	flex: 0 0 auto; /* Nunca se encoge: el log es quien absorbe la altura. */
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
	padding: 10px 16px;
	background: var(--fa-soft);
	max-height: 220px;
	overflow-y: auto;
}

.fa-root .fa-opts:empty { display: none; }

.fa-root .fa-opt {
	margin: 0;
	padding: 8px 13px;
	border: 1px solid var(--fa-accent);
	border-radius: 999px;
	background: #fff;
	color: var(--fa-accent);
	font: inherit;
	font-size: 13.5px;
	font-weight: 550;
	line-height: 1.35;
	text-decoration: none;
	cursor: pointer;
	transition: background .14s ease, color .14s ease;
}

.fa-root .fa-opt:hover { background: var(--fa-accent); color: #fff; }
.fa-root .fa-opt:focus-visible { outline: 2px solid var(--fa-accent); outline-offset: 2px; }

.fa-root .fa-opt--day { min-width: 78px; text-align: center; border-radius: 12px; }
.fa-root .fa-opt--slot { min-width: 62px; text-align: center; font-variant-numeric: tabular-nums; }
.fa-root .fa-opt--link { background: var(--fa-accent); color: #fff; }
.fa-root .fa-opt--link:hover { filter: brightness(1.08); }

/* ------------------------------------------------------------- Formulario */

.fa-root .fa-form { display: flex; flex-direction: column; gap: 9px; width: 100%; }

.fa-root .fa-form__row { display: flex; flex-direction: column; gap: 4px; }
.fa-root .fa-form__row--check { flex-direction: row; align-items: flex-start; gap: 8px; }

.fa-root .fa-form__label { font-size: 12px; font-weight: 600; color: var(--fa-muted); }

.fa-root .fa-form__input {
	width: 100%;
	margin: 0;
	padding: 11px 13px;
	border: 1px solid var(--fa-line);
	border-radius: 10px;
	background: #fff;
	font: inherit;
	font-size: 14.5px;
	color: var(--fa-ink);
}

.fa-root .fa-form__input:focus {
	outline: none;
	border-color: var(--fa-accent);
	box-shadow: 0 0 0 3px rgba(47, 111, 184, .16);
}

.fa-root .fa-form__row--check input[type="checkbox"] {
	width: 17px;
	height: 17px;
	margin: 2px 0 0;
	accent-color: var(--fa-accent);
	flex: 0 0 auto;
}

.fa-root .fa-form__consent { font-size: 11.5px; color: var(--fa-muted); line-height: 1.45; }
.fa-root .fa-form__consent a { color: var(--fa-accent); }

.fa-root .fa-form__error { font-size: 11.5px; color: #c0392b; font-weight: 600; }

.fa-root .fa-form__submit {
	margin: 4px 0 0;
	padding: 12px 16px;
	border: 0;
	border-radius: 10px;
	background: var(--fa-accent);
	color: #fff;
	font: inherit;
	font-size: 14.5px;
	font-weight: 650;
	cursor: pointer;
}

.fa-root .fa-form__submit:hover { filter: brightness(1.07); }

.fa-root .fa-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	opacity: 0 !important;
}

/* --------------------------------------------------------------- Compose */

.fa-root .fa-compose {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 14px;
	border-top: 1px solid var(--fa-line);
	background: #fff;
}

.fa-root .fa-compose.is-hidden { display: none; }

.fa-root .fa-compose__input {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	padding: 11px 14px;
	border: 1px solid var(--fa-line);
	border-radius: 999px;
	background: var(--fa-soft);
	font: inherit;
	font-size: 14.5px;
	color: var(--fa-ink);
}

.fa-root .fa-compose__input:focus {
	outline: none;
	border-color: var(--fa-accent);
	background: #fff;
	box-shadow: 0 0 0 3px rgba(47, 111, 184, .14);
}

.fa-root .fa-compose__send {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--fa-accent);
	color: #fff;
	cursor: pointer;
}

.fa-root .fa-compose__send:hover { filter: brightness(1.08); }

/* ----------------------------------------------------------------- Móvil */

@media (max-width: 520px) {
	.fa-root { bottom: 16px; }
	.fa-root.fa-pos-right { right: 16px; }
	.fa-root.fa-pos-left { left: 16px; }

	.fa-root:not(.fa-root--inline) .fa-panel {
		position: fixed;
		inset: 0;
		width: 100vw;
		max-width: 100vw;
		height: 100dvh;
		max-height: 100dvh;
		border-radius: 0;
	}

	.fa-root.is-open .fa-launcher { display: none; }
}
