/* Answyr Chat — deflection widget (ported from SimplyChat). Tokens from tokens.css. */

.answyr-chat-launcher {
	position: fixed;
	bottom: 20px;
	right: 20px;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	border: 0;
	padding: 0;
	/* Center the inline SVG and shrug off theme button resets. */
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	color: #fff;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba( 0, 0, 0, 0.2 );
	z-index: 99999;
}

.answyr-chat-launcher-icon {
	display: block;
	width: 26px;
	height: 26px;
}

.answyr-chat-panel {
	position: fixed;
	bottom: 88px;
	right: 20px;
	width: 360px;
	max-width: calc( 100vw - 40px );
	height: 520px;
	max-height: calc( 100vh - 120px );
	display: flex;
	flex-direction: column;
	background: var(--answyr-surface);
	border-radius: var(--answyr-radius-lg);
	box-shadow: 0 8px 30px rgba( 0, 0, 0, 0.25 );
	overflow: hidden;
	z-index: 99999;
	font-size: 14px;
}

/* Author display:flex above beats the UA [hidden] rule — re-assert hiding. */
.answyr-chat-panel[hidden] {
	display: none;
}

.answyr-chat-header {
	color: #fff;
	padding: var(--answyr-gap) var(--answyr-gap-md);
	font-weight: 600;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.answyr-chat-min {
	background: none;
	border: 0;
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	padding: 0 var(--answyr-gap-xs);
	opacity: 0.85;
}

.answyr-chat-min:hover {
	opacity: 1;
}

/* Waiting / typing indicator */
.answyr-chat-thinking {
	min-width: 44px;
}

.answyr-typing {
	display: inline-flex;
	gap: var(--answyr-gap-xs);
	align-items: center;
	padding: 2px 0;
}

.answyr-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--answyr-ink-faint);
	display: inline-block;
	animation: answyr-typing-bounce 1.2s infinite ease-in-out both;
}

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

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

@keyframes answyr-typing-bounce {
	0%, 80%, 100% {
		transform: scale(0.6);
		opacity: 0.4;
	}
	40% {
		transform: scale(1);
		opacity: 1;
	}
}

.answyr-chat-log {
	flex: 1;
	overflow-y: auto;
	padding: var(--answyr-gap-md);
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.answyr-chat-msg {
	padding: 9px 12px;
	border-radius: 10px;
	max-width: 85%;
	white-space: pre-wrap;
	line-height: 1.45;
}

.answyr-chat-user {
	align-self: flex-end;
	background: var(--answyr-accent);
	color: #fff;
}

.answyr-chat-assistant {
	align-self: flex-start;
	background: var(--answyr-line-soft);
	color: var(--answyr-ink);
}

.answyr-chat-sources {
	margin-top: var(--answyr-gap-sm);
	display: flex;
	flex-direction: column;
	gap: 3px;
	font-size: 12px;
}

.answyr-chat-sources a {
	color: var(--answyr-accent);
}

.answyr-chat-form {
	display: flex;
	border-top: 1px solid var(--answyr-line);
}

.answyr-chat-input {
	flex: 1;
	border: 0;
	padding: var(--answyr-gap) var(--answyr-gap-md);
	font: inherit;
	outline: none;
}

.answyr-chat-send {
	border: 0;
	background: transparent;
	color: var(--answyr-accent);
	font-size: 20px;
	padding: 0 var(--answyr-gap-md);
	cursor: pointer;
}

.answyr-chat-escalate {
	border: 0;
	border-top: 1px solid var(--answyr-line);
	background: var(--answyr-surface-soft);
	color: var(--answyr-ink-soft);
	padding: var(--answyr-gap-sm);
	cursor: pointer;
	font: inherit;
}

.answyr-chat-escalate-form {
	display: flex;
	flex-direction: column;
	gap: var(--answyr-gap-xs);
	padding: 10px;
	border: 1px dashed var(--answyr-line);
	border-radius: var(--answyr-radius);
}

.answyr-chat-escalate-form input,
.answyr-chat-escalate-form textarea {
	border: 1px solid var(--answyr-line);
	border-radius: var(--answyr-radius-sm);
	padding: var(--answyr-gap-sm);
	font: inherit;
}

.answyr-chat-escalate-form .answyr-esc-submit {
	border: 0;
	border-radius: var(--answyr-radius-sm);
	background: var(--answyr-accent);
	color: #fff;
	padding: var(--answyr-gap-sm);
	cursor: pointer;
}

.answyr-esc-transcript {
	display: flex;
	align-items: center;
	gap: var(--answyr-gap-xs);
	font-size: 13px;
	color: var(--answyr-ink-soft);
}

.answyr-esc-status {
	font-size: 12px;
	color: var(--answyr-ink-soft);
}

/* Post-escalation "ticket created" confirmation (replaces the escalate form). */
.answyr-chat-confirm {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: var(--answyr-gap-sm);
	padding: var(--answyr-gap-md);
	border: 1px solid var(--answyr-line);
	border-radius: var(--answyr-radius);
	background: var(--answyr-surface-soft);
}

.answyr-chat-confirm-icon {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--answyr-accent);
	color: #fff;
	font-size: 24px;
	line-height: 44px;
}

.answyr-chat-confirm-title {
	font-size: 16px;
	font-weight: 600;
	color: var(--answyr-ink);
}

.answyr-chat-confirm-ref {
	font-size: 13px;
	font-weight: 600;
	color: var(--answyr-accent);
}

.answyr-chat-confirm-note {
	margin: 0;
	font-size: 13px;
	line-height: 1.5;
	color: var(--answyr-ink-soft);
}

.answyr-chat-confirm-cta {
	display: inline-block;
	background: var(--answyr-accent);
	color: #fff;
	text-decoration: none;
	padding: var(--answyr-gap-sm) var(--answyr-gap-md);
	border-radius: var(--answyr-radius-sm);
	font-weight: 600;
}

.answyr-chat-confirm-again {
	border: 0;
	background: none;
	color: var(--answyr-ink-soft);
	font: inherit;
	font-size: 13px;
	cursor: pointer;
	text-decoration: underline;
	padding: var(--answyr-gap-xs);
}
