/* Hire Across Euro — AI chat widget */

#hae-chat-root {
	--hae-accent: #e85a2a;
	--hae-dark: #1e293b;
	--hae-bg: #ffffff;
	--hae-panel-bg: #f8fafc;
	--hae-text: #1f2937;
	--hae-muted: #64748b;
	--hae-border: #e2e8f0;
	--hae-radius: 16px;
	--hae-shadow: 0 18px 48px rgba(15, 23, 42, .22);

	position: fixed;
	bottom: 20px;
	z-index: 99998;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.5;
	color: var(--hae-text);
}

#hae-chat-root[data-position="right"] { right: 20px; }
#hae-chat-root[data-position="left"] { left: 20px; }

/* Themes style bare `button` and `svg` globally — neutralise that here so the
   widget looks the same on any theme. */
#hae-chat-root,
#hae-chat-root *,
#hae-chat-root *::before,
#hae-chat-root *::after {
	box-sizing: border-box;
}

/* Only properties the component rules below never set — an id selector here
   would otherwise outrank them. */
#hae-chat-root button {
	margin: 0;
	min-width: 0;
	min-height: 0;
	text-transform: none;
	letter-spacing: normal;
	line-height: 1.4;
}

#hae-chat-root svg {
	display: block;
	flex: 0 0 auto;
	max-width: none;
	fill: none;
	stroke: currentColor;
}

/* ------------------------------------------------------------- launcher */

.hae-launcher {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 13px 20px 13px 16px;
	border: 0;
	border-radius: 999px;
	background: var(--hae-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	box-shadow: var(--hae-shadow);
	transition: transform .18s ease, box-shadow .18s ease;
}

.hae-launcher:hover { transform: translateY(-2px); }
.hae-launcher:focus-visible { outline: 3px solid var(--hae-dark); outline-offset: 2px; }
.hae-launcher-icon { display: inline-flex; }

#hae-chat-root.is-open .hae-launcher { display: none; }

/* ---------------------------------------------------------------- panel */

.hae-panel {
	display: flex;
	flex-direction: column;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 110px);
	overflow: hidden;
	background: var(--hae-bg);
	border: 1px solid var(--hae-border);
	border-radius: var(--hae-radius);
	box-shadow: var(--hae-shadow);
	animation: hae-in .18s ease-out;
}

.hae-panel[hidden] { display: none; }

@keyframes hae-in {
	from { opacity: 0; transform: translateY(12px); }
	to { opacity: 1; transform: none; }
}

.hae-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	background: var(--hae-dark);
	color: #fff;
}

.hae-head-title {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	color: #fff;
}

.hae-head-sub {
	margin: 2px 0 0;
	font-size: 12.5px;
	line-height: 1.3;
	color: rgba(255, 255, 255, .72);
}

.hae-close {
	display: inline-flex;
	padding: 6px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #fff;
	cursor: pointer;
	opacity: .8;
}

.hae-close:hover { opacity: 1; background: rgba(255, 255, 255, .12); }

/* ------------------------------------------------------------ transcript */

.hae-log {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px;
	background: var(--hae-panel-bg);
	overscroll-behavior: contain;
}

.hae-msg { display: flex; margin-bottom: 10px; }
.hae-msg--user { justify-content: flex-end; }

.hae-bubble {
	max-width: 84%;
	padding: 10px 14px;
	border-radius: 14px;
	background: #fff;
	border: 1px solid var(--hae-border);
	font-size: 14.5px;
	word-wrap: break-word;
}

.hae-msg--user .hae-bubble {
	background: var(--hae-accent);
	border-color: var(--hae-accent);
	color: #fff;
}

.hae-bubble p { margin: 0 0 8px; }
.hae-bubble p:last-child { margin-bottom: 0; }
.hae-bubble ul { margin: 4px 0 4px 18px; padding: 0; }
.hae-bubble li { margin: 2px 0; }
.hae-bubble a { color: inherit; text-decoration: underline; }
.hae-msg--assistant .hae-bubble a { color: var(--hae-accent); }

.hae-typing .hae-bubble {
	display: flex;
	gap: 4px;
	align-items: center;
	padding: 14px;
}

.hae-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--hae-muted);
	animation: hae-blink 1.2s infinite ease-in-out;
}

.hae-typing span:nth-child(2) { animation-delay: .18s; }
.hae-typing span:nth-child(3) { animation-delay: .36s; }

@keyframes hae-blink {
	0%, 60%, 100% { opacity: .25; }
	30% { opacity: 1; }
}

/* ----------------------------------------------------------------- chips */

.hae-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0 16px;
	background: var(--hae-panel-bg);
}

.hae-chips:empty { padding: 0; }

.hae-chip {
	padding: 7px 12px;
	border: 1px solid var(--hae-border);
	border-radius: 999px;
	background: #fff;
	color: var(--hae-dark);
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}

.hae-chip:hover { border-color: var(--hae-accent); color: var(--hae-accent); }

/* --------------------------------------------------------------- composer */

.hae-form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 12px 12px 8px;
	background: var(--hae-panel-bg);
	border-top: 1px solid var(--hae-border);
}

.hae-input {
	flex: 1 1 auto;
	max-height: 120px;
	padding: 10px 12px;
	border: 1px solid var(--hae-border);
	border-radius: 12px;
	background: #fff;
	color: var(--hae-text);
	font: inherit;
	font-size: 14.5px;
	line-height: 1.4;
	resize: none;
}

.hae-input:focus { outline: none; border-color: var(--hae-accent); }

.hae-send {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 12px;
	background: var(--hae-accent);
	color: #fff;
	cursor: pointer;
}

.hae-send svg { width: 18px; height: 18px; }
.hae-close svg { width: 20px; height: 20px; }
.hae-launcher svg { width: 24px; height: 24px; }

.hae-send[disabled] { opacity: .55; cursor: default; }

.hae-foot {
	margin: 0;
	padding: 0 16px 12px;
	background: var(--hae-panel-bg);
	color: var(--hae-muted);
	font-size: 11.5px;
	text-align: center;
}

/* ---------------------------------------------------------------- mobile */

@media (max-width: 480px) {
	#hae-chat-root { bottom: 14px; }
	#hae-chat-root[data-position="right"] { right: 14px; }
	#hae-chat-root[data-position="left"] { left: 14px; }

	.hae-panel {
		width: calc(100vw - 28px);
		height: calc(100vh - 100px);
	}

	.hae-launcher-label { display: none; }
	.hae-launcher { padding: 15px; }
}

@media (prefers-reduced-motion: reduce) {
	.hae-panel, .hae-launcher { animation: none; transition: none; }
}
