/* SEN Multi Loop Grid Widget — modernes Mediathek-Layout */

.sen-mlg {
	--sen-mlg-cols: 3;
	--sen-mlg-gap: 24px;
	--sen-mlg-accent: var(--e-global-color-accent, #111);
	--sen-mlg-radius: 999px;
	--sen-mlg-border: #e5e5e5;
	--sen-mlg-muted: #6b6b6b;
	--sen-mlg-bg: #fafafa;
	width: 100%;
	position: relative;
}

/* ───── Filter Bar ───────────────────────────────────────────── */

.sen-mlg__filterbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1rem 1.25rem;
	padding: 1rem 1.25rem;
	margin-bottom: 1.5rem;
	background: var(--sen-mlg-bg);
	border: 1px solid var(--sen-mlg-border);
	border-radius: 12px;
}

.sen-mlg__filter {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	min-width: 0;
}

.sen-mlg__filter--search {
	flex: 1 1 220px;
	min-width: 200px;
}

.sen-mlg__filter--meta {
	margin-left: auto;
	gap: 0.75rem;
}

.sen-mlg__filter-label {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--sen-mlg-muted);
	white-space: nowrap;
}

.sen-mlg__visually-hidden {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0);
	white-space: nowrap; border: 0;
}

/* Chips */
.sen-mlg__chips {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.sen-mlg__chip {
	appearance: none;
	display: inline-flex;
	align-items: center;
	height: 2.1rem;
	padding: 0 0.95rem;
	font: inherit;
	font-size: 0.9rem;
	line-height: 1;
	color: inherit;
	background: #fff;
	border: 1px solid var(--sen-mlg-border);
	border-radius: var(--sen-mlg-radius);
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.sen-mlg__chip:hover {
	border-color: var(--sen-mlg-accent);
}

.sen-mlg__chip:focus {
	outline: none;
}

.sen-mlg .sen-mlg__chip.is-active {
	background: var(--sen-mlg-accent);
	border-color: var(--sen-mlg-accent);
	color: #fff;
}

/* Select */
.sen-mlg__select {
	min-height: 2.1rem;
	padding: 0 2rem 0 0.85rem;
	font: inherit;
	font-size: 0.9rem;
	color: inherit;
	background: #fff;
	border: 1px solid var(--sen-mlg-border);
	border-radius: 8px;
	appearance: none;
	-webkit-appearance: none;
	background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
		linear-gradient(135deg, currentColor 50%, transparent 50%);
	background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
	background-size: 5px 5px;
	background-repeat: no-repeat;
}

.sen-mlg__select:focus,
.sen-mlg__search:focus,
.sen-mlg__chip:focus-visible {
	outline: 2px solid var(--sen-mlg-accent);
	outline-offset: 2px;
}

/* Search */
.sen-mlg__search {
	flex: 1;
	min-width: 0;
	height: 2.3rem;
	padding: 0 0.95rem;
	font: inherit;
	background: #fff;
	border: 1px solid var(--sen-mlg-border);
	border-radius: 8px;
}

/* Counter + Reset */
.sen-mlg__counter {
	font-size: 0.85rem;
	color: var(--sen-mlg-muted);
}

.sen-mlg__reset {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.1rem;
	height: 2.1rem;
	padding: 0;
	background: transparent;
	border: 1px solid transparent;
	border-radius: 50%;
	color: var(--sen-mlg-muted);
	cursor: pointer;
	transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.2s;
}

.sen-mlg__reset:hover {
	color: var(--sen-mlg-accent);
	border-color: var(--sen-mlg-border);
}

.sen-mlg__reset:active {
	transform: rotate(-30deg);
}

.sen-mlg__reset-icon {
	width: 1.05rem;
	height: 1.05rem;
	display: block;
}

/* ───── Grid ─────────────────────────────────────────────────── */

.sen-mlg__grid {
	display: grid;
	grid-template-columns: repeat(var(--sen-mlg-cols), minmax(0, 1fr));
	gap: var(--sen-mlg-gap);
	align-items: stretch;
}

/* Item-Wrapper streckt sich automatisch auf die Zeilenhöhe (CSS-Grid Default).
   Mit display:flex + column wird das gerenderte Elementor-Template darin gezwungen,
   die volle Höhe zu füllen — Karten erscheinen so alle gleich hoch. */
.sen-mlg__item {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.sen-mlg__item > * {
	width: 100%;
	flex: 1 1 auto;
}

/* Innerhalb des Elementor-Wrappers Container/Section auf volle Höhe strecken,
   damit der Karten-Hintergrund/-Border bis zum Rand reicht. */
.sen-mlg__item > .elementor {
	display: flex;
	flex-direction: column;
}

.sen-mlg__item > .elementor > .e-con,
.sen-mlg__item > .elementor > .elementor-section,
.sen-mlg__item > .elementor > .elementor-container,
.sen-mlg__item > .elementor > [data-element_type] {
	flex: 1 1 auto;
}

.sen-mlg__empty {
	padding: 2rem 1.5rem;
	text-align: center;
	color: var(--sen-mlg-muted);
	border: 1px dashed var(--sen-mlg-border);
	border-radius: 8px;
	margin-top: 1rem;
}

.sen-mlg--empty {
	padding: 1.5rem;
	text-align: center;
	color: var(--sen-mlg-muted);
	border: 1px dashed var(--sen-mlg-border);
	border-radius: 8px;
}

/* ───── Loading-State ────────────────────────────────────────── */

.sen-mlg.is-loading {
	pointer-events: none;
}

.sen-mlg.is-loading .sen-mlg__grid {
	opacity: 0.45;
	transition: opacity 0.2s;
}

.sen-mlg__loading {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 36px;
	height: 36px;
	border: 3px solid var(--sen-mlg-border);
	border-top-color: var(--sen-mlg-accent);
	border-radius: 50%;
	transform: translate(-50%, -50%);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.15s;
}

.sen-mlg.is-loading .sen-mlg__loading {
	opacity: 1;
	animation: sen-mlg-spin 0.8s linear infinite;
}

@keyframes sen-mlg-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* ───── Footer (Pagination / Load More / Sentinel) ───────────── */

.sen-mlg__footer {
	display: flex;
	justify-content: center;
	margin-top: 2rem;
}

.sen-mlg__pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: center;
}

.sen-mlg__pagination a,
.sen-mlg__pagination span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.25rem;
	height: 2.25rem;
	padding: 0 0.75rem;
	text-decoration: none;
	border: 1px solid var(--sen-mlg-border);
	border-radius: 8px;
	line-height: 1;
	transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.sen-mlg__pagination a:hover {
	border-color: var(--sen-mlg-accent);
}

.sen-mlg__pagination .current {
	font-weight: 700;
	background: var(--sen-mlg-accent);
	color: #fff;
	border-color: var(--sen-mlg-accent);
}

.sen-mlg__load-more {
	appearance: none;
	font: inherit;
	font-weight: 600;
	padding: 0.65rem 1.4rem;
	background: transparent;
	color: var(--sen-mlg-accent);
	border: 1.5px solid var(--sen-mlg-accent);
	border-radius: var(--sen-mlg-radius);
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
}

.sen-mlg__load-more:hover {
	background: var(--sen-mlg-accent);
	color: #fff;
}

.sen-mlg__load-more[hidden] {
	display: none;
}

.sen-mlg__sentinel {
	height: 1px;
	width: 100%;
}

/* ───── Fallback-Karte (kein Template gewählt) ──────────────── */

.sen-mlg__fallback {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	color: inherit;
	text-decoration: none;
	height: 100%;
}

.sen-mlg__fallback-thumb img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 8px;
}

.sen-mlg__fallback-title {
	margin: 0;
	font-size: 1.1rem;
	line-height: 1.3;
}

.sen-mlg__fallback-excerpt {
	font-size: 0.95rem;
	line-height: 1.5;
	color: var(--sen-mlg-muted);
}

/* ───── Responsive ───────────────────────────────────────────── */

@media (max-width: 720px) {
	.sen-mlg__filterbar {
		gap: 0.75rem;
		padding: 0.85rem 1rem;
	}
	.sen-mlg__filter--meta {
		margin-left: 0;
		width: 100%;
		justify-content: space-between;
	}
}
