/**
 * PWA for Fluent Community — estilos de front-end.
 *
 * Escopo estreito de propósito: todo seletor começa com .pwafc- e nada
 * seleciona elementos do tema. Um plugin que estiliza body, a ou button
 * quebra temas alheios de formas difíceis de diagnosticar.
 *
 * As cores herdam de variáveis CSS com fallback, então o tema pode
 * sobrescrever sem !important.
 */

.pwafc-prompt,
.pwafc-bulletin {
	--pwafc-bg: var( --pwafc-color-bg, #ffffff );
	--pwafc-fg: var( --pwafc-color-fg, #1a1a1a );
	--pwafc-muted: var( --pwafc-color-muted, #5c5c5c );
	--pwafc-accent: var( --pwafc-color-accent, #1e40af );
	--pwafc-accent-fg: var( --pwafc-color-accent-fg, #ffffff );
	--pwafc-border: var( --pwafc-color-border, rgba( 0, 0, 0, 0.12 ) );

	box-sizing: border-box;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.45;
	color: var( --pwafc-fg );
}

.pwafc-prompt *,
.pwafc-bulletin * {
	box-sizing: border-box;
}

/* ------------------------------------------------------------------ */
/* Prompts flutuantes                                                  */
/* ------------------------------------------------------------------ */

.pwafc-prompt {
	position: fixed;
	z-index: 99999;
	left: 50%;
	bottom: 16px;
	width: calc( 100% - 32px );
	max-width: 420px;
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 16px;
	background: var( --pwafc-bg );
	border: 1px solid var( --pwafc-border );
	border-radius: 14px;
	box-shadow: 0 12px 32px rgba( 0, 0, 0, 0.16 );

	/* Começa fora da tela e sem interatividade, para animar a entrada
	   sem causar layout shift no carregamento. */
	transform: translate( -50%, 130% );
	opacity: 0;
	pointer-events: none;
	transition: transform 0.28s ease, opacity 0.28s ease;
}

.pwafc-prompt.is-visible {
	transform: translate( -50%, 0 );
	opacity: 1;
	pointer-events: auto;
}

.pwafc-prompt__icon {
	width: 44px;
	height: 44px;
	border-radius: 10px;
	flex: 0 0 auto;
	object-fit: cover;
}

.pwafc-prompt__content {
	flex: 1 1 auto;
	min-width: 0;
}

.pwafc-prompt__title {
	display: block;
	font-size: 15px;
	font-weight: 600;
	margin-bottom: 2px;
}

.pwafc-prompt__body {
	margin: 0;
	font-size: 13.5px;
	color: var( --pwafc-muted );
}

.pwafc-prompt__actions {
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 0 0 auto;
}

/* ------------------------------------------------------------------ */
/* Botões                                                              */
/* ------------------------------------------------------------------ */

.pwafc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 8px 14px;
	font-size: 13.5px;
	font-weight: 600;
	line-height: 1.2;
	border: 1px solid transparent;
	border-radius: 8px;
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
	transition: opacity 0.15s ease;
}

.pwafc-btn:hover {
	opacity: 0.88;
}

/* Foco visível: remover o outline sem repor um indicador torna o
   componente inutilizável por teclado. */
.pwafc-btn:focus-visible,
.pwafc-bulletin__close:focus-visible {
	outline: 2px solid var( --pwafc-accent );
	outline-offset: 2px;
}

.pwafc-btn--primary {
	background: var( --pwafc-accent );
	color: var( --pwafc-accent-fg );
}

.pwafc-btn--ghost {
	background: transparent;
	color: var( --pwafc-muted );
	border-color: var( --pwafc-border );
}

/* ------------------------------------------------------------------ */
/* Mural                                                               */
/* ------------------------------------------------------------------ */

.pwafc-bulletin {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 14px 16px;
	background: var( --pwafc-bg );
	border: 1px solid var( --pwafc-border );
	border-radius: 12px;
	opacity: 0;
	transition: opacity 0.28s ease, transform 0.28s ease;
}

.pwafc-bulletin.is-visible {
	opacity: 1;
}

.pwafc-bulletin__image {
	width: 48px;
	height: 48px;
	border-radius: 8px;
	object-fit: cover;
	flex: 0 0 auto;
}

.pwafc-bulletin__content {
	flex: 1 1 auto;
	min-width: 0;
}

.pwafc-bulletin__title {
	display: block;
	font-weight: 600;
	margin-bottom: 3px;
}

.pwafc-bulletin__body p:first-child {
	margin-top: 0;
}

.pwafc-bulletin__body p:last-child {
	margin-bottom: 0;
}

.pwafc-bulletin__actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 0 0 auto;
}

.pwafc-bulletin__close {
	background: none;
	border: 0;
	font-size: 22px;
	line-height: 1;
	padding: 2px 6px;
	cursor: pointer;
	color: var( --pwafc-muted );
	border-radius: 6px;
}

/* Banner e toast flutuam; inline fica no fluxo da página. */
.pwafc-bulletin--banner,
.pwafc-bulletin--toast {
	position: fixed;
	z-index: 99998;
	left: 50%;
	width: calc( 100% - 32px );
	max-width: 640px;
	transform: translate( -50%, 20px );
	box-shadow: 0 8px 24px rgba( 0, 0, 0, 0.14 );
}

.pwafc-bulletin--banner.is-visible,
.pwafc-bulletin--toast.is-visible {
	transform: translate( -50%, 0 );
}

.pwafc-bulletin--banner {
	top: 16px;
}

.pwafc-bulletin--toast {
	bottom: 16px;
	max-width: 420px;
}

.pwafc-bulletin--bottom {
	top: auto;
	bottom: 16px;
}

.pwafc-bulletin--inline {
	margin: 0 0 12px;
}

.pwafc-bulletin--modal {
	position: fixed;
	z-index: 100000;
	top: 50%;
	left: 50%;
	width: calc( 100% - 32px );
	max-width: 480px;
	transform: translate( -50%, -46% );
	flex-direction: column;
	box-shadow: 0 24px 64px rgba( 0, 0, 0, 0.28 );
}

.pwafc-bulletin--modal.is-visible {
	transform: translate( -50%, -50% );
}

.pwafc-mural {
	margin: 0 0 16px;
}

.pwafc-mural--empty {
	display: none;
}

/* ------------------------------------------------------------------ */
/* Tema escuro e acessibilidade                                        */
/* ------------------------------------------------------------------ */

@media ( prefers-color-scheme: dark ) {
	.pwafc-prompt,
	.pwafc-bulletin {
		--pwafc-color-bg: #1c1c1e;
		--pwafc-color-fg: #f2f2f7;
		--pwafc-color-muted: #a1a1aa;
		--pwafc-color-border: rgba( 255, 255, 255, 0.14 );
		--pwafc-color-accent: #60a5fa;
		--pwafc-color-accent-fg: #0b1220;
	}
}

/* Respeita quem pediu menos animação no sistema — para parte das pessoas
   isso não é preferência estética, é o que evita enjoo. */
@media ( prefers-reduced-motion: reduce ) {
	.pwafc-prompt,
	.pwafc-bulletin {
		transition: opacity 0.01ms;
		transform: none;
	}

	.pwafc-prompt.is-visible,
	.pwafc-bulletin.is-visible {
		transform: none;
	}

	.pwafc-prompt {
		left: auto;
		right: 16px;
	}

	.pwafc-bulletin--banner,
	.pwafc-bulletin--toast,
	.pwafc-bulletin--modal {
		left: auto;
		right: 16px;
	}
}

@media ( max-width: 480px ) {
	.pwafc-prompt {
		flex-wrap: wrap;
	}

	.pwafc-prompt__actions {
		flex-direction: row;
		width: 100%;
	}

	.pwafc-prompt__actions .pwafc-btn {
		flex: 1 1 auto;
	}
}
