/* ----------------------------------------------------------------------------------------
* TechLuviz AI chatbot widget
* Markup: resources/views/partials/chatbot.blade.php   Script: asset/js/chatbot.js
* Everything is scoped under .tlc so the site's global styles can't leak in or out.
* ---------------------------------------------------------------------------------------- */

@property --tlc-angle {
	syntax: "<angle>";
	inherits: false;
	initial-value: 0deg;
}

.tlc {
	--tlc-accent: #BFF747;
	--tlc-accent-2: #2ec4b6;
	--tlc-accent-3: #2E82C4;
	--tlc-bg: #0b0d0c;
	--tlc-surface: #151917;
	--tlc-bubble: #1a1f1c;
	--tlc-border: rgba(255, 255, 255, 0.09);
	--tlc-text: #F5F5F4;
	--tlc-muted: rgba(245, 245, 244, 0.6);
	--tlc-ink: #0b0d0c;
	--tlc-ease: cubic-bezier(0.2, 0.9, 0.3, 1.15);
	font-family: var(--default-font, "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif);
	font-size: 15px;
	line-height: 1.5;
	color: var(--tlc-text);
	-webkit-font-smoothing: antialiased;
}

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

.tlc [hidden] {
	display: none !important;
}

.tlc button,
.tlc textarea {
	font-family: inherit;
	margin: 0;
}

.tlc button {
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.tlc button:focus-visible,
.tlc a:focus-visible {
	outline: 2px solid var(--tlc-accent);
	outline-offset: 2px;
}

.tlc-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Launcher ---------- */

.tlc-launcher {
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 1000;
	width: 64px;
	height: 64px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: linear-gradient(135deg, #dcff7d 0%, var(--tlc-accent) 45%, #8fd62a 100%);
	box-shadow: 0 12px 32px rgba(191, 247, 71, 0.35), 0 4px 14px rgba(0, 0, 0, 0.55);
	transition: transform 0.35s var(--tlc-ease), box-shadow 0.3s ease;
	animation: tlcLauncherIn 0.7s var(--tlc-ease) 0.4s backwards;
}

.tlc-launcher:hover {
	transform: scale(1.08) rotate(-5deg);
	box-shadow: 0 16px 40px rgba(191, 247, 71, 0.5), 0 4px 14px rgba(0, 0, 0, 0.55);
}

.tlc-launcher:active {
	transform: scale(0.94);
}

/* two expanding rings keep it quietly attention-grabbing */
.tlc-launcher::before,
.tlc-launcher::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 2px solid var(--tlc-accent);
	opacity: 0;
	pointer-events: none;
	animation: tlcRing 2.8s ease-out infinite;
}

.tlc-launcher::after {
	animation-delay: 1.4s;
}

.tlc.is-open .tlc-launcher::before,
.tlc.is-open .tlc-launcher::after {
	animation: none;
}

.tlc-launcher-icon {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	transition: transform 0.45s var(--tlc-ease), opacity 0.25s ease;
}

.tlc-launcher-bot {
	animation: tlcFloat 3.6s ease-in-out infinite;
}

.tlc-launcher-bot .tlc-bot-svg {
	width: 38px;
	height: 38px;
}

.tlc-launcher-close {
	font-size: 22px;
	color: var(--tlc-ink);
	opacity: 0;
	transform: rotate(-90deg) scale(0.4);
}

.tlc.is-open .tlc-launcher-bot {
	opacity: 0;
	transform: rotate(90deg) scale(0.4);
	animation: none;
}

.tlc.is-open .tlc-launcher-close {
	opacity: 1;
	transform: none;
}

.tlc-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 10px;
	background: #ff5d5d;
	color: #fff;
	font-size: 11px;
	font-weight: 800;
	line-height: 20px;
	text-align: center;
	box-shadow: 0 0 0 3px var(--tlc-bg);
	animation: tlcBadge 1.8s ease-in-out infinite;
}

.tlc.is-seen .tlc-badge,
.tlc.is-open .tlc-badge {
	display: none;
}

/* ---------- Greeting bubble ---------- */

.tlc-teaser {
	position: fixed;
	right: 24px;
	bottom: 102px;
	z-index: 1000;
	max-width: 260px;
	background: #fff;
	color: #111;
	border-radius: 18px 18px 4px 18px;
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
	transform-origin: 100% 100%;
	animation: tlcPop 0.55s var(--tlc-ease) backwards;
}

.tlc-teaser-text {
	display: block;
	width: 100%;
	padding: 13px 38px 13px 16px;
	border: 0;
	background: transparent;
	text-align: left;
	color: inherit;
}

.tlc-teaser-text strong {
	display: block;
	font-size: 14.5px;
	font-weight: 800;
	line-height: 1.3;
}

.tlc-teaser-text span {
	display: block;
	margin-top: 2px;
	font-size: 13px;
	color: #4b5250;
	line-height: 1.4;
}

.tlc-teaser-close {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 26px;
	height: 26px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #7a817f;
	font-size: 12px;
	transition: background 0.2s, color 0.2s;
}

.tlc-teaser-close:hover {
	background: rgba(0, 0, 0, 0.08);
	color: #111;
}

/* ---------- Panel ---------- */

.tlc-panel {
	position: fixed;
	right: 24px;
	bottom: 104px;
	z-index: 1000;
	display: flex;
	flex-direction: column;
	width: 392px;
	max-width: calc(100vw - 32px);
	height: min(660px, calc(100vh - 132px));
	height: min(660px, calc(100dvh - 132px));
	border-radius: 24px;
	background: var(--tlc-bg);
	overflow: hidden;
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), 0 0 70px rgba(191, 247, 71, 0.1);
	transform-origin: 100% 100%;
	opacity: 0;
	visibility: hidden;
	transform: translateY(24px) scale(0.88);
	transition: opacity 0.25s ease, transform 0.45s var(--tlc-ease), visibility 0s linear 0.45s;
}

.tlc.is-open .tlc-panel {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition: opacity 0.25s ease, transform 0.45s var(--tlc-ease), visibility 0s;
}

/* restoring an open chat on page load shouldn't replay the opening animation */
.tlc.is-instant .tlc-panel,
.tlc.is-instant .tlc-launcher-icon {
	transition: none;
}

/* rotating rainbow border */
.tlc-panel::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 5;
	padding: 1.5px;
	border-radius: inherit;
	background: conic-gradient(from var(--tlc-angle), rgba(191, 247, 71, 0) 0%, var(--tlc-accent) 12%, var(--tlc-accent-2) 24%, var(--tlc-accent-3) 36%, rgba(46, 130, 196, 0) 50%, rgba(191, 247, 71, 0) 100%);
	-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	-webkit-mask-composite: xor;
	mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	mask-composite: exclude;
	pointer-events: none;
	animation: tlcAngle 6s linear infinite;
}

/* ---------- Header ---------- */

.tlc-head {
	position: relative;
	flex: none;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 12px 16px 16px;
	background: #0f1311;
	border-bottom: 1px solid var(--tlc-border);
	overflow: hidden;
	isolation: isolate;
}

/* slow-drifting colour glows behind the header */
.tlc-head::before,
.tlc-head::after {
	content: "";
	position: absolute;
	z-index: -1;
	width: 190px;
	height: 190px;
	border-radius: 50%;
	filter: blur(42px);
	opacity: 0.55;
	pointer-events: none;
}

.tlc-head::before {
	top: -110px;
	left: -40px;
	background: var(--tlc-accent);
	animation: tlcDriftA 9s ease-in-out infinite alternate;
}

.tlc-head::after {
	top: -120px;
	right: -50px;
	background: var(--tlc-accent-3);
	animation: tlcDriftB 11s ease-in-out infinite alternate;
}

.tlc-avatar {
	position: relative;
	flex: none;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: linear-gradient(135deg, #dcff7d, var(--tlc-accent) 50%, #8fd62a);
	box-shadow: 0 0 0 3px rgba(191, 247, 71, 0.18);
}

.tlc-avatar .tlc-bot-svg {
	width: 32px;
	height: 32px;
}

.tlc-online {
	position: absolute;
	right: 0;
	bottom: 1px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: #36e07f;
	box-shadow: 0 0 0 2.5px #0f1311;
	animation: tlcOnline 2s ease-out infinite;
}

.tlc-title {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.tlc-title strong {
	font-size: 16.5px;
	font-weight: 800;
	color: #fff;
	line-height: 1.25;
	letter-spacing: -0.01em;
}

.tlc-title span {
	font-size: 12px;
	color: var(--tlc-muted);
	line-height: 1.4;
}

.tlc-icon-btn {
	flex: none;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 11px;
	background: transparent;
	color: var(--tlc-muted);
	font-size: 14px;
	transition: background 0.2s, color 0.2s, transform 0.3s var(--tlc-ease);
}

.tlc-icon-btn:hover {
	background: rgba(255, 255, 255, 0.09);
	color: #fff;
}

#tlc-reset:hover i {
	display: inline-block;
	animation: tlcSpinOnce 0.6s ease;
}

#tlc-close:hover {
	transform: rotate(90deg);
}

/* bot character (shared by launcher, header and message avatars) */
.tlc-bot-svg {
	display: block;
	overflow: visible;
}

.tlc-bot-eye {
	transform-box: fill-box;
	transform-origin: center;
	animation: tlcBlink 5s infinite;
}

.tlc-bot-bulb {
	animation: tlcBulb 2s ease-in-out infinite;
}

/* ---------- Conversation ---------- */

.tlc-log {
	position: relative;
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 18px 14px 10px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background:
		radial-gradient(120% 55% at 50% 0%, rgba(191, 247, 71, 0.07), transparent 65%),
		radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px) 0 0 / 18px 18px,
		var(--tlc-bg);
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.tlc-log::-webkit-scrollbar {
	width: 6px;
}

.tlc-log::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.18);
	border-radius: 3px;
}

.tlc-msg {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	max-width: 100%;
	animation: tlcMsgIn 0.45s var(--tlc-ease) backwards;
}

.tlc-msg-user {
	justify-content: flex-end;
}

.tlc.is-instant .tlc-msg {
	animation: none;
}

.tlc-mini {
	flex: none;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: linear-gradient(135deg, #dcff7d, var(--tlc-accent) 55%, #8fd62a);
}

.tlc-mini .tlc-bot-svg {
	width: 20px;
	height: 20px;
}

.tlc-bubble {
	max-width: calc(100% - 40px);
	padding: 10px 14px;
	border-radius: 6px 18px 18px 18px;
	background: var(--tlc-bubble);
	border: 1px solid var(--tlc-border);
	color: var(--tlc-text);
	font-size: 14.5px;
	line-height: 1.55;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.tlc-msg-user .tlc-bubble {
	max-width: 85%;
	border: 0;
	border-radius: 18px 6px 18px 18px;
	background: linear-gradient(135deg, #d6ff6a, var(--tlc-accent));
	color: var(--tlc-ink);
	font-weight: 600;
	white-space: pre-wrap;
	box-shadow: 0 6px 18px rgba(191, 247, 71, 0.18);
}

.tlc-msg-error .tlc-bubble {
	border-color: rgba(255, 93, 93, 0.45);
	background: rgba(255, 93, 93, 0.09);
}

.tlc-bubble p {
	margin: 0 0 0.6em;
	line-height: inherit;
}

.tlc-bubble > :last-child {
	margin-bottom: 0;
}

.tlc-bubble ul,
.tlc-bubble ol {
	margin: 0 0 0.6em;
	padding-left: 1.2em;
}

.tlc-bubble ul {
	list-style: none;
	padding-left: 0;
}

.tlc-bubble ul li {
	position: relative;
	padding-left: 1.05em;
}

.tlc-bubble ul li::before {
	content: "";
	position: absolute;
	left: 0.1em;
	top: 0.62em;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--tlc-accent);
}

.tlc-bubble ol li {
	padding-left: 0.2em;
}

.tlc-bubble ol li::marker {
	color: var(--tlc-accent);
	font-weight: 700;
}

.tlc-bubble li {
	margin: 0 0 0.3em;
	line-height: inherit;
}

.tlc-bubble strong {
	color: #fff;
	font-weight: 700;
}

.tlc-bubble code {
	padding: 1px 6px;
	border-radius: 6px;
	background: rgba(255, 255, 255, 0.1);
	font-size: 0.9em;
}

.tlc-bubble a {
	color: var(--tlc-accent);
	font-weight: 600;
	text-decoration: underline;
	text-decoration-color: rgba(191, 247, 71, 0.4);
	text-underline-offset: 3px;
	transition: text-decoration-color 0.2s, color 0.2s;
}

.tlc-bubble a:hover {
	color: #fff;
	text-decoration-color: var(--tlc-accent);
}

/* words fade in one after another when a reply arrives */
.tlc-w {
	opacity: 0;
	animation: tlcWord 0.4s ease forwards;
}

.tlc-error-actions {
	margin-top: 8px;
}

.tlc-retry {
	padding: 5px 12px;
	border: 1px solid rgba(255, 93, 93, 0.55);
	border-radius: 999px;
	background: transparent;
	color: #ff9b9b;
	font-size: 12.5px;
	font-weight: 700;
	transition: background 0.2s, color 0.2s;
}

.tlc-retry:hover {
	background: #ff5d5d;
	color: #fff;
}

/* typing indicator */
.tlc-typing .tlc-bubble {
	display: flex;
	align-items: center;
	gap: 5px;
	padding: 14px 16px;
}

.tlc-typing .tlc-bubble i {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--tlc-accent);
	animation: tlcDot 1.1s ease-in-out infinite;
}

.tlc-typing .tlc-bubble i:nth-child(2) {
	animation-delay: 0.15s;
}

.tlc-typing .tlc-bubble i:nth-child(3) {
	animation-delay: 0.3s;
}

/* ---------- Quick replies ---------- */

.tlc-chips {
	flex: none;
	display: flex;
	gap: 8px;
	padding: 10px 14px 4px;
	overflow-x: auto;
	scrollbar-width: none;
	-webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
	mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
}

.tlc-chips::-webkit-scrollbar {
	display: none;
}

.tlc-chip {
	flex: none;
	padding: 7px 14px;
	border: 1px solid rgba(191, 247, 71, 0.35);
	border-radius: 999px;
	background: rgba(191, 247, 71, 0.06);
	color: var(--tlc-accent);
	font-size: 12.5px;
	font-weight: 700;
	white-space: nowrap;
	transition: background 0.2s, color 0.2s, transform 0.25s var(--tlc-ease), border-color 0.2s;
}

.tlc-chip:hover {
	background: var(--tlc-accent);
	border-color: var(--tlc-accent);
	color: var(--tlc-ink);
	transform: translateY(-2px);
}

.tlc-chip:disabled {
	opacity: 0.45;
	pointer-events: none;
}

.tlc.is-open .tlc-chip {
	animation: tlcChipIn 0.5s var(--tlc-ease) backwards;
}

.tlc.is-open .tlc-chip:nth-child(2) { animation-delay: 0.06s; }
.tlc.is-open .tlc-chip:nth-child(3) { animation-delay: 0.12s; }
.tlc.is-open .tlc-chip:nth-child(4) { animation-delay: 0.18s; }

/* ---------- Input ---------- */

.tlc-form {
	flex: none;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	margin: 8px 12px 6px;
	padding: 6px 6px 6px 16px;
	border-radius: 20px;
	background: var(--tlc-surface);
	border: 1px solid var(--tlc-border);
	transition: border-color 0.2s, box-shadow 0.25s;
}

.tlc-form:focus-within {
	border-color: rgba(191, 247, 71, 0.65);
	box-shadow: 0 0 0 4px rgba(191, 247, 71, 0.12);
}

.tlc-input {
	flex: 1;
	min-width: 0;
	height: 38px;
	max-height: 112px;
	padding: 8px 0;
	border: 0;
	border-radius: 0;
	outline: 0;
	box-shadow: none;
	resize: none;
	background: transparent;
	color: var(--tlc-text);
	font-size: 15px;
	line-height: 22px;
}

.tlc-input::placeholder {
	color: rgba(245, 245, 244, 0.42);
}

.tlc-send {
	flex: none;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: 14px;
	background: var(--tlc-accent);
	color: var(--tlc-ink);
	font-size: 15px;
	transition: transform 0.3s var(--tlc-ease), background 0.2s, opacity 0.2s;
}

.tlc-send:hover:not(:disabled) {
	transform: scale(1.08);
}

.tlc-send:hover:not(:disabled) i {
	animation: tlcFly 0.6s ease;
}

.tlc-send:active:not(:disabled) {
	transform: scale(0.92);
}

.tlc-send:disabled {
	opacity: 0.35;
	cursor: default;
}

.tlc-foot {
	flex: none;
	margin: 0;
	padding: 0 16px 12px;
	text-align: center;
	font-size: 11px;
	line-height: 1.4;
	color: var(--tlc-muted);
}

.tlc-foot a {
	color: var(--tlc-accent);
	font-weight: 600;
	text-decoration: none;
}

.tlc-foot a:hover {
	text-decoration: underline;
}

/* ---------- Keyframes ---------- */

@keyframes tlcLauncherIn {
	from { opacity: 0; transform: scale(0.3) translateY(30px); }
	to { opacity: 1; transform: none; }
}

@keyframes tlcRing {
	0% { opacity: 0.6; transform: scale(1); }
	100% { opacity: 0; transform: scale(1.65); }
}

@keyframes tlcFloat {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-3px); }
}

@keyframes tlcBadge {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.18); }
}

@keyframes tlcPop {
	from { opacity: 0; transform: translateY(10px) scale(0.85); }
	to { opacity: 1; transform: none; }
}

@keyframes tlcAngle {
	to { --tlc-angle: 360deg; }
}

@keyframes tlcDriftA {
	from { transform: translate(0, 0) scale(1); }
	to { transform: translate(70px, 30px) scale(1.25); }
}

@keyframes tlcDriftB {
	from { transform: translate(0, 0) scale(1.1); }
	to { transform: translate(-80px, 24px) scale(0.9); }
}

@keyframes tlcOnline {
	0% { box-shadow: 0 0 0 2.5px #0f1311, 0 0 0 2.5px rgba(54, 224, 127, 0.7); }
	100% { box-shadow: 0 0 0 2.5px #0f1311, 0 0 0 9px rgba(54, 224, 127, 0); }
}

@keyframes tlcBlink {
	0%, 92%, 100% { transform: scaleY(1); }
	95.5% { transform: scaleY(0.08); }
}

@keyframes tlcBulb {
	0%, 100% { transform: scale(1); opacity: 1; }
	50% { transform: scale(0.7); opacity: 0.55; }
}

@keyframes tlcMsgIn {
	from { opacity: 0; transform: translateY(14px) scale(0.94); }
	to { opacity: 1; transform: none; }
}

@keyframes tlcWord {
	from { opacity: 0; transform: translateY(3px); }
	to { opacity: 1; transform: none; }
}

@keyframes tlcDot {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
	30% { transform: translateY(-6px); opacity: 1; }
}

@keyframes tlcChipIn {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: none; }
}

@keyframes tlcSpinOnce {
	to { transform: rotate(360deg); }
}

@keyframes tlcFly {
	40% { transform: translate(4px, -4px) scale(1.1); opacity: 0; }
	41% { transform: translate(-4px, 4px); }
	100% { transform: none; opacity: 1; }
}

/* ---------- Small screens: full-screen sheet ---------- */

@media (max-width: 575.98px) {
	.tlc-launcher {
		right: 16px;
		bottom: 16px;
		width: 58px;
		height: 58px;
	}

	.tlc-launcher-bot .tlc-bot-svg {
		width: 34px;
		height: 34px;
	}

	.tlc-teaser {
		right: 16px;
		bottom: 88px;
		max-width: min(260px, calc(100vw - 32px));
	}

	.tlc-panel {
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		width: 100%;
		max-width: none;
		height: 100vh;
		height: 100dvh;
		border-radius: 0;
		transform-origin: 50% 100%;
		transform: translateY(40px) scale(0.98);
	}

	.tlc-panel::before {
		display: none;
	}

	.tlc.is-open .tlc-launcher {
		visibility: hidden;
	}

	.tlc-input {
		font-size: 16px; /* stops iOS zooming into the field */
	}

	html.tlc-lock,
	html.tlc-lock body {
		overflow: hidden;
	}
}

@media (max-height: 560px) and (min-width: 576px) {
	.tlc-panel {
		height: calc(100vh - 120px);
		bottom: 96px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tlc *,
	.tlc *::before,
	.tlc *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		animation-delay: 0s !important;
		transition-duration: 0.01ms !important;
		transition-delay: 0s !important;
	}

	.tlc-w {
		opacity: 1;
	}
}
