/* Farma AI Chat — botón flotante estilo WhatsApp + panel con la estética
   de Clínicas Farma (rosa/magenta de marca, tipografía limpia). */

.fac-root, .fac-root * {
	box-sizing: border-box;
}

.fac-root {
	--fac-primary: #DC0375;
	--fac-accent: #BF0068;
	--fac-wa: #25D366;
	--fac-wa-dark: #128C7E;
	font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 999999;
}

/* Botón flotante — icono de WhatsApp, reconocible al instante */
.fac-launcher {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--fac-wa), var(--fac-wa-dark));
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
	position: relative;
}
.fac-launcher:hover {
	transform: scale(1.06);
	box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
}
.fac-launcher svg { width: 30px; height: 30px; }
.fac-launcher .fac-close-icon { display: none; }
.fac-root.fac-open .fac-launcher .fac-chat-icon { display: none; }
.fac-root.fac-open .fac-launcher .fac-close-icon { display: block; }

.fac-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	background: var(--fac-primary);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	padding: 4px 6px;
	border-radius: 999px;
	border: 2px solid #fff;
}
.fac-root.fac-open .fac-badge, .fac-root.fac-seen .fac-badge { display: none; }

/* Panel de chat */
.fac-panel {
	position: absolute;
	right: 0;
	bottom: 76px;
	width: 370px;
	max-width: calc(100vw - 24px);
	height: 560px;
	max-height: calc(100vh - 120px);
	background: #fff;
	border-radius: 18px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
	display: none;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px);
	transition: opacity 0.18s ease, transform 0.18s ease;
}
.fac-root.fac-open .fac-panel {
	display: flex;
	opacity: 1;
	transform: translateY(0);
}

.fac-header {
	background: linear-gradient(135deg, var(--fac-primary), var(--fac-accent));
	color: #fff;
	padding: 16px 18px;
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}
.fac-header-avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
.fac-header-avatar svg { width: 20px; height: 20px; fill: #fff; }
.fac-header-text { flex: 1; min-width: 0; }
.fac-header-title {
	font-weight: 700;
	font-size: 15px;
	margin: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.fac-header-subtitle {
	font-size: 12px;
	margin: 2px 0 0;
	opacity: 0.9;
	display: flex;
	align-items: center;
	gap: 5px;
}
.fac-header-subtitle::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #4ADE80;
	display: inline-block;
}
.fac-header-close {
	background: rgba(255, 255, 255, 0.15);
	border: none;
	color: #fff;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
.fac-header-close svg { width: 14px; height: 14px; }

/* Cuerpo de mensajes */
.fac-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px 14px;
	background: #F6EFF3;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.fac-disclosure {
	font-size: 11.5px;
	color: #7a5468;
	background: #FEF9FD;
	border: 1px solid #f1d9e8;
	border-radius: 10px;
	padding: 8px 10px;
	text-align: center;
	margin-bottom: 4px;
}

.fac-msg {
	max-width: 84%;
	padding: 9px 13px;
	border-radius: 16px;
	font-size: 13.5px;
	line-height: 1.45;
	white-space: pre-wrap;
	word-wrap: break-word;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}
.fac-msg.fac-bot {
	align-self: flex-start;
	background: #fff;
	color: #2a2230;
	border-bottom-left-radius: 4px;
}
.fac-msg.fac-user {
	align-self: flex-end;
	background: var(--fac-primary);
	color: #fff;
	border-bottom-right-radius: 4px;
}
.fac-msg a { color: inherit; text-decoration: underline; }

.fac-typing {
	align-self: flex-start;
	background: #fff;
	border-radius: 16px;
	border-bottom-left-radius: 4px;
	padding: 11px 15px;
	display: flex;
	gap: 4px;
}
.fac-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #c9a6ba;
	display: inline-block;
	animation: fac-bounce 1.2s infinite ease-in-out;
}
.fac-typing span:nth-child(2) { animation-delay: 0.15s; }
.fac-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes fac-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30% { transform: translateY(-4px); opacity: 1; }
}

/* Botones de acción (reserva / hablar con humano) dentro del hilo */
.fac-action {
	align-self: flex-start;
	display: flex;
	flex-direction: column;
	gap: 6px;
	max-width: 84%;
}
.fac-action-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 14px;
	border-radius: 10px;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	border: none;
}
.fac-action-btn.fac-btn-booking {
	background: var(--fac-primary);
	color: #fff;
}
.fac-action-btn.fac-btn-handoff {
	background: var(--fac-wa);
	color: #fff;
}
.fac-action-btn svg { width: 15px; height: 15px; fill: currentColor; }

/* Pie: input + acceso directo a humano */
.fac-footer {
	flex-shrink: 0;
	border-top: 1px solid #eee;
	background: #fff;
}
.fac-quick-human {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	font-size: 11.5px;
	color: #128C7E;
	text-decoration: none;
	padding: 7px 10px;
	border-bottom: 1px solid #f2f2f2;
}
.fac-quick-human svg { width: 12px; height: 12px; fill: currentColor; }
.fac-quick-human:hover { text-decoration: underline; }

.fac-input-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 10px;
}
.fac-input {
	flex: 1;
	resize: none;
	border: 1px solid #e2d3da;
	border-radius: 20px;
	padding: 10px 14px;
	font-size: 13.5px;
	font-family: inherit;
	max-height: 90px;
	line-height: 1.35;
}
.fac-input:focus { outline: none; border-color: var(--fac-primary); }
.fac-send {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: none;
	background: var(--fac-primary);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
.fac-send:disabled { opacity: 0.5; cursor: default; }
.fac-send svg { width: 16px; height: 16px; fill: #fff; }

@media (max-width: 480px) {
	.fac-root { right: 12px; bottom: 12px; }
	.fac-panel {
		width: calc(100vw - 20px);
		height: calc(100vh - 100px);
		bottom: 72px;
	}
}
