/* ── AI Chat Search block ─────────────────────────────────────────────────── */
.wcb-ai-chat {
	background: var(--wcb-on-primary, #ffffff);
	border: 1px solid var(--wcb-border, #e2e8f0);
	border-radius: var(--wcb-radius-xl);
	padding: var(--wcb-space-2xl);
	display: flex;
	flex-direction: column;
	gap: var(--wcb-space-lg);
	font-family: inherit;
}

/* ── Message thread ──────────────────────────────────────────────────────── */
.wcb-ai-chat-messages {
	display: none;
	flex-direction: column;
	gap: var(--wcb-space-sm);
	max-height: 280px;
	overflow-y: auto;
	padding: var(--wcb-space-sm) 0;
}

.wcb-ai-chat-messages.wcb-has-messages {
	display: flex;
}

.wcb-chat-bubble {
	max-width: 80%;
	padding: var(--wcb-space-md) var(--wcb-space-lg);
	border-radius: var(--wcb-radius-xl);
	font-size: var(--wcb-text-base);
	line-height: var(--wcb-leading-normal);
}

.wcb-chat-bubble--user {
	background: var(--wcb-primary, #2563eb);
	color: var(--wcb-on-primary, #ffffff);
	align-self: flex-end;
	border-end-inline-end-radius: var(--wcb-space-xs);
}

.wcb-chat-bubble--assistant {
	background: var(--wcb-surface, #f1f5f9);
	color: var(--wcb-contrast, #0f172a);
	align-self: flex-start;
	border-end-inline-start-radius: var(--wcb-space-xs);
}

/* ── Form ────────────────────────────────────────────────────────────────── */
.wcb-ai-chat-form {
	display: flex;
	gap: var(--wcb-space-md);
}

.wcb-ai-chat-input {
	flex: 1;
	min-width: 0;
	padding: var(--wcb-space-md) var(--wcb-space-lg);
	border: 1.5px solid var(--wcb-border, #e2e8f0);
	border-radius: var(--wcb-radius-md);
	font-size: var(--wcb-text-md);
	font-family: inherit;
	color: var(--wcb-contrast, #0f172a);
	background: var(--wcb-on-primary, #ffffff);
	transition: border-color var(--wcb-transition-fast);
}

.wcb-ai-chat-input:focus {
	border-color: var(--wcb-primary, #2563eb);
	box-shadow: var(--wcb-shadow-focus);
}

.wcb-ai-chat-input:focus-visible {
	outline: 2px solid var(--wcb-primary, #2563eb);
	outline-offset: 2px;
	border-color: var(--wcb-primary, #2563eb);
	box-shadow: var(--wcb-shadow-focus);
}

.wcb-ai-chat-input:disabled {
	background: var(--wcb-bg-subtle, #f8fafc);
}

/* ── Results ─────────────────────────────────────────────────────────────── */
.wcb-ai-results {
	display: none;
	flex-direction: column;
	gap: var(--wcb-space-sm);
}

.wcb-ai-results.wcb-shown {
	display: flex;
}

.wcb-ai-result-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--wcb-space-sm);
	padding: var(--wcb-space-md) var(--wcb-space-lg);
	background: var(--wcb-bg-subtle, #f8fafc);
	border: 1px solid var(--wcb-border, #e2e8f0);
	border-radius: var(--wcb-radius-md);
	text-decoration: none;
	color: var(--wcb-contrast, #0f172a);
	transition: border-color var(--wcb-transition-fast);
	min-width: 0;
}

.wcb-ai-result-item:hover {
	border-color: var(--wcb-text-secondary, #6b7280);
}

.wcb-ai-result-item strong {
	font-size: var(--wcb-text-base);
	font-weight: var(--wcb-font-bold);
}

.wcb-ai-result-company {
	font-size: var(--wcb-text-sm);
	color: var(--wcb-text-secondary, #6b7280);
}

/* ── Shared button tokens ────────────────────────────────────────────────── */
.wcb-cbtn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--wcb-space-sm);
	padding: var(--wcb-space-md) var(--wcb-space-xl);
	border-radius: var(--wcb-radius-md);
	font-size: var(--wcb-text-base);
	font-weight: var(--wcb-font-semibold);
	text-decoration: none;
	cursor: pointer;
	border: none;
	font-family: inherit;
	transition: background var(--wcb-transition-fast);
	white-space: nowrap;
}

.wcb-cbtn--primary {
	background: var(--wcb-primary, #2563eb);
	color: var(--wcb-on-primary, #ffffff);
}

.wcb-cbtn--primary:hover:not(:disabled) {
	background: var(--wcb-primary-dark, #1d4ed8);
}

.wcb-cbtn--primary:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
	.wcb-ai-chat {
		padding: var(--wcb-space-lg);
	}

	.wcb-ai-chat-form {
		flex-direction: column;
	}

	.wcb-chat-bubble {
		max-width: 90%;
	}
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
	.wcb-ai-chat-input,
	.wcb-ai-result-item,
	.wcb-cbtn {
		transition: none;
	}
}
