/**
 * Add to Cart Behaviour - side cart.
 *
 * Everything is namespaced .pg-atcb-* and driven by CSS custom properties, which the plugin prints
 * from its settings. A child theme overrides any single value with one line and never has to fight
 * specificity. The fallbacks below are what you get if that inline block never lands.
 */

:root {
	--pg-atcb-width: 400px;
	--pg-atcb-thumb: 64px;
	--pg-atcb-bg: #fff;
	--pg-atcb-fg: #1e1e1e;
	--pg-atcb-muted: #6b7280;
	--pg-atcb-line: #e5e7eb;
	--pg-atcb-accent: #111827;
	--pg-atcb-accent-fg: #fff;
	--pg-atcb-radius: 6px;
	--pg-atcb-z: 999999; /* above sticky headers and most cookie bars */
	--pg-atcb-overlay: rgba(0, 0, 0, .45);
	--pg-atcb-shadow: 0 0 40px rgba(0, 0, 0, .18);
	--pg-atcb-basket-x: 24px;
	--pg-atcb-basket-y: 24px;
	--pg-atcb-good: #15803d;
	--pg-atcb-bad: #b32d2e;
}

/*
 * An author `display` declaration beats the user-agent's `[hidden] { display: none }` no matter the
 * specificity, and both the drawer and the basket set one. Without this, `el.hidden = true` from JS
 * is a no-op: the closed drawer keeps its buttons in the keyboard tab order, and "hide the basket
 * when the cart is empty" does nothing at all.
 */
.pg-atcb-drawer[hidden],
.pg-atcb-basket[hidden],
.pg-atcb-overlay[hidden],
.pg-atcb-foot[hidden],
.pg-atcb-badge[hidden] {
	display: none;
}

/* Lock the page behind the drawer without the iOS scroll-jump. */
html.pg-atcb-locked,
html.pg-atcb-locked body {
	overflow: hidden;
}

.pg-atcb-overlay {
	position: fixed;
	inset: 0;
	background: var(--pg-atcb-overlay);
	opacity: 0;
	transition: opacity .22s ease;
	z-index: calc(var(--pg-atcb-z) - 1);
}
.pg-atcb-overlay.is-open { opacity: 1; }

.pg-atcb-drawer {
	position: fixed;
	top: 0;
	bottom: 0;
	width: min(var(--pg-atcb-width), 100vw);
	max-width: 100vw;
	background: var(--pg-atcb-bg);
	color: var(--pg-atcb-fg);
	display: flex;
	flex-direction: column;
	box-shadow: var(--pg-atcb-shadow);
	z-index: var(--pg-atcb-z);
	transition: transform .26s cubic-bezier(.4, 0, .2, 1);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.pg-atcb-drawer.pg-atcb-right { right: 0; transform: translateX(100%); }
.pg-atcb-drawer.pg-atcb-left  { left: 0;  transform: translateX(-100%); }
.pg-atcb-drawer.is-open { transform: translateX(0); }

/* Someone who asked for less motion still needs the drawer, just not the slide. */
@media (prefers-reduced-motion: reduce) {
	.pg-atcb-drawer,
	.pg-atcb-overlay,
	.pg-atcb-rewards-fill,
	.pg-atcb-toast { transition: none; }
}

.pg-atcb-drawer.is-busy,
.pg-atcb-inline.is-busy { cursor: progress; }
.pg-atcb-drawer.is-busy .pg-atcb-body,
.pg-atcb-inline.is-busy .pg-atcb-body { opacity: .55; transition: opacity .12s ease; }

/* ─────────── chrome ─────────── */

.pg-atcb-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 18px;
	border-bottom: 1px solid var(--pg-atcb-line);
}
.pg-atcb-title { margin: 0; font-size: 16px; font-weight: 600; }
.pg-atcb-close {
	background: none;
	border: 0;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: var(--pg-atcb-muted);
	padding: 0 4px;
}
.pg-atcb-close:hover { color: var(--pg-atcb-fg); }

.pg-atcb-body { flex: 1 1 auto; overflow-y: auto; padding: 8px 18px 18px; }
.pg-atcb-subhead {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--pg-atcb-muted);
	margin: 20px 0 8px;
	font-weight: 600;
}

.pg-atcb-link {
	background: none;
	border: 0;
	padding: 0;
	font-size: 12px;
	color: var(--pg-atcb-muted);
	text-decoration: underline;
	cursor: pointer;
}
.pg-atcb-link:hover { color: var(--pg-atcb-fg); }

/* ─────────── toasts ─────────── */

.pg-atcb-toasts {
	position: absolute;
	top: 60px;
	left: 12px;
	right: 12px;
	z-index: 2;
	display: grid;
	gap: 6px;
	pointer-events: none;
}
.pg-atcb-toast {
	background: var(--pg-atcb-fg);
	color: var(--pg-atcb-bg);
	padding: 10px 12px;
	border-radius: var(--pg-atcb-radius);
	font-size: 13px;
	line-height: 1.35;
	opacity: 1;
	transition: opacity .3s ease, transform .3s ease;
}
.pg-atcb-toast.is-error { background: var(--pg-atcb-bad); color: #fff; }
.pg-atcb-toast.is-success { background: var(--pg-atcb-good); color: #fff; }
.pg-atcb-toast.is-out { opacity: 0; transform: translateY(-6px); }
.pg-atcb-toast a { color: inherit; }

/* ─────────── skeleton ─────────── */

.pg-atcb-skel-list { list-style: none; margin: 0; padding: 0; }
.pg-atcb-skel-item { display: grid; grid-template-columns: var(--pg-atcb-thumb) 1fr; gap: 12px; padding: 14px 0; }
.pg-atcb-skel-lines { display: grid; gap: 8px; align-content: start; }
.pg-atcb-skel {
	display: block;
	height: 12px;
	border-radius: 4px;
	background: linear-gradient(90deg, var(--pg-atcb-line) 25%, rgba(255, 255, 255, .55) 50%, var(--pg-atcb-line) 75%);
	background-size: 400% 100%;
	animation: pg-atcb-shimmer 1.4s ease infinite;
}
.pg-atcb-skel-thumb { height: var(--pg-atcb-thumb); border-radius: var(--pg-atcb-radius); }
.pg-atcb-skel-short { width: 55%; }
@keyframes pg-atcb-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .pg-atcb-skel { animation: none; } }

/* ─────────── empty ─────────── */

.pg-atcb-empty { color: var(--pg-atcb-muted); text-align: center; padding: 40px 0; display: grid; gap: 14px; justify-items: center; }
.pg-atcb-empty-img { max-width: 140px; height: auto; opacity: .85; }
.pg-atcb-empty-text { margin: 0; }
.pg-atcb-empty .pg-atcb-btn { min-width: 190px; }

/* ─────────── items ─────────── */

.pg-atcb-items { list-style: none; margin: 0; padding: 0; }

.pg-atcb-item {
	display: grid;
	grid-template-columns: var(--pg-atcb-thumb) 1fr auto;
	gap: 12px;
	align-items: start;
	padding: 14px 0;
	border-bottom: 1px solid var(--pg-atcb-line);
}
.pg-atcb-item:last-child { border-bottom: 0; }

.pg-atcb-thumb img { width: var(--pg-atcb-thumb); height: auto; border-radius: var(--pg-atcb-radius); display: block; }

.pg-atcb-meta { min-width: 0; }
.pg-atcb-name { font-size: 13px; font-weight: 600; line-height: 1.35; }
.pg-atcb-name a { color: inherit; text-decoration: none; }
.pg-atcb-name a:hover { text-decoration: underline; }

.pg-atcb-price { font-size: 13px; margin-top: 2px; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.pg-atcb-price del { color: var(--pg-atcb-muted); opacity: .8; font-size: 12px; }
.pg-atcb-price-now { font-weight: 600; }
.pg-atcb-unit { font-size: 11px; color: var(--pg-atcb-muted); }
.pg-atcb-save { display: inline-block; margin-top: 2px; font-size: 11px; color: var(--pg-atcb-good); font-weight: 600; }

.pg-atcb-gift-badge {
	display: inline-block;
	margin-top: 4px;
	padding: 1px 7px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	background: var(--pg-atcb-good);
	color: #fff;
}

/* WooCommerce renders variation data as a dl; keep it small and out of the way. */
.pg-atcb-meta .variation { font-size: 11px; color: var(--pg-atcb-muted); margin: 2px 0 0; }
.pg-atcb-meta .variation dt, .pg-atcb-meta .variation dd { display: inline; margin: 0; }
.pg-atcb-meta .variation dd:after { content: ''; display: block; }

.pg-atcb-qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--pg-atcb-line);
	border-radius: var(--pg-atcb-radius);
	margin-top: 8px;
	overflow: hidden;
}
.pg-atcb-step {
	background: none;
	border: 0;
	width: 30px;
	height: 30px;
	cursor: pointer;
	font-size: 15px;
	line-height: 1;
	color: var(--pg-atcb-fg);
}
.pg-atcb-step:hover:not(:disabled) { background: color-mix(in srgb, var(--pg-atcb-line) 55%, transparent); }
.pg-atcb-step:disabled { opacity: .35; cursor: not-allowed; }
.pg-atcb-qty-input {
	width: 42px;
	height: 30px;
	border: 0;
	border-left: 1px solid var(--pg-atcb-line);
	border-right: 1px solid var(--pg-atcb-line);
	text-align: center;
	font-size: 13px;
	padding: 0;
	background: transparent;
	color: inherit;
	-moz-appearance: textfield;
}
.pg-atcb-qty-input::-webkit-outer-spin-button,
.pg-atcb-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.pg-atcb-item .pg-atcb-link { display: block; margin-top: 6px; }

.pg-atcb-remove {
	background: none;
	border: 0;
	font-size: 20px;
	line-height: 1;
	color: var(--pg-atcb-muted);
	cursor: pointer;
	padding: 0 2px;
}
.pg-atcb-remove:hover { color: var(--pg-atcb-bad); }

/* Compact row layout: thumbnail shrinks, secondary actions tuck onto one line. */
.pg-atcb-layout-row .pg-atcb-item { grid-template-columns: 44px 1fr auto; padding: 10px 0; align-items: center; }
.pg-atcb-layout-row .pg-atcb-thumb img { width: 44px; }
.pg-atcb-layout-row .pg-atcb-qty { margin-top: 4px; }
.pg-atcb-layout-row .pg-atcb-unit,
.pg-atcb-layout-row .pg-atcb-item .pg-atcb-link { display: none; }

/* ─────────── rewards ─────────── */

.pg-atcb-rewards { padding: 12px 0 4px; }
.pg-atcb-rewards-msg { margin: 0 0 8px; font-size: 12.5px; color: var(--pg-atcb-fg); text-align: center; }
.pg-atcb-rewards.is-complete .pg-atcb-rewards-msg { color: var(--pg-atcb-good); font-weight: 600; }

.pg-atcb-rewards-track {
	position: relative;
	height: 6px;
	border-radius: 999px;
	background: var(--pg-atcb-line);
	overflow: visible;
}
.pg-atcb-rewards-fill {
	display: block;
	height: 100%;
	border-radius: 999px;
	background: var(--pg-atcb-accent);
	transition: width .35s cubic-bezier(.4, 0, .2, 1);
}
.pg-atcb-rewards.is-complete .pg-atcb-rewards-fill { background: var(--pg-atcb-good); }
.pg-atcb-rewards-tick {
	position: absolute;
	top: 50%;
	width: 10px;
	height: 10px;
	margin-left: -5px;
	border-radius: 50%;
	transform: translateY(-50%);
	background: var(--pg-atcb-bg);
	border: 2px solid var(--pg-atcb-line);
}
.pg-atcb-rewards-tick.is-done { border-color: var(--pg-atcb-good); background: var(--pg-atcb-good); }

.pg-atcb-gift-hint { display: block; margin: 0 0 10px; }

/* ─────────── saved for later ─────────── */

.pg-atcb-saved-list { list-style: none; margin: 0; padding: 0; }
.pg-atcb-saved-item {
	display: grid;
	grid-template-columns: 44px 1fr;
	gap: 10px;
	padding: 10px 0;
	border-bottom: 1px solid var(--pg-atcb-line);
}
.pg-atcb-saved-item:last-child { border-bottom: 0; }
.pg-atcb-saved-item .pg-atcb-thumb img { width: 44px; }
.pg-atcb-saved-actions { display: flex; gap: 12px; margin-top: 4px; }

/* ─────────── recommendations ─────────── */

.pg-atcb-rec-list { list-style: none; margin: 0; padding: 0; }
.pg-atcb-rec {
	display: grid;
	grid-template-columns: 44px 1fr auto;
	gap: 10px;
	align-items: center;
	padding: 8px 0;
}
.pg-atcb-rec-thumb img { width: 44px; height: auto; border-radius: var(--pg-atcb-radius); display: block; }
.pg-atcb-rec-name { font-size: 12.5px; font-weight: 600; color: inherit; text-decoration: none; display: block; }
.pg-atcb-rec-name:hover { text-decoration: underline; }
.pg-atcb-rec .pg-atcb-price { font-size: 12px; color: var(--pg-atcb-muted); }
.pg-atcb-rec .pg-atcb-price del { font-size: 11px; }

.pg-atcb-recs-slider .pg-atcb-rec-list {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 140px;
	gap: 12px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	padding-bottom: 6px;
}
.pg-atcb-recs-slider .pg-atcb-rec {
	grid-template-columns: 1fr;
	justify-items: center;
	text-align: center;
	scroll-snap-align: start;
	gap: 6px;
}
.pg-atcb-recs-slider .pg-atcb-rec-thumb img { width: 100%; }

/* ─────────── footer ─────────── */

.pg-atcb-foot { border-top: 1px solid var(--pg-atcb-line); padding: 14px 18px 16px; display: grid; gap: 12px; }

.pg-atcb-totals { display: grid; gap: 5px; font-size: 13px; }
.pg-atcb-total-row { display: flex; justify-content: space-between; gap: 12px; }
.pg-atcb-total-discount { color: var(--pg-atcb-good); }
.pg-atcb-total-grand { font-size: 15px; padding-top: 6px; border-top: 1px solid var(--pg-atcb-line); }

.pg-atcb-coupon { display: grid; gap: 8px; }
.pg-atcb-coupon-applied { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.pg-atcb-coupon-applied li { display: flex; justify-content: space-between; font-size: 12px; }
.pg-atcb-coupon-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pg-atcb-chip {
	border: 1px dashed var(--pg-atcb-line);
	background: none;
	color: var(--pg-atcb-fg);
	border-radius: 999px;
	padding: 3px 10px;
	font-size: 11px;
	cursor: pointer;
}
.pg-atcb-chip:hover { border-color: var(--pg-atcb-accent); }
.pg-atcb-coupon-form { display: flex; gap: 6px; }
.pg-atcb-coupon-input {
	flex: 1 1 auto;
	min-width: 0;
	border: 1px solid var(--pg-atcb-line);
	border-radius: var(--pg-atcb-radius);
	padding: 8px 10px;
	font-size: 13px;
	background: transparent;
	color: inherit;
}

.pg-atcb-btn-small {
	border: 1px solid var(--pg-atcb-line);
	background: transparent;
	color: var(--pg-atcb-fg);
	border-radius: var(--pg-atcb-radius);
	padding: 7px 12px;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
	line-height: 1.2;
}
.pg-atcb-btn-small:hover { border-color: var(--pg-atcb-accent); color: var(--pg-atcb-fg); }

.pg-atcb-shipcalc { display: grid; gap: 8px; }
.pg-atcb-shipcalc .pg-atcb-subhead { margin: 0; }
/* State and postcode sit side by side; country, city and the button take the full width. Which of
   the three optional fields exist is WooCommerce's decision, so the grid must not assume any of them. */
.pg-atcb-shipcalc-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pg-atcb-shipcalc-fields select,
.pg-atcb-shipcalc-fields input {
	border: 1px solid var(--pg-atcb-line);
	border-radius: var(--pg-atcb-radius);
	padding: 7px 8px;
	font-size: 12px;
	background: transparent;
	color: inherit;
	min-width: 0;
}
.pg-atcb-shipcalc-fields .pg-atcb-ship-country,
.pg-atcb-shipcalc-fields .pg-atcb-ship-city,
.pg-atcb-shipcalc-fields .pg-atcb-ship-go { grid-column: 1 / -1; }
.pg-atcb-shipcalc-none { font-size: 12px; color: var(--pg-atcb-muted); margin: 0; }
.pg-atcb-rates { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 12.5px; }
.pg-atcb-rates label { display: flex; gap: 8px; align-items: center; cursor: pointer; }

.pg-atcb-buttons { display: grid; gap: 8px; }
.pg-atcb-btn {
	display: block;
	text-align: center;
	padding: 12px 16px;
	border-radius: var(--pg-atcb-radius);
	text-decoration: none;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
}
.pg-atcb-btn-main { background: var(--pg-atcb-accent); color: var(--pg-atcb-accent-fg); }
.pg-atcb-btn-main:hover { opacity: .9; color: var(--pg-atcb-accent-fg); }
.pg-atcb-btn-alt { background: transparent; color: var(--pg-atcb-fg); border: 1px solid var(--pg-atcb-line); }
.pg-atcb-btn-alt:hover { background: color-mix(in srgb, var(--pg-atcb-line) 35%, transparent); color: var(--pg-atcb-fg); }

.pg-atcb-continue { display: block; text-align: center; font-size: 12px; color: var(--pg-atcb-muted); }

.pg-atcb-drawer :focus-visible,
.pg-atcb-basket:focus-visible { outline: 2px solid var(--pg-atcb-accent); outline-offset: 2px; }

/* ─────────── floating basket ─────────── */

.pg-atcb-basket {
	position: fixed;
	z-index: calc(var(--pg-atcb-z) - 2);
	width: 56px;
	height: 56px;
	border-radius: 50%;
	border: 0;
	cursor: pointer;
	background: var(--pg-atcb-accent);
	color: var(--pg-atcb-accent-fg);
	box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
	display: grid;
	place-items: center;
}
.pg-atcb-basket-bottom-right { right: var(--pg-atcb-basket-x); bottom: var(--pg-atcb-basket-y); }
.pg-atcb-basket-bottom-left  { left: var(--pg-atcb-basket-x);  bottom: var(--pg-atcb-basket-y); }
.pg-atcb-basket-middle-right { right: var(--pg-atcb-basket-x); top: 50%; transform: translateY(-50%); }
.pg-atcb-basket-middle-left  { left: var(--pg-atcb-basket-x);  top: 50%; transform: translateY(-50%); }

.pg-atcb-icon { width: 22px; height: 22px; }

.pg-atcb-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 999px;
	background: var(--pg-atcb-bg);
	color: var(--pg-atcb-fg);
	font-size: 11px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
	box-shadow: 0 0 0 2px var(--pg-atcb-accent);
}

.pg-atcb-menu-item .pg-atcb-menu-link { position: relative; display: inline-flex; align-items: center; }
.pg-atcb-menu-item .pg-atcb-badge {
	position: static;
	margin-left: 6px;
	background: var(--pg-atcb-accent);
	color: var(--pg-atcb-accent-fg);
	box-shadow: none;
}

@media (max-width: 767px) {
	.pg-atcb-hide-mobile { display: none !important; }
}

/* ─────────── inline shortcode ─────────── */

.pg-atcb-inline {
	border: 1px solid var(--pg-atcb-line);
	border-radius: var(--pg-atcb-radius);
	color: var(--pg-atcb-fg);
	background: var(--pg-atcb-bg);
}
.pg-atcb-inline .pg-atcb-body { max-height: none; }

@media (max-width: 480px) {
	.pg-atcb-drawer { width: 100vw; }
}
