/**
 * NexGen Coaching App - front-end styles.
 *
 * Scoped to .nga-* class names so no theme rule can collide. Colours come
 * from custom properties printed inline by the plugin.
 */

:root {
	--nga-primary: #5b6cff;
	--nga-accent: #00d4ff;
	--nga-ink: #10152b;
	--nga-bg: #ffffff;
	--nga-radius: 16px;
	--nga-tabbar-h: 64px;
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

.nga-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 11px 20px;
	border: 0;
	border-radius: 12px;
	font: inherit;
	font-weight: 600;
	font-size: 0.94rem;
	line-height: 1.2;
	cursor: pointer;
	text-decoration: none;
	transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.nga-btn:active {
	transform: translateY(1px);
}

.nga-btn:focus-visible {
	outline: 2px solid var(--nga-primary);
	outline-offset: 2px;
}

.nga-btn[disabled] {
	opacity: 0.6;
	cursor: default;
}

.nga-btn-primary {
	color: #fff;
	background: linear-gradient(145deg, var(--nga-primary), var(--nga-accent));
	box-shadow: 0 10px 22px -12px color-mix(in srgb, var(--nga-primary) 85%, transparent);
}

.nga-btn-ghost {
	color: inherit;
	background: rgba(127, 137, 181, 0.14);
}

.nga-btn.is-saved,
.nga-btn.is-on {
	background: rgba(61, 220, 151, 0.16);
	color: #14855c;
	box-shadow: none;
}

/* ------------------------------------------------------------------ */
/* Save-offline bar on materials                                       */
/* ------------------------------------------------------------------ */

.nga-offline-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	margin: 26px 0;
	padding: 16px 18px;
	border: 1px solid rgba(91, 108, 255, 0.22);
	border-radius: var(--nga-radius);
	background: linear-gradient(135deg, rgba(91, 108, 255, 0.07), rgba(0, 212, 255, 0.05));
}

.nga-offline-info {
	display: flex;
	align-items: center;
	gap: 13px;
	min-width: 0;
}

.nga-offline-icon {
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 12px;
	background: linear-gradient(145deg, var(--nga-primary), var(--nga-accent));
	color: #fff;
}

.nga-offline-icon svg {
	width: 20px;
	height: 20px;
}

.nga-offline-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.nga-offline-text strong {
	font-size: 0.97rem;
	line-height: 1.3;
}

.nga-offline-text span {
	font-size: 0.84rem;
	opacity: 0.72;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Bottom tab bar - only in installed/standalone mode                  */
/* ------------------------------------------------------------------ */

.nga-tabbar {
	display: none;
}

.nga-standalone .nga-tabbar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 9990;
	display: flex;
	align-items: stretch;
	justify-content: space-around;
	gap: 2px;
	padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
	background: var(--nga-bg);
	border-top: 1px solid rgba(16, 21, 43, 0.1);
	box-shadow: 0 -6px 24px -18px rgba(16, 21, 43, 0.8);
}

.nga-tab {
	flex: 1 1 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 3px;
	padding: 7px 4px;
	border-radius: 12px;
	color: inherit;
	text-decoration: none;
	opacity: 0.62;
	transition: opacity 0.15s ease, background 0.15s ease;
	-webkit-tap-highlight-color: transparent;
}

.nga-tab:hover,
.nga-tab:focus-visible {
	opacity: 1;
	text-decoration: none;
}

.nga-tab.is-active {
	opacity: 1;
	color: var(--nga-primary);
	background: rgba(91, 108, 255, 0.1);
}

.nga-tab-icon {
	display: block;
	width: 23px;
	height: 23px;
}

.nga-tab-icon svg {
	width: 100%;
	height: 100%;
	display: block;
}

.nga-tab-label {
	font-size: 0.69rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	line-height: 1.1;
}

/* Keep page content clear of the fixed bar. */
.nga-standalone body.nexgen-app-has-nav,
.nga-standalone.nexgen-app-has-nav body {
	padding-bottom: calc(var(--nga-tabbar-h) + env(safe-area-inset-bottom, 0px));
}

/* ------------------------------------------------------------------ */
/* Install banner                                                      */
/* ------------------------------------------------------------------ */

.nga-install {
	position: fixed;
	left: 50%;
	bottom: 18px;
	transform: translateX(-50%);
	z-index: 9995;
	width: min(520px, calc(100vw - 28px));
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 16px;
	border-radius: var(--nga-radius);
	background: var(--nga-bg);
	border: 1px solid rgba(16, 21, 43, 0.1);
	box-shadow: 0 22px 48px -22px rgba(16, 21, 43, 0.55);
	animation: nga-rise 0.35s ease both;
}

.nga-install[hidden] {
	display: none;
}

@keyframes nga-rise {
	from { opacity: 0; transform: translate(-50%, 14px); }
	to { opacity: 1; transform: translate(-50%, 0); }
}

.nga-install-icon {
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	border-radius: 12px;
}

.nga-install-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	flex: 1 1 auto;
}

.nga-install-body strong {
	font-size: 0.95rem;
}

.nga-install-body span {
	font-size: 0.83rem;
	opacity: 0.74;
	line-height: 1.4;
}

.nga-install-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 0 0 auto;
}

.nga-install-actions .nga-btn {
	padding: 9px 14px;
	font-size: 0.86rem;
}

.nga-standalone .nga-install {
	display: none;
}

/* ------------------------------------------------------------------ */
/* Toasts                                                              */
/* ------------------------------------------------------------------ */

.nga-toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	transform: translate(-50%, 16px);
	z-index: 9999;
	max-width: min(420px, calc(100vw - 32px));
	padding: 12px 18px;
	border-radius: 12px;
	background: rgba(16, 21, 43, 0.94);
	color: #fff;
	font-size: 0.89rem;
	line-height: 1.4;
	text-align: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease, transform 0.3s ease;
	box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.8);
}

.nga-toast.is-in {
	opacity: 1;
	transform: translate(-50%, 0);
}

.nga-toast-ok { background: rgba(20, 133, 92, 0.96); }
.nga-toast-warn { background: rgba(190, 60, 96, 0.96); }

.nga-standalone .nga-toast {
	bottom: calc(var(--nga-tabbar-h) + 18px + env(safe-area-inset-bottom, 0px));
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 600px) {
	.nga-offline-bar {
		align-items: stretch;
		flex-direction: column;
	}

	.nga-offline-bar .nga-btn {
		width: 100%;
	}

	.nga-install {
		flex-wrap: wrap;
	}

	.nga-install-actions {
		width: 100%;
		justify-content: flex-end;
	}
}

@media (prefers-color-scheme: dark) {
	.nga-standalone .nga-tabbar,
	.nga-install {
		background: #161b33;
		color: #eef1ff;
		border-color: rgba(255, 255, 255, 0.12);
	}
}

@media (prefers-reduced-motion: reduce) {
	.nga-btn,
	.nga-tab,
	.nga-toast,
	.nga-install {
		transition: none;
		animation: none;
	}
}
