/**
 * KI-Kennzeichnung: Frontend
 * Copyright (c) 2026 ULTIM8MEDIA, https://ultim8media.de
 * GPL-2.0-or-later
 *
 * Variablen werden per Inline-CSS aus den Plugin-Einstellungen gesetzt.
 * Das Badge ist ein eigenes Element (.u8-ki-badge, per JS eingefuegt).
 * Ohne JavaScript greift ::after als Notloesung.
 */

:root {
	--ki-badge-text: "✦ KI-generiert";
	--ki-badge-text-mod: "✦ KI-bearbeitet";
	--ki-size: 12px;
	--ki-size-mobile: 10px;
	--ki-bg: rgba(0, 0, 0, 0.42);
	--ki-fg: rgba(255, 255, 255, 0.92);
	--ki-bg-light: rgba(255, 255, 255, 0.6);
	--ki-fg-light: rgba(0, 0, 0, 0.85);
}

.ki-label {
	position: relative;
}

/* Wrapper aus dem Content-Filter (Fallback ohne Wrapper-Attribut) */
.ki-label-wrap {
	display: block;
}

.ki-label-wrap--image {
	display: inline-block;
	max-width: 100%;
	line-height: 0;
	vertical-align: top;
}

.ki-label.elementor-widget-image {
	line-height: 0;
}

.ki-label > img,
.ki-label > .elementor-widget-container > img,
.ki-label > figure > img,
.ki-label > a > img {
	display: block;
	max-width: 100%;
	height: auto;
}

/* Badge-Element */
.ki-label > .u8-ki-badge,
html:not(.ki-js) .ki-label::after {
	position: absolute;
	right: 12px;
	bottom: 12px;
	left: auto;
	top: auto;
	width: auto;
	height: auto;
	z-index: 5;
	box-sizing: border-box;
	display: block;
	margin: 0;
	transform: none;
	transition: none;

	font-family: inherit;
	font-size: var(--ki-size);
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: 0.01em;
	white-space: nowrap;

	color: var(--ki-fg);
	background: var(--ki-bg);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);

	padding: 5px 10px;
	border-radius: 4px;
	pointer-events: none;
}

html:not(.ki-js) .ki-label::after {
	content: var(--ki-badge-text);
}

html:not(.ki-js) .ki-label.ki-label--modified::after {
	content: var(--ki-badge-text-mod);
}

/* Position (Klasse aus Einstellung oder Mediathek, Abstand kommt per Inline-CSS) */
.ki-label.ki-label--br > .u8-ki-badge, html:not(.ki-js) .ki-label.ki-label--br::after { right: 12px; bottom: 12px; left: auto; top: auto; }
.ki-label.ki-label--bl > .u8-ki-badge, html:not(.ki-js) .ki-label.ki-label--bl::after { left: 12px; bottom: 12px; right: auto; top: auto; }
.ki-label.ki-label--tr > .u8-ki-badge, html:not(.ki-js) .ki-label.ki-label--tr::after { right: 12px; top: 12px; left: auto; bottom: auto; }
.ki-label.ki-label--tl > .u8-ki-badge, html:not(.ki-js) .ki-label.ki-label--tl::after { left: 12px; top: 12px; right: auto; bottom: auto; }

/* Helle Badge fuer dunkle Bilder */
.ki-label.ki-label--light > .u8-ki-badge,
html:not(.ki-js) .ki-label.ki-label--light::after {
	color: var(--ki-fg-light);
	background: var(--ki-bg-light);
}

/* AI-Icon: zwei Buchstaben als Maske, Bild scheint durch */
.ki-label.ki-label--icon > .u8-ki-badge,
html:not(.ki-js) .ki-label.ki-label--icon::after {
	width: 36px;
	height: 28px;
	padding: 0;
	border-radius: 0;
	font-size: 0;
	line-height: 0;
	color: transparent;
	background: #FFFFFFCC;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 620.6 483.3%22%3E%3Cpath fill=%22%23000000%22 fill-rule=%22evenodd%22 d=%22M486.2 403.5 620.6 0 540.9 8.2 496.9 135.9 455.4 260.6ZM0 483.3 89.4 473 150.9 376.1 329.1 355.7 339.3 443.3 417.6 433.8 371.9 26.5 266.9 37.1ZM200.4 291 302.9 120.8 320.8 278Z%22/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 620.6 483.3%22%3E%3Cpath fill=%22%23000000%22 fill-rule=%22evenodd%22 d=%22M486.2 403.5 620.6 0 540.9 8.2 496.9 135.9 455.4 260.6ZM0 483.3 89.4 473 150.9 376.1 329.1 355.7 339.3 443.3 417.6 433.8 371.9 26.5 266.9 37.1ZM200.4 291 302.9 120.8 320.8 278Z%22/%3E%3C/svg%3E") center / contain no-repeat;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}
html:not(.ki-js) .ki-label.ki-label--icon::after {
	content: "";
}
.ki-label.ki-label--icon.ki-label--icon-dark > .u8-ki-badge,
html:not(.ki-js) .ki-label.ki-label--icon.ki-label--icon-dark::after {
	background: #3A3A3ACC;
}

/* Verschachtelt: Label nur am aeusseren Element */
.ki-label .ki-label > .u8-ki-badge { display: none; }
html:not(.ki-js) .ki-label .ki-label::after { content: none; }

/* Bild-Widget: Label innerhalb des Border-Radius halten */
.ki-label.elementor-widget-image:not(.ki-label--noclip),
.ki-label-wrap--image:not(.ki-label--noclip) {
	overflow: hidden;
}

/* Screenreader-Text, per JS eingefuegt */
.ki-label .ki-sr {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	clip-path: inset(50%) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

@media (max-width: 767px) {
	.ki-label > .u8-ki-badge,
	html:not(.ki-js) .ki-label::after {
		font-size: var(--ki-size-mobile);
		padding: 4px 8px;
		right: 8px;
		bottom: 8px;
	}
	.ki-label.ki-label--br > .u8-ki-badge, html:not(.ki-js) .ki-label.ki-label--br::after { right: 8px; bottom: 8px; }
	.ki-label.ki-label--bl > .u8-ki-badge, html:not(.ki-js) .ki-label.ki-label--bl::after { left: 8px; bottom: 8px; }
	.ki-label.ki-label--tr > .u8-ki-badge, html:not(.ki-js) .ki-label.ki-label--tr::after { right: 8px; top: 8px; }
	.ki-label.ki-label--tl > .u8-ki-badge, html:not(.ki-js) .ki-label.ki-label--tl::after { left: 8px; top: 8px; }
	.ki-label.ki-label--icon > .u8-ki-badge,
	html:not(.ki-js) .ki-label.ki-label--icon::after {
		width: 28px;
		height: 22px;
		padding: 0;
	}
}

@media print {
	.ki-label > .u8-ki-badge,
	html:not(.ki-js) .ki-label::after {
		color: #000;
		background: transparent;
		border: 1px solid #000;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}
	.ki-label.ki-label--icon > .u8-ki-badge,
	html:not(.ki-js) .ki-label.ki-label--icon::after {
		border: 0;
		background: #000000;
	}
}
