/* AAAIS School Finder chat window. Colors match the site theme (accent #00abcd, hover #fe4288). */

.aaais-chat {
	--ac-accent: #00abcd;
	--ac-accent-dark: #008aa6;
	--ac-pink: #fe4288;
	--ac-ink: #1f3a42;
	--ac-muted: #66848d;
	--ac-line: #dbe7ea;
	--ac-bot-bg: #f1f7f8;
	--ac-white: #ffffff;
	--ac-radius: 16px;
	--ac-font: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif;

	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 99990;
	font-family: var(--ac-font);
	font-size: 15px;
	line-height: 1.5;
	color: var(--ac-ink);
}

.aaais-chat *,
.aaais-chat *::before,
.aaais-chat *::after {
	box-sizing: border-box;
}

/* Keep the theme's button and icon styles out of the chat window. */
.aaais-chat button {
	margin: 0;
	min-width: 0;
	min-height: 0;
	background-image: none;
	text-transform: none;
	text-decoration: none;
	text-shadow: none;
	letter-spacing: normal;
	line-height: 1;
	-webkit-appearance: none;
	appearance: none;
}

.aaais-chat svg {
	display: block;
	flex: none;
	max-width: none;
	max-height: none;
	fill: none !important;
	stroke: currentColor !important;
	overflow: visible;
	vertical-align: middle;
}

.aaais-chat svg * {
	fill: none !important;
	stroke: currentColor !important;
}

.aaais-chat svg .aaais-chat__dot {
	fill: currentColor !important;
	stroke: none !important;
}

/* Launcher */
.aaais-chat__launcher {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-left: auto;
	padding: 0 22px 0 16px;
	height: 56px;
	border: 0;
	border-radius: 28px;
	background: var(--ac-accent);
	color: var(--ac-white);
	font: 500 16px/1 var(--ac-font);
	letter-spacing: 0.01em;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(0, 92, 112, 0.28);
	transition: background-color 0.15s ease, transform 0.15s ease;
}

.aaais-chat__launcher:hover,
.aaais-chat__launcher:focus-visible {
	background: var(--ac-pink);
	color: var(--ac-white);
	transform: translateY(-1px);
}

.aaais-chat__launcher:focus-visible,
.aaais-chat button:focus-visible,
.aaais-chat a:focus-visible {
	outline: 3px solid var(--ac-pink);
	outline-offset: 2px;
}

.aaais-chat__launcher svg {
	width: 30px;
	height: 30px;
	flex: none;
}

.aaais-chat.is-open .aaais-chat__launcher {
	display: none;
}

/* Panel */
.aaais-chat__panel {
	display: none;
	flex-direction: column;
	width: 390px;
	height: min(600px, calc(100vh - 48px));
	background: var(--ac-white);
	border-radius: var(--ac-radius);
	box-shadow: 0 18px 48px rgba(16, 52, 62, 0.25);
	overflow: hidden;
}

.aaais-chat.is-open .aaais-chat__panel {
	display: flex;
	animation: aaais-chat-in 0.18s ease-out;
}

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

.aaais-chat__header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 16px 16px 20px;
	background: var(--ac-accent);
	color: var(--ac-white);
}

.aaais-chat__avatar {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	flex: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.2);
}

.aaais-chat__avatar svg {
	width: 22px;
	height: 22px;
}

.aaais-chat__title {
	flex: 1;
	min-width: 0;
}

.aaais-chat__name {
	margin: 0;
	font: 500 17px/1.2 var(--ac-font);
	color: var(--ac-white);
}

.aaais-chat__subtitle {
	margin: 2px 0 0;
	font-size: 13px;
	opacity: 0.9;
}

.aaais-chat__close {
	padding: 0;
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--ac-white);
	cursor: pointer;
}

.aaais-chat__close:hover {
	background: rgba(255, 255, 255, 0.18);
}

.aaais-chat__close svg {
	width: 20px;
	height: 20px;
}

/* Messages */
.aaais-chat__log {
	flex: 1;
	overflow-y: auto;
	padding: 20px 16px 8px;
	scroll-behavior: smooth;
}

.aaais-chat__msg {
	display: flex;
	margin-bottom: 12px;
}

.aaais-chat__bubble {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 14px;
	overflow-wrap: anywhere;
}

.aaais-chat__msg--bot .aaais-chat__bubble {
	background: var(--ac-bot-bg);
	border-bottom-left-radius: 4px;
}

.aaais-chat__msg--user {
	justify-content: flex-end;
}

.aaais-chat__msg--user .aaais-chat__bubble {
	background: var(--ac-accent);
	color: var(--ac-white);
	border-bottom-right-radius: 4px;
}

.aaais-chat__msg--error .aaais-chat__bubble {
	background: #fff1f5;
	color: #8a1f45;
}

.aaais-chat__bubble p {
	margin: 0 0 8px;
}

.aaais-chat__bubble p:last-child,
.aaais-chat__bubble ul:last-child {
	margin-bottom: 0;
}

.aaais-chat__bubble ul {
	margin: 4px 0 8px;
	padding-left: 20px;
}

.aaais-chat__bubble li {
	margin: 2px 0;
}

.aaais-chat__bubble a {
	color: var(--ac-accent-dark);
	font-weight: 500;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.aaais-chat__bubble a:hover {
	color: var(--ac-pink);
}

/* Typing dots */
.aaais-chat__typing {
	display: inline-flex;
	gap: 4px;
	padding: 4px 2px;
}

.aaais-chat__typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--ac-muted);
	animation: aaais-chat-dot 1.2s infinite ease-in-out;
}

.aaais-chat__typing span:nth-child(2) { animation-delay: 0.15s; }
.aaais-chat__typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes aaais-chat-dot {
	0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-3px); }
}

/* Suggestions */
.aaais-chat__suggestions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 4px 0 12px;
}

.aaais-chat__chip {
	padding: 7px 12px;
	border: 1.5px solid var(--ac-accent);
	border-radius: 18px;
	background: var(--ac-white);
	color: var(--ac-accent-dark);
	font: 500 13px/1.3 var(--ac-font);
	text-align: left;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.aaais-chat__chip:hover {
	background: var(--ac-pink);
	border-color: var(--ac-pink);
	color: var(--ac-white);
}

/* Composer */
.aaais-chat__form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid var(--ac-line);
}

.aaais-chat__input {
	flex: 1;
	min-height: 44px;
	max-height: 120px;
	margin: 0;
	padding: 11px 14px;
	border: 1.5px solid var(--ac-line);
	border-radius: 22px;
	background: var(--ac-white);
	color: var(--ac-ink);
	font: 15px/1.4 var(--ac-font);
	resize: none;
}

.aaais-chat__input:focus {
	border-color: var(--ac-accent);
	outline: none;
	box-shadow: 0 0 0 3px rgba(0, 171, 205, 0.18);
}

.aaais-chat__send {
	padding: 0;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	flex: none;
	border: 0;
	border-radius: 50%;
	background: var(--ac-accent);
	color: var(--ac-white);
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.aaais-chat__send:hover {
	background: var(--ac-pink);
}

.aaais-chat__send:disabled {
	background: var(--ac-line);
	cursor: default;
}

.aaais-chat__send svg {
	width: 20px;
	height: 20px;
}

.aaais-chat__footnote {
	margin: 0;
	padding: 0 16px 10px;
	color: var(--ac-muted);
	font-size: 11.5px;
	text-align: center;
}

.aaais-chat__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* Phones: full screen panel, icon-only launcher */
@media (max-width: 600px) {
	.aaais-chat {
		right: 16px;
		bottom: 16px;
	}

	.aaais-chat__launcher {
		width: 60px;
		height: 60px;
		padding: 0;
		justify-content: center;
		border-radius: 50%;
	}

	.aaais-chat__launcher-label {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
	}

	.aaais-chat.is-open {
		inset: 0;
	}

	.aaais-chat__panel {
		width: 100%;
		height: 100%;
		border-radius: 0;
	}

	.aaais-chat__input {
		font-size: 16px; /* Stops iOS zooming in on focus. */
	}
}

@media (prefers-reduced-motion: reduce) {
	.aaais-chat *,
	.aaais-chat *::before,
	.aaais-chat *::after {
		animation: none !important;
		transition: none !important;
	}
}
