/* Cart page (WooCommerce Cart block) + "Available offers" (markup: inc/cart-page.php) */

/* ---- Layout: items on the left, a summary card on the right that stays in view ---- */
.wc-block-cart { gap: 32px; }
.wc-block-cart .wc-block-cart__main .wc-block-cart-items { border-collapse: separate; }
.wc-block-cart .wc-block-cart-items__header { font-size: 12px; letter-spacing: .08em; color: var(--muted-dark); }
.wc-block-cart .wc-block-cart-items__row { transition: background .2s; }
.wc-block-cart .wc-block-cart-item__image img { border-radius: var(--radius-sm); border: 1px solid var(--line-dark); background: #fff; }
.wc-block-cart .wc-block-components-product-name { font-weight: 600; font-size: 16px; text-decoration: none; color: var(--text-dark); }
.wc-block-cart .wc-block-components-product-name:hover { color: var(--accent); }
.wc-block-cart .wc-block-cart-item__total .wc-block-components-product-price { font-weight: 600; }
.wc-block-cart .wc-block-components-quantity-selector { border-radius: 999px; overflow: hidden; }
.wc-block-cart .wc-block-components-quantity-selector::after { border-radius: 999px; }

.wc-block-cart .wc-block-cart__sidebar {
	align-self: flex-start; position: sticky; top: calc(var(--header-h) + 24px);
	padding: 22px 24px 24px !important; border-radius: var(--radius); background: var(--white); border: 1px solid var(--line-dark);
	box-shadow: 0 1px 2px rgba(11, 12, 16, .04), 0 12px 32px -18px rgba(11, 12, 16, .18);
}
.wc-block-cart .wc-block-cart__sidebar .wp-block-woocommerce-cart-order-summary-block { background: transparent; }
.wc-block-cart .wc-block-cart__sidebar .wc-block-components-totals-wrapper { padding-left: 0; padding-right: 0; }
.wc-block-cart .wc-block-cart__totals-title { font-size: 12px !important; letter-spacing: .08em; color: var(--muted-dark); padding: 0 0 8px !important; }
.wc-block-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__label { font-weight: 600; }
.wc-block-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.wc-block-cart .wc-block-components-totals-discount .wc-block-components-totals-item__value { color: #2f8a3e; font-weight: 600; }
.wc-block-cart .wc-block-components-totals-coupon .wc-block-components-panel__button { font-weight: 500; }
.wc-block-cart .wc-block-cart__submit-container { padding-top: 4px; }
.wc-block-cart .wc-block-cart__submit-button { min-height: 56px; font-size: 17px; font-weight: 700; }

@media (max-width: 781px) {
	.wc-block-cart .wc-block-cart__sidebar { position: static; padding: 18px !important; }
}

/* ---- Available offers ---- */
.rp-offers { padding: 16px 0; border-bottom: 1px solid var(--line-dark); font-family: var(--font); }
.rp-offers[hidden] { display: none; }
/* Checkout: the summary card has no side padding (each Woo row pads itself) and rows divide with a top border. */
.wc-block-checkout .rp-offers { padding: 16px 0; border-bottom: 0; border-top: 1px solid var(--line-dark); }
.wc-block-checkout .rp-offer::before, .wc-block-checkout .rp-offer::after { background: var(--paper); } /* phone: no card, notches sit on the page colour */
@media (min-width: 782px) {
	/* Two columns: the summary is a white card like the cart's (Woo leaves it see-through). */
	.wc-block-checkout .wc-block-checkout__sidebar .wp-block-woocommerce-checkout-order-summary-block {
		background: var(--white); border-radius: var(--radius); border-color: var(--line-dark); overflow: hidden;
		box-shadow: 0 1px 2px rgba(11, 12, 16, .04), 0 12px 32px -18px rgba(11, 12, 16, .18);
	}
	.wc-block-checkout .rp-offers { padding: 16px; }
	.wc-block-checkout .rp-offer::before, .wc-block-checkout .rp-offer::after { background: var(--white); }
}
.rp-offers__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 0 12px; }
.rp-offers__title { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.01em; color: var(--text-dark); }
.rp-offers__count { font-size: 12px; font-weight: 600; color: #2f8a3e; background: color-mix(in srgb, #2f8a3e 12%, #fff); padding: 3px 8px; border-radius: 999px; }
.rp-offers__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.rp-offer {
	position: relative; padding: 14px 14px 12px; border-radius: 14px;
	border: 1.5px dashed color-mix(in srgb, var(--accent) 50%, transparent); background: #f6f4ff;
	transition: border-color .2s, background .2s, opacity .2s;
}
/* Ticket notches */
.rp-offer::before, .rp-offer::after { content: ""; position: absolute; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--white); border: 1.5px dashed transparent; }
.rp-offer::before { left: -8px; box-shadow: inset -1px 0 0 color-mix(in srgb, var(--accent) 35%, transparent); }
.rp-offer::after { right: -8px; box-shadow: inset 1px 0 0 color-mix(in srgb, var(--accent) 35%, transparent); }

.rp-offer.is-applied { border-style: solid; border-color: #2f8a3e; background: color-mix(in srgb, #2f8a3e 7%, #fff); }
.rp-offer.is-applied::before { box-shadow: inset -1px 0 0 #2f8a3e; }
.rp-offer.is-applied::after { box-shadow: inset 1px 0 0 #2f8a3e; }
.rp-offer.is-locked { border-color: var(--line-dark); background: var(--paper); }
.rp-offer.is-locked::before, .rp-offer.is-locked::after { box-shadow: inset 0 0 0 1px var(--line-dark); }
.rp-offer.is-locked .rp-offer__title, .rp-offer.is-locked .rp-offer__code { opacity: .6; }
.rp-offer.is-busy { opacity: .6; pointer-events: none; }

.rp-offer__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rp-offer .rp-offer__code {
	all: unset; box-sizing: border-box; position: relative; display: inline-flex; align-items: center; gap: 6px;
	padding: 4px 9px; border-radius: 8px; background: var(--white); border: 1px solid var(--line-dark);
	color: var(--accent); cursor: pointer; transition: border-color .15s;
}
.rp-offer .rp-offer__code:hover { border-color: var(--accent); }
.rp-offer .rp-offer__code:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rp-offer__code svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.rp-offer__code code { font: 700 13px/1.2 var(--font); letter-spacing: .08em; background: none; padding: 0; color: var(--text-dark); }
.rp-offer__code.is-copied::after { content: attr(data-label); position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); padding: 3px 8px; border-radius: 6px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; }
.rp-offer__flag { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink); background: var(--lime); padding: 3px 8px; border-radius: 999px; }

.rp-offer__title { margin: 10px 0 0; font-size: 16px; font-weight: 700; letter-spacing: -.01em; color: var(--text-dark); line-height: 1.25; }
.rp-offer__meta { margin: 3px 0 0; font-size: 13px; line-height: 1.4; color: var(--muted-dark); }
.rp-offer__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line-dark); flex-wrap: wrap; }
.rp-offer__save { font-size: 13px; font-weight: 600; color: #2f8a3e; }
.rp-offer__why { font-size: 13px; font-weight: 500; color: var(--muted-dark); }
.rp-offer__actions { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; }

.rp-offer .rp-offer__apply {
	all: unset; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;
	min-width: 76px; height: 34px; padding: 0 16px; border-radius: 999px; background: var(--ink); color: #fff;
	font: 600 14px/1 var(--font); cursor: pointer; transition: background .2s, transform .2s;
}
.rp-offer .rp-offer__apply:hover { background: var(--accent); transform: translateY(-1px); }
.rp-offer .rp-offer__apply:focus-visible, .rp-offer .rp-offer__remove:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rp-offer__done { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 700; color: #2f8a3e; }
.rp-offer__done svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.rp-offer .rp-offer__remove { all: unset; cursor: pointer; font: 500 13px/1 var(--font); color: var(--muted-dark); text-decoration: underline; text-underline-offset: 3px; }
.rp-offer .rp-offer__remove:hover { color: #d33; }
.rp-offer__error { margin: 8px 0 0; font-size: 13px; color: #c62828; }
.rp-offer__error[hidden] { display: none; }

/* ---- Many offers: first two show, the rest open with "View N more" and scroll inside the card ---- */
.rp-offer--more { display: none; }
.rp-offers.is-expanded .rp-offer--more { display: block; animation: rp-offer-in .25s ease both; }
.rp-offers.is-expanded .rp-offers__list {
	max-height: min(460px, 55vh); overflow-y: auto; overscroll-behavior: contain;
	padding: 2px 10px 2px 8px; margin: 0 -10px 0 -8px; /* room for the ticket notches and the scrollbar */
	scrollbar-width: thin; scrollbar-color: var(--line-dark) transparent;
	-webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 24px), transparent);
	        mask-image: linear-gradient(to bottom, #000 calc(100% - 24px), transparent);
}
@keyframes rp-offer-in { from { opacity: 0; transform: translateY(-4px); } }

.rp-offers .rp-offers__toggle {
	all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%;
	margin-top: 10px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line-dark); background: var(--white);
	font: 600 14px/1.2 var(--font); color: var(--text-dark); cursor: pointer; text-align: center; transition: border-color .15s, background .15s;
}
.rp-offers .rp-offers__toggle:hover { border-color: var(--accent); background: #f6f4ff; }
.rp-offers .rp-offers__toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rp-offers__toggle svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.rp-offers__toggle-less { display: none; }
.rp-offers.is-expanded .rp-offers__toggle-more { display: none; }
.rp-offers.is-expanded .rp-offers__toggle-less { display: inline; }
.rp-offers.is-expanded .rp-offers__toggle svg { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .rp-offers.is-expanded .rp-offer--more { animation: none; } }

/* ---- Checkout: every offer in a dialog (centred on desktop, a bottom sheet on phones) — see cart-page.js ---- */
.rp-offers-modal {
	width: min(460px, calc(100vw - 32px)); max-width: none; max-height: min(640px, 85vh); padding: 0; margin: auto;
	border: 0; border-radius: 18px; background: var(--white); color: var(--text-dark); font-family: var(--font);
	box-shadow: 0 24px 64px -16px rgba(11, 12, 16, .35); overflow: hidden;
}
.rp-offers-modal[open] { display: flex; flex-direction: column; animation: rp-modal-in .22s ease both; }
.rp-offers-modal::backdrop { background: rgba(11, 12, 16, .45); animation: rp-fade-in .22s ease both; }
.rp-offers-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line-dark); }
.rp-offers-modal__head .rp-offers__title { font-size: 17px; }
.rp-offers-modal .rp-offers-modal__close {
	all: unset; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
	border-radius: 50%; cursor: pointer; color: var(--text-dark); transition: background .15s;
}
.rp-offers-modal .rp-offers-modal__close:hover { background: var(--paper); }
.rp-offers-modal .rp-offers-modal__close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rp-offers-modal__close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.rp-offers-modal__body { overflow-y: auto; overscroll-behavior: contain; padding: 30px 20px 20px; scrollbar-width: thin; } /* top room for the "Copied" tip */
.rp-offers-modal .rp-offer--more { display: block; }
.rp-offers-modal .rp-offer::before, .rp-offers-modal .rp-offer::after { background: var(--white); }
html:has(.rp-offers-modal[open]) { overflow: hidden; }

@media (max-width: 600px) {
	.rp-offers-modal { width: 100%; max-height: 85vh; margin: auto 0 0; border-radius: 20px 20px 0 0; }
	.rp-offers-modal[open] { animation-name: rp-sheet-in; }
	.rp-offers-modal__head::before { content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--line-dark); }
	.rp-offers-modal__head { position: relative; padding-top: 22px; }
	.rp-offers-modal__body { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
}
@keyframes rp-modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes rp-sheet-in { from { transform: translateY(100%); } }
@keyframes rp-fade-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .rp-offers-modal[open], .rp-offers-modal::backdrop { animation: none; } }
