/**
 * Advantage FAQ chatbot – brand blue #2E37A4 / #36B4FF
 * Optional Gemini AI (AJAX); WhatsApp only on unknown / [[WHATSAPP]].
 */

:root {
	--adv-chat-blue: #2e37a4;
	--adv-chat-cyan: #36b4ff;
	--adv-chat-text: #040406;
	--adv-chat-muted: #5a6270;
	--adv-chat-bg: #f3f6fb;
	--adv-chat-panel: #ffffff;
	--adv-chat-shadow: 0 12px 40px rgba(4, 4, 6, 0.22);
}

/* Stack: chat toggle bottom; existing WhatsApp sits above it */
body.adv-chat-ready #adv-whatsapp-float,
body.adv-chat-ready .adv-whatsapp-button {
	bottom: 92px !important;
}

@media (max-width: 900px) {
	body.adv-chat-ready #adv-whatsapp-float,
	body.adv-chat-ready .adv-whatsapp-button {
		bottom: 168px !important;
	}
}

.adv-chat {
	position: fixed;
	right: 16px;
	bottom: 24px;
	z-index: 2147483646;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.45;
	color: var(--adv-chat-text);
	pointer-events: none;
}

@media (max-width: 900px) {
	.adv-chat {
		bottom: 100px;
	}
}

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

.adv-chat__toggle {
	pointer-events: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	background: linear-gradient(145deg, var(--adv-chat-cyan) 0%, var(--adv-chat-blue) 100%);
	color: #fff;
	box-shadow: 0 8px 24px rgba(46, 55, 164, 0.4);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
	animation: adv-chat-pulse 2.4s ease-in-out infinite;
}

.adv-chat__toggle:hover,
.adv-chat__toggle:focus-visible {
	transform: scale(1.06);
	box-shadow: 0 10px 28px rgba(46, 55, 164, 0.5);
	outline: none;
}

.adv-chat.is-open .adv-chat__toggle {
	animation: none;
}

.adv-chat__toggle-icon {
	display: block;
	width: 28px;
	height: 28px;
}

.adv-chat__toggle-icon--close {
	display: none;
}

.adv-chat.is-open .adv-chat__toggle-icon--open {
	display: none;
}

.adv-chat.is-open .adv-chat__toggle-icon--close {
	display: block;
}

@keyframes adv-chat-pulse {
	0%,
	100% {
		box-shadow: 0 8px 24px rgba(46, 55, 164, 0.4);
	}
	50% {
		box-shadow: 0 8px 28px rgba(54, 180, 255, 0.55), 0 0 0 10px rgba(54, 180, 255, 0.12);
	}
}

.adv-chat__panel {
	pointer-events: auto;
	position: absolute;
	right: 0;
	bottom: 76px;
	display: flex;
	flex-direction: column;
	width: min(360px, calc(100vw - 32px));
	height: min(480px, calc(100vh - 140px));
	max-height: 520px;
	overflow: hidden;
	border-radius: 16px;
	background: var(--adv-chat-panel);
	box-shadow: var(--adv-chat-shadow);
	opacity: 0;
	visibility: hidden;
	transform: translateY(16px) scale(0.96);
	transform-origin: bottom right;
	transition:
		opacity 0.28s ease,
		transform 0.28s ease,
		visibility 0.28s;
}

.adv-chat.is-open .adv-chat__panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
}

@media (max-width: 900px) {
	.adv-chat__panel {
		bottom: 72px;
		height: min(460px, calc(100vh - 200px));
	}
}

.adv-chat__header {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 14px 16px;
	background: linear-gradient(120deg, var(--adv-chat-blue) 0%, #252d8a 55%, var(--adv-chat-cyan) 160%);
	color: #fff;
}

.adv-chat__brand {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.01em;
	line-height: 1.25;
}

.adv-chat__header-close {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	cursor: pointer;
	transition: background 0.2s ease;
}

.adv-chat__header-close:hover,
.adv-chat__header-close:focus-visible {
	background: rgba(255, 255, 255, 0.28);
	outline: none;
}

.adv-chat__messages {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 14px 14px 8px;
	background: var(--adv-chat-bg);
	-webkit-overflow-scrolling: touch;
}

.adv-chat__msg {
	max-width: 92%;
	margin: 0 0 10px;
	padding: 10px 12px;
	border-radius: 12px;
	opacity: 0;
	animation: adv-chat-fade-in 0.35s ease forwards;
}

.adv-chat__msg--bot {
	margin-right: auto;
	background: #fff;
	color: var(--adv-chat-text);
	border: 1px solid rgba(46, 55, 164, 0.1);
	border-bottom-left-radius: 4px;
}

.adv-chat__msg--user {
	margin-left: auto;
	background: var(--adv-chat-blue);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.adv-chat__msg a {
	color: var(--adv-chat-blue);
	text-decoration: underline;
}

.adv-chat__msg--user a {
	color: #fff;
}

.adv-chat__msg p {
	margin: 0 0 0.5em;
}

.adv-chat__msg p:last-child {
	margin-bottom: 0;
}

.adv-chat__lead {
	margin: 0 0 0.4em !important;
	font-weight: 600;
	color: var(--adv-chat-blue);
}

.adv-chat__fact p:last-child {
	margin-bottom: 0;
}

@keyframes adv-chat-fade-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* FAQ chips removed — free-text only */
.adv-chat__chips {
	display: none !important;
}
.adv-chat__chips-legacy {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-top: 8px;
	max-height: 220px;
	overflow-x: hidden;
	overflow-y: auto;
	padding-right: 2px;
	-webkit-overflow-scrolling: touch;
}

.adv-chat__chip {
	display: block;
	width: 100%;
	margin: 0;
	padding: 8px 10px;
	border: 1px solid rgba(46, 55, 164, 0.28);
	border-radius: 10px;
	background: #fff;
	color: var(--adv-chat-blue);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.35;
	text-align: left;
	white-space: normal;
	cursor: pointer;
	transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.adv-chat__chip:hover,
.adv-chat__chip:focus-visible {
	background: rgba(54, 180, 255, 0.12);
	border-color: var(--adv-chat-cyan);
	outline: none;
}

.adv-chat__wa {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 10px;
	padding: 8px 12px;
	border-radius: 10px;
	background: #25d366;
	color: #fff !important;
	font-size: 13px;
	font-weight: 700;
	text-decoration: none !important;
	transition: background 0.2s ease, transform 0.2s ease;
}

.adv-chat__wa:hover,
.adv-chat__wa:focus-visible {
	background: #1ebe57;
	transform: translateY(-1px);
	outline: none;
}

.adv-chat__wa svg {
	flex-shrink: 0;
}

.adv-chat__msg--typing {
	padding: 12px 14px;
}

.adv-chat__typing {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	height: 14px;
}

.adv-chat__typing span {
	display: block;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--adv-chat-blue);
	opacity: 0.35;
	animation: adv-chat-typing 1.2s ease-in-out infinite;
}

.adv-chat__typing span:nth-child(2) {
	animation-delay: 0.15s;
}

.adv-chat__typing span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes adv-chat-typing {
	0%,
	80%,
	100% {
		opacity: 0.3;
		transform: translateY(0);
	}
	40% {
		opacity: 1;
		transform: translateY(-3px);
	}
}

.adv-chat__send:disabled,
.adv-chat__input:disabled {
	opacity: 0.65;
	cursor: not-allowed;
}

.adv-chat__footer {
	flex: 0 0 auto;
	padding: 10px 12px 12px;
	border-top: 1px solid rgba(46, 55, 164, 0.1);
	background: #fff;
}

.adv-chat__form {
	display: flex;
	gap: 8px;
	align-items: center;
}

.adv-chat__input {
	flex: 1 1 auto;
	min-width: 0;
	height: 40px;
	padding: 0 12px;
	border: 1px solid rgba(46, 55, 164, 0.22);
	border-radius: 10px;
	background: var(--adv-chat-bg);
	color: var(--adv-chat-text);
	font-size: 14px;
}

.adv-chat__input:focus {
	outline: none;
	border-color: var(--adv-chat-cyan);
	box-shadow: 0 0 0 3px rgba(54, 180, 255, 0.2);
}

.adv-chat__send {
	flex: 0 0 auto;
	height: 40px;
	padding: 0 14px;
	border: 0;
	border-radius: 10px;
	background: var(--adv-chat-blue);
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
	transition: background 0.2s ease;
}

.adv-chat__send:hover,
.adv-chat__send:focus-visible {
	background: #252d8a;
	outline: none;
}

.adv-chat__hint {
	margin: 6px 2px 0;
	font-size: 11px;
	line-height: 1.35;
	color: var(--adv-chat-muted);
}

@media (prefers-reduced-motion: reduce) {
	.adv-chat__toggle {
		animation: none;
	}

	.adv-chat__panel,
	.adv-chat__toggle,
	.adv-chat__msg,
	.adv-chat__wa,
	.adv-chat__chip,
	.adv-chat__typing span {
		transition: none;
		animation: none;
	}

	.adv-chat__msg {
		opacity: 1;
	}

	.adv-chat__typing span {
		opacity: 0.55;
	}
}
