/**
 * plugins/themes/mjliTheme/styles/mjli-ui.css (v1.6)
 *
 * Distributed under the GNU GPL v3.
 *
 * Site-wide extras: sliding underline in the main menu, a soft glow in the
 * footer, and the "MJLI Help" chat assistant (js/mjli-ui.js).
 */

/* ---------- Main menu: sliding underline (desktop) ---------- */
@media (min-width: 992px) {
	.pkp_navigation_primary > li:not(.mjli_current) > a {
		position: relative;
	}

	.pkp_navigation_primary > li:not(.mjli_current) > a:hover,
	.pkp_navigation_primary > li:not(.mjli_current) > a:focus {
		border-bottom-color: transparent;
	}

	.pkp_navigation_primary > li:not(.mjli_current) > a:before {
		content: "";
		position: absolute;
		left: 14px;
		right: 14px;
		bottom: -2px;
		height: 2px;
		background: #245C06;
		transform: scaleX(0);
		transform-origin: left center;
		transition: transform 0.25s ease;
	}

	.pkp_navigation_primary > li:first-child:not(.mjli_current) > a:before {
		left: 0;
	}

	.pkp_navigation_primary > li:not(.mjli_current) > a:hover:before,
	.pkp_navigation_primary > li:not(.mjli_current) > a:focus:before,
	.pkp_navigation_primary > li.show:not(.mjli_current) > a:before {
		transform: scaleX(1);
	}
}

/* ---------- Footer glow ---------- */
.pkp_structure_footer_wrapper {
	position: relative;
	overflow: hidden;
}

.pkp_structure_footer_wrapper:before {
	content: "";
	position: absolute;
	right: -120px;
	top: -180px;
	width: 420px;
	height: 420px;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(117, 186, 43, 0.22), rgba(117, 186, 43, 0) 70%);
	pointer-events: none;
}

.pkp_structure_footer {
	position: relative;
}

/* ---------- MJLI Help (FAQ chat) ---------- */
.mjli_help {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 1000;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 14px;
	font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	color: #14210E;
}

/* Article pages have a back-to-top button and, on phones, an action bar */
.pkp_page_article.pkp_op_view .mjli_help {
	bottom: 84px;
}

@media (max-width: 899px) {
	.pkp_page_article.pkp_op_view .mjli_help {
		bottom: calc(88px + env(safe-area-inset-bottom));
	}
}

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

.mjli_help_row {
	display: flex;
	align-items: center;
	gap: 12px;
}

.mjli_help_launcher {
	position: relative;
	width: 60px;
	height: 60px;
	border: 0;
	border-radius: 50%;
	background: #245C06;
	color: #FFFFFF;
	box-shadow: 0 12px 28px rgba(15, 42, 2, 0.35);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s ease, background-color 0.2s ease;
}

.mjli_help_launcher:hover,
.mjli_help_launcher:focus {
	background: #173D04;
	transform: translateY(-2px);
}

.mjli_help_launcher.mjli_help_ping:after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 2px solid #75BA2B;
	animation: mjliHelpPing 2s ease-out infinite;
	pointer-events: none;
}

.mjli_help_launcher svg {
	display: block;
}

.mjli_help_teaser {
	min-height: 44px;
	padding: 10px 16px;
	border: 1px solid #E2E6DC;
	border-radius: 999px;
	background: #FFFFFF;
	box-shadow: 0 8px 24px rgba(15, 42, 2, 0.15);
	font: inherit;
	font-size: 14px;
	font-weight: 500;
	color: #14210E;
	cursor: pointer;
	animation: mjliHelpPop 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.mjli_help_panel {
	width: 390px;
	max-width: calc(100vw - 32px);
	height: 580px;
	max-height: calc(100vh - 120px);
	background: #FFFFFF;
	border: 1px solid #E2E6DC;
	border-radius: 22px;
	box-shadow: 0 24px 60px rgba(15, 42, 2, 0.28), 0 2px 8px rgba(15, 42, 2, 0.12);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transform-origin: bottom right;
	animation: mjliHelpPop 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.mjli_help_panel[hidden] {
	display: none;
}

.mjli_help_head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 12px 14px 18px;
	background: #173D04;
	color: #FFFFFF;
}

.mjli_help_avatar {
	position: relative;
	flex: none;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #75BA2B;
	color: #0F2A02;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: "Source Serif 4", Georgia, serif;
	font-weight: 700;
	font-size: 13px;
}

.mjli_help_avatar:after {
	content: "";
	position: absolute;
	right: 0;
	bottom: 0;
	width: 11px;
	height: 11px;
	border-radius: 50%;
	background: #9FD65A;
	border: 2px solid #173D04;
}

.mjli_help_titles {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.mjli_help_title {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: #FFFFFF;
	font-family: inherit;
	line-height: 1.3;
}

.mjli_help_sub {
	font-size: 12px;
	color: #C3D2B8;
}

.mjli_help_close {
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #FFFFFF;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.mjli_help_close:hover,
.mjli_help_close:focus {
	background: rgba(255, 255, 255, 0.12);
}

.mjli_help_log {
	flex: 1;
	overflow-y: auto;
	padding: 18px 16px;
	background: #F7F6F1;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.mjli_help_msg {
	max-width: 88%;
	padding: 12px 14px;
	font-size: 14px;
	line-height: 1.55;
	white-space: pre-line;
	animation: mjliHelpPop 0.25s ease-out;
}

.mjli_help_bot {
	align-self: flex-start;
	background: #FFFFFF;
	border: 1px solid #E2E6DC;
	border-radius: 4px 16px 16px 16px;
	color: #14210E;
}

.mjli_help_user {
	align-self: flex-end;
	max-width: 80%;
	background: #245C06;
	color: #FFFFFF;
	border-radius: 16px 4px 16px 16px;
}

.mjli_help_link {
	display: inline-block;
	margin-top: 8px;
	font-size: 13px;
	font-weight: 600;
	color: #245C06;
	white-space: normal;
}

.mjli_help_typing {
	align-self: flex-start;
	display: flex;
	gap: 5px;
	padding: 14px 16px;
	background: #FFFFFF;
	border: 1px solid #E2E6DC;
	border-radius: 4px 16px 16px 16px;
}

.mjli_help_typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #4F5A48;
	animation: mjliHelpBlink 1.2s infinite;
}

.mjli_help_typing span:nth-child(2) {
	animation-delay: 0.2s;
}

.mjli_help_typing span:nth-child(3) {
	animation-delay: 0.4s;
}

.mjli_help_foot {
	border-top: 1px solid #E2E6DC;
	background: #FFFFFF;
	padding: 10px 12px 0;
}

.mjli_help_chips {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding-bottom: 10px;
	scrollbar-width: thin;
}

.mjli_help_chip {
	flex: none;
	min-height: 36px;
	padding: 6px 12px;
	border: 1px solid #C9D1BF;
	border-radius: 999px;
	background: #FFFFFF;
	font: inherit;
	font-size: 13px;
	font-weight: 500;
	color: #1F4510;
	cursor: pointer;
	white-space: nowrap;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.mjli_help_chip:hover,
.mjli_help_chip:focus {
	background: #EAF2E1;
	border-color: #245C06;
}

.mjli_help_ask {
	display: flex;
	gap: 8px;
	align-items: center;
	padding-bottom: 10px;
}

.mjli_help_input {
	flex: 1;
	min-width: 0;
	min-height: 44px;
	padding: 10px 16px;
	border: 1px solid #C9D1BF;
	border-radius: 999px;
	background: #F7F6F1;
	font: inherit;
	font-size: 14px;
	color: #14210E;
}

.mjli_help_input:focus {
	outline: none;
	border-color: #245C06;
	box-shadow: 0 0 0 3px rgba(117, 186, 43, 0.25);
}

.mjli_help_send {
	flex: none;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: #245C06;
	color: #FFFFFF;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.mjli_help_send:hover,
.mjli_help_send:focus {
	background: #173D04;
}

.mjli_help_note {
	margin: 0;
	padding: 0 4px 12px;
	font-size: 11px;
	line-height: 1.4;
	color: #4F5A48;
}

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

@keyframes mjliHelpPop {
	from { opacity: 0; transform: translateY(12px) scale(0.97); }
	to { opacity: 1; transform: none; }
}

@keyframes mjliHelpPing {
	0% { transform: scale(1); opacity: 0.55; }
	100% { transform: scale(1.7); opacity: 0; }
}

@keyframes mjliHelpBlink {
	0%, 80%, 100% { opacity: 0.25; }
	40% { opacity: 1; }
}

@media print {
	.mjli_help {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mjli_help_panel,
	.mjli_help_msg,
	.mjli_help_teaser,
	.mjli_help_typing span {
		animation: none;
	}

	.mjli_help_launcher.mjli_help_ping:after {
		display: none;
	}

	.pkp_navigation_primary > li > a:before,
	.mjli_help_launcher {
		transition: none;
	}
}
