/* ==========================================================================
   TEAM360 — Chat assistant widget
   ========================================================================== */

.chatbot {
	position: fixed;
	right: var(--space-md);
	bottom: var(--space-md);
	z-index: 950;
}

/* Back-to-top sits above the chat bubble so the two never overlap. */
.back-to-top {
	bottom: calc(var(--space-md) + 68px);
}

.chatbot-bubble {
	position: relative;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--gradient-primary);
	box-shadow: 0 10px 30px -8px rgba(var(--c-primary-rgb), .7);
	transition: transform var(--dur-fast) var(--ease-out);
}

.chatbot-bubble:hover {
	transform: scale(1.06);
}

.chatbot-bubble::before {
	content: '';
	position: absolute;
	inset: -6px;
	border-radius: 50%;
	border: 1px solid rgba(var(--c-secondary-rgb), .5);
	animation: pulseGlow 2.6s ease-in-out infinite;
}

.chatbot-bubble .icon {
	width: 24px;
	height: 24px;
	color: #fff;
	position: absolute;
	transition: opacity .2s var(--ease-out), transform .2s var(--ease-out);
}

.chatbot-bubble .icon-close {
	opacity: 0;
	transform: rotate(-45deg) scale(.6);
}

.chatbot.is-open .chatbot-bubble .icon-chat {
	opacity: 0;
	transform: rotate(45deg) scale(.6);
}

.chatbot.is-open .chatbot-bubble .icon-close {
	opacity: 1;
	transform: rotate(0) scale(1);
}

.chatbot-panel {
	position: absolute;
	right: 0;
	bottom: calc(100% + 16px);
	width: min(370px, calc(100vw - 2 * var(--space-md)));
	height: min(520px, 70vh);
	display: flex;
	flex-direction: column;
	border-radius: var(--radius-lg);
	overflow: hidden;
	transform-origin: bottom right;
	transform: scale(.85) translateY(20px);
	opacity: 0;
	visibility: hidden;
	transition: transform var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out), visibility var(--dur-base);
	box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7);
}

.chatbot.is-open .chatbot-panel {
	transform: scale(1) translateY(0);
	opacity: 1;
	visibility: visible;
}

.chatbot-header {
	display: flex;
	align-items: center;
	gap: .7rem;
	padding: var(--space-sm) var(--space-md);
	border-bottom: 1px solid var(--c-border);
	background: rgba(255, 255, 255, .02);
}

.chatbot-avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--gradient-primary);
	flex-shrink: 0;
}

.chatbot-avatar .icon {
	width: 20px;
	height: 20px;
	color: #fff;
}

.chatbot-title {
	font-weight: 600;
	font-size: var(--fs-sm);
}

.chatbot-status {
	display: flex;
	align-items: center;
	gap: .35rem;
	font-size: var(--fs-xs);
	color: var(--c-text-muted);
}

.chatbot-status-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--c-success);
	box-shadow: 0 0 6px 1px var(--c-success);
}

.chatbot-messages {
	flex: 1;
	overflow-y: auto;
	padding: var(--space-md);
	display: flex;
	flex-direction: column;
	gap: .6rem;
}

.chatbot-msg {
	max-width: 82%;
	padding: .65rem .9rem;
	border-radius: var(--radius-md);
	font-size: var(--fs-sm);
	line-height: 1.5;
	animation: fadeInUp .35s var(--ease-out);
}

.chatbot-msg.bot {
	align-self: flex-start;
	background: var(--c-card-hover);
	border: 1px solid var(--c-border);
	border-bottom-left-radius: 4px;
}

.chatbot-msg.user {
	align-self: flex-end;
	background: var(--gradient-primary);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.chatbot-typing {
	align-self: flex-start;
	display: flex;
	gap: 4px;
	padding: .7rem .9rem;
	border-radius: var(--radius-md);
	background: var(--c-card-hover);
	border: 1px solid var(--c-border);
}

.chatbot-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--c-text-muted);
	animation: bounce 1.2s ease-in-out infinite;
}

.chatbot-typing span:nth-child(2) { animation-delay: .15s; }
.chatbot-typing span:nth-child(3) { animation-delay: .3s; }

.chatbot-quick-replies {
	display: flex;
	flex-wrap: wrap;
	gap: .4rem;
	padding: 0 var(--space-md) var(--space-sm);
}

.chatbot-quick-reply {
	padding: .45rem .8rem;
	border-radius: var(--radius-full);
	border: 1px solid var(--c-border-strong);
	font-size: var(--fs-xs);
	color: var(--c-secondary);
	transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.chatbot-quick-reply:hover {
	background: var(--gradient-primary);
	color: #fff;
	border-color: transparent;
}

.chatbot-input-row {
	display: flex;
	gap: .5rem;
	padding: var(--space-sm) var(--space-md);
	border-top: 1px solid var(--c-border);
}

.chatbot-input-row input {
	flex: 1;
	padding: .7rem .9rem;
	border-radius: var(--radius-full);
	border: 1px solid var(--c-border-strong);
	background: rgba(255, 255, 255, .03);
	font-size: var(--fs-sm);
}

.chatbot-input-row input:focus {
	border-color: var(--c-secondary);
	outline: none;
}

.chatbot-msg a {
	color: var(--c-secondary);
	text-decoration: underline;
}

@media (max-width: 480px) {
	.chatbot {
		right: var(--space-sm);
		bottom: var(--space-sm);
	}

	.chatbot-panel {
		width: calc(100vw - 2 * var(--space-sm));
	}

	.back-to-top {
		bottom: calc(var(--space-sm) + 64px);
	}
}
