:root {
	--ags-ai-green: #056b35;
	--ags-ai-green-dark: #034723;
	--ags-ai-leaf: #dff5df;
	--ags-ai-sun: #f5c84b;
	--ags-ai-ink: #183126;
	--ags-ai-paper: #fbfdf8;
}

.ags-ai {
	position: fixed;
	right: 18px;
	bottom: 22px;
	z-index: 9998;
	font-family: "Poppins", sans-serif;
	color: var(--ags-ai-ink);
	pointer-events: auto;
	touch-action: manipulation;
}

.ags-ai__toggle {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.ags-ai__launcher {
	display: flex;
	align-items: center;
	gap: 9px;
	min-height: 50px;
	padding: 0 17px;
	border: 0;
	border-radius: 999px;
	background: linear-gradient(135deg, var(--ags-ai-green), var(--ags-ai-green-dark));
	box-shadow: 0 12px 32px rgba(3, 71, 35, .3);
	color: #fff;
	font-weight: 700;
	cursor: pointer;
}

.ags-ai__launcher svg,
.ags-ai__form button svg {
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.ags-ai__pulse {
	width: 8px;
	height: 8px;
	border: 2px solid #fff;
	border-radius: 50%;
	background: var(--ags-ai-sun);
	box-shadow: 0 0 0 0 rgba(245, 200, 75, .6);
	animation: ags-ai-pulse 2s infinite;
}

.ags-ai__panel {
	position: absolute;
	right: 0;
	bottom: 62px;
	display: none;
	flex-direction: column;
	width: min(380px, calc(100vw - 28px));
	max-height: min(640px, calc(100vh - 120px));
	overflow: hidden;
	border: 1px solid rgba(5, 107, 53, .16);
	border-radius: 22px;
	background:
		radial-gradient(circle at 90% 0%, rgba(245, 200, 75, .2), transparent 32%),
		var(--ags-ai-paper);
	box-shadow: 0 24px 70px rgba(18, 49, 34, .25);
	transform-origin: right bottom;
	animation: ags-ai-open .22s ease-out;
}

.ags-ai__toggle:checked ~ .ags-ai__panel {
	display: flex;
}

.ags-ai__header {
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 15px 16px;
	background: var(--ags-ai-green-dark);
	color: #fff;
}

.ags-ai__mark {
	display: grid;
	width: 38px;
	height: 38px;
	place-items: center;
	border: 1px solid rgba(255,255,255,.35);
	border-radius: 12px 4px 12px 4px;
	background: var(--ags-ai-green);
	color: var(--ags-ai-sun);
	font-weight: 800;
}

.ags-ai__header strong,
.ags-ai__header small {
	display: block;
}

.ags-ai__header strong {
	font-size: 15px;
	line-height: 1.2;
}

.ags-ai__header small {
	margin-top: 3px;
	color: rgba(255,255,255,.72);
	font-size: 11px;
}

.ags-ai__close {
	margin-left: auto;
	padding: 5px 8px;
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 27px;
	line-height: 1;
	cursor: pointer;
}

.ags-ai__messages {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 11px;
	min-height: 230px;
	padding: 16px;
	overflow-y: auto;
	scroll-behavior: smooth;
}

.ags-ai__message {
	max-width: 88%;
	padding: 11px 13px;
	border-radius: 15px;
	font-size: 13px;
	line-height: 1.5;
}

.ags-ai__message--bot {
	align-self: flex-start;
	border-bottom-left-radius: 4px;
	background: #fff;
	box-shadow: 0 5px 18px rgba(24, 49, 38, .08);
}

.ags-ai__message--user {
	align-self: flex-end;
	border-bottom-right-radius: 4px;
	background: var(--ags-ai-green);
	color: #fff;
}

.ags-ai__message--loading {
	color: #5b6e64;
	font-style: italic;
}

.ags-ai__products {
	display: grid;
	gap: 8px;
}

.ags-ai__product {
	display: grid;
	grid-template-columns: 58px 1fr;
	gap: 10px;
	padding: 9px;
	border: 1px solid #e4eee6;
	border-radius: 13px;
	background: #fff;
	color: var(--ags-ai-ink);
	text-decoration: none;
}

.ags-ai__product:hover {
	border-color: var(--ags-ai-green);
	color: var(--ags-ai-green-dark);
}

.ags-ai__product img {
	width: 58px;
	height: 58px;
	border-radius: 9px;
	object-fit: cover;
}

.ags-ai__product strong,
.ags-ai__product span {
	display: block;
}

.ags-ai__product strong {
	font-size: 12px;
	line-height: 1.35;
}

.ags-ai__product span {
	margin-top: 5px;
	color: var(--ags-ai-green);
	font-size: 12px;
	font-weight: 700;
}

.ags-ai__product em {
	color: #687b70;
	font-size: 10px;
	font-style: normal;
}

.ags-ai__action {
	display: inline-flex;
	margin-top: 9px;
	padding: 8px 12px;
	border-radius: 999px;
	background: var(--ags-ai-leaf);
	color: var(--ags-ai-green-dark);
	font-size: 12px;
	font-weight: 700;
	text-decoration: none;
}

.ags-ai__quick {
	display: flex;
	gap: 7px;
	padding: 0 14px 11px;
	overflow-x: auto;
}

.ags-ai__quick button {
	flex: 0 0 auto;
	padding: 7px 10px;
	border: 1px solid #cfe3d3;
	border-radius: 999px;
	background: #fff;
	color: var(--ags-ai-green-dark);
	font-size: 11px;
	cursor: pointer;
}

.ags-ai__form {
	display: grid;
	grid-template-columns: 1fr 44px;
	gap: 8px;
	padding: 11px 12px;
	border-top: 1px solid #e6eee7;
	background: #fff;
}

.ags-ai__form input {
	width: 100%;
	min-height: 44px;
	padding: 0 13px;
	border: 1px solid #ccdacf;
	border-radius: 12px;
	background: #f9fbf8;
	color: var(--ags-ai-ink);
	font-size: 13px;
}

.ags-ai__form input:focus {
	border-color: var(--ags-ai-green);
	outline: 3px solid rgba(5,107,53,.12);
}

.ags-ai__form button {
	display: grid;
	width: 44px;
	height: 44px;
	place-items: center;
	border: 0;
	border-radius: 12px;
	background: var(--ags-ai-green);
	color: #fff;
	cursor: pointer;
}

.ags-ai__privacy {
	margin: 0;
	padding: 0 14px 11px;
	background: #fff;
	color: #748278;
	font-size: 9px;
	text-align: center;
}

@keyframes ags-ai-open {
	from { opacity: 0; transform: translateY(8px) scale(.97); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes ags-ai-pulse {
	70% { box-shadow: 0 0 0 8px rgba(245, 200, 75, 0); }
	100% { box-shadow: 0 0 0 0 rgba(245, 200, 75, 0); }
}

@media (max-width: 767px) {
	.ags-ai {
		right: 12px;
		bottom: 82px;
	}
	.ags-ai__launcher {
		position: relative;
		justify-content: center;
		width: 60px;
		height: 60px;
		min-height: 60px;
		padding: 0;
		gap: 0;
		border: 2px solid rgba(255, 255, 255, .9);
		border-radius: 50%;
		box-shadow: 0 10px 28px rgba(3, 71, 35, .34);
	}
	.ags-ai__launcher > span:last-child {
		display: none;
	}
	.ags-ai__launcher svg {
		width: 27px;
		height: 27px;
	}
	.ags-ai__launcher .ags-ai__pulse {
		position: absolute;
		top: 5px;
		right: 5px;
		width: 10px;
		height: 10px;
		border-width: 2px;
	}
	.ags-ai__panel {
		position: fixed;
		right: 10px;
		bottom: 140px;
		left: 10px;
		width: auto;
		max-height: calc(100vh - 165px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.ags-ai__panel,
	.ags-ai__pulse {
		animation: none;
	}
}
