/*
 * ehorses Inserate-Modul – Design nach ehorses-Formularvorlage.
 * Alle Regeln sind auf .ehim begrenzt; Farben und Maße über eigene Variablen.
 */
.ehim {
	--ehim-green: #22c38a;
	--ehim-green-2: #36d39b;
	--ehim-green-ink: #0f8a5f;
	--ehim-ring: rgba(34, 195, 138, .28);
	--ehim-ink: #1f2328;
	--ehim-text: #4b5563;
	--ehim-muted: #8b929c;
	--ehim-line: #e3e6ea;
	--ehim-soft: #f5f7f8;
	--ehim-bg: #fff;
	--ehim-radius: 20px;
	--ehim-radius-sm: 12px;
	--ehim-font: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--ehim-pad: clamp(16px, 4vw, 40px);
	--ehim-gap: 14px;

	margin: 2.5rem 0;
	font-family: var(--ehim-font);
	color: var(--ehim-text);
	-webkit-font-smoothing: antialiased;
}

.ehim *,
.ehim *::before,
.ehim *::after {
	box-sizing: border-box;
}

.ehim [hidden] {
	display: none !important;
}

.ehim__card {
	container-type: inline-size;
	background: var(--ehim-bg);
	border: 1px solid var(--ehim-line);
	border-radius: var(--ehim-radius);
	box-shadow: 0 24px 48px -28px rgba(16, 24, 40, .22);
	padding: clamp(20px, 4vw, 36px) var(--ehim-pad);
	overflow: hidden;
}

/* Kopf */
.ehim__head {
	text-align: center;
	margin: 0 0 24px;
}

.ehim .ehim__title {
	margin: 0 0 6px;
	font-family: var(--ehim-font);
	font-size: clamp(1.25rem, 2.6vw, 1.6rem);
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: -.01em;
	color: var(--ehim-ink);
}

.ehim .ehim__sub {
	margin: 0;
	font-size: .9375rem;
	line-height: 1.5;
	color: var(--ehim-text);
}

/* Zusammenfassung (zitierfähig für Suchmaschinen und KI-Systeme) */
.ehim .ehim__summary {
	margin: 6px 0 0;
	font-size: .9375rem;
	line-height: 1.6;
	color: var(--ehim-text);
	text-align: center;
}

/* Filter */
.ehim__filters {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 14px 12px;
	margin: 0 0 16px;
}

@container (min-width: 640px) {
	.ehim__filters {
		gap: 14px 20px;
	}
}

.ehim__field {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 0;
}

.ehim .ehim__label {
	margin: 0;
	font-size: .875rem;
	font-weight: 600;
	color: var(--ehim-ink);
}

.ehim .ehim__select {
	appearance: none;
	-webkit-appearance: none;
	width: 100%;
	height: 46px;
	margin: 0;
	padding: 0 34px 0 14px;
	text-overflow: ellipsis;
	font: 500 .9375rem/1.2 var(--ehim-font);
	color: var(--ehim-ink);
	background-color: var(--ehim-bg);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2322c38a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	border: 1px solid var(--ehim-line);
	border-radius: var(--ehim-radius-sm);
	box-shadow: none;
	cursor: pointer;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.ehim .ehim__select:hover {
	border-color: #cfd4da;
}

.ehim .ehim__select:focus-visible {
	outline: none;
	border-color: var(--ehim-green);
	box-shadow: 0 0 0 4px var(--ehim-ring);
}

.ehim .ehim__select:disabled {
	cursor: default;
	color: var(--ehim-muted);
	background-color: var(--ehim-soft);
}

.ehim__field.is-active .ehim__select {
	border-color: var(--ehim-green);
	background-color: #f1fbf7;
}

/* Trefferzeile */
.ehim__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 0 0 16px;
	padding: 0 0 12px;
	border-bottom: 1px solid var(--ehim-line);
}

.ehim .ehim__count {
	margin: 0;
	font-size: .875rem;
	font-weight: 600;
	color: var(--ehim-green-ink);
}

.ehim .ehim__reset {
	flex: 0 0 auto;
	margin: 0;
	padding: 4px 0;
	font: 600 .875rem/1.2 var(--ehim-font);
	color: var(--ehim-text);
	background: none;
	border: 0;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.ehim .ehim__reset:hover {
	color: var(--ehim-ink);
}

.ehim .ehim__reset:focus-visible {
	outline: 2px solid var(--ehim-green);
	outline-offset: 2px;
	border-radius: 4px;
}

/* Karussell */
.ehim__carousel {
	position: relative;
}

.ehim .ehim__track {
	display: flex;
	gap: var(--ehim-gap);
	/* Randlos bis an die Kartenkante wischen, Inhalt bleibt bündig */
	margin: 0 calc(-1 * var(--ehim-pad));
	padding: 4px var(--ehim-pad) 12px;
	scroll-padding-inline: var(--ehim-pad);
	list-style: none;
	overflow-x: auto;
	overflow-y: hidden;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.ehim .ehim__track::-webkit-scrollbar {
	display: none;
}

.ehim .ehim__item {
	/* Mobil: 1,6 Karten sichtbar – der Anschnitt zeigt, dass gewischt werden kann */
	flex: 0 0 62%;
	min-width: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	scroll-snap-align: start;
}

@container (min-width: 480px) {
	.ehim .ehim__item {
		flex-basis: calc((100% - 2 * var(--ehim-gap)) / 2.4);
	}
}

@container (min-width: 640px) {
	/* Desktop: bündig ohne Anschnitt, geblättert wird mit den Pfeilen oder per Trackpad */
	.ehim .ehim__track {
		margin: 0;
		padding: 4px 0 12px;
		scroll-padding-inline: 0;
	}
	.ehim .ehim__item {
		flex-basis: calc((100% - 3 * var(--ehim-gap)) / 4);
	}
}

.ehim .ehim__item::before {
	content: none;
}

/* Pfeile (nur bei Geräten mit Maus/Trackpad und genug Breite) */
.ehim .ehim__nav {
	position: absolute;
	top: calc(50% - 30px);
	z-index: 2;
	display: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	color: var(--ehim-ink);
	background: var(--ehim-bg);
	border: 1px solid var(--ehim-line);
	border-radius: 50%;
	box-shadow: 0 8px 20px -8px rgba(16, 24, 40, .35);
	cursor: pointer;
	transition: opacity .2s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}

.ehim .ehim__nav--prev {
	left: -14px;
}

.ehim .ehim__nav--next {
	right: -14px;
}

@media (hover: hover) and (pointer: fine) {
	@container (min-width: 640px) {
		.ehim .ehim__nav {
			display: flex;
		}
	}
}

.ehim .ehim__nav:hover:not(:disabled) {
	color: var(--ehim-green-ink);
	border-color: var(--ehim-green);
	transform: scale(1.05);
}

.ehim .ehim__nav:focus-visible {
	outline: none;
	box-shadow: 0 0 0 4px var(--ehim-ring);
}

.ehim .ehim__nav:disabled {
	opacity: 0;
	pointer-events: none;
}

/* Fortschrittsbalken wie im ehorses-Formular */
.ehim__progress {
	position: relative;
	height: 4px;
	margin: 4px 0 0;
	overflow: hidden;
	background: #eceef1;
	border-radius: 4px;
}

.ehim__progress-bar {
	display: block;
	height: 100%;
	width: 30%;
	background: linear-gradient(90deg, var(--ehim-green), var(--ehim-green-2));
	border-radius: 4px;
	will-change: transform;
}

.ehim .ehim__tile {
	display: flex;
	min-width: 0;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
	color: inherit;
	text-decoration: none;
	background: var(--ehim-bg);
	border: 1px solid var(--ehim-line);
	border-radius: 14px;
	transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.ehim .ehim__tile:hover {
	border-color: #d3d8dd;
	box-shadow: 0 10px 20px -14px rgba(16, 24, 40, .35);
	transform: translateY(-2px);
}

.ehim .ehim__tile:focus-visible {
	outline: none;
	border-color: var(--ehim-green);
	box-shadow: 0 0 0 4px var(--ehim-ring);
}

.ehim__media {
	position: relative;
	display: block;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	/* Platzhalter, wenn kein Foto vorhanden ist */
	background: var(--ehim-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 24 24' fill='none' stroke='%23c3c9cf' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Ccircle cx='8.5' cy='10' r='1.5'/%3E%3Cpath d='m21 16-5-5-8 8'/%3E%3C/svg%3E") center / 44px no-repeat;
}

.ehim .ehim__media img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
	border-radius: 0;
	transition: transform .35s ease;
}

.ehim .ehim__tile:hover .ehim__media img {
	transform: scale(1.04);
}

.ehim__body {
	display: flex;
	flex-direction: column;
	gap: 3px;
	flex: 1;
	padding: 12px 14px 14px;
	min-width: 0;
}

.ehim__breed {
	font-size: .6875rem;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--ehim-green-ink);
}

.ehim__name {
	font-size: .9375rem;
	font-weight: 700;
	line-height: 1.3;
	color: var(--ehim-ink);
}

.ehim__meta,
.ehim__uses {
	font-size: .8125rem;
	line-height: 1.4;
	color: var(--ehim-text);
}

.ehim__uses {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ehim__loc {
	display: flex;
	align-items: center;
	gap: 4px;
	margin-top: auto;
	padding-top: 6px;
	font-size: .75rem;
	color: var(--ehim-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ehim__loc::before {
	content: "";
	flex: 0 0 12px;
	width: 12px;
	height: 12px;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b929c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Letzte Karte: Sprung in den Marktplatz */
.ehim .ehim__tile--more {
	align-items: center;
	justify-content: center;
	gap: 12px;
	min-height: 100%;
	padding: 24px 16px;
	text-align: center;
	background: #f1fbf7;
	border: 1px dashed var(--ehim-green);
}

.ehim .ehim__tile--more:hover {
	border-color: var(--ehim-green);
	background: #e6f8f0;
}

.ehim__more-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	color: #fff;
	background: linear-gradient(90deg, var(--ehim-green), var(--ehim-green-2));
	border-radius: 50%;
	box-shadow: 0 10px 20px -10px rgba(34, 195, 138, .8);
}

.ehim__more-text {
	font-size: .9375rem;
	font-weight: 700;
	line-height: 1.3;
	color: var(--ehim-ink);
}

/* Leerer Zustand */
.ehim__empty {
	padding: 28px 16px;
	text-align: center;
	background: var(--ehim-soft);
	border-radius: var(--ehim-radius-sm);
}

.ehim .ehim__empty-text {
	margin: 0 0 8px;
	font-size: .9375rem;
	color: var(--ehim-text);
	text-align: center;
}

/* Aktionen */
.ehim__actions {
	margin-top: 20px;
}

.ehim .ehim__cta {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 50px;
	margin: 0;
	padding: 12px 20px;
	font: 600 1rem/1.2 var(--ehim-font);
	color: #fff;
	text-align: center;
	text-decoration: none;
	background: linear-gradient(90deg, var(--ehim-green), var(--ehim-green-2));
	border: 0;
	border-radius: 10px;
	box-shadow: 0 12px 24px -12px rgba(34, 195, 138, .7);
	cursor: pointer;
	transition: transform .15s ease, box-shadow .15s ease;
}

.ehim .ehim__cta:hover,
.ehim .ehim__cta:focus {
	color: #fff;
	text-decoration: none;
	transform: translateY(-1px);
	box-shadow: 0 16px 28px -12px rgba(34, 195, 138, .8);
}

.ehim .ehim__cta:focus-visible {
	outline: none;
	box-shadow: 0 0 0 4px var(--ehim-ring);
}

@media (prefers-reduced-motion: reduce) {
	.ehim *,
	.ehim *::before,
	.ehim *::after {
		transition: none !important;
	}
	.ehim .ehim__tile:hover,
	.ehim .ehim__tile:hover .ehim__media img,
	.ehim .ehim__cta:hover,
	.ehim .ehim__nav:hover:not(:disabled) {
		transform: none;
	}
	.ehim .ehim__track {
		scroll-behavior: auto;
	}
}

/*
 * Schutz gegen Theme- und Elementor-Regeln.
 * Themes setzen Linkfarben und Unterstreichungen oft mit hoher Spezifität (z. B. #content a:hover).
 * Diese wenigen Eigenschaften werden daher gezielt mit !important festgelegt – nur innerhalb des Moduls.
 */
.ehim a.ehim__tile,
.ehim a.ehim__tile:link,
.ehim a.ehim__tile:visited,
.ehim a.ehim__tile:hover,
.ehim a.ehim__tile:focus,
.ehim a.ehim__tile:active {
	color: var(--ehim-text) !important;
	text-decoration: none !important;
	background-image: none !important;
	border: 1px solid var(--ehim-line) !important;
}

.ehim a.ehim__tile:hover {
	border-color: #d3d8dd !important;
}

.ehim a.ehim__tile:focus-visible {
	border-color: var(--ehim-green) !important;
}

.ehim a.ehim__tile--more,
.ehim a.ehim__tile--more:hover {
	border: 1px dashed var(--ehim-green) !important;
}

.ehim a.ehim__tile *,
.ehim a.ehim__cta *,
.ehim a.ehim__tile:hover *,
.ehim a.ehim__cta:hover * {
	text-decoration: none !important;
	border: 0 !important;
}

.ehim a.ehim__tile .ehim__name,
.ehim a.ehim__tile:hover .ehim__name,
.ehim a.ehim__tile--more .ehim__more-text,
.ehim a.ehim__tile--more:hover .ehim__more-text {
	color: var(--ehim-ink) !important;
}

.ehim a.ehim__tile .ehim__meta,
.ehim a.ehim__tile .ehim__uses,
.ehim a.ehim__tile:hover .ehim__meta,
.ehim a.ehim__tile:hover .ehim__uses {
	color: var(--ehim-text) !important;
}

.ehim a.ehim__tile .ehim__loc,
.ehim a.ehim__tile:hover .ehim__loc {
	color: var(--ehim-muted) !important;
}

.ehim a.ehim__tile .ehim__breed,
.ehim a.ehim__tile:hover .ehim__breed {
	color: var(--ehim-green-ink) !important;
}

.ehim a.ehim__tile--more .ehim__more-icon {
	color: #fff !important;
}

.ehim a.ehim__cta,
.ehim a.ehim__cta:link,
.ehim a.ehim__cta:visited,
.ehim a.ehim__cta:hover,
.ehim a.ehim__cta:focus,
.ehim a.ehim__cta:active {
	color: #fff !important;
	text-decoration: none !important;
	background: linear-gradient(90deg, var(--ehim-green), var(--ehim-green-2)) !important;
	border: 0 !important;
}

.ehim button.ehim__nav,
.ehim button.ehim__nav:hover,
.ehim button.ehim__nav:focus {
	width: 44px !important;
	height: 44px !important;
	min-width: 0 !important;
	padding: 0 !important;
	border: 1px solid var(--ehim-line) !important;
	border-radius: 50% !important;
	background: var(--ehim-bg) !important;
	color: var(--ehim-ink) !important;
	text-decoration: none !important;
}

.ehim button.ehim__nav:hover:not(:disabled) {
	color: var(--ehim-green-ink) !important;
	border-color: var(--ehim-green) !important;
}

.ehim button.ehim__reset,
.ehim button.ehim__reset:hover,
.ehim button.ehim__reset:focus {
	padding: 4px 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: none !important;
	color: var(--ehim-text) !important;
	box-shadow: none !important;
}
