/* ==========================================================================
   Asistente flotante estilo WhatsApp — ver inc/wa-chatbot.php
   ========================================================================== */

.ftwa {
	--ftwa-green: #25d366;
	--ftwa-teal: #008069;
	--ftwa-accent: #00a884;
	--ftwa-chat: #efeae2;
	--ftwa-in: #ffffff;
	--ftwa-out: #d9fdd3;
	--ftwa-text: #111b21;
	--ftwa-muted: #667781;
	--ftwa-tick: #53bdeb;
	--ftwa-link: #027eb5;
	--ftwa-bar: #f0f2f5;
	--ftwa-line: #e9edef;
	--ftwa-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
	--ftwa-bottom: 20px;
	--ftwa-right: 20px;

	position: fixed;
	right: var(--ftwa-right);
	bottom: var(--ftwa-bottom);
	z-index: 1035;
	font-family: "Segoe UI", "Helvetica Neue", Helvetica, "Lucida Grande", Arial, Ubuntu, Cantarell, "Fira Sans", sans-serif;
	-webkit-font-smoothing: antialiased;
	color: var(--ftwa-text);
}

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

.ftwa button { font: inherit; cursor: pointer; }
.ftwa svg { display: block; width: 100%; height: 100%; }

/* Barra fija de Ordenar/Filtrar en la tienda mobile: subimos el botón. */
@media (max-width: 991.98px) {
	body:has(.ft-shop-toolbar__mobile) .ftwa { --ftwa-bottom: 84px; }
}
/* El "volver arriba" de Bootscore queda encima del botón de WhatsApp. */
body:has(#ftwa) .top-button { bottom: 96px; right: 28px; }
@media (max-width: 991.98px) {
	body:has(.ft-shop-toolbar__mobile):has(#ftwa) .top-button { bottom: 160px; }
}
.ft-jr-mode .ftwa { display: none; }

/* ── Botón flotante ─────────────────────────────────────────── */
.ftwa-fab {
	position: relative;
	width: 60px;
	height: 60px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--ftwa-green);
	color: #fff;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22), 0 2px 4px rgba(0, 0, 0, 0.12);
	display: grid;
	place-items: center;
	transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.ftwa-fab:hover { transform: scale(1.06); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.26); }
.ftwa-fab:focus-visible { outline: 3px solid #fff; box-shadow: 0 0 0 6px var(--ftwa-teal); }
.ftwa-fab__icon {
	grid-area: 1 / 1;
	width: 32px;
	height: 32px;
	transition: transform 0.25s ease, opacity 0.2s ease;
}
.ftwa-fab__icon--close { width: 26px; height: 26px; opacity: 0; transform: rotate(-90deg) scale(0.6); }
.ftwa[data-state="open"] .ftwa-fab { background: var(--ftwa-teal); }
.ftwa[data-state="open"] .ftwa-fab__icon--wa { opacity: 0; transform: rotate(90deg) scale(0.6); }
.ftwa[data-state="open"] .ftwa-fab__icon--close { opacity: 1; transform: none; }

/* Pulso suave para llamar la atención la primera vez. */
.ftwa-fab::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.55);
	animation: ftwa-pulse 2.4s ease-out 3;
	pointer-events: none;
}
.ftwa[data-state="open"] .ftwa-fab::after { animation: none; }
@keyframes ftwa-pulse {
	0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.55); }
	80%, 100% { box-shadow: 0 0 0 18px rgba(37, 211, 102, 0); }
}

.ftwa-fab__badge {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 22px;
	height: 22px;
	padding: 0 5px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 11px;
	background: #ff3b30;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	font-variant-numeric: tabular-nums;
	border: 2px solid #fff;
	z-index: 1;
}
.ftwa-fab__badge[hidden] { display: none; }

/* ── Globito de bienvenida ──────────────────────────────────── */
.ftwa-teaser {
	position: absolute;
	right: 0;
	bottom: 74px;
	width: max-content;
	max-width: min(290px, calc(100vw - 40px));
	animation: ftwa-pop 0.3s ease-out;
}
.ftwa-teaser[hidden] { display: none; }
.ftwa-teaser__body {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px 10px 10px;
	border: 0;
	border-radius: 12px 12px 2px 12px;
	background: #fff;
	color: var(--ftwa-text);
	text-align: left;
	box-shadow: 0 6px 24px rgba(11, 20, 26, 0.18);
}
.ftwa-teaser__body img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; background: #fff; border: 1px solid var(--ftwa-line); }
.ftwa-teaser__body strong { display: block; font-size: 13px; color: var(--ftwa-teal); }
.ftwa-teaser__text { display: block; font-size: 14px; line-height: 1.35; }
.ftwa-teaser__close {
	position: absolute;
	top: -9px;
	left: -9px;
	width: 22px;
	height: 22px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: #54656f;
	color: #fff;
	padding: 0;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.ftwa .ftwa-teaser__close svg { width: 14px; height: 14px; }

/* ── Panel ──────────────────────────────────────────────────── */
.ftwa-panel {
	position: absolute;
	right: 0;
	bottom: 76px;
	width: 380px;
	height: min(640px, calc(100vh - 120px));
	height: min(640px, calc(100dvh - 120px));
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: 14px;
	background: var(--ftwa-chat);
	box-shadow: 0 12px 48px rgba(11, 20, 26, 0.28), 0 2px 8px rgba(11, 20, 26, 0.12);
	transform-origin: bottom right;
	animation: ftwa-open 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.ftwa-panel[hidden] { display: none; }

@keyframes ftwa-open {
	from { opacity: 0; transform: translateY(12px) scale(0.92); }
	to { opacity: 1; transform: none; }
}
@keyframes ftwa-pop {
	from { opacity: 0; transform: translateY(8px) scale(0.95); }
	to { opacity: 1; transform: none; }
}

@media (max-width: 575.98px) {
	.ftwa[data-state="open"] { --ftwa-bottom: 0; --ftwa-right: 0; }
	.ftwa-panel {
		position: fixed;
		inset: 0;
		width: 100%;
		height: 100%;
		border-radius: 0;
		animation-name: ftwa-open-mobile;
	}
	.ftwa[data-state="open"] .ftwa-fab { display: none; }
	html.ftwa-lock, html.ftwa-lock body { overflow: hidden; }
	@keyframes ftwa-open-mobile {
		from { opacity: 0; transform: translateY(40px); }
		to { opacity: 1; transform: none; }
	}
}

/* ── Header ─────────────────────────────────────────────────── */
.ftwa-head {
	flex: none;
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 60px;
	padding: 10px 8px 10px 14px;
	padding-top: max(10px, env(safe-area-inset-top));
	background: var(--ftwa-teal);
	color: #fff;
}
.ftwa-head__back {
	display: none;
	width: 28px;
	height: 28px;
	margin-left: -6px;
	padding: 2px;
	border: 0;
	background: none;
	color: #fff;
}
@media (max-width: 575.98px) {
	.ftwa-head__back { display: block; }
	.ftwa-head__btn--close { display: none; }
}
.ftwa-head__avatar {
	width: 40px;
	height: 40px;
	flex: none;
	border-radius: 50%;
	background: #fff;
	object-fit: contain;
	padding: 3px;
}
.ftwa-head__info { flex: 1; min-width: 0; }
.ftwa-head__name {
	font-size: 16px;
	font-weight: 600;
	line-height: 1.25;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.ftwa-head__status {
	font-size: 13px;
	line-height: 1.3;
	opacity: 0.85;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.ftwa-head__btn {
	flex: none;
	width: 38px;
	height: 38px;
	padding: 9px;
	border: 0;
	border-radius: 50%;
	background: none;
	color: #fff;
	transition: background-color 0.15s;
}
.ftwa-head__btn:hover,
.ftwa-head__btn:focus-visible { background: rgba(255, 255, 255, 0.14); color: #fff; }

/* ── Cuerpo con fondo de doodles ────────────────────────────── */
.ftwa-body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 10px 4% 12px;
	background-color: var(--ftwa-chat);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' fill='none' stroke='%23000' stroke-opacity='.055' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 22h22a4 4 0 0 1 4 4v12a4 4 0 0 1-4 4H28l-7 6v-6h-3a4 4 0 0 1-4-4V26a4 4 0 0 1 4-4z'/%3E%3Cpath d='M118 30c-4-6-14-4-14 3 0 6 14 14 14 14s14-8 14-14c0-7-10-9-14-3z'/%3E%3Cpath d='M70 96l4 9 10 1-7 7 2 10-9-5-9 5 2-10-7-7 10-1z'/%3E%3Cpath d='M136 108h26l4 10v8h-34v-8zM140 126a3 3 0 1 0 0 .1M158 126a3 3 0 1 0 0 .1'/%3E%3Cpath d='M20 132l14-12 14 12v16H20zM30 148v-9h8v9'/%3E%3Ccircle cx='160' cy='62' r='8'/%3E%3Cpath d='M64 20h10l4 18h18l3-12H80M84 44a2 2 0 1 0 0 .1M94 44a2 2 0 1 0 0 .1'/%3E%3Crect x='96' y='150' width='14' height='24' rx='3'/%3E%3Cpath d='M101 170h4M60 160c6-6 14-6 20 0M64 166c4-3 8-3 12 0'/%3E%3Cpath d='M164 158l6-6M168 164l6-6'/%3E%3C/svg%3E");
	background-size: 180px 180px;
	scroll-behavior: smooth;
}
.ftwa-log { display: flex; flex-direction: column; }

/* Chip de fecha + aviso amarillo (como el de cifrado de extremo a extremo). */
.ftwa-chip {
	align-self: center;
	margin: 6px 0 10px;
	padding: 5px 12px 6px;
	border-radius: 7.5px;
	background: #fff;
	color: var(--ftwa-muted);
	font-size: 12.5px;
	text-transform: uppercase;
	box-shadow: var(--ftwa-shadow);
}
.ftwa-notice {
	align-self: center;
	max-width: 92%;
	margin: 0 0 12px;
	padding: 6px 12px 7px;
	border-radius: 7.5px;
	background: #ffeecd;
	color: #54656f;
	font-size: 12.5px;
	line-height: 1.4;
	text-align: center;
	box-shadow: var(--ftwa-shadow);
}
.ftwa .ftwa-notice svg { display: inline-block; width: 10px; height: 12px; margin-right: 4px; vertical-align: -1px; }

/* ── Burbujas ───────────────────────────────────────────────── */
.ftwa-msg {
	position: relative;
	max-width: 88%;
	margin-bottom: 2px;
	padding: 6px 7px 8px 9px;
	border-radius: 7.5px;
	box-shadow: var(--ftwa-shadow);
	font-size: 14.2px;
	line-height: 19px;
	overflow-wrap: anywhere;
	animation: ftwa-msg-in 0.18s ease-out;
}
@keyframes ftwa-msg-in {
	from { opacity: 0; transform: translateY(4px); }
	to { opacity: 1; transform: none; }
}
.ftwa-msg--in { align-self: flex-start; background: var(--ftwa-in); }
.ftwa-msg--out { align-self: flex-end; background: var(--ftwa-out); }
.ftwa-msg--first { margin-top: 10px; }
.ftwa-log > .ftwa-msg--first:first-child { margin-top: 0; }
.ftwa-msg--in.ftwa-msg--first { border-top-left-radius: 0; }
.ftwa-msg--out.ftwa-msg--first { border-top-right-radius: 0; }

/* Colita de la burbuja. */
.ftwa-msg--first::before {
	content: "";
	position: absolute;
	top: 0;
	width: 8px;
	height: 13px;
}
.ftwa-msg--in.ftwa-msg--first::before {
	left: -8px;
	background: var(--ftwa-in);
	clip-path: polygon(0 0, 100% 0, 100% 100%);
}
.ftwa-msg--out.ftwa-msg--first::before {
	right: -8px;
	background: var(--ftwa-out);
	clip-path: polygon(0 0, 100% 0, 0 100%);
}

.ftwa-msg__text { white-space: pre-wrap; }
.ftwa-msg__text a { color: var(--ftwa-link); text-decoration: none; }
.ftwa-msg__text a:hover { text-decoration: underline; }
.ftwa-msg__text strong { font-weight: 600; }

/* Hora + tildes, flotando abajo a la derecha como en WhatsApp. */
.ftwa-msg__meta {
	float: right;
	position: relative;
	top: 6px;
	margin: -10px 0 -5px 10px;
	display: inline-flex;
	align-items: center;
	gap: 3px;
	color: var(--ftwa-muted);
	font-size: 11px;
	line-height: 15px;
	white-space: nowrap;
}
.ftwa .ftwa-msg__ticks { width: 16px; height: 11px; color: var(--ftwa-tick); }

/* Respuestas rápidas: botones pegados debajo del mensaje. */
.ftwa-actions {
	align-self: flex-start;
	display: flex;
	flex-direction: column;
	gap: 2px;
	width: 88%;
	max-width: 300px;
	margin: 2px 0 4px;
}
.ftwa .ftwa-action {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	min-height: 40px;
	padding: 8px 12px;
	border: 0;
	border-radius: 7.5px;
	background: var(--ftwa-in);
	color: var(--ftwa-accent);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.25;
	text-align: center;
	text-decoration: none;
	box-shadow: var(--ftwa-shadow);
	transition: background-color 0.15s;
	animation: ftwa-msg-in 0.18s ease-out;
}
.ftwa-action:hover,
.ftwa-action:focus-visible { background: #f5f6f6; color: var(--ftwa-accent); }
.ftwa-action[aria-disabled="true"] { color: #8696a0; cursor: default; }
.ftwa-action svg { width: 16px; height: 16px; flex: none; }
.ftwa-action--list { border-top: 1px solid var(--ftwa-line); }

/* Tarjetas de producto (como un mensaje de catálogo de WhatsApp Business). */
.ftwa-products {
	align-self: flex-start;
	display: flex;
	gap: 8px;
	max-width: 100%;
	margin: 4px 0;
	padding: 2px 0 8px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: thin;
}
.ftwa-product {
	flex: 0 0 168px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: 7.5px;
	background: var(--ftwa-in);
	color: var(--ftwa-text);
	text-decoration: none;
	box-shadow: var(--ftwa-shadow);
	scroll-snap-align: start;
	animation: ftwa-msg-in 0.2s ease-out;
}
.ftwa-product:hover { color: var(--ftwa-text); }
.ftwa-product__img {
	aspect-ratio: 1;
	width: 100%;
	background: #fff;
	object-fit: contain;
	border-bottom: 1px solid var(--ftwa-line);
}
.ftwa-product__body { display: flex; flex-direction: column; gap: 2px; flex: 1; padding: 7px 9px 4px; }
.ftwa-product__title {
	font-size: 13.5px;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.ftwa-product__price { font-size: 13.5px; font-weight: 600; }
.ftwa-product__cat { font-size: 11.5px; color: var(--ftwa-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ftwa-product__cta {
	padding: 8px;
	border-top: 1px solid var(--ftwa-line);
	color: var(--ftwa-accent);
	font-size: 13.5px;
	font-weight: 500;
	text-align: center;
}

/* "escribiendo…" */
.ftwa-typing {
	align-self: flex-start;
	display: inline-flex;
	gap: 4px;
	margin-top: 10px;
	padding: 12px 14px;
	border-radius: 0 7.5px 7.5px 7.5px;
	background: var(--ftwa-in);
	box-shadow: var(--ftwa-shadow);
	position: relative;
}
.ftwa-typing::before {
	content: "";
	position: absolute;
	top: 0;
	left: -8px;
	width: 8px;
	height: 13px;
	background: var(--ftwa-in);
	clip-path: polygon(0 0, 100% 0, 100% 100%);
}
.ftwa-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #8696a0;
	animation: ftwa-dot 1.2s infinite ease-in-out;
}
.ftwa-typing span:nth-child(2) { animation-delay: 0.15s; }
.ftwa-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ftwa-dot {
	0%, 60%, 100% { opacity: 0.35; transform: none; }
	30% { opacity: 1; transform: translateY(-3px); }
}

/* ── Barra de escritura ─────────────────────────────────────── */
.ftwa-foot {
	flex: none;
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 6px 8px;
	padding-bottom: max(6px, env(safe-area-inset-bottom));
	background: var(--ftwa-bar);
}
.ftwa-foot__menu {
	flex: none;
	width: 40px;
	height: 40px;
	padding: 9px;
	border: 0;
	border-radius: 50%;
	background: none;
	color: #54656f;
}
.ftwa-foot__menu:hover { background: rgba(0, 0, 0, 0.05); }
.ftwa-foot__input {
	flex: 1;
	min-width: 0;
	height: 42px;
	padding: 9px 14px;
	border: 0;
	border-radius: 21px;
	background: #fff;
	color: var(--ftwa-text);
	font: inherit;
	font-size: 15px;
	outline: none;
	box-shadow: none;
}
.ftwa-foot__input::placeholder { color: #8696a0; }
.ftwa-foot__input:focus { box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.25); }
.ftwa-foot__send {
	flex: none;
	width: 42px;
	height: 42px;
	padding: 11px 10px 11px 12px;
	border: 0;
	border-radius: 50%;
	background: var(--ftwa-accent);
	color: #fff;
	transition: transform 0.15s, background-color 0.15s, opacity 0.15s;
}
.ftwa-foot__send:disabled { background: #8696a0; opacity: 0.6; cursor: default; }
.ftwa-foot__send:not(:disabled):hover { transform: scale(1.06); }

/* ── Hoja de lista (mensaje de lista de WhatsApp) ───────────── */
.ftwa-sheet { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; justify-content: flex-end; }
.ftwa-sheet[hidden] { display: none; }
.ftwa-sheet__scrim { position: absolute; inset: 0; background: rgba(11, 20, 26, 0.4); animation: ftwa-fade 0.2s; }
.ftwa-sheet__panel {
	position: relative;
	max-height: 82%;
	display: flex;
	flex-direction: column;
	border-radius: 14px 14px 0 0;
	background: #fff;
	animation: ftwa-sheet-up 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes ftwa-fade { from { opacity: 0; } }
@keyframes ftwa-sheet-up { from { transform: translateY(100%); } }
.ftwa-sheet__head {
	flex: none;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px 10px;
	font-size: 16px;
	font-weight: 600;
}
.ftwa-sheet__head::before {
	content: "";
	position: absolute;
	top: 6px;
	left: 50%;
	width: 36px;
	height: 4px;
	margin-left: -18px;
	border-radius: 2px;
	background: #d1d7db;
}
.ftwa-sheet__x { width: 30px; height: 30px; padding: 4px; border: 0; background: none; color: #54656f; border-radius: 50%; }
.ftwa-sheet__x:hover { background: var(--ftwa-bar); }
.ftwa-sheet__list { overflow-y: auto; overscroll-behavior: contain; padding: 0 0 max(12px, env(safe-area-inset-bottom)); }
.ftwa-sheet__section {
	margin: 0;
	padding: 14px 20px 6px;
	color: var(--ftwa-accent);
	font-size: 13.5px;
	font-weight: 500;
}
.ftwa-row {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	padding: 10px 20px;
	border: 0;
	background: none;
	color: var(--ftwa-text);
	text-align: left;
}
.ftwa-row:hover,
.ftwa-row:focus-visible { background: #f5f6f6; }
.ftwa-row__icon { flex: none; width: 26px; font-size: 20px; line-height: 1; text-align: center; }
.ftwa-row__text { flex: 1; min-width: 0; padding-bottom: 10px; margin-bottom: -10px; border-bottom: 1px solid var(--ftwa-line); }
.ftwa-row:last-child .ftwa-row__text { border-bottom-color: transparent; }
.ftwa-row__title { display: block; font-size: 15.5px; line-height: 1.3; }
.ftwa-row__desc { display: block; font-size: 13px; color: var(--ftwa-muted); line-height: 1.35; }
.ftwa-row__radio {
	flex: none;
	width: 20px;
	height: 20px;
	border: 2px solid #8696a0;
	border-radius: 50%;
}

@media (prefers-reduced-motion: reduce) {
	.ftwa *,
	.ftwa *::before,
	.ftwa *::after { animation: none !important; transition: none !important; }
	.ftwa-body { scroll-behavior: auto; }
}

@media print {
	.ftwa { display: none !important; }
}

.ftwa-product__variant {
	align-self: flex-start;
	padding: 1px 7px;
	border-radius: 9px;
	background: var(--ftwa-out);
	color: #1f7a4d;
	font-size: 11.5px;
	font-weight: 600;
}

/* El globo del logo tiene la colita abajo a la izquierda: centrado por caja
   se ve corrido hacia arriba a la derecha. 1px lo compensa a la vista. */
.ftwa .ftwa-fab__icon--wa svg { transform: translate(-1px, 1px); }
