/* ---------------------------------------------------------------
   Design tokens
   ---------------------------------------------------------------
   Every colour, radius and timing used by the plugin resolves here,
   so a theme can retheme the whole catalogue by redefining a handful
   of custom properties. Elementor's own controls still win, since
   they emit higher-specificity rules per widget.

   :where() keeps specificity at zero so nothing here outranks a
   theme's own :root block.
   --------------------------------------------------------------- */
:where(:root) {
	--spc-accent: #6c3ce9;
	--spc-accent-contrast: #fff;
	--spc-danger: #b32d2e;
	--spc-danger-contrast: #fff;

	--spc-text: inherit;
	/* 5.6:1 on white — passes AA for body text, unlike a plain grey. */
	--spc-muted: #5c6470;
	--spc-border: rgba(0, 0, 0, .14);
	--spc-border-strong: rgba(0, 0, 0, .24);
	--spc-surface-subtle: rgba(0, 0, 0, .05);
	--spc-surface-hover: rgba(0, 0, 0, .09);

	--spc-cart-thumb-size: 72px;
	--spc-cart-qty-width: 64px;

	--spc-radius: 4px;
	--spc-radius-lg: 8px;
	--spc-radius-pill: 999px;

	--spc-speed: 160ms;
	--spc-ease: cubic-bezier(.2, .7, .3, 1);

	--spc-focus-width: 2px;
	--spc-focus-offset: 2px;
}

/* ---------------------------------------------------------------
   Focus
   ---------------------------------------------------------------
   One ring, applied once, to everything the keyboard can reach.
   :focus-visible keeps it off mouse clicks; the :focus fallback
   covers browsers without it.
   --------------------------------------------------------------- */
.spc-cart :focus-visible,
.spc-grid :focus-visible,
.spc-filter :focus-visible,
.spc-add-to-cart-wrap :focus-visible,
.spc-cart-icon-wrap:focus-visible {
	outline: var(--spc-focus-width) solid var(--spc-accent);
	outline-offset: var(--spc-focus-offset);
	border-radius: var(--spc-radius);
}

.spc-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* Minimal, unopinionated styles — everything is themeable in Elementor. */
.spc-price del { color: var(--spc-muted); margin-right: .35em; }
.spc-price ins { text-decoration: none; font-weight: 600; }

.spc-add-to-cart-wrap { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.spc-add-to-cart-wrap .spc-qty { width: 5rem; padding: .5rem; }
.spc-button {
	display: inline-block;
	padding: .75rem 1.5rem;
	text-decoration: none;
	cursor: pointer;
	border-radius: var(--spc-radius);
	transition: background-color var(--spc-speed) var(--spc-ease), color var(--spc-speed) var(--spc-ease), opacity var(--spc-speed) var(--spc-ease);
}
.spc-add-to-cart.spc-loading { opacity: .6; pointer-events: none; }
.spc-add-to-cart.spc-error { background: var(--spc-danger); color: var(--spc-danger-contrast); }
.spc-out-of-stock { color: var(--spc-muted); font-style: italic; }

.spc-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: .5rem; }
.spc-gallery img { width: 100%; height: auto; display: block; }

/* ---------------------------------------------------------------
   Cart
   ---------------------------------------------------------------
   Not a <table>. Rows are flex on wide screens and grid cards on
   narrow ones, with ARIA roles carrying the table semantics. Flex
   basis per column means hiding a column simply gives its space
   back — no template to keep in sync with the PHP.
   --------------------------------------------------------------- */
.spc-cart-table-wrap { width: 100%; }
.spc-cart-table { width: 100%; }

.spc-cart-head,
.spc-cart-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 0;
	border-bottom: 1px solid var(--spc-border);
}
.spc-cart-head {
	font-weight: 600;
	border-bottom-width: 2px;
}
.spc-cart-row:last-child { border-bottom: 0; }

/* Column widths. The name flexes; the rest hold their size. */
.spc-cart-table .spc-cart-thumb      { flex: 0 0 var(--spc-cart-thumb-size, 72px); }
.spc-cart-table .spc-cart-name       { flex: 1 1 auto; min-width: 0; }
.spc-cart-table .spc-cart-price      { flex: 0 0 110px; }
.spc-cart-table .spc-cart-qty        { flex: 0 0 120px; }
.spc-cart-table .spc-cart-line-total { flex: 0 0 120px; }
.spc-cart-table .spc-cart-remove     { flex: 0 0 44px; text-align: right; }

.spc-cart-table .spc-cell { display: block; min-width: 0; }
.spc-cart-table .spc-cell[data-label]::before { display: none; }

/* Height and object-fit are driven by Elementor controls; the defaults
   keep the natural aspect ratio when nothing is set. */
.spc-cart-thumb img {
	display: block;
	width: 100%;
	height: auto;
	object-fit: cover;
	object-position: center center;
	border-radius: var(--spc-radius);
}
.spc-cart-name a { overflow-wrap: anywhere; }
.spc-cart-variation,
.spc-cart-sku { display: block; margin-top: 2px; font-size: .85em; color: var(--spc-muted); }

/* Quantity field.
   Themes style `input[type=number]` at (0,1,1); the extra class step wins
   so the field stays compact instead of inheriting form-control sizing.
   Native spinner arrows are left alone by default — hiding them is opt-in
   via the widget's Quantity control setting. */
.spc-cart .spc-cart-qty-input {
	box-sizing: border-box;
	width: var(--spc-cart-qty-width, 64px);
	max-width: 100%;
	min-height: 0;
	padding: .35rem .4rem;
	font: inherit;
	font-size: .95em;
	line-height: 1.2;
	text-align: center;
	color: inherit;
	background: transparent;
	border: 1px solid var(--spc-border-strong);
	border-radius: var(--spc-radius);
	box-shadow: none;
	transition: border-color var(--spc-speed) var(--spc-ease);
}
.spc-cart .spc-cart-qty-input:hover { border-color: var(--spc-accent); }

/* Native arrows are cramped at small widths, so give the field a little
   more room when they are showing. */
.spc-cart .spc-cart-qty--native .spc-cart-qty-input { padding-right: .2rem; }

/* --- Plus / minus stepper --- */
.spc-cart .spc-qty-stepper {
	display: inline-flex;
	align-items: stretch;
	border: 1px solid var(--spc-border-strong);
	border-radius: var(--spc-radius);
	overflow: hidden;
}
.spc-cart .spc-qty-stepper .spc-cart-qty-input {
	width: var(--spc-cart-qty-width, 44px);
	border: 0;
	border-radius: 0;
	-moz-appearance: textfield;
	appearance: textfield;
}
.spc-cart .spc-qty-stepper .spc-cart-qty-input::-webkit-outer-spin-button,
.spc-cart .spc-qty-stepper .spc-cart-qty-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}
.spc-cart .spc-qty-step {
	-webkit-appearance: none;
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	font: inherit;
	font-size: 1.05em;
	line-height: 1;
	color: var(--spc-muted);
	background: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	cursor: pointer;
	transition: color var(--spc-speed) var(--spc-ease), background-color var(--spc-speed) var(--spc-ease);
}
.spc-cart .spc-qty-step:hover { color: var(--spc-accent); background: var(--spc-surface-subtle); }
.spc-cart .spc-qty-step:disabled { opacity: .4; cursor: not-allowed; }

/* --- Arrows hidden entirely --- */
.spc-cart .spc-cart-qty--none .spc-cart-qty-input {
	-moz-appearance: textfield;
	appearance: textfield;
}
.spc-cart .spc-cart-qty--none .spc-cart-qty-input::-webkit-outer-spin-button,
.spc-cart .spc-cart-qty--none .spc-cart-qty-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* A bare glyph, not a button.
   Theme and Elementor kit styles target `button` at (0,1,1) or higher and
   load after this file, so the reset needs the extra class steps to win.
   Everything here is overridable from the widget's Remove Button panel. */
.spc-cart .spc-cart-remove .spc-remove-item,
.spc-cart .spc-cart-remove .spc-remove-item:focus {
	-webkit-appearance: none;
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	height: auto;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	font: inherit;
	font-size: 1.4rem;
	line-height: 1;
	letter-spacing: normal;
	color: var(--spc-muted);
	background: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	text-shadow: none;
	text-decoration: none;
	cursor: pointer;
	transition: color var(--spc-speed) var(--spc-ease), background-color var(--spc-speed) var(--spc-ease);
}
.spc-cart .spc-cart-remove .spc-remove-item:hover { color: var(--spc-danger); background: none; }

.spc-cart-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	flex-wrap: wrap;
	margin-top: 1.25rem;
}
.spc-cart-total-row { margin: 0; }
.spc-cart-count--empty { display: none; }

/* ---------------------------------------------------------------
   Tablet and phone
   ---------------------------------------------------------------
   Below the tablet breakpoint each row becomes a card:
   thumbnail | content | remove, with the column name printed
   beside each value. Rows are grid tracks, so the spacing is
   exactly what is declared here — nothing inherits cell padding.
   --------------------------------------------------------------- */
@media (max-width: 1024px) {

	.spc-cart--stack .spc-cart-head { display: none; }

	.spc-cart--stack .spc-cart-row {
		display: grid;
		grid-template-columns: var(--spc-cart-thumb-size, 72px) minmax(0, 1fr) auto;
		grid-template-areas:
			"thumb name   remove"
			"thumb price  price"
			"thumb qty    qty"
			"thumb total  total";
		align-items: center;
		column-gap: 12px;
		row-gap: 2px;
		padding: 12px 0;
	}

	.spc-cart--stack .spc-cart-row .spc-cart-thumb {
		grid-area: thumb;
		align-self: start;
		flex: none;
	}
	.spc-cart--stack .spc-cart-row .spc-cart-name       { grid-area: name; font-weight: 600; line-height: 1.3; }
	.spc-cart--stack .spc-cart-row .spc-cart-price      { grid-area: price; }
	.spc-cart--stack .spc-cart-row .spc-cart-qty        { grid-area: qty; }
	.spc-cart--stack .spc-cart-row .spc-cart-line-total { grid-area: total; font-weight: 600; }
	.spc-cart--stack .spc-cart-row .spc-cart-remove     { grid-area: remove; justify-self: end; align-self: start; }

	/* Label / value pairs. */
	.spc-cart--stack .spc-cart-row .spc-cart-price,
	.spc-cart--stack .spc-cart-row .spc-cart-qty,
	.spc-cart--stack .spc-cart-row .spc-cart-line-total {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		min-height: 0;
		text-align: right;
	}
	/* Row labels. Styled from the widget's Row Labels panel; these are
	   the fallbacks when nothing is set there. */
	.spc-cart--stack .spc-cart-row .spc-cell[data-label]::before {
		content: attr(data-label);
		display: block;
		flex: 0 0 auto;
		font-size: .85em;
		font-weight: 400;
		line-height: 1.3;
		color: var(--spc-muted);
		text-align: left;
	}
	.spc-cart--stack.spc-hide-labels .spc-cart-row .spc-cell[data-label]::before { display: none; }
	.spc-cart--stack.spc-hide-labels .spc-cart-row .spc-cart-price,
	.spc-cart--stack.spc-hide-labels .spc-cart-row .spc-cart-qty,
	.spc-cart--stack.spc-hide-labels .spc-cart-row .spc-cart-line-total { justify-content: flex-end; }

	.spc-cart--stack .spc-cart-row .spc-cart-name { padding-bottom: 4px; }

	/* No image: drop the thumbnail track. */
	.spc-cart--stack .spc-cart-row.spc-no-thumb {
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-areas:
			"name  remove"
			"price price"
			"qty   qty"
			"total total";
	}

	/* Scroll variant keeps the wide row and slides sideways. */
	.spc-cart--scroll .spc-cart-table-wrap {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		overscroll-behavior-x: contain;
	}
	.spc-cart--scroll .spc-cart-table { min-width: 620px; }

	.spc-cart-footer { flex-direction: column; align-items: stretch; gap: .85rem; }
	.spc-cart-footer .spc-cart-total-row { display: flex; justify-content: space-between; align-items: baseline; }
	.spc-cart-footer .spc-checkout-button { display: block; text-align: center; }
}

@media (max-width: 400px) {
	.spc-cart--stack .spc-cart-row { column-gap: 10px; }
}

/* Touch devices get a real tap area without any visible chrome. */
@media (pointer: coarse) {
	.spc-cart .spc-cart-remove .spc-remove-item { min-width: 44px; min-height: 44px; }
}

/* ---------------------------------------------------------------
   Elementor widget support
   --------------------------------------------------------------- */
.spc-cart-icon-wrap { display: flex; align-items: center; gap: .5rem; text-decoration: none; }
.spc-cart-icon { position: relative; display: inline-flex; align-items: center; line-height: 1; }
.spc-cart-icon svg { width: 1em; height: 1em; }

/* Badge in the icon corner */
.spc-badge-corner .spc-cart-count {
	position: absolute; top: -.5em; right: -.7em;
	display: inline-block; min-width: 1.35em; height: 1.35em; line-height: 1.35em;
	padding: 0 .3em; text-align: center; font-size: .7em; font-weight: 600;
	background: var(--spc-danger); color: var(--spc-danger-contrast); border-radius: var(--spc-radius-pill);
}
.spc-badge-inline .spc-cart-count {
	display: inline-block; margin-left: .4em; padding: 0 .45em;
	min-width: 1.4em; text-align: center; border-radius: var(--spc-radius-pill);
	background: var(--spc-danger); color: var(--spc-danger-contrast); font-size: .8em;
}
.spc-cart-count--empty { display: none !important; }

/* Label-above layout for variation dropdowns */
.spc-select-layout-column .spc-variation-select { align-items: flex-start; }
.spc-select-layout-column .spc-variation-select label { min-width: 0; }
.spc-select-layout-row .spc-variation-select { align-items: center; }

/* Extra cart cells */
.spc-cart-sku { display: block; font-size: .8em; color: var(--spc-muted); margin-top: 2px; }
