/* TUTSA website assistant.
   Sits above everything, including the Google map info windows, and stays
   clear of the safe area on a phone. Colours fall back to literals so the
   widget still looks right on a page that has not loaded the design tokens. */

.tchat{
	--tc-blue:var(--tv-blue,#1554ec);
	--tc-ink:var(--tv-ink,#102747);
	--tc-muted:var(--tv-muted,#526175);
	--tc-line:var(--tv-line,#dce1e5);
	--tc-navy:#0c2546;

	position:fixed;
	right:20px;
	bottom:20px;
	bottom:calc(20px + env(safe-area-inset-bottom, 0px));
	z-index:2400;
	font-family:"DM Sans",system-ui,-apple-system,"Segoe UI",sans-serif;
}

/* The Elementor kit styles bare button, a and h2 elements at a specificity a
   single class cannot beat, which is why every control below is written as
   ancestor plus element type. This clears what the kit sets first. */
.tchat button,
.tchat a,
.tchat textarea{
	border:0;
	border-radius:0;
	background:none;
	box-shadow:none;
	text-transform:none;
	letter-spacing:normal;
	font-family:inherit;
	text-decoration:none;
	margin:0;
	min-height:0;
}
.tchat button{-webkit-appearance:none;appearance:none;cursor:pointer}
.tchat h2,.tchat p{margin:0;padding:0;font-family:inherit;text-transform:none;letter-spacing:normal}

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

.tchat button.tchat-launch{
	display:inline-flex;align-items:center;gap:10px;
	background:var(--tc-navy);color:#fff;
	border:0;border-radius:999px;
	padding:13px 20px 13px 17px;
	font-weight:700;font-size:14.5px;line-height:1;
	cursor:pointer;
	box-shadow:0 12px 30px rgba(12,37,70,.28);
	transition:transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.tchat button.tchat-launch:hover{background:var(--tc-blue);transform:translateY(-2px);
	box-shadow:0 16px 36px rgba(21,84,236,.32)}
.tchat button.tchat-launch:focus-visible{outline:3px solid var(--tc-blue);outline-offset:3px}
.tchat-launch-icon{display:grid;place-items:center;line-height:0}
.tchat.is-open button.tchat-launch{opacity:0;pointer-events:none}

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

.tchat-panel{
	position:absolute;right:0;bottom:0;
	width:min(384px, calc(100vw - 32px));
	height:min(600px, calc(100vh - 96px));
	display:flex;flex-direction:column;
	background:#fff;
	border:1px solid var(--tc-line);
	border-radius:18px;
	overflow:hidden;
	box-shadow:0 26px 70px rgba(12,37,70,.26);
}

.tchat-head{
	display:flex;align-items:center;justify-content:space-between;gap:12px;
	padding:15px 15px 15px 17px;
	background:var(--tc-navy);color:#fff;
}
.tchat-id{display:flex;align-items:center;gap:11px;min-width:0}
.tchat-mark{
	flex:0 0 34px;width:34px;height:34px;border-radius:10px;
	display:grid;place-items:center;
	background:var(--tc-blue);color:#fff;
	font-weight:800;font-size:16px;line-height:1;
}
.tchat h2.tchat-title{margin:0;font-weight:700;font-size:15px;line-height:1.2;color:#fff}
.tchat-sub{margin:3px 0 0;font-weight:400;font-size:12px;line-height:1.3;color:rgba(255,255,255,.72)}
.tchat button.tchat-close{
	flex:0 0 auto;background:rgba(255,255,255,.12);border:0;border-radius:9px;
	width:32px;height:32px;display:grid;place-items:center;
	color:#fff;cursor:pointer;transition:background .15s ease;
}
.tchat button.tchat-close:hover{background:rgba(255,255,255,.24)}
.tchat button.tchat-close:focus-visible{outline:2px solid #fff;outline-offset:2px}

/* ------------------------------------------------------------------ log */

.tchat-log{
	flex:1 1 auto;overflow-y:auto;
	padding:18px 16px 6px;
	background:#f7f9fc;
	display:flex;flex-direction:column;gap:12px;
	scroll-behavior:smooth;
}
.tchat-log:focus-visible{outline:2px solid var(--tc-blue);outline-offset:-2px}

.tchat-msg{display:flex;max-width:100%}
.tchat-msg.is-user{justify-content:flex-end}

.tchat-body{
	max-width:88%;
	padding:12px 14px;
	border-radius:14px;
	font-size:14px;line-height:1.55;
	color:var(--tc-ink);
	background:#fff;
	border:1px solid var(--tc-line);
	box-shadow:0 2px 6px rgba(12,37,70,.05);
}
.tchat-msg.is-user .tchat-body{
	background:var(--tc-blue);color:#fff;border-color:var(--tc-blue);
	border-bottom-right-radius:5px;
}
.tchat-msg.is-bot .tchat-body{border-bottom-left-radius:5px}
.tchat-msg.is-error .tchat-body{background:#fff6f5;border-color:#f2c4bd}

.tchat-body p{margin:0 0 8px;color:inherit}
.tchat-body p:last-child{margin-bottom:0}

/* --------------------------------------------------------------- links */

.tchat-links{display:flex;flex-direction:column;gap:6px;margin-top:11px;
	padding-top:11px;border-top:1px solid var(--tc-line)}
.tchat a.tchat-link{
	display:flex;align-items:center;gap:8px;
	padding:9px 11px;border-radius:9px;
	background:#eef3ff;
	color:var(--tc-blue);
	font-weight:700;font-size:13px;line-height:1.35;
	text-decoration:none;
	transition:background .15s ease;
}
.tchat a.tchat-link:hover{background:#e0e9ff;text-decoration:none}
.tchat a.tchat-link:focus-visible{outline:2px solid var(--tc-blue);outline-offset:2px}
.tchat a.tchat-link svg{flex:0 0 auto}

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

.tchat-chips{margin-top:2px}
.tchat-chips-label{
	margin:0 0 8px;font-size:11.5px;font-weight:700;letter-spacing:.06em;
	text-transform:uppercase;color:var(--tc-muted);
}
.tchat-chips-list{display:flex;flex-wrap:wrap;gap:7px}
.tchat button.tchat-chip{
	background:#fff;border:1px solid var(--tc-line);border-radius:999px;
	padding:8px 13px;font-weight:600;font-size:12.5px;line-height:1.25;color:var(--tc-ink);
	cursor:pointer;text-align:left;
	transition:border-color .15s ease, color .15s ease, background .15s ease;
}
.tchat button.tchat-chip:hover{border-color:var(--tc-blue);color:var(--tc-blue);background:#f4f7ff}
.tchat button.tchat-chip:focus-visible{outline:2px solid var(--tc-blue);outline-offset:2px}

/* -------------------------------------------------------------- typing */

.tchat-typing{display:inline-flex;gap:5px;align-items:center;padding:3px 1px}
.tchat-typing i{
	width:7px;height:7px;border-radius:50%;background:var(--tc-muted);
	opacity:.42;animation:tchat-bounce 1.1s infinite ease-in-out;
}
.tchat-typing i:nth-child(2){animation-delay:.16s}
.tchat-typing i:nth-child(3){animation-delay:.32s}
@keyframes tchat-bounce{
	0%,72%,100%{transform:translateY(0);opacity:.42}
	36%{transform:translateY(-4px);opacity:.9}
}
@media(prefers-reduced-motion:reduce){
	.tchat-typing i{animation:none}
	.tchat button.tchat-launch{transition:none}
}

/* ---------------------------------------------------------------- form */

.tchat-form{
	display:flex;align-items:flex-end;gap:9px;
	padding:12px 13px;
	background:#fff;
	border-top:1px solid var(--tc-line);
}
.tchat form.tchat-form textarea{
	flex:1 1 auto;min-width:0;
	resize:none;
	border:1px solid var(--tc-line);border-radius:11px;
	padding:11px 13px;
	font-weight:400;font-size:14px;line-height:1.45;color:var(--tc-ink);
	background:#fff;
	/* One line to start with, growing only as the visitor types. */
	height:42px;min-height:42px;max-height:130px;
	overflow-y:auto;
}
.tchat form.tchat-form textarea:focus{outline:none;border-color:var(--tc-blue);
	box-shadow:0 0 0 3px rgba(21,84,236,.14)}
.tchat form.tchat-form textarea:disabled{background:#f5f7fa;color:var(--tc-muted)}

.tchat button.tchat-send{
	flex:0 0 auto;width:42px;height:42px;
	display:grid;place-items:center;
	background:var(--tc-blue);color:#fff;
	border:0;border-radius:11px;cursor:pointer;
	transition:background .15s ease;
}
.tchat button.tchat-send:hover:not(:disabled){background:#0f45c9}
.tchat button.tchat-send:disabled{background:#a9bbe6;cursor:default}
.tchat button.tchat-send:focus-visible{outline:2px solid var(--tc-ink);outline-offset:2px}

.tchat-privacy{
	margin:0;padding:0 15px 13px;
	background:#fff;
	font-size:11px;line-height:1.5;color:var(--tc-muted);
}
.tchat p.tchat-privacy a{color:var(--tc-blue);font-weight:600}

/* ------------------------------------------------------- screen readers */

.tchat-sr{
	position:absolute !important;width:1px;height:1px;
	padding:0;margin:-1px;overflow:hidden;
	clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0;
}

/* ---------------------------------------------------------------- phone */

@media(max-width:560px){
	.tchat{right:14px;left:14px;bottom:14px;
		bottom:calc(14px + env(safe-area-inset-bottom, 0px))}
	.tchat-launch{width:100%;justify-content:center}
	.tchat-panel{
		position:fixed;left:10px;right:10px;bottom:10px;top:10px;
		width:auto;height:auto;border-radius:16px;
	}
	.tchat-body{max-width:92%}
}
