/**
 * Newdeal PWA Install Bubble — stylesheet
 *
 * Layered approach:
 *  - CSS variables fed by JS so admins can re-theme without touching code.
 *  - Single namespace `.ndpib-*` to avoid collisions with the active theme.
 *  - All selectors specificity-bounded by `.ndpib-bubble` / `.ndpib-modal`
 *    to prevent leakage into the rest of the page.
 *  - Mobile-first responsive breakpoint at 600px.
 *  - Reduced-motion support via prefers-reduced-motion.
 */

/* ─── Bubble container ────────────────────────────────────────────────── */

.ndpib-bubble {
	/* Themeable */
	--ndpib-bg: #1d2a5e;
	--ndpib-text: #ffffff;
	--ndpib-accent: #ffffff;
	--ndpib-accent-text: #1d2a5e;

	position: fixed;
	z-index: 999999;
	bottom: 20px;
	display: flex;
	align-items: center;
	gap: 14px;
	max-width: 460px;
	width: calc(100% - 32px);
	padding: 14px 18px;
	background: var(--ndpib-bg);
	color: var(--ndpib-text);
	border-radius: 14px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28),
				0 2px 6px rgba(0, 0, 0, 0.10);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 14px;
	line-height: 1.45;

	/* Entrance animation */
	opacity: 0;
	transform: translateY(24px);
	transition: opacity 220ms ease, transform 260ms cubic-bezier(.21, 1.02, .73, 1);
}

.ndpib-bubble.ndpib-visible {
	opacity: 1;
	transform: translateY(0);
}

/* Position variants */
.ndpib-bubble.ndpib-pos-bottom-center {
	left: 50%;
	transform: translate(-50%, 24px);
}
.ndpib-bubble.ndpib-pos-bottom-center.ndpib-visible {
	transform: translate(-50%, 0);
}
.ndpib-bubble.ndpib-pos-bottom-right  { right: 20px; }
.ndpib-bubble.ndpib-pos-bottom-left   { left: 20px;  }

/* ─── Bubble parts ────────────────────────────────────────────────────── */

.ndpib-bubble .ndpib-icon {
	flex-shrink: 0;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.14);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--ndpib-text);
}

.ndpib-bubble .ndpib-text {
	flex: 1 1 auto;
	min-width: 0;
}

.ndpib-bubble .ndpib-title {
	font-weight: 600;
	font-size: 15px;
	margin-bottom: 2px;
}

.ndpib-bubble .ndpib-message {
	opacity: 0.92;
	font-size: 13px;
}

.ndpib-bubble .ndpib-actions {
	display: flex;
	gap: 8px;
	flex-shrink: 0;
}

/* Buttons */
.ndpib-bubble .ndpib-btn {
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	padding: 8px 14px;
	border-radius: 8px;
	border: none;
	white-space: nowrap;
	transition: transform 120ms ease, opacity 120ms ease, box-shadow 120ms ease;
}

.ndpib-bubble .ndpib-btn-install {
	background: var(--ndpib-accent);
	color: var(--ndpib-accent-text);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.ndpib-bubble .ndpib-btn-install:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
}
.ndpib-bubble .ndpib-btn-install:active {
	transform: translateY(0);
}

.ndpib-bubble .ndpib-btn-dismiss {
	background: transparent;
	color: var(--ndpib-text);
	border: 1px solid rgba(255, 255, 255, 0.32);
}
.ndpib-bubble .ndpib-btn-dismiss:hover {
	background: rgba(255, 255, 255, 0.10);
}

/* Top-right close (×) — visually subtle, always there for keyboard users */
.ndpib-bubble .ndpib-close {
	position: absolute;
	top: 6px;
	right: 8px;
	background: transparent;
	border: none;
	color: var(--ndpib-text);
	opacity: 0.6;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 4px;
	transition: opacity 120ms ease;
}
.ndpib-bubble .ndpib-close:hover  { opacity: 1; }
.ndpib-bubble .ndpib-close:focus  { outline: 2px solid var(--ndpib-accent); outline-offset: 2px; }

/* ─── Mobile-tuned layout ─────────────────────────────────────────────── */

@media (max-width: 600px) {
	.ndpib-bubble {
		flex-wrap: wrap;
		max-width: none;
		width: calc(100% - 24px);
		bottom: 12px;
		padding: 14px 16px;
	}
	.ndpib-bubble.ndpib-pos-bottom-center {
		left: 12px;
		right: 12px;
		transform: translateY(24px);
	}
	.ndpib-bubble.ndpib-pos-bottom-center.ndpib-visible {
		transform: translateY(0);
	}
	.ndpib-bubble.ndpib-pos-bottom-right,
	.ndpib-bubble.ndpib-pos-bottom-left {
		left: 12px;
		right: 12px;
	}
	.ndpib-bubble .ndpib-actions {
		width: 100%;
		justify-content: flex-end;
		margin-top: 6px;
	}
	.ndpib-bubble .ndpib-btn-install,
	.ndpib-bubble .ndpib-btn-dismiss {
		flex: 1 1 auto;
		text-align: center;
	}
}

/* ─── Manual install instructions modal ───────────────────────────────── */

.ndpib-modal {
	--ndpib-bg: #1d2a5e;
	--ndpib-text: #ffffff;
	--ndpib-accent: #ffffff;
	--ndpib-accent-text: #1d2a5e;

	position: fixed;
	inset: 0;
	background: rgba(15, 20, 45, 0.55);
	backdrop-filter: blur(2px);
	z-index: 1000000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;

	opacity: 0;
	transition: opacity 200ms ease;
}

.ndpib-modal.ndpib-visible { opacity: 1; }

.ndpib-modal-card {
	background: #ffffff;
	color: #1d2a5e;
	border-radius: 14px;
	width: 100%;
	max-width: 440px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
	overflow: hidden;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	transform: scale(0.96);
	transition: transform 220ms cubic-bezier(.21, 1.02, .73, 1);
}

.ndpib-modal.ndpib-visible .ndpib-modal-card {
	transform: scale(1);
}

.ndpib-modal-header {
	background: var(--ndpib-bg);
	color: var(--ndpib-text);
	padding: 14px 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.ndpib-modal-header h3 {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
}
.ndpib-modal-close {
	background: transparent;
	border: none;
	color: var(--ndpib-text);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	opacity: 0.75;
	padding: 4px 8px;
	border-radius: 4px;
}
.ndpib-modal-close:hover { opacity: 1; }

.ndpib-modal-body {
	padding: 18px;
	font-size: 14px;
	line-height: 1.55;
}
.ndpib-modal-body h4 {
	margin: 0 0 12px;
	font-size: 15px;
	font-weight: 600;
}

.ndpib-steps {
	list-style: none;
	padding: 0;
	margin: 0;
}
.ndpib-steps li {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 8px 0;
	border-bottom: 1px dashed rgba(29, 42, 94, 0.12);
}
.ndpib-steps li:last-child { border-bottom: none; }

.ndpib-step-num {
	flex-shrink: 0;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--ndpib-bg);
	color: var(--ndpib-text);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 12px;
	margin-top: 1px;
}

.ndpib-modal-footer {
	padding: 12px 18px 18px;
	display: flex;
	justify-content: flex-end;
}

.ndpib-modal .ndpib-btn-install {
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	padding: 8px 18px;
	border-radius: 8px;
	border: none;
	background: var(--ndpib-bg);
	color: var(--ndpib-text);
}
.ndpib-modal .ndpib-btn-install:hover {
	filter: brightness(1.1);
}

/* ─── Accessibility: respect prefers-reduced-motion ───────────────────── */

@media (prefers-reduced-motion: reduce) {
	.ndpib-bubble,
	.ndpib-modal,
	.ndpib-modal-card {
		transition: opacity 100ms linear;
	}
	.ndpib-bubble {
		transform: none !important;
	}
}

/* ─── Print: never print the bubble ───────────────────────────────────── */

@media print {
	.ndpib-bubble,
	.ndpib-modal { display: none !important; }
}
