/* ============================================
   COMPONENT: Floating Chat Widget
   ============================================ */

.chat-widget {
	position: fixed;
	bottom: 2rem;
	right: 2rem;
	z-index: 9998;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 1.2rem;
}

/* Chat buttons container */
.chat-widget__buttons {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 1.2rem;
	transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Individual chat button */
.chat-widget__btn {
	position: relative;
	width: 5rem;
	height: 5rem;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 0.4rem 1.2rem rgba(0, 0, 0, 0.15);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	text-decoration: none;
}

.chat-widget__btn:hover {
	transform: scale(1.1);
	box-shadow: 0 0.6rem 2rem rgba(0, 0, 0, 0.2);
}

.chat-widget__btn:active {
	transform: scale(0.95);
}

/* Button variants */
.chat-widget__btn--messenger {
	background: linear-gradient(135deg, #0084ff 0%, #00c6ff 100%);
}

.chat-widget__btn--ai {
	background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
}

.chat-widget__btn--zalo {
	background: #0068ff;
}

/* Button icons */
.chat-widget__icon {
	width: 2.4rem;
	height: 2.4rem;
	fill: #ffffff;
	color: #ffffff;
}

/* Tooltip */
.chat-widget__tooltip {
	position: absolute;
	right: calc(100% + 1.2rem);
	top: 50%;
	transform: translateY(-50%);
	background-color: var(--gray-900, #1a1a1a);
	color: #ffffff;
	font-family: var(--font-primary, 'Inter', sans-serif);
	font-size: 1.3rem;
	font-weight: 500;
	padding: 0.8rem 1.2rem;
	border-radius: 0.6rem;
	white-space: nowrap;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
	pointer-events: none;
}

.chat-widget__tooltip::after {
	content: '';
	position: absolute;
	top: 50%;
	right: -0.6rem;
	transform: translateY(-50%);
	border: 0.6rem solid transparent;
	border-left-color: var(--gray-900, #1a1a1a);
	border-right: none;
}

.chat-widget__btn:hover .chat-widget__tooltip {
	opacity: 1;
	visibility: visible;
}

/* Main toggle button (mobile) */
.chat-widget__toggle {
	width: 5.5rem;
	height: 5.5rem;
	border-radius: 50%;
	border: none;
	background: var(--brand-secondary, #213368);
	cursor: pointer;
	display: none;
	align-items: center;
	justify-content: center;
	box-shadow: 0 0.4rem 1.6rem rgba(0, 0, 0, 0.2);
	transition: transform 0.3s ease, box-shadow 0.3s ease;
	position: relative;
}

.chat-widget__toggle:hover {
	transform: scale(1.05);
	box-shadow: 0 0.6rem 2rem rgba(0, 0, 0, 0.25);
}

.chat-widget__toggle-icon {
	width: 2.8rem;
	height: 2.8rem;
	fill: #ffffff;
	color: #ffffff;
	transition: transform 0.3s ease, opacity 0.3s ease;
}

.chat-widget__toggle-icon--close {
	position: absolute;
	opacity: 0;
	transform: rotate(-90deg);
}

/* Toggle active state */
.chat-widget--open .chat-widget__toggle-icon--chat {
	opacity: 0;
	transform: rotate(90deg);
}

.chat-widget--open .chat-widget__toggle-icon--close {
	opacity: 1;
	transform: rotate(0);
}

/* Pulse animation for toggle button */
.chat-widget__toggle::before {
	content: '';
	position: absolute;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	background: inherit;
	opacity: 0;
	animation: chat-pulse 2s ease-out infinite;
}

@keyframes chat-pulse {
	0% {
		transform: scale(1);
		opacity: 0.5;
	}
	100% {
		transform: scale(1.5);
		opacity: 0;
	}
}

/* Mobile styles */
@media (max-width: 767px) {
	.chat-widget {
		bottom: 8rem;
		right: 1.6rem;
	}

	.chat-widget__toggle {
		display: flex;
	}

	.chat-widget__buttons {
		opacity: 0;
		visibility: hidden;
		transform: translateY(1rem);
		pointer-events: none;
	}

	.chat-widget--open .chat-widget__buttons {
		opacity: 1;
		visibility: visible;
		transform: translateY(0);
		pointer-events: auto;
	}

	.chat-widget__btn {
		width: 4.4rem;
		height: 4.4rem;
	}

	.chat-widget__icon {
		width: 2rem;
		height: 2rem;
	}

	.chat-widget__tooltip {
		display: none;
	}
}

/* Small mobile */
@media (max-width: 375px) {
	.chat-widget {
		right: 1.2rem;
		bottom: 8rem;
	}

	.chat-widget__toggle {
		width: 5rem;
		height: 5rem;
	}

	.chat-widget__btn {
		width: 4rem;
		height: 4rem;
	}
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
	.chat-widget__btn,
	.chat-widget__toggle,
	.chat-widget__buttons,
	.chat-widget__toggle-icon {
		transition: none;
	}

	.chat-widget__toggle::before {
		animation: none;
	}
}
