/* Website chat (AI). Separate file so the theme CSS (main.css) stays untouched.
   Sits above the back-to-top button (#toTop, bottom-right 10px/50px) and below the cookie
   banner (z-index 1080), so the consent choice is never covered. */

.sa-root {
	--sa-from: #FF8C42;
	--sa-to: #7C5CFF;
	--sa-ink: #0F1530;
	--sa-muted: #5f6787;
	--sa-bg: #ffffff;
	--sa-soft: #f3f4fa;
	position: fixed;
	right: 10px;
	bottom: 70px;
	z-index: 1070;
	font-size: .9rem;
	line-height: 1.5;
	color: var(--sa-ink);
	pointer-events: none; /* the wrapper must not swallow clicks on the page beneath it */
}

.sa-launcher,
.sa-panel { pointer-events: auto; }

.sa-launcher {
	display: inline-flex;
	align-items: center;
	gap: .5rem;
	padding: .65rem 1rem;
	border: 0;
	border-radius: 999px;
	background: linear-gradient(135deg, var(--sa-from), var(--sa-to));
	color: #fff;
	font-weight: 600;
	box-shadow: 0 .4rem 1.2rem rgba(15, 21, 48, .25);
	cursor: pointer;
}

.sa-launcher:focus-visible,
.sa-close:focus-visible,
.sa-send:focus-visible {
	outline: 3px solid var(--sa-to);
	outline-offset: 2px;
}

.sa-launcher__icon { display: inline-flex; }

.sa-root--open .sa-launcher__text { display: none; }

.sa-panel {
	position: absolute;
	right: 0;
	bottom: calc(100% + 10px);
	width: 360px;
	max-height: min(560px, calc(100vh - 160px));
	display: flex;
	flex-direction: column;
	background: var(--sa-bg);
	border-radius: .75rem;
	box-shadow: 0 .75rem 2.25rem rgba(15, 21, 48, .28);
	overflow: hidden;
}

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

.sa-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: .7rem 1rem;
	background: linear-gradient(135deg, var(--sa-from), var(--sa-to));
	color: #fff;
}

.sa-title { font-weight: 600; }

.sa-close {
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	padding: 0 .25rem;
}

.sa-notice {
	margin: 0;
	padding: .5rem 1rem;
	background: var(--sa-soft);
	color: var(--sa-muted);
	font-size: .78rem;
}

.sa-notice a { text-decoration: underline; color: inherit; }

.sa-list {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: .75rem 1rem;
	display: flex;
	flex-direction: column;
	gap: .5rem;
}

.sa-msg {
	max-width: 88%;
	padding: .5rem .75rem;
	border-radius: .75rem;
	overflow-wrap: anywhere;
}

.sa-msg--assistant {
	align-self: flex-start;
	background: var(--sa-soft);
	border-bottom-left-radius: .2rem;
}

.sa-msg--assistant a { color: var(--sa-to); text-decoration: underline; }

.sa-msg--user {
	align-self: flex-end;
	background: var(--sa-to);
	color: #fff;
	border-bottom-right-radius: .2rem;
	white-space: pre-wrap;
}

.sa-msg--system {
	align-self: center;
	max-width: 100%;
	color: var(--sa-muted);
	font-size: .8rem;
	text-align: center;
}

.sa-msg--system a { color: var(--sa-to); text-decoration: underline; }

.sa-msg--thinking { font-style: italic; }

.sa-verify {
	padding: .25rem 1rem .5rem;
	color: var(--sa-muted);
	font-size: .8rem;
	text-align: center;
}

.sa-verify[hidden] { display: none; }

.sa-form {
	display: flex;
	gap: .5rem;
	padding: .6rem .75rem;
	border-top: 1px solid #e6e8f2;
}

.sa-input {
	flex: 1 1 auto;
	resize: none;
	border: 1px solid #d5d9ea;
	border-radius: .5rem;
	padding: .45rem .6rem;
	font: inherit;
	color: var(--sa-ink);
	background: #fff;
}

.sa-input:focus { outline: 2px solid var(--sa-to); outline-offset: 0; border-color: transparent; }

.sa-send {
	flex: 0 0 auto;
	align-self: flex-end;
	border: 0;
	border-radius: .5rem;
	padding: .5rem .9rem;
	background: var(--sa-to);
	color: #fff;
	font-weight: 600;
	cursor: pointer;
}

.sa-send:disabled,
.sa-input:disabled { opacity: .55; cursor: not-allowed; }

@media (max-width: 520px) {
	.sa-root { left: 8px; right: 8px; display: flex; flex-direction: column; align-items: flex-end; }
	.sa-panel { width: auto; left: 0; right: 0; max-height: calc(100vh - 140px); }
}

@media (prefers-reduced-motion: no-preference) {
	.sa-panel:not([hidden]) { animation: sa-in .16s ease-out; }
	@keyframes sa-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}
