/* ===========================================
   WD Produktraster – Frontend Styles
   =========================================== */

.wdpr-empty {
	font-family: var( --e-global-typography-text-font-family, inherit );
	color: var( --e-global-color-text, #555 );
}

/* --- Unendliches Laden --- */
.wdpr-loadmore-sentinel {
	height: 1px;
}

.wdpr-loadmore-status {
	text-align: center;
	font-size: 0.85rem;
	color: var( --e-global-color-text, #777 );
	min-height: 1.4em;
	margin: 1em 0 0;
}

/* --- Grid --- */
.wdpr-grid {
	display: grid;
	grid-template-columns: repeat( var( --wdpr-cols-desktop, 3 ), 1fr );
	gap: 24px;
	list-style: none;
	margin: 0;
	padding: 0;
}

@media ( max-width: 1024px ) {
	.wdpr-grid {
		grid-template-columns: repeat( var( --wdpr-cols-tablet, 2 ), 1fr );
	}
}

@media ( max-width: 600px ) {
	.wdpr-grid {
		grid-template-columns: repeat( var( --wdpr-cols-mobile, 1 ), 1fr );
	}
}

/* Breitbild-Media-Query mit dem konkreten Breakpoint aus den Plugin-
   Einstellungen wird zusätzlich per wp_add_inline_style ausgegeben,
   da CSS-Variablen in @media-Bedingungen nicht funktionieren. */

/* --- Karte --- */
.wdpr-card {
	display: flex;
	flex-direction: column;
	position: relative;
	text-decoration: none;
	color: inherit;
	font-family: var( --e-global-typography-text-font-family, inherit );
	background: #ffffff;
	border-radius: 10px;
	padding: 12px 12px 16px;
	margin-top: 16px; /* Platz für die Schleife oben, siehe .wdpr-card--loop */
	box-sizing: border-box;
}

/* Schatten UND ein sichtbarer, dezenter Rand sind jetzt dauerhaft da
   (nicht erst bei Hover) – nur der Schatten allein reicht auf hellem
   Untergrund nicht aus, um klar als abgegrenzte Karte erkennbar zu sein.
   Bei Hover bewegt sich bewusst nur das Bild (siehe .wdpr-hover-zoom
   weiter unten) – die Karte selbst bleibt an ihrem Platz. */
.wdpr-card--shadow {
	border: 1px solid rgba( 0, 0, 0, 0.08 );
	box-shadow: 0 8px 24px rgba( 0, 0, 0, 0.14 );
}

/* Kein Unterstrich mehr beim Hover auf den Titel - stattdessen
   erscheint der "Zum Artikel"-Button (siehe .wdpr-card__button). */

/* Kleine Schlaufe + Öse oben mittig, damit die Karte wie ein
   Anhänge-Etikett wirkt (rein dekorativ, per CSS, keine Extra-Bilder). */
.wdpr-card--loop::before,
.wdpr-card--loop::after {
	content: '';
	position: absolute;
	left: 50%;
	transform: translateX( -50% );
}

.wdpr-card--loop::before {
	top: -14px;
	width: 18px;
	height: 16px;
	border: 2px solid rgba( 0, 0, 0, 0.35 );
	border-bottom: none;
	border-radius: 50% 50% 0 0 / 100% 100% 0 0;
	z-index: 1;
}

.wdpr-card--loop::after {
	top: -4px;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background-color: inherit; /* übernimmt automatisch die Kartenfarbe */
	border: 2px solid rgba( 0, 0, 0, 0.25 );
	z-index: 2;
}

.wdpr-card__image-wrap {
	position: relative;
	overflow: hidden;
	border-radius: 6px;
	background: #f3f3f3;
	margin-bottom: 0.75em;
}

.wdpr-card__image-wrap img,
.wdpr-card__image-wrap picture img {
	/* !important noetig, da manche Themes/WooCommerce-Loop-Styles
	   (z.B. "ul.products li.product img") durch mehr Element-Selektoren
	   eine hoehere Spezifitaet haben und sonst "height: auto" erzwingen -
	   dadurch behaelt das Bild sein natuerliches Seitenverhaeltnis bei und
	   es entsteht ein leerer Rand, wenn das Bild nicht exakt im gewaehlten
	   Format (z.B. 4:5) vorliegt. */
	display: block !important;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	object-fit: cover !important;
	object-position: center !important;
	transition: transform 0.35s ease;
}

.wdpr-hover-zoom:hover img {
	transform: scale( 1.06 );
}

/* Kompatibilitaet mit dem Plugin "ki-bildkennzeichnung": bei KI-markierten
   Bildern wird der <img> zusaetzlich in einen <span class="kibk-ai-badge-wrap">
   gepackt (fuer die Badge-Positionierung). Dieser Wrapper hat von Haus aus
   keine feste Hoehe (nur display:block) - dadurch lief unser "height: 100%"
   am Bild ins Leere (Prozent-Hoehe ohne definierte Hoehe der Elternbox wird
   von Browsern als "auto" behandelt), und das Bild fiel auf sein natuerliches
   Seitenverhaeltnis zurueck statt den 4:5-/1:1-/3:4-Rahmen ohne Rand
   auszufuellen. Fix: den Wrapper explizit auf 100% Breite/Hoehe des Bild-
   Containers strecken. */
.wdpr-card__image-wrap .kibk-ai-badge-wrap {
	display: block !important;
	position: relative !important;
	width: 100% !important;
	height: 100% !important;
	line-height: 0 !important;
}

/* --- "Zum Artikel"-Button bei Hover --- */
.wdpr-card__button {
	position: absolute;
	left: 50%;
	bottom: 14px;
	transform: translate( -50%, 10px );
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.55em 1.3em;
	background: #1c1c1c;
	color: #fff;
	font-size: 0.85rem;
	font-weight: 600;
	white-space: nowrap;
	border-radius: 30px;
	box-shadow: 0 6px 16px rgba( 0, 0, 0, 0.25 );
	opacity: 0;
	pointer-events: none;
	z-index: 3;
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.wdpr-card:hover .wdpr-card__button,
.wdpr-card:focus-within .wdpr-card__button {
	opacity: 1;
	transform: translate( -50%, 0 );
}

/* --- Sale-Badge (unabhaengig vom Preis-Anhaenger) --- */
.wdpr-sale-badge {
	position: absolute;
	top: 14px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	box-sizing: border-box;
	padding: 0.3em 0.65em;
	background: #e63946;
	color: #fff;
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1.4;
	white-space: nowrap;
	border-radius: 999px;
	box-shadow: 0 4px 10px rgba( 0, 0, 0, 0.2 );
	z-index: 2;
}

.wdpr-sale-badge--left {
	left: 18px;
}

.wdpr-sale-badge--right {
	right: 18px;
}

@media ( hover: none ) {
	/* Touch-Geraete haben keinen echten Hover-Zustand - Button dauerhaft
	   sichtbar lassen, statt ihn unerreichbar zu machen. */
	.wdpr-card__button {
		opacity: 1;
		pointer-events: auto;
		transform: translate( -50%, 0 );
		position: static;
		margin-top: 0.6em;
	}
}

/* Bildverhältnisse */
.wdpr-ratio--1-1 {
	aspect-ratio: 1 / 1;
}

.wdpr-ratio--4-5 {
	aspect-ratio: 4 / 5;
}

.wdpr-ratio--3-4 {
	aspect-ratio: 3 / 4;
}

.wdpr-ratio--auto {
	aspect-ratio: auto;
}

.wdpr-placeholder-image {
	width: 100%;
	height: 100%;
	background: repeating-linear-gradient( 45deg, #eee, #eee 10px, #f6f6f6 10px, #f6f6f6 20px );
}

/* --- Titel --- */
.wdpr-card__title {
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.4;
	color: var( --e-global-color-text, #222 );
}

/* --- Preis-Anhänger (Tag-Optik) --- */
.wdpr-tag {
	position: absolute;
	top: 14px;
	display: inline-block;
	max-width: calc( 100% - 32px );
	box-sizing: border-box;
	padding: 0.4em 0.9em 0.4em 1.4em;
	background: #1c1c1c;
	color: #fff;
	border-radius: 2px 8px 8px 2px;
	box-shadow: 0 4px 10px rgba( 0, 0, 0, 0.25 );
	z-index: 2;
	transform-origin: top left;
}

.wdpr-tag--left {
	left: 18px;
}

.wdpr-tag--right {
	right: 18px;
	padding: 0.4em 1.4em 0.4em 0.9em;
	border-radius: 8px 2px 2px 8px;
	transform-origin: top right;
}

/* Loch im Anhänger */
.wdpr-tag__hole {
	position: absolute;
	left: 6px;
	top: 50%;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: rgba( 255, 255, 255, 0.85 );
	box-shadow: inset 0 0 0 1px rgba( 0, 0, 0, 0.35 );
	transform: translateY( -50% );
}

.wdpr-tag--right .wdpr-tag__hole {
	left: auto;
	right: 6px;
}

/* "Schnur" des Anhängers */
.wdpr-tag__string {
	position: absolute;
	left: 9px;
	top: -10px;
	width: 10px;
	height: 12px;
	border: 2px solid rgba( 0, 0, 0, 0.55 );
	border-bottom: none;
	border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.wdpr-tag--right .wdpr-tag__string {
	left: auto;
	right: 9px;
}

.wdpr-tag__price {
	display: block;
	font-size: 0.85rem;
	font-weight: 700;
	line-height: 1.35;
	white-space: normal;
	overflow-wrap: break-word;
}

/* Alter/durchgestrichener Preis und neuer Preis jeweils auf eigener
   Zeile, damit lange, mit Label versehene Preistexte (z.B. "Alter
   Preis: 19,90 € " / "Neuer Preis: 10,00 €") nicht abgeschnitten werden. */
.wdpr-tag__price del,
.wdpr-tag__price ins {
	display: block;
}

.wdpr-tag__price del {
	font-size: 0.8em;
	font-weight: 400;
	opacity: 0.75;
	margin-bottom: 0.15em;
}

.wdpr-tag__price ins {
	text-decoration: none;
}

@media ( max-width: 600px ) {
	.wdpr-tag {
		padding: 0.3em 0.7em 0.3em 1.1em;
	}

	.wdpr-tag__price {
		font-size: 0.78rem;
	}
}
