/* ================================================================
   BGL Notifications — toasts + confirm modal
   ----------------------------------------------------------------
   Single style sheet shared by /js/bgl_notifications.js. The module
   creates and attaches every element at runtime so this file only
   contains classes — there's no markup to keep in sync.

   Palette (matches dashboard-inbox.css and the BGL design system):
     - turquoise         #428583  → success / brand accent
     - red               #dc2626  → error / destructive
     - saffron           #ea9921  → warning
     - dark teal text    #003842
     - panel surface     #ffffff with 1px #e2e6ea border
     - shadow            soft grey, no harsh outlines

   Z-index plan: toasts sit at 11000; the modal sits at 12000 so
   it always wins focus when an action requires confirmation.
   ================================================================ */

/* -------- Toast container ----------------------------------------- */
.bgl-toast-stack {
	position: fixed;
	top: 1rem;
	right: 1rem;
	z-index: 11000;
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	pointer-events: none;
	max-width: min(420px, calc(100vw - 2rem));
}

@media (max-width: 640px) {
	.bgl-toast-stack {
		left: 0.75rem;
		right: 0.75rem;
		top: 0.75rem;
		max-width: none;
		align-items: stretch;
	}
}

/* -------- Toast item ---------------------------------------------- */
.bgl-toast {
	pointer-events: auto;
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	padding: 0.85rem 1rem;
	background: #ffffff;
	border: 1px solid #e2e6ea;
	border-left: 4px solid #428583;
	border-radius: 12px;
	box-shadow: 0 12px 28px rgba(0, 26, 31, 0.12), 0 2px 6px rgba(0, 26, 31, 0.06);
	font-family: 'Fustat', 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
	color: #001a1f;
	opacity: 0;
	transform: translateY(-8px) scale(0.98);
	transition: opacity 0.22s ease, transform 0.22s ease;
}
.bgl-toast.is-showing {
	opacity: 1;
	transform: translateY(0) scale(1);
}
.bgl-toast.is-leaving {
	opacity: 0;
	transform: translateY(-6px) scale(0.97);
}

.bgl-toast--success { border-left-color: #428583; }
.bgl-toast--error   { border-left-color: #dc2626; }
.bgl-toast--warning { border-left-color: #ea9921; }
.bgl-toast--info    { border-left-color: #00838f; }

.bgl-toast-icon {
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 1.05rem;
	background: rgba(66, 133, 131, 0.12);
	color: #428583;
}
.bgl-toast--error   .bgl-toast-icon { background: rgba(220, 38, 38, 0.10); color: #dc2626; }
.bgl-toast--warning .bgl-toast-icon { background: rgba(234, 153, 33, 0.14); color: #b06b07; }
.bgl-toast--info    .bgl-toast-icon { background: rgba(0, 131, 143, 0.10); color: #00838f; }

.bgl-toast-body {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding-top: 4px;
}
.bgl-toast-title {
	font-weight: 700;
	font-size: 0.9rem;
	color: #001a1f;
	line-height: 1.3;
}
.bgl-toast-message {
	font-size: 0.86rem;
	color: #3d5a62;
	line-height: 1.45;
	word-break: break-word;
}

.bgl-toast-action {
	align-self: flex-start;
	margin-top: 6px;
	background: transparent;
	border: none;
	padding: 0;
	font: inherit;
	font-size: 0.82rem;
	font-weight: 700;
	color: #428583;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
}
.bgl-toast-action:hover {
	color: #003842;
}

.bgl-toast-close {
	flex: 0 0 auto;
	background: transparent;
	border: none;
	cursor: pointer;
	color: #6b7177;
	padding: 4px;
	margin: -2px -4px 0 0;
	border-radius: var(--bgl-btn-radius);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease, color 0.15s ease;
	line-height: 1;
}
.bgl-toast-close:hover {
	background: #f1f3f4;
	color: #001a1f;
}
.bgl-toast-close .ph {
	font-size: 1rem;
}

/* -------- Modal --------------------------------------------------- */
.bgl-modal-overlay {
	position: fixed;
	inset: 0;
	z-index: 12000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	background: rgba(0, 26, 31, 0.55);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	opacity: 0;
	transition: opacity 0.18s ease;
}
.bgl-modal-overlay.is-showing {
	opacity: 1;
}

.bgl-modal {
	background: #ffffff;
	border-radius: 14px;
	box-shadow: 0 24px 60px rgba(0, 26, 31, 0.28), 0 4px 14px rgba(0, 26, 31, 0.12);
	width: min(440px, 100%);
	max-height: calc(100vh - 2rem);
	overflow: hidden;
	font-family: 'Fustat', 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
	color: #001a1f;
	transform: translateY(8px) scale(0.98);
	transition: transform 0.22s ease;
	display: flex;
	flex-direction: column;
}
.bgl-modal-overlay.is-showing .bgl-modal {
	transform: translateY(0) scale(1);
}

.bgl-modal-header {
	padding: 1.1rem 1.25rem 0.5rem;
	display: flex;
	align-items: flex-start;
	gap: 0.9rem;
}
.bgl-modal-icon {
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 1.25rem;
	background: rgba(66, 133, 131, 0.12);
	color: #428583;
}
.bgl-modal--danger .bgl-modal-icon {
	background: rgba(220, 38, 38, 0.10);
	color: #dc2626;
}
.bgl-modal--warning .bgl-modal-icon {
	background: rgba(234, 153, 33, 0.14);
	color: #b06b07;
}
.bgl-modal-title {
	font-family: 'Crimson Pro', Georgia, serif;
	font-weight: 400;
	font-size: 1.2rem;
	letter-spacing: -0.3px;
	color: #001a1f;
	margin: 0;
	line-height: 1.25;
	padding-top: 6px;
}

.bgl-modal-body {
	padding: 0.5rem 1.25rem 1rem;
	font-size: 0.95rem;
	line-height: 1.5;
	color: #3d5a62;
}
.bgl-modal-body p { margin: 0 0 0.5rem; }
.bgl-modal-body p:last-child { margin-bottom: 0; }

.bgl-modal-actions {
	padding: 0.85rem 1.25rem 1.1rem;
	display: flex;
	justify-content: flex-end;
	gap: 0.6rem;
	flex-wrap: wrap;
}
.bgl-modal-btn {
	font-family: 'Fustat', 'Manrope', sans-serif;
	font-size: 0.9rem;
	font-weight: 600;
	padding: 0.6rem 1.1rem;
	border-radius: var(--bgl-btn-radius);
	border: 1px solid transparent;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	line-height: 1.2;
	text-decoration: none;
	box-sizing: border-box;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
	min-height: 38px;
}
.bgl-modal-btn:active { transform: translateY(1px); }
.bgl-modal-btn--cancel {
	background: #ffffff;
	border-color: #d5dde0;
	color: #3d5a62;
}
.bgl-modal-btn--cancel:hover {
	background: #f5f7f8;
	border-color: #b8c4c8;
	color: #001a1f;
}
.bgl-modal-btn--confirm {
	background: #428583;
	border-color: #428583;
	color: #ffffff;
}
.bgl-modal-btn--confirm:hover,
.bgl-modal-btn--confirm:visited,
.bgl-modal-btn--confirm:focus {
	color: #ffffff;
}
.bgl-modal-btn--confirm:hover {
	background: #366f6d;
	border-color: #366f6d;
}
.bgl-modal-btn--secondary {
	background: #ffffff;
	border-color: rgba(66, 133, 131, 0.45);
	color: #2a6f6d;
}
.bgl-modal-btn--secondary:hover,
.bgl-modal-btn--secondary:visited,
.bgl-modal-btn--secondary:focus {
	color: #003842;
}
.bgl-modal-btn--secondary:hover {
	background: rgba(66, 133, 131, 0.08);
	border-color: #428583;
}
.bgl-modal-actions--stacked {
	flex-direction: column;
	align-items: stretch;
	gap: 0.55rem;
}
.bgl-modal-actions--stacked .bgl-modal-btn {
	width: 100%;
}
.bgl-modal--danger .bgl-modal-btn--confirm {
	background: #dc2626;
	border-color: #dc2626;
}
.bgl-modal--danger .bgl-modal-btn--confirm:hover {
	background: #b91c1c;
	border-color: #b91c1c;
}
.bgl-modal--warning .bgl-modal-btn--confirm {
	background: #ea9921;
	border-color: #ea9921;
}
.bgl-modal--warning .bgl-modal-btn--confirm:hover {
	background: #c97f0e;
	border-color: #c97f0e;
}

/* -------- Premium invitation (not a hard paywall) ----------------- */
.bgl-modal--premium {
	width: min(440px, 100%);
}
.bgl-modal--premium .bgl-modal-header,
.bgl-modal--premium .bgl-modal-actions {
	flex-shrink: 0;
}
.bgl-modal-header--premium {
	flex-direction: column;
	align-items: flex-start;
	gap: 0;
	padding: 1.3rem 1.35rem 0.25rem;
}
.bgl-modal--premium .bgl-modal-icon {
	width: 52px;
	height: 52px;
	font-size: 1.55rem;
	margin-bottom: 0.9rem;
	background: rgba(66, 133, 131, 0.12);
	color: #428583;
}
.bgl-modal-eyebrow {
	margin: 0 0 0.28rem;
	font-family: 'Fustat', 'Manrope', sans-serif;
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #428583;
	line-height: 1.3;
}
.bgl-modal--premium .bgl-modal-title {
	font-size: 1.45rem;
	font-weight: 600;
	padding-top: 0;
	letter-spacing: -0.4px;
	line-height: 1.2;
}
.bgl-modal--premium .bgl-modal-body {
	padding: 0.45rem 1.35rem 0.2rem;
	overflow-y: auto;
	flex: 1 1 auto;
	min-height: 0;
}
.bgl-modal-premium-context {
	margin-top: 0.7rem !important;
	font-size: 0.9rem;
	font-weight: 600;
	color: #001a1f;
	line-height: 1.45;
	overflow-wrap: break-word;
}
.bgl-modal-premium-benefits {
	list-style: none;
	margin: 0.95rem 0 0.15rem;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.72rem;
}
.bgl-modal-premium-benefit {
	display: flex;
	align-items: flex-start;
	gap: 0.65rem;
}
.bgl-modal-premium-benefit-icon {
	flex: 0 0 auto;
	width: 1.15rem;
	height: 1.15rem;
	margin-top: 0.12rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #428583;
	font-size: 1.05rem;
	line-height: 1;
}
.bgl-modal-premium-benefit-copy {
	display: flex;
	flex-direction: column;
	gap: 0.08rem;
	min-width: 0;
}
.bgl-modal-premium-benefit-copy strong {
	font-size: 0.9rem;
	font-weight: 700;
	color: #001a1f;
	line-height: 1.3;
}
.bgl-modal-premium-benefit-copy span {
	font-size: 0.82rem;
	line-height: 1.4;
	color: #3d5a62;
}
.bgl-modal--premium .bgl-modal-actions {
	padding: 0.95rem 1.35rem 1.2rem;
	margin-top: 0.45rem;
	border-top: 1px solid #e8eef0;
}

@media (max-width: 480px) {
	.bgl-modal--premium .bgl-modal-actions {
		flex-direction: column-reverse;
		align-items: stretch;
	}
	.bgl-modal--premium .bgl-modal-btn {
		width: 100%;
	}
}

/* -------- Premium upgrade gate (compact orange CTA) ----------------- */
.bgl-modal--premium-upgrade {
	width: min(360px, calc(100% - 2rem));
}
.bgl-modal--premium-upgrade .bgl-modal-header--premium {
	padding: 1.05rem 1.2rem 0.1rem;
}
.bgl-modal--premium-upgrade .bgl-modal-icon {
	width: 38px;
	height: 38px;
	font-size: 1.2rem;
	margin-bottom: 0.55rem;
	background: rgba(234, 153, 33, 0.14);
	color: #ea9921;
	border-radius: 10px;
}
.bgl-modal-eyebrow--upgrade {
	color: #c97f0e;
	margin-bottom: 0.35rem;
}
.bgl-modal--premium-upgrade .bgl-modal-title {
	font-size: 1.18rem;
	font-weight: 600;
	line-height: 1.25;
	margin: 0;
}
.bgl-modal--premium-upgrade .bgl-modal-body {
	padding: 0.4rem 1.2rem 0.05rem;
}
.bgl-modal--premium-upgrade .bgl-modal-body p {
	font-size: 0.84rem;
	line-height: 1.45;
	color: #3d5a62;
	margin-bottom: 0.35rem;
}
.bgl-modal--premium-upgrade .bgl-modal-premium-context--muted {
	margin-top: 0.15rem !important;
	font-size: 0.8rem;
	font-weight: 500;
	color: #6a7a82;
	line-height: 1.4;
}
.bgl-modal--premium-upgrade .bgl-modal-actions {
	padding: 0.7rem 1.2rem 0.95rem;
	margin-top: 0.35rem;
	border-top: 1px solid #eceff1;
}
.bgl-modal-actions--stacked-compact {
	gap: 0.45rem;
}
.bgl-modal--premium-upgrade .bgl-modal-btn--confirm {
	background: #ea9921;
	border-color: #ea9921;
	color: #ffffff;
	font-weight: 700;
}
.bgl-modal--premium-upgrade .bgl-modal-btn--confirm:hover,
.bgl-modal--premium-upgrade .bgl-modal-btn--confirm:visited,
.bgl-modal--premium-upgrade .bgl-modal-btn--confirm:focus {
	color: #ffffff;
	background: #c97f0e;
	border-color: #c97f0e;
}
.bgl-modal--premium-upgrade .bgl-modal-btn--secondary {
	background: #ffffff;
	border-color: rgba(0, 56, 66, 0.16);
	color: #2a4a4f;
	font-weight: 600;
}
.bgl-modal--premium-upgrade .bgl-modal-btn--secondary:hover {
	background: #f5f7f8;
	border-color: rgba(0, 56, 66, 0.24);
	color: #001a1f;
}
.bgl-modal-actions--stacked-compact .bgl-modal-btn--cancel {
	background: transparent;
	border-color: transparent;
	color: #7c8b8f;
	font-weight: 600;
	min-height: 32px;
	padding: 0.35rem 0.5rem;
}
.bgl-modal-actions--stacked-compact .bgl-modal-btn--cancel:hover {
	background: transparent;
	border-color: transparent;
	color: #3d5a62;
}
.bgl-modal--premium-upgrade .bgl-modal-btn:focus-visible {
	outline-color: #ea9921;
}

@media (max-width: 480px) {
	.bgl-modal--premium-upgrade .bgl-modal-actions {
		flex-direction: column;
		align-items: stretch;
	}
	.bgl-modal--premium-upgrade .bgl-modal-btn {
		width: 100%;
	}
}

/* Focus outline that matches the BGL palette (no browser default blue) */
.bgl-toast-close:focus-visible,
.bgl-modal-btn:focus-visible {
	outline: 2px solid #428583;
	outline-offset: 2px;
}

/* When the page is scroll-locked because a modal is open we also
   freeze the body so backdrop scrolling doesn't leak through. JS
   adds the class on open and removes it on close. */
html.bgl-modal-open,
body.bgl-modal-open {
	overflow: hidden !important;
}

/* Respect users who prefer reduced motion: disable the slide-in /
   slide-out animations but keep the opacity fade as a soft cue. */
@media (prefers-reduced-motion: reduce) {
	.bgl-toast,
	.bgl-toast.is-showing,
	.bgl-toast.is-leaving,
	.bgl-modal,
	.bgl-modal-overlay.is-showing .bgl-modal {
		transform: none !important;
		transition: opacity 0.15s ease !important;
	}
}
