/* GAI — greentick Assistant (floating widget) */

.gai-root {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99999;
	font-family: var(--gtn-font-sans, system-ui, sans-serif);
}

/* Floating toggle button */
.gai-toggle {
	width: 58px;
	height: 58px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	background: linear-gradient(135deg, #01652F 0%, #0B6E36 100%);
	color: #fff;
	display: grid;
	place-items: center;
	box-shadow: 0 10px 26px -6px rgba(3, 16, 8, 0.45);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.gai-toggle:hover {
	transform: translateY(-2px);
	box-shadow: 0 14px 30px -6px rgba(3, 16, 8, 0.5);
}
.gai-toggle__close { display: none; }
.gai-toggle.is-open .gai-toggle__icon { display: none; }
.gai-toggle.is-open .gai-toggle__close { display: block; }
.gai-toggle.is-open {
	background: linear-gradient(135deg, #0C2414 0%, #123020 100%);
}

/* Panel */
.gai-panel {
	position: absolute;
	right: 0;
	bottom: 70px;
	width: 364px;
	max-width: calc(100vw - 32px);
	height: min(600px, calc(100dvh - 130px));
	min-height: 400px;
	background: #fff;
	border: 1px solid rgba(1, 101, 47, 0.14);
	border-radius: 18px;
	box-shadow: 0 24px 60px -12px rgba(3, 16, 8, 0.35);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}
.gai-panel[hidden] { display: none; }
body.drawer-open .gai-root {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}
@media (max-width: 640px) {
	.gai-root { right: 12px; bottom: 14px; }
	.gai-toggle { width: 46px; height: 46px; }
	.gai-toggle svg { width: 21px; height: 21px; }
	.gai-panel { bottom: 58px; width: calc(100vw - 24px); max-width: 364px; height: min(520px, calc(100dvh - 88px)); min-height: 320px; }
}

.gai-panel__head {
	display: flex;
	align-items: center;
	gap: 0.7rem;
	padding: 0.85rem 1rem;
	background: linear-gradient(90deg, #01652F 0%, #0B6E36 60%, #92A91A 130%);
	color: #fff;
	flex: none;
}
.gai-panel__avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.16);
	display: grid;
	place-items: center;
	font-weight: 800;
	font-size: 1.0625rem;
	color: #C9E265;
	flex: none;
}
.gai-panel__id { display: flex; flex-direction: column; line-height: 1.25; flex: 1; }
.gai-panel__id strong { font-size: 1rem; }
.gai-panel__id span { font-size: 0.6875rem; opacity: 0.82; }
.gai-panel__min {
	background: transparent;
	border: none;
	color: #fff;
	cursor: pointer;
	opacity: 0.85;
	padding: 4px;
}
.gai-panel__min:hover { opacity: 1; }

/* Log */
.gai-panel__log {
	flex: 1;
	overflow-y: auto;
	padding: 1rem;
	background: #F6F9F4;
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
	scroll-behavior: smooth;
}

.gai-msg { display: flex; flex-direction: column; align-items: flex-start; }
.gai-msg--user { align-items: flex-end; }
.gai-msg--bot { justify-content: flex-start; }
.gai-msg--user { justify-content: flex-end; }
.gai-msg__bubble {
	max-width: 84%;
	padding: 0.6rem 0.85rem;
	border-radius: 14px;
	font-size: 0.875rem;
	line-height: 1.5;
	white-space: pre-line;
	word-break: break-word;
}
.gai-msg--bot .gai-msg__bubble {
	background: #fff;
	border: 1px solid rgba(1, 101, 47, 0.12);
	color: #22352A;
	border-bottom-left-radius: 4px;
}
.gai-msg--user .gai-msg__bubble {
	background: #01652F;
	color: #fff;
	border-bottom-right-radius: 4px;
}
.gai-msg__link {
	display: inline-block;
	margin: 0.5rem 0 0.15rem;
	font-size: 0.8125rem;
	font-weight: 700;
	color: #01652F;
	text-decoration: underline;
	text-decoration-color: rgba(146, 169, 26, 0.6);
	text-underline-offset: 3px;
}
.gai-msg__link:hover { color: #5C6E0D; }

/* Typing indicator */
.gai-msg--typing .gai-msg__bubble { display: inline-flex; gap: 4px; align-items: center; padding: 0.75rem 0.9rem; }
.gai-msg--typing span {
	width: 6px; height: 6px; border-radius: 50%;
	background: #92A91A;
	opacity: 0.4;
	animation: gai-blink 1.2s infinite;
}
.gai-msg--typing span:nth-child(2) { animation-delay: 0.2s; }
.gai-msg--typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes gai-blink {
	0%, 70%, 100% { opacity: 0.25; transform: translateY(0); }
	35% { opacity: 1; transform: translateY(-2px); }
}

/* Chips */
.gai-panel__chips {
	display: flex;
	gap: 0.45rem;
	flex-wrap: nowrap;
	overflow-x: auto;
	padding: 0.55rem 0.9rem;
	border-top: 1px solid rgba(1, 101, 47, 0.08);
	background: #fff;
	flex: none;
	scrollbar-width: none;
}
.gai-panel__chips::-webkit-scrollbar { display: none; }
.gai-chip {
	font-size: 0.75rem;
	font-weight: 600;
	color: #01652F;
	background: rgba(146, 169, 26, 0.12);
	border: 1px solid rgba(146, 169, 26, 0.3);
	border-radius: 999px;
	padding: 0.3rem 0.7rem;
	cursor: pointer;
	transition: background 0.15s ease;
	white-space: nowrap;
	flex: none;
}
.gai-chip:hover { background: rgba(146, 169, 26, 0.24); }

/* Form */
.gai-panel__form {
	display: flex;
	gap: 0.5rem;
	padding: 0.7rem 0.9rem 0.5rem;
	border-top: 1px solid rgba(1, 101, 47, 0.08);
	background: #fff;
	flex: none;
}
.gai-panel__input {
	flex: 1;
	border: 1px solid rgba(1, 101, 47, 0.2);
	border-radius: 10px;
	padding: 0.55rem 0.8rem;
	font-size: 0.875rem;
	font-family: inherit;
	color: #22352A;
	background: #FBFDF6;
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.gai-panel__input:focus {
	border-color: #92A91A;
	box-shadow: 0 0 0 3px rgba(146, 169, 26, 0.15);
	background: #fff;
}
.gai-panel__send {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: none;
	background: #01652F;
	color: #fff;
	cursor: pointer;
	display: grid;
	place-items: center;
	flex: none;
	transition: background 0.15s ease, transform 0.15s ease;
}
.gai-panel__send:hover { background: #0B6E36; transform: translateY(-1px); }

.gai-panel__note {
	margin: 0;
	padding: 0 0.95rem 0.6rem;
	font-size: 0.625rem;
	color: #7B877E;
	background: #fff;
	flex: none;
}

/* Mobile */
@media (max-width: 480px) {
	.gai-root { right: 14px; bottom: 14px; }
	.gai-panel {
		position: fixed;
		right: 10px;
		left: 10px;
		bottom: 82px;
		width: auto;
		max-width: none;
		height: calc(100dvh - 150px);
	}
}

/* Follow-up suggestion chips under a fallback answer */
.gai-suggest {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 8px;
}
.gai-suggest__chip {
	font: inherit;
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--gtn-lime, #92A91A);
	background: rgba(146, 169, 26, 0.10);
	border: 1px solid rgba(146, 169, 26, 0.35);
	border-radius: 999px;
	padding: 4px 11px;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease;
}
.gai-suggest__chip:hover {
	background: rgba(146, 169, 26, 0.20);
	border-color: rgba(146, 169, 26, 0.60);
}

gtn-turnstile-wrap {
	margin: 12px 0;
	text-align: center;
}
/* Turnstile widget row inside the chat panel */
.gai-turnstile-row {
	display: flex;
	justify-content: center;
	padding: 0.45rem 0.9rem 0;
	border-top: 1px solid rgba(1, 101, 47, 0.08);
	background: #fff;
	flex: none;
}
.gai-turnstile-row .gtn-turnstile {
	min-height: 0;
}
