// Ask AI screen (Analytics) and the AI test-connection line in Settings.

.ssgsw-react .ssgsw-ai {
	display: flex;
	flex-direction: column;
	gap: 14px;

	&__banner {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 10px 14px;
		padding: 12px 16px;
		border: 1px solid var(--ssgsw-border);
		border-radius: 10px;
		background: #fff8e6;

		&.is-error {
			background: #fdecec;
			border-color: #f1b5b5;
		}

		a {
			font-weight: 600;
		}
	}

	&__prompts {
		display: flex;
		flex-wrap: wrap;
		gap: 8px;
	}

	&__chip {
		padding: 6px 12px;
		border: 1px solid var(--ssgsw-border);
		border-radius: 999px;
		background: #fff;
		color: inherit;
		font: inherit;
		cursor: pointer;

		&:hover:not(:disabled) {
			border-color: var(--ssgsw-blue);
			color: var(--ssgsw-blue);
		}

		&:disabled {
			opacity: 0.55;
			cursor: not-allowed;
		}
	}

	&__thread {
		display: flex;
		flex-direction: column;
		gap: 12px;
		max-height: 60vh;
		overflow-y: auto;
		padding: 2px;
	}

	&__msg {
		max-width: 860px;
		padding: 12px 16px;
		border-radius: 10px;
		border: 1px solid var(--ssgsw-border);
		background: #fff;

		&.is-user {
			align-self: flex-end;
			background: #eef4ff;
			border-color: #c9dcff;
		}

		&.is-error {
			background: #fdecec;
			border-color: #f1b5b5;
		}
	}

	&__text {
		margin: 0;
		white-space: pre-wrap;
		overflow-wrap: anywhere;
		line-height: 1.55;
	}

	&__meta {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 8px;
		margin-top: 10px;
		font-size: 12px;
		color: #5c6770;
	}

	&__metrics {
		display: flex;
		flex-wrap: wrap;
		gap: 4px;
	}

	&__metric {
		padding: 1px 8px;
		border-radius: 999px;
		background: #f1f3f5;
	}

	&__form {
		display: flex;
		gap: 10px;
		align-items: flex-end;

		textarea {
			flex: 1;
			min-height: 44px;
			resize: vertical;
			padding: 8px 10px;
			border: 1px solid var(--ssgsw-border);
			border-radius: 6px;
			font: inherit;
		}
	}

	&__usage {
		font-size: 12px;
		color: #5c6770;
	}
}

.ssgsw-react .ssgsw-ai-test {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
	margin: 8px 0;

	&__usage {
		font-size: 12px;
		color: #5c6770;
	}
}

@media (max-width: 782px) {
	.ssgsw-react .ssgsw-ai__form {
		flex-direction: column;
		align-items: stretch;
	}
}
