/* ── FuncioHouse Chatbot Widget ──────────────────────────────── */

#fh-chatbot-widget {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 99999;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
	font-size: 14px;
	line-height: 1.4;
	color: #1a1a2e;
	box-sizing: border-box;
}

#fh-chatbot-widget *,
#fh-chatbot-widget *::before,
#fh-chatbot-widget *::after {
	box-sizing: inherit;
}

/* ── Bubble ──────────────────────────────────────────────────── */

#fh-chat-bubble {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: #1a4d8f;
	color: white;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 18px rgba(26, 77, 143, 0.45);
	position: relative;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	padding: 0;
	outline: none;
	animation: fh-bubble-pulse 2.5s ease-in-out infinite;
}

#fh-chat-bubble:focus-visible {
	outline: 3px solid #5b9bd5;
	outline-offset: 2px;
}

#fh-chat-bubble:hover {
	animation: none;
	transform: scale(1.08);
	box-shadow: 0 6px 22px rgba(26, 77, 143, 0.55);
}

#fh-chat-bubble.fh-active {
	animation: none;
	transform: scale(0.95);
}

#fh-chat-bubble svg {
	width: 26px;
	height: 26px;
	pointer-events: none;
}

/* Badge */
#fh-chat-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	background: #e53e3e;
	color: white;
	border-radius: 50%;
	min-width: 18px;
	height: 18px;
	font-size: 10px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 4px;
	border: 2px solid #fff;
	pointer-events: none;
}

@keyframes fh-bubble-pulse {
	0%, 100% { transform: scale(1); }
	50%       { transform: scale(1.08); }
}

/* ── Chat window ─────────────────────────────────────────────── */

#fh-chat-window {
	position: absolute;
	bottom: 66px;
	right: 0;
	width: 360px;
	height: 490px;
	background: #f3f5f9;
	border-radius: 16px;
	box-shadow: 0 8px 36px rgba(0, 0, 0, 0.16), 0 2px 10px rgba(0, 0, 0, 0.08);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: fh-slide-up 0.24s ease-out;
}

@keyframes fh-slide-up {
	from {
		opacity: 0;
		transform: translateY(14px) scale(0.97);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* ── Header ──────────────────────────────────────────────────── */

#fh-chat-header {
	background: #1a4d8f;
	padding: 11px 13px;
	display: flex;
	align-items: center;
	gap: 9px;
	flex-shrink: 0;
}

.fh-header-avatar {
	width: 38px;
	height: 38px;
	background: rgba(255, 255, 255, 0.2);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	color: white;
}

.fh-header-avatar svg {
	width: 20px;
	height: 20px;
}

.fh-header-info {
	flex: 1;
	min-width: 0;
}

.fh-header-name {
	color: white;
	font-weight: 700;
	font-size: 13.5px;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.fh-header-sub {
	color: rgba(255, 255, 255, 0.78);
	font-size: 10.5px;
	margin-top: 2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.fh-online-dot {
	width: 9px;
	height: 9px;
	background: #48bb78;
	border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, 0.7);
	flex-shrink: 0;
	animation: fh-pulse 2.4s infinite ease-in-out;
}

@keyframes fh-pulse {
	0%, 100% { opacity: 1; }
	50%       { opacity: 0.55; }
}

#fh-chat-minimize {
	background: none;
	border: none;
	color: rgba(255, 255, 255, 0.75);
	cursor: pointer;
	font-size: 17px;
	padding: 4px 5px;
	line-height: 1;
	transition: color 0.15s;
	border-radius: 4px;
}

#fh-chat-minimize:hover {
	color: white;
	background: rgba(255, 255, 255, 0.1);
}

/* ── Messages area ───────────────────────────────────────────── */

#fh-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 12px 11px;
	display: flex;
	flex-direction: column;
	gap: 7px;
	scroll-behavior: smooth;
	min-height: 0;
}

#fh-chat-messages::-webkit-scrollbar {
	width: 4px;
}

#fh-chat-messages::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.14);
	border-radius: 2px;
}

/* ── Message bubbles ─────────────────────────────────────────── */

.fh-message {
	max-width: 84%;
	padding: 9px 12px;
	font-size: 13.5px;
	line-height: 1.47;
	word-break: break-word;
	white-space: pre-wrap;
}

.fh-message-user {
	background: #1a4d8f;
	color: white;
	border-radius: 12px 12px 3px 12px;
	align-self: flex-end;
}

.fh-message-assistant {
	background: white;
	color: #1a1a2e;
	border-radius: 12px 12px 12px 3px;
	border: 0.5px solid rgba(0, 0, 0, 0.07);
	align-self: flex-start;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* ── Typing indicator ────────────────────────────────────────── */

.fh-typing {
	display: flex !important;
	align-items: center;
	gap: 5px;
	padding: 12px 15px;
	min-width: 54px;
	white-space: normal;
}

.fh-typing span {
	width: 7px;
	height: 7px;
	background: #1a4d8f;
	border-radius: 50%;
	opacity: 0.55;
	animation: fh-bounce 1.3s infinite ease-in-out;
	display: block;
}

.fh-typing span:nth-child(1) { animation-delay: 0s; }
.fh-typing span:nth-child(2) { animation-delay: 0.22s; }
.fh-typing span:nth-child(3) { animation-delay: 0.44s; }

@keyframes fh-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.55; }
	30%            { transform: translateY(-5px); opacity: 1; }
}

/* ── Suggestions ─────────────────────────────────────────────── */

#fh-chat-suggestions {
	padding: 0 11px 8px;
	display: flex;
	flex-direction: column;
	gap: 5px;
	flex-shrink: 0;
}

.fh-suggestion {
	background: white;
	border: 1px solid #ccd9ef;
	color: #1a4d8f;
	border-radius: 8px;
	padding: 7px 10px;
	font-size: 12px;
	text-align: left;
	cursor: pointer;
	line-height: 1.35;
	transition: background 0.15s, border-color 0.15s;
	font-family: inherit;
}

.fh-suggestion:hover {
	background: #ebf1fb;
	border-color: #1a4d8f;
}

/* ── Input area ──────────────────────────────────────────────── */

#fh-chat-input-area {
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 8px 11px;
	background: white;
	border-top: 1px solid rgba(0, 0, 0, 0.07);
	flex-shrink: 0;
}

#fh-chat-input {
	flex: 1;
	border: 1px solid #d3dae8;
	border-radius: 20px;
	padding: 8px 14px;
	font-size: 13px;
	outline: none;
	transition: border-color 0.15s;
	background: #f7f8fb;
	color: #1a1a2e;
	font-family: inherit;
	min-width: 0;
}

#fh-chat-input::placeholder {
	color: #9aa5b8;
}

#fh-chat-input:focus {
	border-color: #1a4d8f;
	background: white;
}

#fh-chat-input:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

#fh-chat-send {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #1a4d8f;
	color: white;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.15s, transform 0.1s;
	padding: 0;
}

#fh-chat-send svg {
	width: 17px;
	height: 17px;
}

#fh-chat-send:hover {
	background: #154079;
}

#fh-chat-send:active {
	transform: scale(0.91);
}

#fh-chat-send:disabled {
	opacity: 0.45;
	cursor: not-allowed;
	transform: none;
}

/* ── Feedback form ───────────────────────────────────────────── */

#fh-feedback-form {
	padding: 11px 12px;
	background: white;
	border-top: 1px solid rgba(0, 0, 0, 0.07);
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex-shrink: 0;
}

#fh-feedback-form p {
	margin: 0;
	font-size: 13px;
	font-weight: 600;
	color: #1a1a2e;
}

#fh-feedback-input {
	border: 1px solid #d3dae8;
	border-radius: 8px;
	padding: 8px 10px;
	font-size: 13px;
	resize: none;
	height: 68px;
	outline: none;
	font-family: inherit;
	color: #1a1a2e;
	transition: border-color 0.15s;
}

#fh-feedback-input:focus {
	border-color: #1a4d8f;
}

.fh-feedback-actions {
	display: flex;
	gap: 8px;
}

#fh-feedback-submit {
	background: #1a4d8f;
	color: white;
	border: none;
	border-radius: 6px;
	padding: 7px 16px;
	font-size: 13px;
	cursor: pointer;
	font-family: inherit;
	transition: background 0.15s;
}

#fh-feedback-submit:hover {
	background: #154079;
}

#fh-feedback-submit:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

#fh-feedback-cancel {
	background: none;
	border: 1px solid #d3dae8;
	border-radius: 6px;
	padding: 7px 14px;
	font-size: 13px;
	cursor: pointer;
	color: #666;
	font-family: inherit;
	transition: border-color 0.15s, color 0.15s;
}

#fh-feedback-cancel:hover {
	border-color: #999;
	color: #333;
}

/* ── Footer ──────────────────────────────────────────────────── */

#fh-chat-footer {
	background: white;
	padding: 5px 11px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	border-top: 1px solid rgba(0, 0, 0, 0.06);
	flex-shrink: 0;
}

#fh-chat-footer span {
	font-size: 10px;
	color: #9aa5b8;
	line-height: 1.3;
	flex: 1;
}

#fh-feedback-btn {
	background: none;
	border: none;
	color: #1a4d8f;
	cursor: pointer;
	font-size: 11px;
	padding: 3px 7px;
	border-radius: 5px;
	white-space: nowrap;
	transition: background 0.15s;
	font-family: inherit;
	flex-shrink: 0;
}

#fh-feedback-btn:hover {
	background: #ebf1fb;
}

/* ── Tooltip ─────────────────────────────────────────────────── */

#fh-chat-tooltip {
	position: absolute;
	right: 62px;
	top: 50%;
	transform: translateY(-50%);
	background: white;
	border: 1px solid #1a4d8f;
	border-radius: 20px;
	padding: 8px 30px 8px 14px;
	font-size: 13px;
	color: #1a4d8f;
	white-space: nowrap;
	box-shadow: 0 3px 14px rgba(26, 77, 143, 0.18);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.4s ease, visibility 0.4s ease;
	z-index: 100;
	cursor: pointer;
	user-select: none;
	pointer-events: none;
}

#fh-chat-tooltip.fh-tooltip-visible {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

/* Arrow pointing right — toward the bubble */
#fh-chat-tooltip::before {
	content: '';
	position: absolute;
	right: -9px;
	top: 50%;
	transform: translateY(-50%);
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 9px 0 9px 9px;
	border-color: transparent transparent transparent #1a4d8f;
}

#fh-chat-tooltip::after {
	content: '';
	position: absolute;
	right: -7px;
	top: 50%;
	transform: translateY(-50%);
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 7px 0 7px 7px;
	border-color: transparent transparent transparent white;
}

#fh-tooltip-close {
	position: absolute;
	top: 50%;
	right: 10px;
	transform: translateY(-50%);
	background: none;
	border: none;
	color: #1a4d8f;
	cursor: pointer;
	font-size: 11px;
	line-height: 1;
	padding: 2px 3px;
	opacity: 0.55;
	transition: opacity 0.15s;
	font-family: inherit;
}

#fh-tooltip-close:hover {
	opacity: 1;
}

/* ── Utility ─────────────────────────────────────────────────── */

.fh-hidden {
	display: none !important;
}

/* ── Mobile ──────────────────────────────────────────────────── */

@media (max-width: 480px) {
	#fh-chatbot-widget {
		bottom: 0;
		right: 0;
		left: 0;
	}

	#fh-chat-bubble {
		position: fixed;
		bottom: 16px;
		right: 16px;
	}

	#fh-chat-window {
		position: fixed;
		bottom: 0;
		right: 0;
		left: 0;
		width: 100%;
		height: 88dvh;
		border-radius: 16px 16px 0 0;
		animation: fh-slide-up-mobile 0.24s ease-out;
	}

	@keyframes fh-slide-up-mobile {
		from {
			opacity: 0;
			transform: translateY(30px);
		}
		to {
			opacity: 1;
			transform: translateY(0);
		}
	}
}

/* ── Tooltip — mobile (encima de la burbuja) ─────────────────── */

@media (max-width: 768px) {
	#fh-chat-tooltip {
		position: fixed;
		right: 5px;
		left: 5px;
		bottom: 80px; /* 16px offset + 52px burbuja + 12px hueco */
		top: auto;
		transform: none;
		white-space: normal;
		text-align: center;
		padding: 10px 32px 10px 16px;
	}

	/* Arrow pointing down — toward the bubble (bottom-right) */
	#fh-chat-tooltip::before {
		right: 28px;
		left: auto;
		top: auto;
		bottom: -9px;
		transform: none;
		border-width: 9px 9px 0 9px;
		border-color: #1a4d8f transparent transparent transparent;
	}

	#fh-chat-tooltip::after {
		right: 28px;
		left: auto;
		top: auto;
		bottom: -7px;
		transform: none;
		border-width: 7px 7px 0 7px;
		border-color: white transparent transparent transparent;
	}
}
