/* Product Rewards & Sidecart – sidecart.
 * Native <dialog> in de top layer: staat altijd boven alles en vast aan het scherm.
 * Alles gescoped onder .chcr-sc (prefix bewust anders dan .chh-sc van de Verzend-countdown). */

dialog.chcr-sc {
	--chcr-accent: var(--chcr-brand, var(--e-global-color-primary, var(--e-global-color-accent, #6b3e26)));
	--chcr-text: var(--e-global-color-text, #2b2522);
	--chcr-muted: #6f6a66;
	--chcr-border: #ece7e2;
	--chcr-soft: #faf7f4;
	--chcr-bg: #fff;
	--chcr-radius: 8px;
	--chcr-width: 420px;
	--chcr-backdrop: rgba(20, 14, 10, .45);

	position: fixed;
	inset: 0 0 0 auto;
	width: min(var(--chcr-width), 100vw);
	max-width: 100vw;
	height: 100vh;
	height: 100dvh;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: var(--chcr-bg);
	color: var(--chcr-text);
	font-family: var(--e-global-typography-text-font-family, inherit);
	font-size: 14px;
	line-height: 1.4;
	box-shadow: -8px 0 32px rgba(0, 0, 0, .12);
	overflow: hidden;
	transform: translateX(100%);
	transition: transform .28s ease;
}
dialog.chcr-sc:not([open]) { display: none; }
dialog.chcr-sc.is-open { transform: translateX(0); }
dialog.chcr-sc::backdrop {
	background: rgba(20, 14, 10, .45);
	opacity: 0;
	transition: opacity .28s ease;
}
dialog.chcr-sc.is-open::backdrop { opacity: 1; }
dialog.chcr-sc:focus { outline: none; }
.chcr-sc *, .chcr-sc *::before, .chcr-sc *::after { box-sizing: border-box; }
html.chcr-lock { overflow: hidden; }

/* Elementor Menu Cart-dropdown verbergen als wij de klik overnemen. */
body.chcr-intercept .elementor-menu-cart__container,
body.chcr-intercept .elementor-menu-cart__main { display: none !important; }

.chcr-sc .chcr-sc__panel { display: flex; flex-direction: column; height: 100%; }

.chcr-sc .chcr-sc__head {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 20px;
	border-bottom: 1px solid var(--chcr-border);
}
.chcr-sc .chcr-sc__title { margin: 0; padding: 0; font-size: 18px; line-height: 1.2; font-weight: 700; color: inherit; font-family: inherit; }

.chcr-sc button {
	margin: 0;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	text-transform: none;
	letter-spacing: normal;
	box-shadow: none;
	cursor: pointer;
	line-height: 1.2;
}
.chcr-sc button:disabled { cursor: default; }
.chcr-sc button:focus-visible, .chcr-sc a:focus-visible { outline: 2px solid var(--chcr-accent); outline-offset: 2px; }

.chcr-sc .chcr-sc__close { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border-radius: 50%; }
.chcr-sc .chcr-sc__close:hover { background: var(--chcr-soft); color: inherit; }

.chcr-sc .chcr-sc__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 20px; display: flex; flex-direction: column; gap: 16px; }
.chcr-sc .chcr-sc__error { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: var(--chcr-radius); background: #fcf0f1; color: #8a1f11; font-size: 13.6px; }
.chcr-sc .chcr-sc__error[hidden] { display: none; }
.chcr-sc .chcr-sc__retry { padding: 6px 10px; border: 1px solid currentColor; border-radius: 999px; font-size: 12.5px; white-space: nowrap; }
.chcr-sc.is-busy .chcr-sc__body, .chcr-sc.is-busy .chcr-sc__foot { opacity: .6; pointer-events: none; transition: opacity .15s; }

/* Regels */
.chcr-sc .chcr-sc__items { display: flex; flex-direction: column; }
.chcr-sc .chcr-sc-item { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--chcr-border); }
.chcr-sc .chcr-sc-item:last-child { border-bottom: 0; }
.chcr-sc .chcr-sc-item__img img { display: block; width: 64px; height: 64px; object-fit: cover; border-radius: 6px; margin: 0; }
.chcr-sc .chcr-sc-item__main { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.chcr-sc .chcr-sc-item__name { font-weight: 600; font-size: 14px; line-height: 1.3; color: inherit; text-decoration: none; }
.chcr-sc a.chcr-sc-item__name:hover { text-decoration: underline; color: inherit; }
.chcr-sc .chcr-sc-item__meta { font-size: 12.5px; color: var(--chcr-muted); }
.chcr-sc .chcr-sc-item__side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 6px; }
.chcr-sc .chcr-sc-item__price { font-weight: 600; font-size: 14px; white-space: nowrap; }
.chcr-sc .chcr-sc-item__remove { padding: 4px 0; font-size: 12px; color: var(--chcr-muted); text-decoration: underline; }
.chcr-sc .chcr-sc-item__remove:hover { color: inherit; background: transparent; }
.chcr-sc .chcr-sc-item.is-gift .chcr-sc-item__price { color: var(--chcr-accent); }

.chcr-sc .chcr-sc-qty { display: inline-flex; align-items: center; border: 1px solid var(--chcr-border); border-radius: 999px; }
.chcr-sc .chcr-sc-qty__btn { width: 40px; height: 36px; padding: 0; font-size: 18px; border-radius: 999px; }
.chcr-sc .chcr-sc-qty__btn:hover:not(:disabled) { background: var(--chcr-soft); color: inherit; }
.chcr-sc .chcr-sc-qty__btn:disabled { opacity: .35; }
.chcr-sc .chcr-sc-qty__val { min-width: 24px; text-align: center; font-size: 14px; }
.chcr-sc .chcr-sc-badge { display: inline-block; padding: 3px 8px; border-radius: 999px; background: var(--chcr-accent); color: #fff; font-size: 11.5px; font-weight: 600; }

/* Footer */
.chcr-sc .chcr-sc__foot { flex: 0 0 auto; padding: 16px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--chcr-border); display: flex; flex-direction: column; gap: 10px; background: var(--chcr-bg); }
.chcr-sc .chcr-sc__foot[hidden] { display: none; }
.chcr-sc .chcr-sc__upsell:empty { display: none; }
.chcr-sc .chcr-sc__upsell { display: flex; flex-direction: column; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--chcr-border); }
.chcr-sc .chcr-sc-upsell__title { margin: 0; font-weight: 700; font-size: 13.6px; }
.chcr-sc .chcr-sc-upsell__item { display: grid; grid-template-columns: 48px 1fr auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; }
.chcr-sc .chcr-sc-upsell__item > :first-child { grid-row: 1 / span 2; width: 48px; height: 48px; object-fit: cover; border-radius: 6px; margin: 0; }
.chcr-sc .chcr-sc-upsell__name { font-size: 13.6px; font-weight: 600; line-height: 1.25; }
.chcr-sc .chcr-sc-upsell__price { grid-column: 2; font-size: 12.5px; color: var(--chcr-muted); }
.chcr-sc .chcr-sc-upsell__add { grid-column: 3; grid-row: 1 / span 2; min-height: 40px; padding: 0 14px; border: 1px solid var(--chcr-accent); border-radius: 999px; color: var(--chcr-accent); font-size: 13px; font-weight: 600; }
.chcr-sc .chcr-sc-upsell__add:hover { background: var(--chcr-accent); color: #fff; }

.chcr-sc .chcr-sc__subtotal { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.chcr-sc .chcr-sc__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	padding: 0 16px;
	border-radius: var(--chcr-radius);
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
	text-align: center;
	transition: background-color .15s, color .15s;
}
.chcr-sc .chcr-sc__btn--primary { background: var(--chcr-accent); color: #fff; border: 1px solid var(--chcr-accent); }
.chcr-sc .chcr-sc__btn--primary:hover { filter: brightness(.92); color: #fff; }
.chcr-sc .chcr-sc__btn--ghost { background: transparent; color: var(--chcr-accent); border: 1px solid var(--chcr-accent); }
.chcr-sc .chcr-sc__btn--ghost:hover { background: var(--chcr-soft); color: var(--chcr-accent); }

.chcr-sc .chcr-sc-empty { display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding: 32px 0; text-align: center; }
.chcr-sc .chcr-sc-empty p, .chcr-sc .chcr-sc-loading { margin: 0; color: var(--chcr-muted); }
.chcr-sc .chcr-sc__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 480px) {
	.chcr-sc .chcr-sc__head, .chcr-sc .chcr-sc__body, .chcr-sc .chcr-sc__foot { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
	dialog.chcr-sc, dialog.chcr-sc::backdrop { transition: none; }
}

/* 1.2.0: skeleton bij de eerste keer laden + dun laadbalkje bij verversen */
.chcr-sc .chcr-sc-skeleton { display: flex; flex-direction: column; gap: 16px; padding-top: 4px; }
.chcr-sc .chcr-sc-skeleton__row { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; }
.chcr-sc .chcr-sc-skeleton__img,
.chcr-sc .chcr-sc-skeleton__lines span {
	display: block;
	border-radius: 6px;
	background: linear-gradient(90deg, var(--chcr-soft) 25%, var(--chcr-border) 50%, var(--chcr-soft) 75%);
	background-size: 200% 100%;
	animation: chcr-shimmer 1.2s linear infinite;
}
.chcr-sc .chcr-sc-skeleton__img { width: 64px; height: 64px; }
.chcr-sc .chcr-sc-skeleton__lines { display: flex; flex-direction: column; gap: 8px; }
.chcr-sc .chcr-sc-skeleton__lines span { height: 12px; width: 80%; }
.chcr-sc .chcr-sc-skeleton__lines span + span { width: 45%; }
@keyframes chcr-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.chcr-sc .chcr-sc__panel { position: relative; }
.chcr-sc.is-loading .chcr-sc__panel::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	height: 2px;
	width: 40%;
	background: var(--chcr-accent);
	animation: chcr-loadbar 1s ease-in-out infinite;
	z-index: 2;
}
@keyframes chcr-loadbar { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) {
	.chcr-sc .chcr-sc-skeleton__img, .chcr-sc .chcr-sc-skeleton__lines span, .chcr-sc.is-loading .chcr-sc__panel::before { animation: none; }
}

/* 1.4.0: verouderde (cache)weergave: wel tonen, nog niet bedienen tot de verse cart binnen is */
.chcr-sc.is-stale .chcr-sc__items,
.chcr-sc.is-stale .chcr-rw,
.chcr-sc.is-stale .chcr-sc__upsell { pointer-events: none; opacity: .7; transition: opacity .15s; }
.chcr-sc.is-stale .chcr-sc__panel::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	height: 2px;
	width: 40%;
	background: var(--chcr-accent);
	animation: chcr-loadbar 1s ease-in-out infinite;
	z-index: 2;
}
.chcr-sc .chcr-sc__items:focus { outline: none; }
@media (prefers-reduced-motion: reduce) {
	.chcr-sc.is-stale .chcr-sc__panel::before { animation: none; }
}

/* 2.1.1: product zonder afbeelding: neutraal vlak i.p.v. lege ruimte */
.chcr-sc .chcr-sc-item__img:empty { width: 64px; height: 64px; border-radius: 6px; background: var(--chcr-soft); }
