/* Jana Sanskriti AI Assistant — front end widget */

.jsai-root {
	--jsai-radius: 14px;
	--jsai-panel-w: 384px;
	--jsai-panel-h: 588px;
	--jsai-ink: var(--jsai-text, #1B1A17);
	--jsai-muted: #6B6560;
	--jsai-line: rgba(27, 26, 23, 0.12);
	--jsai-bubble: #FFFFFF;
	font-family: inherit;
	color: var(--jsai-ink);
	line-height: 1.55;
}

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

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

.jsai-launcher {
	position: fixed;
	bottom: 22px;
	z-index: var(--jsai-z, 99999);
	display: inline-flex;
	align-items: center;
	gap: 9px;
	padding: 12px 20px 12px 15px;
	border: 0;
	border-radius: 999px;
	background: var(--jsai-accent, #6E1B23);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.01em;
	cursor: pointer;
	box-shadow: 0 6px 22px rgba(27, 26, 23, 0.24);
	transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.jsai-right .jsai-launcher { right: 22px; }
.jsai-left  .jsai-launcher { left: 22px; }

.jsai-launcher:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 28px rgba(27, 26, 23, 0.3);
}

.jsai-launcher:focus-visible {
	outline: 3px solid var(--jsai-accent-soft, #C08A2E);
	outline-offset: 3px;
}

.jsai-launcher svg { flex: 0 0 auto; }

.jsai-launcher[hidden] { display: none; }

/* A quiet mark that the assistant has an unread greeting. */
.jsai-launcher .jsai-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--jsai-accent-soft, #C08A2E);
}

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

.jsai-panel {
	position: fixed;
	bottom: 22px;
	z-index: var(--jsai-z, 99999);
	display: flex;
	flex-direction: column;
	width: var(--jsai-panel-w);
	max-width: calc(100vw - 32px);
	height: var(--jsai-panel-h);
	max-height: calc(100vh - 44px);
	background: var(--jsai-surface, #FAF8F3);
	border-radius: var(--jsai-radius);
	box-shadow: 0 18px 50px rgba(27, 26, 23, 0.28);
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px) scale(0.985);
	pointer-events: none;
	transition: opacity 0.18s ease, transform 0.18s ease;
}

.jsai-right .jsai-panel { right: 22px; }
.jsai-left  .jsai-panel { left: 22px; }

.jsai-panel.is-open {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}

/* Inline (shortcode) placement sits in the page flow. */
.jsai-inline .jsai-panel {
	position: relative;
	right: auto;
	left: auto;
	bottom: auto;
	width: 100%;
	max-width: 100%;
	height: 520px;
	max-height: none;
	opacity: 1;
	transform: none;
	pointer-events: auto;
	border: 1px solid var(--jsai-line);
	box-shadow: 0 2px 14px rgba(27, 26, 23, 0.08);
}

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

.jsai-header {
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 14px 14px 14px 16px;
	background: var(--jsai-accent, #6E1B23);
	color: #fff;
	/* A thin brass rule reads as a stage light line under the header. */
	border-bottom: 2px solid var(--jsai-accent-soft, #C08A2E);
}

.jsai-header-avatar {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	object-fit: cover;
	background: rgba(255, 255, 255, 0.16);
	flex: 0 0 auto;
}

.jsai-header-text { flex: 1 1 auto; min-width: 0; }

.jsai-header-name {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.25;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.jsai-header-status {
	margin: 1px 0 0;
	font-size: 12px;
	opacity: 0.82;
}

.jsai-header-btn {
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #fff;
	cursor: pointer;
	transition: background 0.14s ease;
}

.jsai-header-btn:hover { background: rgba(255, 255, 255, 0.16); }

.jsai-header-btn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 1px;
}

/* ---------------------------------------------------------------- Messages */

.jsai-log {
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 18px 16px 8px;
	scrollbar-width: thin;
}

.jsai-msg {
	display: flex;
	margin-bottom: 14px;
}

.jsai-msg-bot { justify-content: flex-start; }
.jsai-msg-user { justify-content: flex-end; }

.jsai-bubble {
	max-width: 86%;
	padding: 11px 14px;
	border-radius: 13px;
	font-size: 14.5px;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.jsai-msg-bot .jsai-bubble {
	background: var(--jsai-bubble);
	border: 1px solid var(--jsai-line);
	border-bottom-left-radius: 4px;
}

.jsai-msg-user .jsai-bubble {
	background: var(--jsai-accent, #6E1B23);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.jsai-bubble p { margin: 0 0 9px; }
.jsai-bubble p:last-child { margin-bottom: 0; }
.jsai-bubble strong { font-weight: 650; }

.jsai-bubble ul {
	margin: 0 0 9px;
	padding-left: 19px;
}

.jsai-bubble li { margin-bottom: 4px; }

.jsai-bubble a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ----------------------------------------------------------------- Sources */

.jsai-sources {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 10px;
	padding-top: 9px;
	border-top: 1px solid var(--jsai-line);
}

.jsai-sources-label {
	width: 100%;
	margin-bottom: 1px;
	font-size: 11.5px;
	color: var(--jsai-muted);
}

.jsai-source {
	display: inline-block;
	max-width: 100%;
	padding: 4px 10px;
	border: 1px solid var(--jsai-line);
	border-radius: 999px;
	background: var(--jsai-surface, #FAF8F3);
	color: var(--jsai-ink);
	font-size: 12.5px;
	text-decoration: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: border-color 0.14s ease, background 0.14s ease;
}

.jsai-source:hover {
	border-color: var(--jsai-accent, #6E1B23);
	background: #fff;
	text-decoration: none;
}

/* ---------------------------------------------------------------- Feedback */

.jsai-feedback {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 8px;
	font-size: 12px;
	color: var(--jsai-muted);
}

.jsai-feedback button {
	width: 26px;
	height: 26px;
	display: grid;
	place-items: center;
	padding: 0;
	border: 1px solid var(--jsai-line);
	border-radius: 7px;
	background: transparent;
	color: var(--jsai-muted);
	cursor: pointer;
	transition: color 0.14s ease, border-color 0.14s ease;
}

.jsai-feedback button:hover {
	color: var(--jsai-accent, #6E1B23);
	border-color: var(--jsai-accent, #6E1B23);
}

.jsai-feedback button:focus-visible {
	outline: 2px solid var(--jsai-accent, #6E1B23);
	outline-offset: 1px;
}

.jsai-feedback.is-done { color: var(--jsai-muted); }

/* ------------------------------------------------------------------- Chips */

.jsai-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
	padding: 2px 16px 12px;
}

.jsai-chip {
	padding: 7px 13px;
	border: 1px solid var(--jsai-line);
	border-radius: 999px;
	background: #fff;
	color: var(--jsai-ink);
	font-size: 13px;
	font-family: inherit;
	text-align: left;
	cursor: pointer;
	transition: border-color 0.14s ease, background 0.14s ease;
}

.jsai-chip:hover {
	border-color: var(--jsai-accent, #6E1B23);
	background: var(--jsai-surface, #FAF8F3);
}

.jsai-chip:focus-visible {
	outline: 2px solid var(--jsai-accent, #6E1B23);
	outline-offset: 1px;
}

/* --------------------------------------------------------------- Composer */

.jsai-composer {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 11px 12px 12px;
	background: #fff;
	border-top: 1px solid var(--jsai-line);
}

.jsai-input {
	flex: 1 1 auto;
	min-height: 40px;
	max-height: 120px;
	padding: 10px 12px;
	border: 1px solid var(--jsai-line);
	border-radius: 10px;
	background: var(--jsai-surface, #FAF8F3);
	color: var(--jsai-ink);
	font: inherit;
	font-size: 14.5px;
	line-height: 1.4;
	resize: none;
	overflow-y: auto;
}

.jsai-input:focus {
	outline: none;
	border-color: var(--jsai-accent, #6E1B23);
	box-shadow: 0 0 0 3px rgba(110, 27, 35, 0.12);
}

.jsai-send {
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 10px;
	background: var(--jsai-accent, #6E1B23);
	color: #fff;
	cursor: pointer;
	transition: opacity 0.14s ease;
}

.jsai-send:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.jsai-send:focus-visible {
	outline: 2px solid var(--jsai-accent-soft, #C08A2E);
	outline-offset: 2px;
}

.jsai-footnote {
	padding: 0 14px 9px;
	background: #fff;
	font-size: 11px;
	color: var(--jsai-muted);
	text-align: center;
}

/* --------------------------------------------------------------- Thinking */

.jsai-typing {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.jsai-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--jsai-muted);
	animation: jsai-bounce 1.15s infinite ease-in-out;
}

.jsai-typing span:nth-child(2) { animation-delay: 0.16s; }
.jsai-typing span:nth-child(3) { animation-delay: 0.32s; }

@keyframes jsai-bounce {
	0%, 70%, 100% { transform: translateY(0); opacity: 0.45; }
	35% { transform: translateY(-4px); opacity: 1; }
}

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

.jsai-form {
	padding: 14px 16px 4px;
}

.jsai-form h4 {
	margin: 0 0 4px;
	font-size: 14.5px;
	font-weight: 650;
}

.jsai-form p.jsai-form-intro {
	margin: 0 0 11px;
	font-size: 13px;
	color: var(--jsai-muted);
}

.jsai-field { margin-bottom: 9px; }

.jsai-field label {
	display: block;
	margin-bottom: 3px;
	font-size: 12.5px;
	color: var(--jsai-muted);
}

.jsai-field input,
.jsai-field textarea {
	width: 100%;
	padding: 9px 11px;
	border: 1px solid var(--jsai-line);
	border-radius: 9px;
	background: #fff;
	color: var(--jsai-ink);
	font: inherit;
	font-size: 14px;
}

.jsai-field textarea { min-height: 62px; resize: vertical; }

.jsai-field input:focus,
.jsai-field textarea:focus {
	outline: none;
	border-color: var(--jsai-accent, #6E1B23);
	box-shadow: 0 0 0 3px rgba(110, 27, 35, 0.12);
}

.jsai-form-actions {
	display: flex;
	gap: 8px;
	margin: 12px 0 6px;
}

.jsai-btn {
	padding: 9px 15px;
	border: 1px solid var(--jsai-accent, #6E1B23);
	border-radius: 9px;
	background: var(--jsai-accent, #6E1B23);
	color: #fff;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.jsai-btn-ghost {
	background: transparent;
	color: var(--jsai-accent, #6E1B23);
}

.jsai-btn:focus-visible {
	outline: 2px solid var(--jsai-accent-soft, #C08A2E);
	outline-offset: 2px;
}

.jsai-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.jsai-error {
	margin: 0 0 8px;
	padding: 9px 11px;
	border-left: 3px solid var(--jsai-accent, #6E1B23);
	background: rgba(110, 27, 35, 0.06);
	font-size: 13px;
}

/* ------------------------------------------------------------------ Mobile */

@media (max-width: 560px) {
	.jsai-panel {
		right: 0 !important;
		left: 0 !important;
		bottom: 0;
		width: 100%;
		max-width: 100%;
		height: 100dvh;
		max-height: 100dvh;
		border-radius: 0;
	}

	.jsai-inline .jsai-panel {
		height: 480px;
		border-radius: var(--jsai-radius);
	}

	.jsai-launcher {
		bottom: 16px;
		padding: 11px 17px 11px 13px;
		font-size: 14px;
	}

	.jsai-right .jsai-launcher { right: 16px; }
	.jsai-left  .jsai-launcher { left: 16px; }

	.jsai-bubble { max-width: 92%; }
}

@media (prefers-reduced-motion: reduce) {
	.jsai-panel,
	.jsai-launcher,
	.jsai-chip,
	.jsai-source {
		transition: none;
	}
	.jsai-typing span { animation: none; opacity: 0.6; }
}

/* ------------------------------------------------------- Footer strip mode */

.jsai-footer-strip {
	width: 100%;
	padding: 40px 20px 48px;
	background: var(--jsai-accent-soft, #F3EBE0);
	border-top: 3px solid var(--jsai-accent, #6E1B23);
}

.jsai-footer-inner {
	max-width: 780px;
	margin: 0 auto;
}

.jsai-footer-heading {
	margin: 0 0 18px;
	font-size: 22px;
	line-height: 1.3;
	font-weight: 600;
	letter-spacing: -0.01em;
	color: var(--jsai-accent, #6E1B23);
	text-align: center;
}

.jsai-footer-embed .jsai-panel {
	width: 100%;
	max-width: none;
	box-shadow: 0 6px 28px rgba(27, 26, 23, 0.14);
}

@media (max-width: 560px) {
	.jsai-footer-strip {
		padding: 28px 14px 34px;
	}

	.jsai-footer-heading {
		font-size: 19px;
	}

	/* The mobile rule that makes floating panels full-screen must not
	   capture the footer embed, which stays in the document flow. */
	.jsai-footer-embed .jsai-panel {
		position: relative;
		inset: auto;
		width: 100%;
		height: auto;
		border-radius: var(--jsai-radius);
	}
}

/* ------------------------------------------- Opt-in contact prompt */

.jsai-lead-prompt {
	margin: 4px 0 10px 0;
	padding-left: 2px;
}

.jsai-lead-btn {
	appearance: none;
	border: 1px solid var(--jsai-accent, #6E1B23);
	background: transparent;
	color: var(--jsai-accent, #6E1B23);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	padding: 7px 14px;
	border-radius: 999px;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.jsai-lead-btn:hover,
.jsai-lead-btn:focus-visible {
	background: var(--jsai-accent, #6E1B23);
	color: #fff;
}
