﻿/**
 * AI Chat Agent — scoped to .shf-aca only (no global conflicts).
 */

.shf-aca {
	--shf-aca-accent: #b8956a;
	--shf-aca-text: #1f1f1f;
	--shf-aca-muted: #9a9a9a;
	--shf-aca-card: #ffffff;
	--shf-aca-send: #c1c7cd;
	--shf-aca-input-bg: #f8f9fa;
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 400px;
	margin-inline: auto;
	padding: 28px 26px 22px;
	background-color: #f9f7f2;
	border: 1px solid rgba(0, 0, 0, 0.06);
	border-radius: 36px;
	box-shadow: 0 20px 50px rgba(80, 55, 30, 0.1);
	overflow: hidden;
	box-sizing: border-box;
	font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--shf-aca-text);
	isolation: isolate;
}

.shf-aca *,
.shf-aca *::before,
.shf-aca *::after {
	box-sizing: border-box;
}

.shf-aca::before {
	content: "";
	position: absolute;
	inset: 0;
	background: radial-gradient(
		ellipse 75% 50% at 100% 0%,
		rgba(236, 196, 150, 0.45) 0%,
		transparent 65%
	);
	pointer-events: none;
	z-index: 0;
}

.shf-aca > * {
	position: relative;
	z-index: 1;
}

/* Header */
.shf-aca .shf-aca-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
}

.shf-aca .shf-aca-header__left {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.shf-aca .shf-aca-header__avatar {
	flex-shrink: 0;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	overflow: hidden;
	background: #111;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.shf-aca .shf-aca-header__avatar img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.shf-aca .shf-aca-header__meta {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 5px;
	min-width: 0;
}

.shf-aca .shf-aca-header__name {
	font-size: 17px;
	font-weight: 600;
	line-height: 1.15;
	color: var(--shf-aca-accent);
	letter-spacing: -0.01em;
}

.shf-aca .shf-aca-header__badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 1px 11px;
	font-size: 11px;
	font-weight: 500;
	line-height: 1.55;
	color: var(--shf-aca-accent);
	border: 1px solid var(--shf-aca-accent);
	border-radius: 999px;
	background: transparent;
	white-space: nowrap;
	letter-spacing: 0.01em;
}

/* Greeting */
.shf-aca .shf-aca-greeting {
	margin: 30px 0 26px;
	padding: 0;
	font-size: 28px;
	font-weight: 600;
	line-height: 1.28;
	letter-spacing: -0.025em;
	color: var(--shf-aca-text);
}

/* Quick Actions */
.shf-aca .shf-aca-actions {
	margin-bottom: 4px;
}

.shf-aca .shf-aca-actions__head {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 14px;
}

.shf-aca .shf-aca-actions__label {
	flex-shrink: 0;
	font-size: 13px;
	font-weight: 400;
	line-height: 1;
	color: var(--shf-aca-muted);
}

.shf-aca .shf-aca-actions__line {
	flex: 1;
	height: 1px;
	background-color: #d8d4ce;
	opacity: 0.85;
}

.shf-aca .shf-aca-actions__grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
}

.shf-aca .shf-aca-action {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: flex-start;
	gap: 12px;
	min-height: 96px;
	padding: 18px 16px;
	border: none;
	border-radius: 18px;
	background: var(--shf-aca-card);
	box-shadow: 0 2px 12px rgba(40, 30, 20, 0.06);
	text-align: left;
	text-decoration: none;
	color: inherit;
	font: inherit;
	cursor: default;
}

.shf-aca a.shf-aca-action {
	cursor: pointer;
}

.shf-aca a.shf-aca-action:hover,
.shf-aca a.shf-aca-action:focus,
.shf-aca a.shf-aca-action:active {
	text-decoration: none;
	color: inherit;
	transform: none;
	box-shadow: 0 2px 12px rgba(40, 30, 20, 0.06);
}

.shf-aca .shf-aca-action__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	padding: 0;
	border-radius: 50%;
	background: #e8e6e1;
	font-size: 16px;
	line-height: 1;
	color: #2f2f2f;
}

.shf-aca .shf-aca-action__icon i,
.shf-aca .shf-aca-action__icon svg {
	width: 16px;
	height: 16px;
	font-size: 16px;
	fill: currentColor;
	display: block;
}

.shf-aca .shf-aca-action__text {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--shf-aca-text);
	letter-spacing: -0.015em;
}

/* Messages */
.shf-aca .shf-aca-messages {
	display: flex;
	flex-direction: column;
	gap: 10px;
	max-height: 280px;
	overflow-y: auto;
	margin: 8px 0 16px;
	padding-right: 4px;
	scrollbar-width: thin;
}

.shf-aca .shf-aca-messages[hidden] {
	display: none !important;
}

.shf-aca .shf-aca-msg {
	max-width: 88%;
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.45;
	word-wrap: break-word;
	animation: shf-aca-fade-in 0.25s ease;
}

.shf-aca .shf-aca-msg--user {
	align-self: flex-end;
	background: var(--shf-aca-accent);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.shf-aca .shf-aca-msg--bot {
	align-self: flex-start;
	background: #fff;
	color: var(--shf-aca-text);
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
	border-bottom-left-radius: 4px;
}

.shf-aca .shf-aca-msg--typing {
	display: inline-flex;
	gap: 4px;
	padding: 14px 16px;
}

.shf-aca .shf-aca-msg--typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #b0b0b0;
	animation: shf-aca-bounce 1.2s infinite ease-in-out;
}

.shf-aca .shf-aca-msg--typing span:nth-child(2) {
	animation-delay: 0.15s;
}

.shf-aca .shf-aca-msg--typing span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes shf-aca-fade-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes shf-aca-bounce {
	0%,
	80%,
	100% {
		transform: translateY(0);
		opacity: 0.4;
	}
	40% {
		transform: translateY(-4px);
		opacity: 1;
	}
}

/* Input — professional pill (mic + circular send) */
.shf-aca .shf-aca-input {
	display: block;
	width: 100%;
	margin-top: auto;
	padding-top: 22px;
}

.shf-aca .shf-aca-input__field {
	display: flex;
	align-items: center;
	gap: 2px;
	width: 100%;
	min-width: 0;
	height: 54px;
	min-height: 54px;
	padding: 6px 6px 6px 22px;
	background: var(--shf-aca-input-bg, #f8f9fa);
	border-radius: 999px;
	border: 1px solid rgba(0, 0, 0, 0.04);
	box-shadow:
		0 1px 2px rgba(0, 0, 0, 0.04),
		0 4px 16px rgba(0, 0, 0, 0.06);
	transition:
		border-color 0.2s ease,
		box-shadow 0.2s ease;
}

.shf-aca .shf-aca-input__field:focus-within {
	border-color: rgba(184, 149, 106, 0.35);
	box-shadow:
		0 1px 2px rgba(0, 0, 0, 0.04),
		0 4px 18px rgba(0, 0, 0, 0.08),
		0 0 0 3px rgba(184, 149, 106, 0.12);
}

.shf-aca .shf-aca-input__field input {
	flex: 1 1 auto;
	min-width: 0;
	width: 100%;
	height: 100%;
	padding: 0 8px 0 0;
	margin: 0;
	border: 0 !important;
	outline: none !important;
	box-shadow: none !important;
	background: transparent !important;
	font-size: 15px;
	font-weight: 400;
	line-height: 1.4;
	letter-spacing: -0.01em;
	color: #2c2c2c;
	font-family: inherit;
	-webkit-appearance: none;
	appearance: none;
}

.shf-aca .shf-aca-input__field input::placeholder {
	color: #9ca3af;
	opacity: 1;
	font-weight: 400;
}

.shf-aca .shf-aca-input__field input::-webkit-search-decoration,
.shf-aca .shf-aca-input__field input::-webkit-search-cancel-button {
	-webkit-appearance: none;
}

.shf-aca .shf-aca-input__mic {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 38px;
	height: 38px;
	padding: 0;
	margin: 0;
	border: none !important;
	border-radius: 50%;
	background: transparent !important;
	color: #9ca3af;
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
	box-shadow: none !important;
	transition: color 0.2s ease, background 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.shf-aca .shf-aca-input__mic:hover {
	color: #6b7280;
	background: transparent !important;
}

.shf-aca .shf-aca-input__mic:focus-visible {
	outline: 2px solid rgba(184, 149, 106, 0.45);
	outline-offset: 2px;
}

.shf-aca .shf-aca-input__mic i,
.shf-aca .shf-aca-input__mic svg {
	width: 15px;
	height: 15px;
	font-size: 15px;
	fill: currentColor;
	display: block;
}

.shf-aca .shf-aca-input__send {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	min-width: 40px;
	min-height: 40px;
	margin: 0;
	padding: 0 !important;
	border: none !important;
	border-radius: 50% !important;
	background: var(--shf-aca-send, #c1c7cd) !important;
	color: #fff !important;
	font-size: 13px;
	line-height: 1;
	cursor: pointer;
	box-shadow: none !important;
	text-decoration: none !important;
	transition:
		background 0.2s ease,
		transform 0.15s ease,
		filter 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.shf-aca .shf-aca-input__send:hover,
.shf-aca .shf-aca-input__send:focus {
	background: #a8b0b8 !important;
	color: #fff !important;
	filter: none;
	transform: none;
}

.shf-aca .shf-aca-input__send:active {
	transform: scale(0.96);
}

.shf-aca .shf-aca-input__send:focus-visible {
	outline: 2px solid rgba(184, 149, 106, 0.5);
	outline-offset: 2px;
}

.shf-aca .shf-aca-input__send i,
.shf-aca .shf-aca-input__send svg {
	width: 13px;
	height: 13px;
	font-size: 13px;
	fill: currentColor;
	display: block;
	pointer-events: none;
}

/* Footer */
.shf-aca .shf-aca-footer {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin-top: 14px;
	font-size: 12px;
	font-weight: 400;
	line-height: 1.4;
	color: #a8a8a8;
	text-align: center;
}

.shf-aca .shf-aca-footer__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--shf-aca-accent);
	font-size: 11px;
	line-height: 1;
}

.shf-aca .shf-aca-footer__icon .shf-aca-spark {
	display: block;
	font-style: normal;
	font-size: 11px;
	line-height: 1;
	color: inherit;
}

.shf-aca .shf-aca-footer__icon i,
.shf-aca .shf-aca-footer__icon svg {
	width: 10px;
	height: 10px;
	font-size: 10px;
	fill: currentColor;
}

.shf-aca .shf-aca-footer__icon:has(.shf-aca-spark) i,
.shf-aca .shf-aca-footer__icon:has(.shf-aca-spark) svg {
	display: none;
}

/* States */
.shf-aca.shf-aca-is-closed {
	display: none;
}

.shf-aca.shf-aca-is-chatting .shf-aca-greeting,
.shf-aca.shf-aca-is-chatting .shf-aca-actions {
	display: none;
}

.shf-aca.shf-aca-is-chatting .shf-aca-messages {
	display: flex !important;
	flex: 1;
	min-height: 160px;
}

.shf-aca .shf-aca-input__mic.shf-aca-is-listening {
	color: var(--shf-aca-accent);
}

@media (max-width: 480px) {
	.shf-aca {
		max-width: 100%;
		border-radius: 28px;
		padding: 22px 20px 18px;
	}

	.shf-aca .shf-aca-greeting {
		font-size: 24px;
		margin: 24px 0 20px;
	}

	.shf-aca .shf-aca-actions__grid {
		gap: 10px;
	}

	.shf-aca .shf-aca-action {
		min-height: 88px;
		padding: 16px 14px;
	}

	.shf-aca .shf-aca-action__text {
		font-size: 13px;
	}

	.shf-aca .shf-aca-input__field {
		height: 50px;
		min-height: 50px;
		padding: 5px 5px 5px 18px;
	}

	.shf-aca .shf-aca-input__send {
		width: 38px;
		height: 38px;
		min-width: 38px;
		min-height: 38px;
	}

	.shf-aca .shf-aca-input__field input {
		font-size: 14px;
	}
}
