/**
 * Affiliate Engine — front-end block styles.
 * Everything is driven by CSS custom properties so a theme can restyle the
 * whole system by overriding a handful of --ae-* variables.
 */

:root {
	--ae-accent: var(--wp--preset--color--accent, #2563eb);
	--ae-accent-contrast: #ffffff;
	--ae-ink: var(--wp--preset--color--contrast, #1a1d24);
	--ae-muted: #6b7280;
	--ae-line: #e5e7eb;
	--ae-surface: #ffffff;
	--ae-surface-2: #f7f8fa;
	--ae-radius: 14px;
	--ae-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
	--ae-shadow-hover: 0 2px 4px rgba(16, 24, 40, .08), 0 16px 40px rgba(16, 24, 40, .12);
	--ae-star: #f59e0b;
	--ae-success: #16a34a;
	--ae-danger: #dc2626;
}

.ae-block { margin-block: clamp(1.5rem, 4vw, 2.5rem); }
.ae-block__heading { font-size: clamp(1.4rem, 2.5vw, 2rem); margin: 0 0 1.2rem; line-height: 1.2; }

/* ---------- Card ---------- */
.ae-card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--ae-surface);
	border: 1px solid var(--ae-line);
	border-radius: var(--ae-radius);
	box-shadow: var(--ae-shadow);
	overflow: hidden;
	transition: transform .18s ease, box-shadow .18s ease;
}
.ae-card:hover { transform: translateY(-3px); box-shadow: var(--ae-shadow-hover); }

.ae-block--box .ae-card { flex-direction: row; gap: 1.5rem; align-items: stretch; }
.ae-block--box .ae-card__media { flex: 0 0 38%; }
@media (max-width: 600px) { .ae-block--box .ae-card { flex-direction: column; } }

.ae-card__badge {
	position: absolute; top: 12px; left: 12px; z-index: 2;
	background: var(--ae-accent); color: var(--ae-accent-contrast);
	font-size: .72rem; font-weight: 700; letter-spacing: .02em;
	text-transform: uppercase; padding: .32em .7em; border-radius: 999px;
	box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.ae-card__media {
	display: flex; align-items: center; justify-content: center;
	background: var(--ae-surface-2); padding: 1.25rem; min-height: 180px;
}
.ae-card__media img { max-width: 100%; max-height: 240px; height: auto; object-fit: contain; mix-blend-mode: multiply; }
.ae-card__noimg { font-size: 3rem; opacity: .35; }

.ae-card__body { display: flex; flex-direction: column; gap: .5rem; padding: 1.1rem 1.25rem 1.25rem; flex: 1; }
.ae-card__brand { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ae-muted); }
.ae-card__title { font-size: 1.08rem; line-height: 1.35; margin: 0; }
.ae-card__title a { color: var(--ae-ink); text-decoration: none; }
.ae-card__title a:hover { color: var(--ae-accent); }

.ae-card__features { margin: .3rem 0 0; padding: 0; list-style: none; display: grid; gap: .3rem; }
.ae-card__features li { position: relative; padding-left: 1.4em; font-size: .9rem; color: #374151; }
.ae-card__features li::before { content: "✓"; position: absolute; left: 0; color: var(--ae-success); font-weight: 700; }

.ae-card__footer { margin-top: auto; padding-top: .9rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ---------- Price ---------- */
.ae-price { display: flex; flex-direction: column; line-height: 1.1; }
.ae-price__now { font-size: 1.35rem; font-weight: 800; color: var(--ae-ink); }
.ae-price__was { font-size: .85rem; color: var(--ae-muted); text-decoration: line-through; }

/* ---------- Rating ---------- */
.ae-rating { display: inline-flex; align-items: center; gap: .4rem; font-size: .88rem; color: var(--ae-muted); }
.ae-stars { letter-spacing: 1px; font-size: 1rem; color: var(--ae-line); position: relative; white-space: nowrap; }
.ae-star.is-full { color: var(--ae-star); }
.ae-star.is-half { background: linear-gradient(90deg, var(--ae-star) 50%, var(--ae-line) 50%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.ae-rating__num { font-weight: 700; color: var(--ae-ink); }

/* ---------- Button ---------- */
.ae-btn {
	box-sizing: border-box;
	display: inline-flex; align-items: center; justify-content: center; gap: .5em;
	background: var(--ae-accent); color: var(--ae-accent-contrast) !important;
	font-weight: 700; font-size: .95rem; text-decoration: none;
	padding: .7em 1.25em; border-radius: 10px; border: none; cursor: pointer;
	transition: filter .15s ease, transform .15s ease; white-space: nowrap;
	max-width: 100%;
}
.ae-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.ae-btn--primary::after { content: "›"; font-size: 1.2em; line-height: 1; }

/* ---------- Grid ---------- */
.ae-grid { display: grid; grid-template-columns: repeat(var(--ae-cols, 3), 1fr); gap: 1.25rem; }
@media (max-width: 980px) { .ae-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .ae-grid { grid-template-columns: 1fr; } }

/* ---------- Product filter ---------- */
.ae-filter__bar { display: flex; flex-wrap: wrap; gap: .7rem 1rem; align-items: flex-end; margin: 0 0 1rem; padding: 1rem 1.1rem; background: var(--ae-surface, #fff); border: 1px solid var(--ae-line, #e0ebe8); border-radius: var(--ae-radius, 14px); }
.ae-filter__field { display: flex; flex-direction: column; gap: .25rem; flex: 1 1 150px; min-width: 0; }
.ae-filter__field--search { flex: 2 1 220px; }
.ae-filter__field label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ae-muted, #5b6e6c); }
.ae-filter__bar input[type="search"], .ae-filter__bar select { width: 100%; padding: .5rem .65rem; border: 1px solid var(--ae-line, #d7e3e0); border-radius: 10px; background: #fff; font-size: .92rem; color: inherit; box-sizing: border-box; }
.ae-filter__bar input[type="search"]:focus, .ae-filter__bar select:focus { outline: 2px solid color-mix(in srgb, var(--ae-accent, #0d9488) 45%, transparent); outline-offset: 1px; border-color: var(--ae-accent, #0d9488); }
.ae-filter__reset { flex: 0 0 auto; align-self: flex-end; padding: .55rem .9rem; border: 1px solid var(--ae-line, #d7e3e0); border-radius: 10px; background: #fff; font-weight: 600; font-size: .85rem; cursor: pointer; color: var(--ae-muted, #5b6e6c); }
.ae-filter__reset:hover { border-color: var(--ae-accent, #0d9488); color: var(--ae-accent, #0d9488); }
.ae-filter__count { margin: 0 0 1rem; font-size: .85rem; color: var(--ae-muted, #5b6e6c); }
.ae-filter__empty { text-align: center; padding: 2rem 1rem; color: var(--ae-muted, #5b6e6c); }
@media (max-width: 600px) { .ae-filter__field, .ae-filter__field--search { flex: 1 1 100%; } .ae-filter__reset { width: 100%; } }

/* ---------- Comparison table ---------- */
.ae-table-scroll { overflow-x: auto; border: 1px solid var(--ae-line); border-radius: var(--ae-radius); }
.ae-table { width: 100%; border-collapse: collapse; min-width: 640px; background: var(--ae-surface); }
.ae-table th, .ae-table td { padding: 1rem; text-align: center; border-bottom: 1px solid var(--ae-line); vertical-align: top; }
.ae-table thead th { background: var(--ae-surface-2); position: relative; }
.ae-table thead img { max-height: 90px; width: auto; display: block; margin: .4rem auto; }
.ae-table__name { display: block; font-weight: 700; font-size: .95rem; }
.ae-table tbody th { text-align: left; font-weight: 600; color: var(--ae-muted); background: var(--ae-surface-2); white-space: nowrap; }
.ae-table__corner { background: var(--ae-surface-2); }
.ae-table__features { list-style: none; margin: 0; padding: 0; text-align: left; display: grid; gap: .25rem; }
.ae-table__features li { font-size: .85rem; padding-left: 1.2em; position: relative; }
.ae-table__features li::before { content: "✓"; position: absolute; left: 0; color: var(--ae-success); }
.ae-table__cta td { border-bottom: none; }

/* ---------- Pros & Cons ---------- */
.ae-proscons { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 600px) { .ae-proscons { grid-template-columns: 1fr; } }
.ae-proscons__col { border-radius: var(--ae-radius); padding: 1.25rem 1.4rem; border: 1px solid var(--ae-line); }
.ae-proscons__col h4 { margin: 0 0 .6rem; font-size: 1.05rem; }
.ae-proscons__col ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .45rem; }
.ae-proscons__col li { position: relative; padding-left: 1.6em; }
.ae-proscons__col--pro { background: color-mix(in srgb, var(--ae-success) 7%, white); border-color: color-mix(in srgb, var(--ae-success) 25%, white); }
.ae-proscons__col--con { background: color-mix(in srgb, var(--ae-danger) 6%, white); border-color: color-mix(in srgb, var(--ae-danger) 22%, white); }
.ae-proscons__col--pro li::before { content: "✓"; position: absolute; left: 0; color: var(--ae-success); font-weight: 700; }
.ae-proscons__col--con li::before { content: "✕"; position: absolute; left: 0; color: var(--ae-danger); font-weight: 700; }

/* ---------- Disclosure ---------- */
.ae-disclosure { font-size: .78rem; color: var(--ae-muted); margin-top: .9rem; line-height: 1.5; }

/* ---------- Editor placeholder ---------- */
.ae-placeholder { padding: 2rem; text-align: center; color: var(--ae-muted); border: 2px dashed var(--ae-line); border-radius: var(--ae-radius); }

/* =====================================================================
 *  v0.2 — Premium-Aufwertung (Ranking, Testsieger-Spalte, Feinschliff)
 * ===================================================================== */

/* Karten: weiche Trennung Bild/Body + Akzent-Border beim Hover */
.ae-card__media { border-bottom: 1px solid var(--ae-line); }
.ae-card:hover { border-color: color-mix(in srgb, var(--ae-accent) 45%, var(--ae-line)); }
.ae-card__footer { border-top: 1px solid var(--ae-line); }

/* Badge etwas feiner */
.ae-card__badge { font-size: .68rem; padding: .36em .8em; }

/* Platz-Nummern für Top-Listen */
.ae-card--ranked .ae-card__badge { left: auto; right: 12px; }
.ae-card__rank {
	position: absolute; top: 12px; left: 12px; z-index: 3;
	width: 38px; height: 38px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	background: var(--ae-accent); color: #fff;
	font-weight: 800; font-size: 1.1rem; line-height: 1;
	box-shadow: 0 6px 16px color-mix(in srgb, var(--ae-accent) 45%, transparent);
	border: 3px solid #fff;
}

/* ---------- Vergleichstabelle (Premium-Redesign) ---------- */
.ae-table { border-collapse: separate; border-spacing: 0; }
.ae-table thead th { padding-top: 1.4rem; vertical-align: bottom; }
.ae-table__head { position: relative; }
.ae-table__head.is-top { padding-top: 2.8rem; }

/* Badge der Nicht-Gewinner: mittig, nicht überlappend */
.ae-table thead .ae-card__badge {
	position: static; display: inline-block; margin: 0 auto .9rem;
}

/* Einheitliche Bild-Box */
.ae-table__media {
	display: flex; align-items: center; justify-content: center;
	height: 130px; margin-bottom: .9rem;
}
.ae-table__media img { max-height: 130px; max-width: 92%; width: auto; object-fit: contain; mix-blend-mode: multiply; }
.ae-table__name { display: block; font-weight: 700; font-size: 1rem; line-height: 1.35; }
.ae-table__price { font-size: 1.4rem; font-weight: 800; color: var(--ae-ink); }

/* Testsieger-Ribbon als Leiste oben auf der Gewinner-Spalte */
.ae-table__winner {
	position: absolute; top: 0; left: 0; right: 0;
	background: var(--ae-accent); color: #fff;
	font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
	padding: .5rem 0; text-align: center;
}

/* Gewinner-Spalte: nur zarter Tint + Akzent-Leiste oben (kein Rahmen) */
.ae-table .is-top { background: color-mix(in srgb, var(--ae-accent) 7%, #fff) !important; }
.ae-table thead .is-top { border-top: 3px solid var(--ae-accent); }

/* CTA-Buttons mit Luft */
.ae-table__cta td { padding: 1.2rem; }
.ae-table__cta .ae-btn { width: 100%; white-space: normal; padding-left: .9rem; padding-right: .9rem; }
.ae-table__cta .is-top .ae-btn { box-shadow: 0 8px 20px color-mix(in srgb, var(--ae-accent) 35%, transparent); }

/* Tabelle: auf dem Desktop kein erzwungener Scroll */
.ae-table { min-width: 0; table-layout: fixed; }
.ae-table__corner, .ae-table tbody th { width: 130px; }
.ae-table td, .ae-table th { padding-left: .85rem; padding-right: .85rem; word-wrap: break-word; }
.ae-table-scroll { overflow-x: visible; }
@media (max-width: 760px) {
	.ae-table { min-width: 620px; }
	.ae-table-scroll { overflow-x: auto; }
}

/* "Preis geprüft am …" Vertrauenshinweis */
.ae-checked {
	display: block; margin-top: .45rem;
	font-size: .72rem; color: var(--ae-muted);
}
.ae-checked::before { content: "🕑 "; }
.ae-card__checked { margin-top: .3rem; }

/* Werbekennzeichnung ("Anzeige") */
.ae-ad {
	display: inline-block;
	font-size: .62rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
	color: var(--ae-muted); border: 1px solid var(--ae-line);
	padding: .12em .5em; border-radius: 5px; line-height: 1.4;
}
.ae-card__ad { padding: 0 1.25rem; margin-bottom: -.2rem; }
.ae-block__ad { margin-top: .8rem; }

/* Preis-Hinweis (Pflicht-Disclaimer am Preis) */
.ae-price__note { display: block; font-size: .68rem; color: var(--ae-muted); margin-top: .15rem; font-weight: 400; }
.ae-table__price-hint { color: var(--ae-muted); font-size: .9rem; }

/* ---------- Breadcrumbs ---------- */
.ae-breadcrumbs { font-size: .85rem; }
.ae-breadcrumbs__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .5rem; }
.ae-breadcrumbs__item { display: inline-flex; align-items: center; color: var(--ae-muted); }
.ae-breadcrumbs__item:not(:last-child)::after { content: "›"; margin-left: .5rem; color: var(--ae-line); }
.ae-breadcrumbs__item a { color: var(--ae-muted); text-decoration: none; }
.ae-breadcrumbs__item a:hover { color: var(--ae-accent); text-decoration: underline; }
.ae-breadcrumbs__item.is-current { color: var(--ae-ink); font-weight: 600; }

/* ---------- FAQ-Accordion ---------- */
.ae-faq { display: grid; gap: .75rem; }
.ae-faq__item {
	border: 1px solid var(--ae-line); border-radius: var(--ae-radius);
	background: var(--ae-surface); overflow: hidden;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.ae-faq__item[open] { border-color: color-mix(in srgb, var(--ae-accent) 40%, var(--ae-line)); box-shadow: var(--ae-shadow); }
.ae-faq__q {
	list-style: none; cursor: pointer; padding: 1.05rem 1.3rem;
	font-weight: 700; font-size: 1.02rem; color: var(--ae-ink);
	display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.ae-faq__q::-webkit-details-marker { display: none; }
.ae-faq__q::after { content: "+"; font-size: 1.5rem; line-height: 1; color: var(--ae-accent); transition: transform .2s ease; }
.ae-faq__item[open] .ae-faq__q::after { transform: rotate(45deg); }
.ae-faq__a { padding: 0 1.3rem 1.15rem; color: #374151; }
.ae-faq__a p { margin: 0 0 .6rem; }
.ae-faq__a p:last-child { margin-bottom: 0; }
