/* Ironloom Support Assistant. Colours follow the Ironloom Theme presets, with the Ironloom palette as fallback. */
.ilsa {
	--a-bg: var(--wp--preset--color--base, #0B1220);
	--a-surface: var(--wp--preset--color--surface, #111C31);
	--a-surface2: var(--wp--preset--color--surface-2, #16233D);
	--a-line: var(--wp--preset--color--line, #1F2D47);
	--a-text: var(--wp--preset--color--contrast, #E8EEF6);
	--a-muted: var(--wp--preset--color--muted, #8A97AB);
	--a-accent: var(--wp--preset--color--accent, #3DA5FF);
	--a-on-accent: var(--wp--preset--color--on-accent, #04101F);
	font-family: inherit;
	font-size: 15px;
	line-height: 1.5;
	color: var(--a-text);
}
.ilsa *, .ilsa *::before, .ilsa *::after { box-sizing: border-box; }
.ilsa button { font: inherit; cursor: pointer; }
.ilsa [hidden] { display: none !important; }
/* The theme styles buttons and links differently: the small buttons of the chat keep one size whichever tag they are. */
.ilsa .ilsa-chip, .ilsa .ilsa-small { font-size: 13px; line-height: 1.4; min-height: 0; }
.ilsa .ilsa-small { padding: 4px 10px; }
.ilsa .ilsa-chip { padding: 5px 12px; }

/* The button: the Ironloom shield */
.ilsa-launch {
	position: fixed; inset-block-end: 20px; inset-inline-end: 20px; z-index: 99990;
	display: flex; align-items: center; gap: 10px;
	padding: 0; border: 0; background: none; color: var(--a-text);
}
.ilsa-launch-icon {
	width: 55px; height: 66px; display: block;
	filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .55));   /* the shadow follows the shield's outline */
	transition: transform .15s ease;
}
.ilsa-launch:hover .ilsa-launch-icon, .ilsa-launch:focus-visible .ilsa-launch-icon { transform: translateY(-2px); }
.ilsa-launch:focus-visible { outline: 2px solid var(--a-accent); outline-offset: 6px; border-radius: 6px; }
.ilsa-teaser {
	background: var(--a-surface); border: 1px solid var(--a-line); border-radius: 12px; padding: 8px 12px;
	font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); max-width: 220px; text-align: start;
}
.ilsa-open .ilsa-launch { display: none; }

/* The window */
.ilsa-panel {
	position: fixed; inset-block-end: 20px; inset-inline-end: 20px; z-index: 99991;
	width: min(400px, calc(100vw - 24px)); height: min(640px, calc(100vh - 40px)); height: min(640px, calc(100dvh - 40px));
	display: flex; flex-direction: column; overflow: hidden;
	background: var(--a-bg); border: 1px solid var(--a-line); border-radius: 16px;
	box-shadow: 0 18px 60px rgba(0, 0, 0, .55);
}
.ilsa-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; background: var(--a-surface); border-block-end: 1px solid var(--a-line); }
.ilsa-head img { width: 30px; height: 36px; flex: none; }
.ilsa-head-text { flex: 1; min-width: 0; }
.ilsa-name { font-weight: 700; font-size: 15px; }
.ilsa-sub { font-size: 12px; color: var(--a-muted); }
.ilsa-icon-btn {
	flex: none; width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent; background: none; color: var(--a-muted);
	display: grid; place-items: center;
}
.ilsa-icon-btn:hover, .ilsa-icon-btn:focus-visible { color: var(--a-text); border-color: var(--a-line); background: var(--a-surface2); outline: none; }
.ilsa-icon-btn svg { width: 18px; height: 18px; }

.ilsa-tools { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; border-block-end: 1px solid var(--a-line); background: var(--a-bg); }
.ilsa-chip {
	border: 1px solid var(--a-line); background: var(--a-surface); color: var(--a-text); border-radius: 999px; padding: 5px 12px; font-size: 13px;
	text-decoration: none; text-align: start;
}
.ilsa-chip:hover, .ilsa-chip:focus-visible { border-color: var(--a-accent); outline: none; }

.ilsa-log { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.ilsa-msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ilsa-msg-bot { align-self: flex-start; background: var(--a-surface); border: 1px solid var(--a-line); border-start-start-radius: 4px; }
.ilsa-msg-user { align-self: flex-end; background: var(--a-accent); color: var(--a-on-accent); border-start-end-radius: 4px; }
.ilsa-msg-note { align-self: stretch; max-width: 100%; background: none; border: 1px dashed var(--a-line); color: var(--a-muted); font-size: 13px; }
.ilsa-msg-account { align-self: stretch; max-width: 100%; background: var(--a-surface2); border: 1px solid var(--a-line); font-size: 14px; }
.ilsa-extra { align-self: flex-start; max-width: 88%; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.ilsa-sources { display: flex; flex-direction: column; gap: 4px; }
.ilsa-sources span { color: var(--a-muted); }
.ilsa-sources a { color: var(--a-accent); text-decoration: underline; text-underline-offset: 2px; }
.ilsa-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--a-muted); }
.ilsa-small {
	border: 1px solid var(--a-line); background: none; color: var(--a-text); border-radius: 8px; padding: 3px 10px; font-size: 13px; text-decoration: none;
}
.ilsa-small:hover, .ilsa-small:focus-visible { border-color: var(--a-accent); outline: none; }
.ilsa-small-main { background: var(--a-accent); border-color: var(--a-accent); color: var(--a-on-accent); font-weight: 600; }
.ilsa-dots::after { content: ""; display: inline-block; width: 1.2em; text-align: start; animation: ilsa-dots 1.2s steps(4, end) infinite; }
@keyframes ilsa-dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.ilsa-form { display: flex; gap: 8px; padding: 10px 12px; border-block-start: 1px solid var(--a-line); background: var(--a-surface); align-items: flex-end; }
.ilsa-form textarea, .ilsa-ticket input, .ilsa-ticket textarea {
	width: 100%; font: inherit; color: var(--a-text); background: var(--a-bg); border: 1px solid var(--a-line); border-radius: 10px; padding: 9px 11px; resize: none;
}
.ilsa-form textarea { flex: 1; max-height: 110px; min-height: 42px; }
.ilsa-form textarea:focus, .ilsa-ticket input:focus, .ilsa-ticket textarea:focus { outline: none; border-color: var(--a-accent); }
.ilsa-send {
	flex: none; height: 42px; padding: 0 16px; border-radius: 10px; border: 0; background: var(--a-accent); color: var(--a-on-accent); font-weight: 700;
}
.ilsa-send:disabled { opacity: .5; cursor: default; }
.ilsa-foot { padding: 6px 12px 9px; font-size: 11px; color: var(--a-muted); background: var(--a-surface); text-align: center; }

.ilsa-ticket { align-self: stretch; display: flex; flex-direction: column; gap: 8px; background: var(--a-surface); border: 1px solid var(--a-line); border-radius: 14px; padding: 12px; }
.ilsa-ticket strong { font-size: 14px; }
.ilsa-ticket p { margin: 0; font-size: 12px; color: var(--a-muted); }
.ilsa-ticket textarea { min-height: 84px; resize: vertical; }
.ilsa-ticket-err { color: #FF8A8A; font-size: 13px; }

@media (max-width: 520px) {
	.ilsa-panel { inset: 0; width: 100%; height: 100%; border-radius: 0; border: 0; }
	.ilsa-launch { inset-block-end: 14px; inset-inline-end: 14px; }
	.ilsa-launch-icon { width: 48px; height: 58px; }
	.ilsa-teaser { display: none; }
}
@media (prefers-reduced-motion: reduce) {
	.ilsa-launch-icon { transition: none; }
	.ilsa-dots::after { animation: none; content: "..."; }
}
@media print { .ilsa { display: none !important; } }
