/* ── Hero Chat Animation ── */

/* Grid background pattern */
.amp-hero-wrapper {
	position: relative;
}

.amp-hero-wrapper::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background-image:
		linear-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px),
		linear-gradient(90deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px);
	background-size: 60px 60px;
	mask-image: radial-gradient(ellipse 80% 70% at 50% 70%, black 30%, transparent 100%);
	-webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 70%, black 30%, transparent 100%);
	z-index: 0;
	overflow: hidden;
	max-width: 100%;
}

.amp-hero-wrapper > * {
	position: relative;
	z-index: 1;
}

/* Chat container */
#amp-hero-chat {
	display: flex;
	justify-content: center;
	padding-top: 3rem;
	position: relative;
	z-index: 2;
}

/* Chat card */
.amp-chat-card {
	width: 100%;
	max-width: 560px;
	background: #ffffff;
	border-radius: 20px;
	box-shadow:
		0 4px 24px rgba(0, 0, 0, 0.08),
		0 1px 3px rgba(0, 0, 0, 0.04);
	overflow: hidden;
	font-family: Inter, system-ui, -apple-system, sans-serif;
}

/* Chat header */
.amp-chat-header {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 1rem 1.5rem;
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.amp-chat-avatar {
	width: 28px;
	height: 28px;
	background: #000000;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #EAE8DD;
	font-size: 0.7rem;
	font-weight: 800;
	letter-spacing: 0.02em;
	flex-shrink: 0;
}

.amp-chat-title {
	font-size: 0.9rem;
	font-weight: 700;
	color: #000000;
}

/* Topic pills */
.amp-chat-topics {
	display: flex;
	gap: 0.5rem;
	padding: 0.75rem 1.5rem;
}

.amp-chat-pill {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.35rem 0.85rem;
	border-radius: 100px;
	font-size: 0.8rem;
	font-weight: 500;
	color: #6B7280;
	background: transparent;
	border: 1px solid rgba(0, 0, 0, 0.1);
	transition: all 0.3s ease;
}

.amp-chat-pill.active {
	background: #000000;
	color: #EAE8DD;
	border-color: #000000;
}

.amp-chat-pill-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: currentColor;
	opacity: 0.5;
}

.amp-chat-pill.active .amp-chat-pill-dot {
	opacity: 1;
	background: #4ade80;
}

/* Messages area */
.amp-chat-messages {
	padding: 0.75rem 1.5rem 1.25rem;
	min-height: 280px;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

/* Message bubbles */
.amp-chat-msg {
	max-width: 85%;
	padding: 0.85rem 1.1rem;
	border-radius: 14px;
	font-size: 0.88rem;
	line-height: 1.55;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.35s ease, transform 0.35s ease;
}

.amp-chat-msg.visible {
	opacity: 1;
	transform: translateY(0);
}

.amp-chat-msg.user {
	align-self: flex-end;
	background: #000000;
	color: #EAE8DD;
	border-bottom-right-radius: 4px;
}

.amp-chat-msg.agent {
	align-self: flex-start;
	background: #F3F2ED;
	color: #000000;
	border-bottom-left-radius: 4px;
}

/* Typing indicator */
.amp-chat-typing {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 0.85rem 1.1rem;
	background: #F3F2ED;
	border-radius: 14px;
	border-bottom-left-radius: 4px;
	align-self: flex-start;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.amp-chat-typing.visible {
	opacity: 1;
	transform: translateY(0);
}

.amp-chat-typing span {
	width: 7px;
	height: 7px;
	background: #6B7280;
	border-radius: 50%;
	animation: amp-typing-bounce 1.2s infinite;
}

.amp-chat-typing span:nth-child(2) {
	animation-delay: 0.15s;
}

.amp-chat-typing span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes amp-typing-bounce {
	0%, 60%, 100% {
		transform: translateY(0);
		opacity: 0.4;
	}
	30% {
		transform: translateY(-4px);
		opacity: 1;
	}
}

/* Status updates */
.amp-chat-status {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	align-self: flex-start;
	padding-left: 0.25rem;
}

.amp-chat-status-item {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	font-size: 0.82rem;
	color: #000000;
	opacity: 0;
	transform: translateX(-8px);
	transition: opacity 0.35s ease, transform 0.35s ease;
}

.amp-chat-status-item.visible {
	opacity: 1;
	transform: translateX(0);
}

.amp-chat-status-icon {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	background: rgba(0, 0, 0, 0.06);
	transition: background 0.3s ease;
}

.amp-chat-status-icon.done {
	background: #000000;
}

.amp-chat-status-icon svg {
	width: 11px;
	height: 11px;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.amp-chat-status-icon.done svg {
	opacity: 1;
}

.amp-chat-status-label {
	color: #6B7280;
	transition: color 0.3s ease;
}

.amp-chat-status-item.done .amp-chat-status-label {
	color: #000000;
}

/* Input bar */
.amp-chat-input {
	display: flex;
	align-items: center;
	margin: 0 1.5rem 1.25rem;
	padding: 0.7rem 1rem;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 12px;
	gap: 0.75rem;
}

.amp-chat-input-text {
	flex: 1;
	font-size: 0.85rem;
	color: #9CA3AF;
	font-family: inherit;
}

.amp-chat-input-cursor {
	display: inline-block;
	width: 1px;
	height: 1em;
	background: #000000;
	animation: amp-cursor-blink 1s steps(1) infinite;
	vertical-align: middle;
	margin-left: 1px;
}

.amp-chat-input-text.typing .amp-chat-input-cursor {
	animation: amp-cursor-blink 0.6s steps(1) infinite;
}

.amp-chat-input-text.typing {
	color: #000000;
}

@keyframes amp-cursor-blink {
	0%, 50% { opacity: 1; }
	51%, 100% { opacity: 0; }
}

.amp-chat-send {
	width: 32px;
	height: 32px;
	background: #000000;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0.3;
	transition: opacity 0.3s ease;
}

.amp-chat-send.active {
	opacity: 1;
}

.amp-chat-send svg {
	width: 14px;
	height: 14px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
	#amp-hero-chat {
		padding-top: 1.5rem;
		padding-left: 0;
		padding-right: 0;
	}

	.amp-chat-card {
		max-width: 100% !important;
		width: 100% !important;
		border-radius: 16px;
	}

	.amp-chat-header {
		padding: 0.75rem 1rem;
	}

	.amp-chat-topics {
		padding: 0.6rem 1rem;
		flex-wrap: wrap !important;
		gap: 0.4rem;
	}

	.amp-chat-pill {
		font-size: 0.7rem;
		padding: 0.25rem 0.55rem;
	}

	.amp-chat-messages {
		padding: 0.6rem 1rem 1rem;
		min-height: auto !important;
	}

	.amp-chat-msg {
		max-width: 92%;
		font-size: 0.8rem;
		padding: 0.7rem 0.9rem;
	}

	.amp-chat-status-item {
		font-size: 0.75rem;
	}

	.amp-chat-input {
		margin: 0 1rem 1rem;
		padding: 0.6rem 0.75rem;
	}

	.amp-chat-input-text {
		font-size: 0.78rem;
	}

	.amp-chat-send {
		width: 28px;
		height: 28px;
	}
}

@media (max-width: 480px) {
	.amp-chat-pill {
		font-size: 0.65rem;
		padding: 0.2rem 0.5rem;
	}

	.amp-chat-msg {
		max-width: 95%;
		font-size: 0.75rem;
		padding: 0.6rem 0.8rem;
	}

	.amp-chat-input-text {
		font-size: 0.72rem;
	}
}

/* Fade out for loop */
.amp-chat-card.fading {
	animation: amp-chat-fade-out 0.8s ease forwards;
}

@keyframes amp-chat-fade-out {
	to {
		opacity: 0;
		transform: translateY(10px);
	}
}

.amp-chat-card.fading-in {
	animation: amp-chat-fade-in 0.6s ease forwards;
}

@keyframes amp-chat-fade-in {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}
