/**
 * Beaver PWA install prompt and update toast.
 *
 * Colours come from the two inline custom properties printed by the plugin, so
 * the prompt matches the app it is offering rather than the active theme.
 */

.beaver-pwa-prompt {
	position: fixed;
	z-index: 99999;
	display: flex;
	align-items: center;
	gap: 12px;
	box-sizing: border-box;
	width: calc( 100% - 32px );
	max-width: 380px;
	padding: 14px 16px;
	background: var( --beaver-pwa-surface, #fff );
	color: #1d2327;
	border-radius: 14px;
	box-shadow: 0 8px 30px rgba( 0, 0, 0, 0.18 ), 0 1px 2px rgba( 0, 0, 0, 0.08 );
	font-size: 14px;
	line-height: 1.45;
	opacity: 0;
	transform: translateY( 12px );
	transition: opacity 0.22s ease, transform 0.22s ease;
}

.beaver-pwa-prompt.is-visible {
	opacity: 1;
	transform: none;
}

.beaver-pwa-prompt[hidden] {
	display: none;
}

/* Placement --------------------------------------------------------------- */

.beaver-pwa-prompt--bottom-right {
	right: 16px;
	bottom: calc( 16px + env( safe-area-inset-bottom ) );
}

.beaver-pwa-prompt--bottom-left {
	left: 16px;
	bottom: calc( 16px + env( safe-area-inset-bottom ) );
}

.beaver-pwa-prompt--bottom-full {
	left: 16px;
	right: 16px;
	bottom: calc( 16px + env( safe-area-inset-bottom ) );
	max-width: none;
	width: auto;
}

.beaver-pwa-prompt--top-full {
	left: 16px;
	right: 16px;
	top: calc( 16px + env( safe-area-inset-top ) );
	max-width: none;
	width: auto;
	transform: translateY( -12px );
}

.beaver-pwa-prompt--top-full.is-visible {
	transform: none;
}

/* Contents ---------------------------------------------------------------- */

.beaver-pwa-prompt__icon {
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
	border-radius: 12px;
	object-fit: cover;
	background: rgba( 0, 0, 0, 0.04 );
}

.beaver-pwa-prompt__body {
	flex: 1 1 auto;
	min-width: 0;
}

.beaver-pwa-prompt__title {
	display: block;
	font-size: 14px;
	font-weight: 600;
}

.beaver-pwa-prompt__text {
	display: block;
	font-size: 13px;
	opacity: 0.72;
}

.beaver-pwa-prompt__text[hidden] {
	display: none;
}

/* The iOS share glyph, drawn so no icon font is needed. */
.beaver-pwa-prompt__share {
	display: inline-block;
	width: 0.62em;
	height: 0.78em;
	margin: 0 0.15em;
	vertical-align: -0.1em;
	background: currentColor;
	-webkit-mask: no-repeat center / contain url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 20'%3E%3Cpath d='M8 1.5 4.8 4.7l1.1 1.1L7.3 4.4v8.2h1.4V4.4l1.4 1.4 1.1-1.1L8 1.5Z'/%3E%3Cpath d='M2.5 8v9.5c0 .6.4 1 1 1h9c.6 0 1-.4 1-1V8h-1.4v9.1H3.9V8H2.5Z'/%3E%3C/svg%3E" );
	mask: no-repeat center / contain url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 20'%3E%3Cpath d='M8 1.5 4.8 4.7l1.1 1.1L7.3 4.4v8.2h1.4V4.4l1.4 1.4 1.1-1.1L8 1.5Z'/%3E%3Cpath d='M2.5 8v9.5c0 .6.4 1 1 1h9c.6 0 1-.4 1-1V8h-1.4v9.1H3.9V8H2.5Z'/%3E%3C/svg%3E" );
}

.beaver-pwa-prompt__action,
.beaver-pwa-button {
	flex: 0 0 auto;
	padding: 9px 16px;
	border: 0;
	border-radius: 999px;
	background: var( --beaver-pwa-theme, #1d2327 );
	color: #fff;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: filter 0.15s ease;
}

.beaver-pwa-prompt__action:hover,
.beaver-pwa-button:hover {
	filter: brightness( 1.15 );
}

.beaver-pwa-prompt__action[hidden],
.beaver-pwa-button[hidden] {
	display: none;
}

.beaver-pwa-prompt__close {
	position: absolute;
	top: 6px;
	right: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: currentColor;
	opacity: 0.5;
	cursor: pointer;
}

.beaver-pwa-prompt__close:hover {
	opacity: 1;
}

.beaver-pwa-prompt :focus-visible {
	outline: 2px solid var( --beaver-pwa-theme, #1d2327 );
	outline-offset: 2px;
}

/* Update toast ------------------------------------------------------------ */

.beaver-pwa-toast {
	position: fixed;
	z-index: 99999;
	left: 50%;
	bottom: calc( 20px + env( safe-area-inset-bottom ) );
	transform: translateX( -50% );
	display: flex;
	align-items: center;
	gap: 12px;
	max-width: calc( 100% - 32px );
	padding: 10px 12px 10px 18px;
	border-radius: 999px;
	background: #1d2327;
	color: #fff;
	font-size: 13px;
	box-shadow: 0 8px 30px rgba( 0, 0, 0, 0.25 );
}

.beaver-pwa-toast__action {
	padding: 6px 14px;
	border: 0;
	border-radius: 999px;
	background: #fff;
	color: #1d2327;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.beaver-pwa-toast__close {
	padding: 0 4px;
	border: 0;
	background: none;
	color: inherit;
	font-size: 18px;
	line-height: 1;
	opacity: 0.6;
	cursor: pointer;
}

/* Small screens ----------------------------------------------------------- */

@media ( max-width: 480px ) {
	.beaver-pwa-prompt {
		left: 12px;
		right: 12px;
		width: auto;
		max-width: none;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.beaver-pwa-prompt {
		transition: none;
	}
}
