/**
 * Majaa – zentrale Bausteine für Meldungen, kurze Einblendungen und Dialoge.
 *
 * Werte aus tokens.css (--majaa-notice-…, --majaa-toast-…, --majaa-dialog-…).
 *
 *   .majaa-ui-notice                Meldung im Seitenfluss
 *     --info | --success | --warning | --error
 *   .majaa-ui-toast                 kurze Einblendung unten (verschwindet von selbst)
 *   dialog.majaa-ui-dialog          Popup (natives <dialog>), Titel h2, Aktionen
 *                                   in .majaa-dialog-actions, Schließen .majaa-dialog-close
 *
 * Fremde Meldungen werden hier angebunden: BuddyPress (#message, .bp-template-notice)
 * und Paid Member Subscriptions (.pms_success-messages-wrapper, .pms_field-errors-wrapper).
 * Bestehende Majaa-Dialoge (Anfrage, Limit, Plus, Bildprüfung, Teilen) lesen dieselben Tokens
 * in ihren eigenen Dateien.
 *
 * Wird von Majaa Core auf allen Frontend-Seiten geladen (auch für Gäste).
 */

/* Meldung */
.majaa-ui-notice,
body #buddypress div#message,
body #buddypress .bp-template-notice,
body .pms_success-messages-wrapper,
body .pms_field-errors-wrapper,
body .pms-warning-message-wrapper {
	box-sizing: border-box;
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0 0 20px;
	padding: var(--majaa-notice-padding);
	border: 1px solid var(--majaa-notice-info-border);
	border-radius: var(--majaa-notice-radius);
	background: var(--majaa-notice-info-bg);
	box-shadow: none;
	color: var(--majaa-color-ink);
	font: 400 15px / 1.5 var(--majaa-font-body);
	text-align: left;
}
.majaa-ui-notice > :is(p, span),
body #buddypress div#message > p,
body #buddypress .bp-template-notice > p,
body :is(.pms_success-messages-wrapper, .pms_field-errors-wrapper, .pms-warning-message-wrapper) p {
	/* !important: Theme und BuddyPress färben den Absatz selbst (roter Balken mit eigenem Symbol). */
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	color: inherit !important;
	font: inherit !important;
}
.majaa-ui-notice > :is(p, span)::before,
body #buddypress div#message > p::before,
body #buddypress .bp-template-notice > p::before,
body :is(.pms_success-messages-wrapper, .pms_field-errors-wrapper, .pms-warning-message-wrapper) p::before {
	content: none !important;
	display: none !important;
}
/* Symbol vor der Meldung: Kreis mit i, Haken, Ausrufezeichen */
.majaa-ui-notice::before,
body #buddypress div#message::before,
body #buddypress .bp-template-notice::before,
body .pms_success-messages-wrapper::before,
body .pms_field-errors-wrapper::before {
	content: "";
	display: block;
	flex: none;
	width: 20px;
	height: 20px;
	margin-top: 2px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* Erfolg */
.majaa-ui-notice--success,
body #buddypress div#message.updated,
body #buddypress div#message.success,
body #buddypress .bp-template-notice.updated,
body .pms_success-messages-wrapper {
	border-color: var(--majaa-notice-success-border);
	background: var(--majaa-notice-success-bg);
}
.majaa-ui-notice--success::before,
body #buddypress div#message.updated::before,
body #buddypress div#message.success::before,
body #buddypress .bp-template-notice.updated::before,
body .pms_success-messages-wrapper::before {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8 12 3 3 5-6'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8 12 3 3 5-6'/%3E%3C/svg%3E");
}
/* Achtung */
.majaa-ui-notice--warning,
body #buddypress div#message.warning,
body .pms-warning-message-wrapper {
	border-color: var(--majaa-notice-warning-border);
	background: var(--majaa-notice-warning-bg);
}
/* Fehler: Rand und Symbol im Fehler-Rot, Text im dunkleren Rot (Designsystem 6) */
.majaa-ui-notice--error,
body #buddypress div#message.error,
body #buddypress .bp-template-notice.error,
body .pms_field-errors-wrapper {
	border-color: var(--majaa-notice-error-border);
	background: var(--majaa-notice-error-bg);
	color: var(--majaa-color-error-text);
}
.majaa-ui-notice--error::before,
body #buddypress div#message.error::before,
body #buddypress .bp-template-notice.error::before,
body .pms_field-errors-wrapper::before {
	background: var(--majaa-color-error);
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v6M12 16.5h.01'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v6M12 16.5h.01'/%3E%3C/svg%3E");
}

/* Kurze Einblendung */
.majaa-ui-toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	z-index: 100001;
	box-sizing: border-box;
	width: max-content;
	max-width: calc(100vw - 32px);
	padding: 12px 18px;
	border: 1px solid var(--majaa-notice-info-border);
	border-radius: var(--majaa-notice-radius);
	background: var(--majaa-notice-info-bg);
	box-shadow: var(--majaa-toast-shadow);
	color: var(--majaa-color-ink);
	font: 400 15px / 1.4 var(--majaa-font-body);
	transform: translateX(-50%);
}

/* Dialog: Grundgerüst für neue Popups (dialog.majaa-ui-dialog) */
dialog.majaa-ui-dialog {
	box-sizing: border-box;
	width: min(var(--majaa-dialog-width), calc(100vw - 32px));
	max-height: calc(100dvh - 32px);
	overflow: auto;
	margin: auto;
	padding: var(--majaa-dialog-padding);
	border: 1px solid var(--majaa-dialog-border);
	border-radius: var(--majaa-dialog-radius);
	background: var(--majaa-dialog-bg);
	box-shadow: var(--majaa-dialog-shadow);
	color: var(--majaa-color-ink);
	font: 400 16px / 1.55 var(--majaa-font-body);
}
dialog.majaa-ui-dialog::backdrop {
	background: var(--majaa-dialog-backdrop);
}
dialog.majaa-ui-dialog h2 {
	margin: 0 40px 16px 0;
	color: var(--majaa-color-ink);
	font: 400 var(--majaa-dialog-title-size) / 1.3 var(--majaa-font-heading);
}
dialog.majaa-ui-dialog .majaa-dialog-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: var(--majaa-button-spacing);
	margin-top: 24px;
}
dialog.majaa-ui-dialog .majaa-dialog-close {
	position: absolute;
	top: 8px;
	right: 8px;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--majaa-color-ink);
	cursor: pointer;
}
@media (max-width: 600px) {
	/* Handy: Dialog als Blatt von unten */
	dialog.majaa-ui-dialog {
		inset: auto 0 0;
		width: 100vw;
		max-width: 100vw;
		margin: 0;
		border-radius: var(--majaa-dialog-radius) var(--majaa-dialog-radius) 0 0;
	}
}

/* Das Theme färbt Meldungstexte über eigene Variablen (Grimlock-Alert, Rot #e74c3c,
 * weiße Schrift, mit !important und langen Selektoren). Innerhalb der Majaa-Meldung
 * werden diese Variablen neutral gesetzt; Farbe und Fläche kommen von der Meldung. */
.majaa-ui-notice,
body #buddypress div#message,
body #buddypress .bp-template-notice,
body .pms_success-messages-wrapper,
body .pms_field-errors-wrapper,
body .pms-warning-message-wrapper {
	--grimlock-alert-color: currentColor;
	--grimlock-alert-background-color: transparent;
	--grimlock-alert-danger-color: currentColor;
	--grimlock-alert-danger-background-color: transparent;
	--grimlock-alert-padding: 0;
	--grimlock-alert-margin-bottom: 0;
	--grimlock-alert-font-size: inherit;
}
