/* =========================================================================
 * SM Stellenfilter
 * -------------------------------------------------------------------------
 * Zwei Teile:
 *   1. Filterleiste (Dropdowns)
 *   2. Kacheln – nur aktiv, wenn der Shortcode mit kacheln="ja" läuft
 *      (Standard). Diese Regeln entsprechen eurem bisherigen CSS, sind aber
 *      an .sm-sf gebunden statt an eine Seiten-ID. Dadurch sieht die Liste
 *      überall gleich aus, unabhängig davon, in welchem Divi-Modul der
 *      Shortcode steckt. Mit kacheln="nein" bleibt allein euer Theme-CSS
 *      zuständig.
 *
 * Zum Anpassen genügen normalerweise die Variablen hier oben.
 * ========================================================================= */

.sm-sf{
	--sf-schwarz:      #1a1a1a;   /* Dropdown-Knopf */
	--sf-gelb:         #ffd500;   /* Hover und Auswahl im Panel */
	--sf-kachel:       #efefef;   /* Hintergrund einer Stellenkachel */
	--sf-kachel-hover: #e6e5e5;   /* beim Überfahren */
	--sf-text:         #1a1a1a;
	--sf-text-leise:   #6d6d6d;
	--sf-rahmen:       #d8d8d8;
}


/* =========================================================================
 * 1. FILTERLEISTE
 * ========================================================================= */

.sm-sf-leiste{
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 14px;
	margin: 0 0 36px;
}

.sm-sf-dd{
	position: relative;
}

/* Standard-Dreieck von <details> entfernen */
.sm-sf-dd > summary{ list-style: none; }
.sm-sf-dd > summary::-webkit-details-marker{ display: none; }
.sm-sf-dd > summary::marker{ content: ""; }


/* --- geschlossener Knopf ------------------------------------------------- */

.sm-sf-knopf{
	display: inline-flex;
	align-items: center;
	gap: 14px;

	min-width: 250px;
	padding: 12px 22px;
	border-radius: 100px;

	background: var(--sf-schwarz);
	color: #fff;

	font-size: 17px;
	line-height: 1.2;
	cursor: pointer;
	user-select: none;
}

.sm-sf-dd > summary:focus-visible{
	outline: 2px solid var(--sf-schwarz);
	outline-offset: 3px;
}

.sm-sf-knopf-text{
	flex: 1 1 auto;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Chevron */
.sm-sf-pfeil{
	flex: 0 0 auto;
	width: 13px;
	height: 13px;
	border-right: 3px solid #fff;
	border-bottom: 3px solid #fff;
	transform: translateY(-4px) rotate(45deg);
	transition: transform .18s ease;
}

.sm-sf-dd[open] .sm-sf-pfeil{
	transform: translateY(3px) rotate(-135deg);
}

/* Aufgeklappt wird der Knopf unten eckiger, damit er mit dem Panel
   als ein Element wirkt. */
.sm-sf-dd[open] .sm-sf-knopf{
	border-radius: 25px;
}


/* --- Panel ---------------------------------------------------------------- */

.sm-sf-panel{
	position: absolute;
	z-index: 40;
	top: calc(100% + 6px);
	left: 0;
	width: 100%;
	min-width: 250px;

	padding: 6px;
	background: #fff;
	border-radius: 4px;
	box-shadow: 0 6px 20px rgba(0,0,0,.18);
}

/* Suchfeld – wird per JavaScript eingeblendet. Ohne JavaScript bliebe es
   wirkungslos, deshalb ist es im Markup zunächst versteckt. */
.sm-sf-suche{
	width: 100%;
	margin-bottom: 6px;
	padding: 7px 10px;
	border: 1px solid var(--sf-rahmen);
	border-radius: 3px;
	font-size: 15px;
	line-height: 1.3;
	background: #fff;
	color: var(--sf-text);
}

.sm-sf-suche:focus{
	outline: none;
	border-color: var(--sf-text-leise);
}

.sm-sf-liste{
	max-height: 320px;
	overflow-y: auto;
}

.sm-sf-option{
	display: flex;
	align-items: center;
	gap: 10px;

	padding: 8px 12px;

	color: var(--sf-text);
	font-size: 16px;
	line-height: 1.3;
	text-decoration: none;
}

.sm-sf-option:hover,
.sm-sf-option:focus-visible{
	background: var(--sf-gelb);
	color: var(--sf-text);
	text-decoration: none;
}

/* Zurücksetzen-Zeile – erscheint nur, wenn etwas ausgewählt ist */
.sm-sf-option.is-reset{
	border-bottom: 1px solid var(--sf-rahmen);
	color: var(--sf-text-leise);
	font-size: 15px;
}

.sm-sf-option.is-reset:hover{
	background: var(--sf-gelb);
	color: var(--sf-text);
}

.sm-sf-option.is-aktiv:not(.is-reset){
	background: var(--sf-gelb);
	font-weight: 600;
}

.sm-sf-name{ flex: 1 1 auto; }

.sm-sf-anzahl{
	flex: 0 0 auto;
	font-size: 13px;
	color: var(--sf-text-leise);
}

/* Option, die mit der übrigen Auswahl keine Treffer hätte */
.sm-sf-option.is-leer{
	opacity: .4;
	pointer-events: none;
}

/* Von der Suche ausgeblendet */
.sm-sf-option[hidden]{ display: none; }


/* --- Ergebnisbereich ------------------------------------------------------ */

.sm-sf-summe{
	margin: 0 0 16px;
	font-size: 15px;
	color: var(--sf-text-leise);
}

.sm-sf-leermeldung{
	padding: 24px 0;
	color: var(--sf-text-leise);
}

.sm-sf.is-laedt .sm-sf-ergebnis{
	opacity: .45;
	transition: opacity .15s ease;
}


/* =========================================================================
 * 2. KACHELN
 * -------------------------------------------------------------------------
 * Divi stylt Überschriften und .et_pb_post mit hoher Spezifität. Deshalb
 * hier doppelte Klasse (#sm-stellenfilter.sm-sf-kacheln) plus !important bei den
 * Eigenschaften, die Divi sonst überschreibt. Ohne das setzt sich die
 * Theme-Typografie durch und die Kacheln bleiben unformatiert.
 * ========================================================================= */

#sm-stellenfilter.sm-sf-kacheln a,
#sm-stellenfilter.sm-sf-kacheln a:hover{
	text-decoration: none !important;
	color: inherit !important;
}

#sm-stellenfilter.sm-sf-kacheln article,
#sm-stellenfilter.sm-sf-kacheln article.et_pb_post{
	background: var(--sf-kachel) !important;
	border-radius: 150px !important;
	margin: 25px 0 0 0 !important;
	padding: 0 !important;
	border: 0 !important;
	box-shadow: none !important;
	overflow: hidden;
	transition: background-color .15s ease;
}

#sm-stellenfilter.sm-sf-kacheln article:hover,
#sm-stellenfilter.sm-sf-kacheln article.et_pb_post:hover{
	background: var(--sf-kachel-hover) !important;
}

#sm-stellenfilter.sm-sf-kacheln .sm_stellenanzeigen_wrapper{
	display: flex !important;
	justify-content: space-between !important;
	align-items: center !important;
	gap: 15px;
	padding: 10px 30px 10px 10px !important;
}

#sm-stellenfilter.sm-sf-kacheln .sm_stellenanzeigen_wrapper .sm_col{
	display: flex !important;
	align-items: center !important;
	gap: 14px;
	font-size: 20px !important;
	line-height: 1.3 !important;
	color: #000 !important;
}

#sm-stellenfilter.sm-sf-kacheln .sm_stellenanzeigen_wrapper .sm_col img{
	width: 80px !important;
	height: 80px !important;
	max-width: 80px !important;
	flex: 0 0 80px;
	background: #fff !important;
	border-radius: 50% !important;
	margin: 0 6px 0 0 !important;
	object-fit: contain;
}

#sm-stellenfilter.sm-sf-kacheln .sm_stellenanzeigen_wrapper h2.entry-title,
#sm-stellenfilter.sm-sf-kacheln .sm_stellenanzeigen_wrapper .entry-title{
	margin: 0 !important;
	padding: 0 !important;
	font-size: 20px !important;
	font-weight: 700 !important;
	line-height: 1.25 !important;
	letter-spacing: 0 !important;
	text-transform: none !important;
	color: var(--sf-text) !important;
}

/* Ort hinter dem Titel */
#sm-stellenfilter.sm-sf-kacheln .sm_standort{
	flex: 0 0 auto;
	font-size: 16px !important;
	font-weight: 400 !important;
	line-height: 1.2 !important;
	color: var(--sf-text-leise) !important;
}

/* Stellentyp rechts */
#sm-stellenfilter.sm-sf-kacheln .sm_col.col2{
	flex: 0 0 auto;
	white-space: nowrap;
}


/* =========================================================================
 * MOBIL
 * ========================================================================= */

@media all and (max-width: 980px){
	.sm-sf-leiste{
		flex-direction: column;
		align-items: center;
	}
}

@media all and (max-width: 767px){

	.sm-sf-dd{
		width: 100%;
	}

	.sm-sf-knopf{
		width: 100%;
		min-width: 0;
		padding: 11px 18px;
		font-size: 16px;
	}

	.sm-sf-panel{
		min-width: 0;
	}

	#sm-stellenfilter.sm-sf-kacheln article,
	#sm-stellenfilter.sm-sf-kacheln article.et_pb_post{
		border-radius: 40px !important;
	}

	#sm-stellenfilter.sm-sf-kacheln .sm_stellenanzeigen_wrapper{
		padding: 10px 18px 10px 10px !important;
	}

	#sm-stellenfilter.sm-sf-kacheln .sm_stellenanzeigen_wrapper h2.entry-title,
	#sm-stellenfilter.sm-sf-kacheln .sm_stellenanzeigen_wrapper .entry-title{
		font-size: 16px !important;
	}

	#sm-stellenfilter.sm-sf-kacheln .sm_stellenanzeigen_wrapper .sm_col img{
		width: 50px !important;
		height: 50px !important;
		max-width: 50px !important;
		flex: 0 0 50px;
		margin-right: 10px !important;
	}

	/* Stellentyp rechts ausblenden – wie in eurem bisherigen CSS */
	#sm-stellenfilter.sm-sf-kacheln .sm_col.col2{
		display: none !important;
	}

	#sm-stellenfilter.sm-sf-kacheln .sm_standort{
		font-size: 13px !important;
	}
}

@media (prefers-reduced-motion: reduce){
	.sm-sf-pfeil,
	#sm-stellenfilter.sm-sf-kacheln article,
	.sm-sf.is-laedt .sm-sf-ergebnis{
		transition: none;
	}
}
