/* =========================================================================
   PAT Site Alerts - frontend + admin preview
   Per-alert colors arrive as CSS variables set by site-alerts.js:
   --psa-bg, --psa-text, --psa-accent, --psa-border, --psa-border-w, --psa-radius,
   --psa-title-size, --psa-msg-size, --psa-cta
   ========================================================================= */

.psa,
.psa * {
	box-sizing: border-box;
}

.psa {
	font-family: inherit;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

.psa button {
	font-family: inherit;
	text-transform: none;
	letter-spacing: normal;
	min-height: 0;
	margin: 0;
	box-shadow: none;
	line-height: 1;
}

.psa h2 {
	margin: 0;
	padding: 0;
	border: 0;
}

.psa-surface {
	position: relative;
	overflow: hidden;
	background: var(--psa-bg);
	color: var(--psa-text);
	border: 0 solid var(--psa-border);
}

.psa-border-bottom { border-bottom-width: var(--psa-border-w); }
.psa-border-top { border-top-width: var(--psa-border-w); }
.psa-border-both { border-top-width: var(--psa-border-w); border-bottom-width: var(--psa-border-w); }
.psa-border-all { border-width: var(--psa-border-w); }

.psa-size-compact { --psa-pad-y: 8px; }
.psa-size-standard { --psa-pad-y: 14px; }
.psa-size-large { --psa-pad-y: 22px; }

.psa-iconsize-small { --psa-icon: 20px; }
.psa-iconsize-medium { --psa-icon: 28px; }
.psa-iconsize-large { --psa-icon: 40px; }
.psa-iconsize-xlarge { --psa-icon: 56px; }

/* ---------- Shared content ---------- */

.psa-inner {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	gap: 16px;
}

.psa-align-center .psa-inner {
	justify-content: center;
	text-align: center;
}

.psa-text {
	min-width: 0;
	font-size: 15px;
	font-weight: 500;
}

.psa-title {
	font-weight: 700;
	color: var(--psa-accent);
	font-size: var(--psa-title-size, inherit);
}

.psa-sep {
	margin-right: 0.15em;
}

.psa-msg {
	font-size: var(--psa-msg-size, 15px);
}

.psa-msg p {
	margin: 0;
}

.psa-msg a {
	color: inherit;
	text-decoration: underline;
}

.psa-layout-inline .psa-text > .psa-title,
.psa-layout-inline .psa-text > .psa-msg,
.psa-layout-inline .psa-text > .psa-msg p {
	display: inline;
}

.psa-layout-stacked .psa-text > .psa-title {
	display: block;
	margin-bottom: 2px;
}

.psa-layout-stacked .psa-text > .psa-msg {
	font-weight: 400;
}

/* Icon */
.psa-icon {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	color: var(--psa-accent);
}

.psa-icon svg,
.psa-icon img {
	width: var(--psa-icon);
	height: var(--psa-icon);
	display: block;
}

.psa-icon img {
	object-fit: contain;
}

.psa-icon .psa-emoji {
	font-size: var(--psa-icon);
	display: block;
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.psa-ianim-bounce { animation: psa-i-bounce 2s ease-in-out infinite; }
.psa-ianim-pulse { animation: psa-i-pulse 2s ease-in-out infinite; }
.psa-ianim-shake { animation: psa-i-shake 2.5s ease-in-out infinite; }
.psa-ianim-spin { animation: psa-i-spin 6s linear infinite; }

/* Buttons */
.psa-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	flex-shrink: 0;
}

.psa-align-center .psa-actions {
	justify-content: center;
}

.psa .psa-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	white-space: nowrap;
	text-decoration: none;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.psa .psa-btn:hover {
	transform: translateY(-1px);
}

.psa .psa-btn-pill {
	padding: 8px 20px;
	border-radius: 999px;
	color: inherit;
	background: rgba(255, 255, 255, 0.18);
	background: color-mix(in srgb, currentColor 16%, transparent);
	border: 2px solid rgba(255, 255, 255, 0.4);
	border: 2px solid color-mix(in srgb, currentColor 40%, transparent);
}

.psa .psa-btn-pill:hover {
	background: color-mix(in srgb, currentColor 28%, transparent);
	color: inherit;
}

.psa-has-cta-color .psa-btn-pill {
	border-color: var(--psa-cta);
}

.psa .psa-btn-solid {
	padding: 9px 22px;
	border-radius: 8px;
	background: var(--psa-cta, #ffffff);
	border: 2px solid var(--psa-cta, #ffffff);
	color: #1e293b;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.psa .psa-btn-solid:hover {
	color: #1e293b;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.psa-has-cta-color .psa-btn-solid,
.psa-has-cta-color .psa-btn-solid:hover {
	color: #ffffff;
}

.psa .psa-btn-outline {
	padding: 8px 20px;
	border-radius: 8px;
	background: transparent;
	border: 2px solid var(--psa-cta, currentColor);
	color: var(--psa-cta, inherit);
}

.psa .psa-btn-outline:hover {
	background: color-mix(in srgb, currentColor 12%, transparent);
	color: var(--psa-cta, inherit);
}

.psa .psa-btn-link {
	padding: 4px 2px;
	background: none;
	border: 0;
	color: var(--psa-cta, inherit);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Close */
.psa .psa-close {
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 8px;
	cursor: pointer;
	color: inherit;
	background: rgba(255, 255, 255, 0.15);
	background: color-mix(in srgb, currentColor 14%, transparent);
	border: 2px solid rgba(255, 255, 255, 0.25);
	border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
	transition: transform 0.2s ease, background 0.2s ease;
}

.psa .psa-close:hover {
	transform: scale(1.08);
	background: color-mix(in srgb, currentColor 26%, transparent);
}

/* ---------- Banner ---------- */

.psa-host-banner {
	position: fixed;
	left: 0;
	right: 0;
	z-index: 1000000;
	display: flex;
	flex-direction: column;
}

.psa-host-banner-top { top: 0; }
.psa-host-banner-bottom { bottom: 0; }

.psa-banner {
	width: 100%;
	container-type: inline-size;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
	transition: transform 0.45s ease, opacity 0.45s ease;
	--psa-fall: 120px;
}

.psa-banner .psa-inner {
	max-width: 1400px;
	margin: 0 auto;
	padding: var(--psa-pad-y, 14px) 20px;
}

.psa-banner .psa-text {
	flex: 1 1 auto;
}

.psa-banner.psa-align-center .psa-text {
	flex: 0 1 auto;
}

.psa-banner.psa-pos-top { transform: translateY(-100%); opacity: 0; }
.psa-banner.psa-pos-bottom { transform: translateY(100%); opacity: 0; }
.psa-banner.psa-enter-fade { transform: none; }
.psa-banner.psa-enter-zoom { transform: scale(0.97); }
.psa-banner.psa-enter-bounce { transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1); }
.psa-banner.psa-in { transform: none; opacity: 1; }

/* ---------- Modal ---------- */

.psa-modal-overlay {
	position: fixed;
	inset: 0;
	z-index: 1000001;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(15, 23, 42, 0.6);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.psa-modal-overlay.psa-in { opacity: 1; }

.psa-modal.psa-surface {
	width: 100%;
	max-width: 560px;
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	border-radius: var(--psa-radius);
	background: #ffffff;
	color: #475569;
	box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
	container-type: inline-size;
	transform: scale(0.92) translateY(20px);
	transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.psa-w-sm.psa-modal { max-width: 400px; }
.psa-w-md.psa-modal { max-width: 560px; }
.psa-w-lg.psa-modal { max-width: 720px; }
.psa-w-xl.psa-modal { max-width: 900px; }

.psa-enter-slide .psa-modal { transform: translateY(-40px); }
.psa-enter-fade .psa-modal { transform: none; }
.psa-enter-zoom .psa-modal { transform: scale(0.85); }
.psa-enter-bounce .psa-modal { transform: scale(0.5); }
.psa-enter-none .psa-modal { transform: none; transition: none; }
.psa-modal-overlay.psa-in .psa-modal { transform: none; }

.psa-modal.psa-iconsize-small { --psa-icon: 32px; }
.psa-modal.psa-iconsize-medium { --psa-icon: 48px; }
.psa-modal.psa-iconsize-large { --psa-icon: 64px; }
.psa-modal.psa-iconsize-xlarge { --psa-icon: 84px; }

.psa-modal-head {
	position: relative;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	padding: 30px 56px 24px;
	text-align: center;
	background: var(--psa-bg);
	color: var(--psa-text);
	--psa-fall: 220px;
}

.psa-modal-head > .psa-icon,
.psa-modal-head > .psa-title {
	position: relative;
	z-index: 1;
}

.psa-modal.psa-layout-inline .psa-modal-head {
	flex-direction: row;
	justify-content: center;
	gap: 14px;
	text-align: left;
}

.psa-modal.psa-layout-inline { --psa-icon: 36px; }

.psa-modal-head .psa-title {
	margin: 0;
	font-size: var(--psa-title-size, 22px);
	line-height: 1.3;
	color: var(--psa-text);
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.psa-modal-head .psa-close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
}

.psa-modal-body {
	padding: 24px 32px 30px;
	text-align: left;
}

.psa-modal.psa-align-center .psa-modal-body {
	text-align: center;
}

.psa-modal-body .psa-msg {
	font-size: var(--psa-msg-size, 16px);
	line-height: 1.7;
	color: #475569;
}

.psa-modal-body .psa-msg p {
	margin: 0 0 0.8em;
}

.psa-modal-body .psa-msg p:last-child {
	margin-bottom: 0;
}

.psa-modal-body .psa-msg a {
	color: #2563eb;
}

.psa-modal-body .psa-actions {
	margin-top: 22px;
}

.psa-modal-body .psa-btn-pill,
.psa-modal-body .psa-btn-solid {
	padding: 12px 30px;
	font-size: 15px;
	background: var(--psa-cta, var(--psa-bg));
	color: var(--psa-text);
	border: 0;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.psa-modal-body .psa-btn-pill:hover,
.psa-modal-body .psa-btn-solid:hover {
	background: var(--psa-cta, var(--psa-bg));
	color: var(--psa-text);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.psa-modal.psa-has-cta-color .psa-modal-body .psa-btn-pill,
.psa-modal.psa-has-cta-color .psa-modal-body .psa-btn-solid {
	color: #ffffff;
}

.psa-modal-body .psa-btn-outline,
.psa-modal-body .psa-btn-outline:hover {
	padding: 11px 28px;
	font-size: 15px;
	color: var(--psa-cta, #1e293b);
	border-color: var(--psa-cta, #cbd5e1);
}

.psa-modal-body .psa-btn-link,
.psa-modal-body .psa-btn-link:hover {
	font-size: 15px;
	color: var(--psa-cta, #2563eb);
}

html.psa-modal-open {
	overflow: hidden;
}

/* ---------- Toast ---------- */

.psa-host-toast {
	position: fixed;
	z-index: 1000000;
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 16px;
	pointer-events: none;
	max-width: 100%;
}

.psa-host-toast-top-right { top: var(--psa-top-offset, 0px); right: 0; }
.psa-host-toast-top-left { top: var(--psa-top-offset, 0px); left: 0; }
.psa-host-toast-top-center { top: var(--psa-top-offset, 0px); left: 50%; transform: translateX(-50%); }
.psa-host-toast-bottom-right { bottom: 0; right: 0; }
.psa-host-toast-bottom-left { bottom: 0; left: 0; }
.psa-host-toast-bottom-center { bottom: 0; left: 50%; transform: translateX(-50%); }

.psa-toast,
.psa-pill-card,
.psa-inline {
	container-type: inline-size;
	--psa-fall: 160px;
}

.psa-toast.psa-iconsize-small,
.psa-pill-card.psa-iconsize-small,
.psa-inline.psa-iconsize-small { --psa-icon: 18px; }
.psa-toast.psa-iconsize-medium,
.psa-pill-card.psa-iconsize-medium,
.psa-inline.psa-iconsize-medium { --psa-icon: 24px; }
.psa-toast.psa-iconsize-large,
.psa-pill-card.psa-iconsize-large,
.psa-inline.psa-iconsize-large { --psa-icon: 32px; }
.psa-toast.psa-iconsize-xlarge,
.psa-pill-card.psa-iconsize-xlarge,
.psa-inline.psa-iconsize-xlarge { --psa-icon: 44px; }

.psa-toast {
	pointer-events: auto;
	width: min(380px, calc(100vw - 32px));
	border-radius: var(--psa-radius);
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
	opacity: 0;
	transform: translateY(16px);
	transition: transform 0.4s ease, opacity 0.4s ease;
}

.psa-host-toast-top-right .psa-toast,
.psa-host-toast-top-left .psa-toast,
.psa-host-toast-top-center .psa-toast {
	transform: translateY(-16px);
}

.psa-toast.psa-enter-fade,
.psa-toast.psa-enter-none { transform: none; }
.psa-toast.psa-enter-zoom { transform: scale(0.9); }
.psa-toast.psa-enter-bounce { transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1); }
.psa-toast.psa-in { opacity: 1; transform: none; }

.psa-toast .psa-inner,
.psa-pill-card .psa-inner {
	align-items: flex-start;
	gap: 12px;
	padding: 16px;
}

.psa-toast .psa-body,
.psa-pill-card .psa-body {
	flex: 1;
	min-width: 0;
}

.psa-toast .psa-msg,
.psa-pill-card .psa-msg {
	font-size: var(--psa-msg-size, 14px);
	font-weight: 400;
}

.psa-toast .psa-actions,
.psa-pill-card .psa-actions {
	margin-top: 10px;
}

.psa-toast .psa-close,
.psa-pill-card .psa-close {
	width: 28px;
	height: 28px;
}

.psa-progress {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 3px;
	background: rgba(255, 255, 255, 0.2);
	z-index: 2;
}

.psa-progress span {
	display: block;
	height: 100%;
	background: var(--psa-border);
	transform-origin: left;
	animation: psa-progress linear forwards;
}

/* ---------- Floating pill ---------- */

.psa-pill-wrap {
	position: fixed;
	z-index: 1000000;
	display: flex;
	flex-direction: column-reverse;
	align-items: flex-end;
	gap: 10px;
	opacity: 0;
	transform: translateY(12px);
	transition: transform 0.4s ease, opacity 0.4s ease;
}

.psa-pill-bottom-right { bottom: 20px; right: 20px; }
.psa-pill-bottom-left { bottom: 20px; left: 20px; align-items: flex-start; }
.psa-pill-top-right { top: calc(var(--psa-top-offset, 0px) + 20px); right: 20px; flex-direction: column; }
.psa-pill-top-left { top: calc(var(--psa-top-offset, 0px) + 20px); left: 20px; flex-direction: column; align-items: flex-start; }

.psa-pill-wrap.psa-in { opacity: 1; transform: none; }

.psa .psa-pill.psa-surface {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px 10px 12px;
	border-radius: 999px;
	border: 2px solid var(--psa-border);
	font-size: 14px;
	font-weight: 700;
	line-height: 1.2;
	cursor: pointer;
	color: var(--psa-text);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	--psa-icon: 22px;
}

.psa .psa-pill.psa-surface:hover {
	transform: translateY(-2px);
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
}

.psa-pill-label {
	max-width: 240px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.psa-pill-card {
	display: none;
	width: min(360px, calc(100vw - 40px));
	border-radius: var(--psa-radius);
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}

.psa-open .psa-pill-card {
	display: block;
	animation: psa-pop 0.25s ease;
}

/* ---------- Inline ---------- */

.psa-inline {
	margin: 16px 0;
	border-radius: var(--psa-radius);
	opacity: 0;
	transition: opacity 0.4s ease;
}

.psa-inline.psa-in { opacity: 1; }

.psa-inline .psa-inner {
	padding: calc(var(--psa-pad-y, 14px) + 4px) 22px;
}

.psa-inline .psa-body {
	flex: 1;
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px 16px;
}

.psa-inline.psa-align-center .psa-body {
	justify-content: center;
}

.psa-inline .psa-text {
	flex: 1 1 260px;
}

/* ---------- Decorative effects ---------- */

.psa-fx {
	position: absolute;
	inset: 0;
	z-index: 0;
	overflow: hidden;
	pointer-events: none;
}

.psa-fx span {
	position: absolute;
	top: -24px;
	line-height: 1;
	color: rgba(255, 255, 255, 0.85);
	text-shadow: 0 0 6px rgba(255, 255, 255, 0.45);
	animation-name: psa-fall;
	animation-timing-function: linear;
	animation-iteration-count: infinite;
	will-change: transform;
}

.psa-fx-leaves span {
	text-shadow: none;
}

.psa-fx-rise span {
	top: auto;
	bottom: -24px;
	color: rgba(255, 182, 193, 0.9);
	animation-name: psa-rise;
}

.psa-fx-twinkle span {
	animation-name: psa-twinkle;
	animation-timing-function: ease-in-out;
	color: rgba(255, 255, 255, 0.9);
}

.psa-fx .psa-confetti {
	width: 7px;
	height: 11px;
	border-radius: 2px;
	opacity: 0.9;
}

/* ---------- Keyframes ---------- */

@keyframes psa-fall {
	0% { transform: translate(0, 0) rotate(0deg); opacity: 0; }
	10% { opacity: 1; }
	90% { opacity: 1; }
	100% { transform: translate(24px, var(--psa-fall, 140px)) rotate(360deg); opacity: 0; }
}

@keyframes psa-rise {
	0% { transform: translateY(0) scale(0.8); opacity: 0; }
	15% { opacity: 1; }
	100% { transform: translateY(calc(var(--psa-fall, 140px) * -1)) scale(1.1); opacity: 0; }
}

@keyframes psa-twinkle {
	0%, 100% { opacity: 0.15; transform: scale(0.7); }
	50% { opacity: 1; transform: scale(1.15); }
}

@keyframes psa-progress {
	from { transform: scaleX(1); }
	to { transform: scaleX(0); }
}

@keyframes psa-pop {
	from { opacity: 0; transform: translateY(8px) scale(0.98); }
	to { opacity: 1; transform: none; }
}

@keyframes psa-i-bounce {
	0%, 100% { transform: translateY(0) rotate(-5deg); }
	50% { transform: translateY(-5px) rotate(5deg); }
}

@keyframes psa-i-pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.15); }
}

@keyframes psa-i-shake {
	0%, 60%, 100% { transform: translateX(0); }
	10%, 30%, 50% { transform: translateX(-3px) rotate(-4deg); }
	20%, 40% { transform: translateX(3px) rotate(4deg); }
}

@keyframes psa-i-spin {
	to { transform: rotate(360deg); }
}

/* ---------- Narrow containers (phones, or the admin mobile preview) ---------- */

@container (max-width: 640px) {
	.psa-inner {
		gap: 10px;
		flex-wrap: wrap;
	}

	.psa-banner .psa-inner,
	.psa-inner {
		padding-left: 14px;
		padding-right: 14px;
	}

	.psa-text {
		font-size: 13.5px;
	}

	.psa-msg {
		font-size: var(--psa-msg-size, 13.5px);
	}

	.psa-icon svg,
	.psa-icon img {
		width: calc(var(--psa-icon) * 0.8);
		height: calc(var(--psa-icon) * 0.8);
	}

	.psa-icon .psa-emoji {
		font-size: calc(var(--psa-icon) * 0.8);
	}

	.psa-inner > .psa-text {
		flex: 1 1 0;
	}

	.psa-inner > .psa-close {
		order: 3;
	}

	.psa-inner > .psa-actions {
		order: 4;
		flex-basis: 100%;
	}

	.psa .psa-btn {
		font-size: 12.5px;
		padding: 7px 14px;
	}

	.psa .psa-close {
		width: 28px;
		height: 28px;
	}

	.psa-modal-head {
		padding: 24px 48px 18px;
	}

	.psa-modal-head .psa-title {
		font-size: var(--psa-title-size, 18px);
	}

	.psa-modal-body {
		padding: 20px 20px 24px;
	}

	.psa-modal-body .psa-msg {
		font-size: var(--psa-msg-size, 15px);
	}

	.psa-modal-body .psa-btn-pill,
	.psa-modal-body .psa-btn-solid,
	.psa-modal-body .psa-btn-outline {
		padding: 10px 24px;
		font-size: 14px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.psa-fx {
		display: none;
	}

	.psa,
	.psa * {
		animation: none !important;
		transition: none !important;
	}
}

/* ---------- Admin preview frame ---------- */

.psa-preview .psa-host-banner,
.psa-preview .psa-host-toast,
.psa-preview .psa-modal-overlay,
.psa-preview .psa-pill-wrap {
	position: absolute;
}

.psa-preview .psa-host-toast-top-right,
.psa-preview .psa-host-toast-top-left,
.psa-preview .psa-host-toast-top-center {
	top: 0;
}

/* Bricks fixed header follows the banner stack height (set inline by site-alerts.js). */
.main-pat-header.brxe-section {
	transition: top 0.3s ease;
}
