/**
 * eBoots — Carrello custom (sketch 009 B). Pannello #eb-cart guidato dalla Store API.
 * SITE-WIDE (markup in inc/cart.php, logica in assets/js/cart-store.js).
 *  - MOBILE (≤768px): bottom-sheet che sale dal basso.
 *  - DESKTOP (>768px): drawer da destra.
 * L'offcanvas nativo di Blocksy è disattivato (l'icona header apre questo pannello).
 */

/* Disattiva l'offcanvas carrello di Blocksy: usiamo il nostro pannello. */
#woo-cart-panel { display: none !important; }

/* blocco scroll quando il pannello è aperto */
html.eb-cart-lock, html.eb-cart-lock body { overflow: hidden; }

/* ---- overlay ---- */
.eb-cart-panel {
	position: fixed;
	inset: 0;
	z-index: 99999;
	visibility: hidden;
	font-family: var(--font-ui);
}
.eb-cart-panel.is-open { visibility: visible; }

.eb-cart-panel__scrim {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	opacity: 0;
	transition: opacity 0.28s ease;
}
.eb-cart-panel.is-open .eb-cart-panel__scrim { opacity: 1; }

/* ---- sheet/drawer ---- */
.eb-cart-panel__sheet {
	position: absolute;
	background: var(--bg);
	color: var(--txt);
	border: 1px solid var(--line-strong);
	display: flex;
	flex-direction: column;
	box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
	transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Avviso transitorio per gli errori Store API (esaurito, limite quantità, ecc.). */
.eb-cart-panel__toast {
	position: absolute;
	left: 50%;
	bottom: 16px;
	transform: translate(-50%, 12px);
	z-index: 5;
	max-width: calc(100% - 32px);
	padding: 10px 16px;
	border-radius: var(--radius-pill, 999px);
	background: #ef4444;
	color: #fff;
	font-family: var(--font-ui, 'Saira', system-ui, sans-serif);
	font-size: 13px;
	font-weight: 600;
	text-align: center;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
}
.eb-cart-panel__toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* MOBILE: bottom-sheet */
@media (max-width: 768px) {
	.eb-cart-panel__sheet {
		left: 0;
		right: 0;
		bottom: 0;
		max-height: 90vh;
		border-radius: 22px 22px 0 0;
		border-bottom: 0;
		transform: translateY(100%);
	}
	.eb-cart-panel.is-open .eb-cart-panel__sheet { transform: translateY(0); }
	.eb-cart-panel__grab {
		display: block;
		width: 42px;
		height: 5px;
		border-radius: 3px;
		background: var(--line-strong);
		margin: 10px auto 0;
		flex: none;
	}
}

/* DESKTOP: drawer da destra */
@media (min-width: 769px) {
	.eb-cart-panel__sheet {
		top: 0;
		right: 0;
		bottom: 0;
		width: 460px;
		max-width: 92vw;
		border-radius: 0;
		border-right: 0;
		box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
		transform: translateX(100%);
	}
	.eb-cart-panel.is-open .eb-cart-panel__sheet { transform: translateX(0); }
	.eb-cart-panel__grab { display: none; }
}

/* ---- head ---- */
.eb-cart-panel__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1rem 1.1rem;
	border-bottom: 1px solid var(--line);
	flex: none;
}
.eb-cart-panel__title {
	margin: 0;
	font-family: var(--font-d);
	font-weight: 800;
	font-size: 1.35rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--txt);
}
.eb-cart-panel__count { font-family: var(--font-ui); font-weight: 600; font-size: 0.75rem; color: var(--muted); }
.eb-cart-panel__close {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 1px solid var(--line);
	background: var(--surface-2);
	color: var(--muted);
	display: grid;
	place-items: center;
	cursor: pointer;
	flex: none;
}
.eb-cart-panel__close svg { width: 15px; height: 15px; }
.eb-cart-panel__close:hover { color: var(--volt); border-color: var(--volt); }

/* ---- body (scroll) ---- */
.eb-cart-panel__body {
	flex: 1 1 auto;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 1rem 1.1rem 0;
	display: flex;
	flex-direction: column;
}
.eb-cart-panel__body::-webkit-scrollbar { width: 0; }
.eb-cart-panel__loading { color: var(--muted); font-size: 0.875rem; padding: 1.5rem 0; text-align: center; }
.eb-cart-panel.is-busy .eb-cart-panel__body { opacity: 0.6; pointer-events: none; }

/* ---- reassure ---- */
.eb-ci-reassure {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	background: linear-gradient(90deg, rgba(199, 247, 63, 0.1), rgba(43, 230, 163, 0.06));
	border: 1px solid rgba(199, 247, 63, 0.28);
	border-radius: var(--radius-md);
	padding: 0.7rem 0.8rem;
	margin-bottom: 1rem;
	flex: none;
}
.eb-ci-reassure p { margin: 0; font-size: 0.75rem; line-height: 1.35; color: var(--txt); }
.eb-ci-reassure strong { color: var(--volt); }

/* ---- items ---- */
.eb-ci-list { list-style: none; margin: 0; padding: 0; }
.eb-ci {
	display: flex;
	gap: 0.85rem;
	padding: 0.9rem 0;
	border-bottom: 1px solid var(--line);
	position: relative;
}
.eb-ci__media { flex: 0 0 72px; }
.eb-ci__media img {
	width: 72px;
	height: 72px;
	object-fit: cover;
	border-radius: var(--radius-md);
	border: 1px solid var(--line);
	background: var(--surface-2);
	display: block;
}
.eb-ci__main { flex: 1; min-width: 0; padding-right: 1.6rem; }
.eb-ci__brand { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); display: block; }
.eb-ci__name { font-family: var(--font-d); font-weight: 800; font-size: 0.95rem; text-transform: uppercase; line-height: 1.1; display: block; margin: 0.1rem 0; }
.eb-ci__tag {
	display: inline-block;
	font-size: 0.625rem;
	font-weight: 600;
	color: var(--txt);
	background: var(--surface-2);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	padding: 0.12rem 0.45rem;
}
.eb-ci__bottom { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.6rem; }
.eb-ci__qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-pill);
	overflow: hidden;
}
.eb-ci__step {
	width: 30px;
	height: 32px;
	background: var(--surface-2);
	border: 0;
	color: var(--txt);
	font-size: 1.1rem;
	line-height: 1;
	cursor: pointer;
	display: grid;
	place-items: center;
}
.eb-ci__step:hover { color: var(--volt); }
.eb-ci__q { min-width: 30px; text-align: center; font-family: var(--font-d); font-weight: 800; font-size: 0.9rem; }
.eb-ci__price { font-family: var(--font-d); font-weight: 800; font-size: 1rem; }
.eb-ci__remove {
	position: absolute;
	top: 0.9rem;
	right: 0;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	border: 1px solid var(--line);
	background: transparent;
	color: var(--muted);
	display: grid;
	place-items: center;
	cursor: pointer;
}
.eb-ci__remove svg { width: 12px; height: 12px; }
.eb-ci__remove:hover { color: var(--volt); border-color: var(--volt); }

/* ---- cross-sell ---- */
.eb-ci-xsell { margin: 1.25rem 0 0.5rem; flex: none; }
.eb-ci-xsell__t { font-family: var(--font-d); font-weight: 800; font-size: 1rem; text-transform: uppercase; margin: 0 0 0.75rem; }
.eb-ci-xsell__row { display: flex; gap: 0.6rem; overflow-x: auto; scrollbar-width: none; }
.eb-ci-xsell__row::-webkit-scrollbar { display: none; }
.eb-xc {
	flex: 0 0 130px;
	border: 1px solid var(--line);
	border-radius: var(--radius-md);
	background: var(--surface);
	padding: 0.55rem;
	text-decoration: none;
	color: var(--txt);
}
.eb-xc__media { display: block; aspect-ratio: 1/1; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.eb-xc__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.eb-xc__name { display: block; font-size: 0.7rem; font-weight: 600; line-height: 1.2; min-height: 1.8rem; margin: 0.4rem 0 0.2rem; }
.eb-xc__bottom { display: flex; align-items: center; justify-content: space-between; }
.eb-xc__price { font-family: var(--font-d); font-weight: 800; font-size: 0.75rem; }
.eb-xc__add { width: 24px; height: 24px; border-radius: 50%; background: var(--volt); color: var(--bg); font-size: 1.1rem; line-height: 1; display: grid; place-items: center; }

/* ---- footer ---- */
.eb-cf {
	position: sticky;
	bottom: 0;
	margin-top: auto;
	padding: 1rem 0 1.1rem;
	background: var(--bg);
	border-top: 1px solid var(--line-strong);
	flex: none;
}
.eb-cf__sum { display: flex; align-items: center; justify-content: space-between; font-size: 0.8125rem; color: var(--muted); margin: 0.3rem 0; }
.eb-cf__sum .v { color: var(--txt); font-weight: 600; }
.eb-cf__free { color: var(--volt) !important; font-weight: 700 !important; }
.eb-cf__sum--total { margin-top: 0.6rem; padding-top: 0.7rem; border-top: 1px solid var(--line); }
.eb-cf__sum--total .k { font-family: var(--font-d); font-weight: 800; font-size: 1rem; text-transform: uppercase; color: var(--txt); }
.eb-cf__sum--total .v { font-family: var(--font-d); font-weight: 800; font-size: 1.5rem; }
.eb-cf__checkout {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	width: 100%;
	margin-top: 0.85rem;
	background: var(--volt);
	color: var(--bg);
	font-family: var(--font-d);
	font-weight: 800;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	font-size: 1.0625rem;
	padding: 0.95rem;
	border-radius: var(--radius-pill);
	text-decoration: none;
	transition: filter 0.15s ease, transform 0.1s ease;
}
.eb-cf__checkout svg { width: 18px; height: 18px; }
.eb-cf__checkout:hover { filter: brightness(1.08); color: var(--bg); }
.eb-cf__checkout:active { transform: translateY(1px); }
.eb-cf__viewcart { display: block; text-align: center; margin-top: 0.6rem; color: var(--muted); font-size: 0.8125rem; text-decoration: underline; }
.eb-cf__viewcart:hover { color: var(--txt); }
.eb-cf__note { display: flex; align-items: center; justify-content: center; gap: 0.4rem; font-size: 0.6875rem; color: var(--muted); margin: 0.7rem 0 0; }
.eb-cf__note svg { width: 13px; height: 13px; }

/* ---- pagamento rapido (express, server-rendered dal gateway) ---- */
.eb-cart-panel__express {
	flex: none;
	border-top: 1px solid var(--line-strong);
	background: var(--bg);
	padding: 0.85rem 1.1rem calc(0.95rem + env(safe-area-inset-bottom));
}
.eb-cart-panel.is-empty .eb-cart-panel__express { display: none; }
.eb-cart-panel__express-or {
	display: block;
	text-align: center;
	font-size: 0.6875rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--muted);
	margin-bottom: 0.6rem;
}
/* i bottoni li stila il gateway; noi garantiamo larghezza piena del container */
.eb-cart-panel__express .wc-stripe-product-checkout-container,
.eb-cart-panel__express [id*="payment-request"],
.eb-cart-panel__express .gpay-card-info-container,
.eb-cart-panel__express .apple-pay-button { width: 100% !important; max-width: 100% !important; }

/* ---- empty ---- */
.eb-ci-empty { text-align: center; padding: 2.5rem 1rem; margin: auto 0; }
.eb-ci-empty__ic { font-size: 3.5rem; filter: grayscale(1) opacity(0.5); }
.eb-ci-empty__t { font-family: var(--font-d); font-weight: 800; font-size: 1.35rem; text-transform: uppercase; margin: 1rem 0 0.4rem; color: var(--txt); }
.eb-ci-empty__d { font-size: 0.85rem; color: var(--muted); margin: 0 0 1.25rem; }
.eb-ci-empty .eb-cf__checkout { max-width: 220px; margin-inline: auto; }
