/* Lef Loyalty. Leunt op de leflite-variabelen, met fallbacks voor andere thema's. */
.lef-loyalty {
	--ll-primary: var(--primary, #1f6feb);
	--ll-surface: var(--white, #fff);
	--ll-track: var(--gray, #eceef1);
	/* Gedempte tekst afgeleid van de tekstkleur zelf: de grijstinten van een thema zijn niet altijd leesbaar als tekst. */
	--ll-muted: color-mix(in srgb, currentColor 62%, transparent);
	--ll-radius: var(--general-border-radius, 10px);
	--ll-small: var(--small-font-size, 0.875rem);
	--ll-tiny: var(--tiny-font-size, 0.75rem);
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 0.75rem;
	font-size: var(--ll-small);
}

.lef-loyalty-card {
	background: var(--ll-surface);
	border: var(--card-border-width, 1px) solid var(--card-border-color, var(--ll-track));
	border-radius: var(--ll-radius);
	padding: 1rem 1.25rem;
}
/* Over de volle breedte: rank met voortgang (en de rank-up melding). De rest loopt in twee kolommen. */
.lef-loyalty-wide { flex: 0 0 100%; }
.lef-loyalty-col { flex: 1 1 320px; min-width: 0; display: grid; gap: 0.75rem; }
.lef-loyalty .lef-loyalty-title { margin: 0 0 0.6rem; font-size: 1rem; line-height: 1.3; }

/* Rank + voortgang */
.lef-loyalty-hero { display: flex; gap: 1rem; align-items: center; }
.lef-loyalty-hero__badge { width: 76px; height: 76px; object-fit: contain; flex: none; margin: -6px 0 -6px -8px; }
.lef-loyalty-hero__body { flex: 1; min-width: 0; }
.lef-loyalty-hero__top { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; }
.lef-loyalty-hero__rank { font-family: var(--heading-font, inherit); font-size: 1.35rem; line-height: 1.1; }
.lef-loyalty-hero__exp { font-family: var(--heading-font, inherit); font-weight: 700; color: var(--ll-primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lef-loyalty .lef-loyalty-hero__next { margin: 0.45rem 0 0; font-size: var(--ll-tiny); line-height: 1.4; display: flex; flex-wrap: wrap; gap: 0.1rem 1rem; justify-content: space-between; }
.lef-loyalty-hero__next em { font-style: normal; color: var(--ll-muted); }
.lef-loyalty-hero__next em::before { content: "\00b7\00a0"; }
.lef-loyalty-hero__pending { color: var(--ll-muted); }

.lef-loyalty-bar { position: relative; display: flex; height: 10px; background: var(--ll-track); border-radius: 999px; }
.lef-loyalty-bar__fill,
.lef-loyalty-bar__wait { height: 100%; animation: lef-loyalty-grow 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.lef-loyalty-bar__fill { background: var(--ll-primary); border-radius: 999px 0 0 999px; box-shadow: 0 0 10px color-mix(in srgb, var(--ll-primary) 40%, transparent); }
.lef-loyalty-bar__fill:last-child { border-radius: 999px; }
.lef-loyalty-bar__wait {
	position: relative;
	border-radius: 0 999px 999px 0;
	background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--ll-primary) 55%, transparent) 0 5px, color-mix(in srgb, var(--ll-primary) 22%, transparent) 5px 10px);
	animation-delay: 0.5s;
	cursor: help;
}
.lef-loyalty-bar__wait::after {
	content: attr(data-tip);
	position: absolute;
	bottom: calc(100% + 8px);
	right: 0;
	width: max-content;
	max-width: min(260px, 70vw);
	padding: 0.4rem 0.6rem;
	border-radius: var(--general-border-radius-small, 6px);
	background: var(--black, #111);
	color: var(--white, #fff);
	font-size: var(--ll-tiny);
	line-height: 1.4;
	opacity: 0;
	visibility: hidden;
	transform: translateY(4px);
	transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
	z-index: 5;
}
.lef-loyalty-bar__wait:hover::after,
.lef-loyalty-bar__wait:focus::after { opacity: 1; visibility: visible; transform: none; }
@keyframes lef-loyalty-grow { from { width: 0; } }

/* Rank up */
.lef-loyalty-levelup {
	padding: 0.6rem 1rem;
	border-radius: var(--ll-radius);
	background: var(--ll-primary);
	color: var(--primary-content, #fff);
	animation: lef-loyalty-pop 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.lef-loyalty-levelup strong { margin-right: 0.5rem; text-transform: uppercase; letter-spacing: 0.06em; }
@keyframes lef-loyalty-pop { from { opacity: 0; transform: scale(0.94); } }

/* Lijsten */
.lef-loyalty .lef-loyalty-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.lef-loyalty-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.6rem; margin: 0; padding: 0; }
.lef-loyalty-list small { color: var(--ll-muted); font-size: var(--ll-tiny); }
/* De tag staat ook buiten .lef-loyalty, daarom eigen fallbacks. */
.lef-loyalty-tag { display: inline-block; padding: 0.1em 0.55em; border-radius: 999px; background: color-mix(in srgb, var(--primary, #1f6feb) 14%, transparent); color: var(--primary, #1f6feb); font-size: var(--tiny-font-size, 0.75rem); font-weight: 600; white-space: nowrap; }
.lef-loyalty-tag.is-muted { background: var(--ll-track); color: var(--ll-muted); }
.lef-loyalty-code { padding: 0.1em 0.5em; border: 1px dashed var(--ll-primary); border-radius: var(--general-border-radius-small, 6px); background: none; font-size: var(--ll-tiny); font-weight: 700; letter-spacing: 0.04em; user-select: all; }
.lef-loyalty-claim { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-left: auto; font-size: var(--ll-tiny); }
.lef-loyalty-list small.lef-loyalty-rejected { flex-basis: 100%; color: var(--error, #b42318); }
/* Acties zijn simpele tekstknoppen. Dubbele selector: wint van de knopstijl (en hover) van het thema. */
.lef-loyalty .lef-loyalty-link,
.lef-loyalty .lef-loyalty-link:hover,
.lef-loyalty .lef-loyalty-link:focus { padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; transform: none; color: var(--ll-primary); font: inherit; font-size: var(--ll-tiny); font-weight: 700; line-height: 1.4; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.lef-loyalty .lef-loyalty-link:hover,
.lef-loyalty .lef-loyalty-link:focus-visible { text-decoration: none; }

/* Extra punten: omschrijving links, punten rechts, actie eronder */
.lef-loyalty-bonus li { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.lef-loyalty-bonus li + li { padding-top: 0.6rem; border-top: 1px solid var(--ll-track); }
.lef-loyalty-bonus li > small,
.lef-loyalty-bonus li > form { grid-column: 1 / -1; margin-left: 0; }

/* Keuze-reward: de producten uit de pool als kaartjes */
.lef-loyalty-gifts { flex-basis: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.5rem; margin-top: 0.25rem; }
.lef-loyalty-gift { display: grid; grid-template-rows: auto 1fr auto auto; gap: 0.35rem; justify-items: center; padding: 0.6rem; border: 1px solid var(--ll-track); border-radius: var(--ll-radius); font-size: var(--ll-tiny); line-height: 1.3; text-align: center; }
.lef-loyalty-gift img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; border-radius: var(--general-border-radius-small, 6px); }
.lef-loyalty-gift__name { font-weight: 600; }
.lef-loyalty-gift__price { color: var(--ll-primary); font-weight: 700; }
.lef-loyalty-gift__price del { margin-right: 0.25rem; color: var(--ll-muted); font-weight: 400; }
.lef-loyalty-pool { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.3rem; }
.lef-loyalty-pool img { display: block; width: 30px; height: 30px; object-fit: cover; border-radius: var(--general-border-radius-small, 6px); border: 1px solid var(--ll-track); }

/* Inklapbare blokken: alle ranks, logboek */
.lef-loyalty-more { padding: 0; }
.lef-loyalty-more summary { padding: 0.7rem 1.25rem; font-weight: 600; cursor: pointer; }
.lef-loyalty .lef-loyalty-table { width: 100%; margin: 0; border: 0; border-collapse: collapse; font-size: var(--ll-tiny); }
.lef-loyalty .lef-loyalty-table td { padding: 0.4rem 0.5rem; border: 0; border-top: 1px solid var(--ll-track); background: none; vertical-align: top; }
.lef-loyalty .lef-loyalty-table td:first-child { padding-left: 1.25rem; white-space: nowrap; }
.lef-loyalty .lef-loyalty-table td:last-child { padding-right: 1.25rem; }
.lef-loyalty .lef-loyalty-table td.lef-loyalty-table__badge { width: 1%; padding-right: 0; }
.lef-loyalty-table__badge img { display: block; width: 32px; height: 32px; max-width: none; object-fit: contain; }
.lef-loyalty .lef-loyalty-table td { vertical-align: middle; }
.lef-loyalty-table .is-locked { color: var(--ll-muted); }
.lef-loyalty-table .is-locked img { filter: grayscale(1); opacity: 0.5; }
.lef-loyalty-table__amount { text-align: right; white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Buiten de tab: winkelwagen, checkout, mini-cart, reviews */
.lef-loyalty-earn { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.6rem; margin: 0.6rem 0; font-size: var(--tiny-font-size, 0.75rem); line-height: 1.4; }
.lef-loyalty-earn strong { color: var(--primary, #1f6feb); white-space: nowrap; }
/* Afrekenen: in een rustig kader, gewone leesgrootte. Een lege houder (lege winkelwagen) neemt geen ruimte in. */
/* Winkelwagen en afrekenen: rank links, punten rechts; daaronder volgende rank links, link rechts */
.lef-loyalty-earn--full { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem 0.75rem; }
.lef-loyalty-earn--full .lef-loyalty-chip { font-weight: 700; }
.lef-loyalty-earn__points { justify-self: end; color: var(--primary, #1f6feb); white-space: nowrap; }
.lef-loyalty-earn__next,
.lef-loyalty-earn--full a { grid-column: 1 / -1; justify-self: start; }
.lef-loyalty-earn__bar { grid-column: 1 / -1; display: flex; height: 4px; margin: 0.15rem 0; border-radius: 999px; overflow: hidden; background: color-mix(in srgb, var(--primary, #1f6feb) 14%, transparent); }
.lef-loyalty-earn__bar i { background: var(--primary, #1f6feb); }
.lef-loyalty-earn__bar i.is-order { opacity: 0.45; }
/* Rank up met deze bestelling: huidige rank, pijl, nieuwe rank, en een labeltje voor de rewards */
.lef-loyalty-earn__up { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.5rem; }
.lef-loyalty-earn__up .lef-loyalty-chip:first-child { font-weight: 400; opacity: 0.6; }
.lef-loyalty-earn__next.is-up > span { margin-right: 0.15rem; padding: 0.1em 0.5em; border-radius: 999px; background: var(--primary, #1f6feb); color: var(--primary-content, #fff); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.lef-loyalty-earn__next em { font-style: normal; font-weight: 600; }
.lef-loyalty-earn__next,
.lef-loyalty-earn--full a { font-size: var(--tiny-font-size, 0.75rem); }
.lef-loyalty-earn--full a { font-weight: 600; text-decoration: underline; white-space: nowrap; }
.lef-loyalty-earn-checkout:empty { display: none; }
.lef-loyalty-earn-checkout { margin-top: 1rem; padding: 0.75rem 1rem; border: 1px solid color-mix(in srgb, var(--primary, #1f6feb) 25%, transparent); border-radius: var(--general-border-radius, 10px); background: color-mix(in srgb, var(--primary, #1f6feb) 6%, var(--white, #fff)); color: var(--black, #111); }
.lef-loyalty-earn-checkout .lef-loyalty-earn { margin: 0; font-size: var(--small-font-size, 0.875rem); }
.lef-loyalty-earn-checkout .lef-loyalty-chip { opacity: 1; }
.lef-loyalty-earn-checkout .lef-loyalty-chip img { width: 28px; height: 28px; }
.lef-loyalty-chip { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 600; opacity: 0.75; }
.lef-loyalty-chip img { width: 22px; height: 22px; object-fit: contain; }
.lef-loyalty-disclosure { font-size: var(--tiny-font-size, 0.75rem); opacity: 0.7; }

@media (max-width: 480px) {
	.lef-loyalty-hero__badge { width: 56px; height: 56px; }
	.lef-loyalty-claim { margin-left: 0; flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
	.lef-loyalty-bar__fill, .lef-loyalty-bar__wait, .lef-loyalty-levelup { animation: none; }
}
