/**
 * Elementor Shop Cart — frontend styles.
 *
 * Every rule is scoped under .espc-cart (or .espc-notice) so the widget cannot
 * leak into the surrounding theme. Sizes, colours and radii arrive as CSS
 * custom properties written by the Elementor controls; the values here are the
 * fallbacks used when the widget renders outside the editor (e.g. in a
 * template, a shortcode, or before the controls have been saved).
 */

.espc-cart {
	/* Written by the Elementor style controls. */
	--espc-width: 900px;
	--espc-gutter: 24px;
	--espc-row-gap: 12px;
	--espc-radius: 16px;
	--espc-thumb-radius: 12px;
	--espc-thumb: 96px;

	--espc-page-bg: #fafafa;
	--espc-card-bg: #ffffff;
	--espc-ink: #171717;
	--espc-muted: #8a8a8a;
	--espc-border: #ececec;

	--espc-gold-a: #b47b18;
	--espc-gold-b: #f0d486;
	--espc-gold-text: #b3771c;
	--espc-badge-bg: #f6f1e8;

	--espc-heading-size: 17px;
	--espc-product-size: 16px;
	--espc-price-size: 16px;

	/* The reference storefront ships no webfonts — system stack throughout. */
	--espc-font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

	background: var(--espc-page-bg);
	color: var(--espc-ink);
	font-family: var(--espc-font);
	-webkit-font-smoothing: antialiased;
	box-sizing: border-box;
	/* Fill the viewport so the page colour reaches the bottom of a short
	   cart. The canvas template prints nothing below this widget. */
	min-height: 100vh;
}

.espc-cart *,
.espc-cart *::before,
.espc-cart *::after {
	box-sizing: border-box;
}

.espc-notice {
	padding: 20px 24px;
	border: 1px dashed #d8d8d8;
	border-radius: 12px;
	background: #fff;
	color: #6b6b6b;
	font: 400 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ------------------------------------------------------------------ *
 * Header bar
 * ------------------------------------------------------------------ */

.espc-header {
	background: var(--espc-card-bg);
	border-bottom: 1px solid var(--espc-border);
}

.espc-header-inner {
	max-width: var(--espc-width);
	margin: 0 auto;
	padding: 22px var(--espc-gutter);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.espc-header-left {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.espc-header-icon {
	display: inline-flex;
	color: var(--espc-gold-text);
	flex: 0 0 auto;
}

.espc-title {
	margin: 0;
	font-size: var(--espc-heading-size);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--espc-ink);
}

.espc-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 26px;
	height: 26px;
	padding: 0 7px;
	border-radius: 999px;
	background: var(--espc-badge-bg);
	color: var(--espc-gold-text);
	font-size: 13px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	flex: 0 0 auto;
}

.espc-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 999px;
	border: 1px solid var(--espc-border);
	background: var(--espc-card-bg);
	color: var(--espc-ink);
	text-decoration: none;
	transition: background 0.15s ease, border-color 0.15s ease;
	flex: 0 0 auto;
}

.espc-close:hover,
.espc-close:focus-visible {
	background: #f5f5f5;
	border-color: #d8d8d8;
}

/* ------------------------------------------------------------------ *
 * Body + selection bar
 * ------------------------------------------------------------------ */

.espc-body {
	max-width: var(--espc-width);
	margin: 0 auto;
	padding: 20px var(--espc-gutter) 40px;
}

.espc-select-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 18px;
	margin-bottom: var(--espc-row-gap);
	border-radius: var(--espc-radius);
	background: var(--espc-card-bg);
	border: 1px solid var(--espc-border);
}

.espc-select-all {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	user-select: none;
}

.espc-select-all-text {
	font-size: 14px;
	font-weight: 500;
	color: var(--espc-ink);
}

.espc-selected {
	font-size: 13px;
	font-weight: 600;
	color: var(--espc-gold-text);
	text-align: right;
}

/* ------------------------------------------------------------------ *
 * Checkboxes — native input hidden, box drawn by us
 * ------------------------------------------------------------------ */

.espc-check,
.espc-select-all {
	position: relative;
}

.espc-check input,
.espc-select-all input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	padding: 0;
	opacity: 0;
	pointer-events: none;
}

.espc-check-box {
	display: inline-block;
	position: relative;
	width: 20px;
	height: 20px;
	flex: 0 0 auto;
	border: 1.5px solid #d8d8d8;
	border-radius: 6px;
	background: #fff;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.espc-check input:checked + .espc-check-box,
.espc-select-all input:checked + .espc-check-box {
	border-color: transparent;
	background: linear-gradient(135deg, var(--espc-gold-a), var(--espc-gold-b));
}

.espc-check input:checked + .espc-check-box::after,
.espc-select-all input:checked + .espc-check-box::after {
	content: "";
	position: absolute;
	left: 6px;
	top: 2px;
	width: 5px;
	height: 10px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.espc-check input:focus-visible + .espc-check-box,
.espc-select-all input:focus-visible + .espc-check-box {
	outline: 2px solid var(--espc-gold-a);
	outline-offset: 2px;
}

/* ------------------------------------------------------------------ *
 * Rows
 * ------------------------------------------------------------------ */

.espc-rows {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--espc-row-gap);
}

.espc-row {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 16px;
	border-radius: var(--espc-radius);
	background: var(--espc-card-bg);
	border: 1px solid var(--espc-border);
	transition: opacity 0.2s ease, border-color 0.2s ease;
}

/* Dimmed while an AJAX round-trip is in flight. Deliberately does not set
   pointer-events: none — the script guards against out-of-order responses
   with a per-row sequence number, so rapid clicks stay responsive. */
.espc-row.is-busy {
	opacity: 0.6;
}

/* A deselected row keeps its place but reads as inactive. */
.espc-row.is-unselected {
	border-color: transparent;
	background: #f5f5f5;
}

.espc-row-thumb {
	flex: 0 0 auto;
	width: var(--espc-thumb);
	height: var(--espc-thumb);
	border-radius: var(--espc-thumb-radius);
	overflow: hidden;
	background: #f4f4f6;
}

.espc-row-thumb a {
	display: block;
	width: 100%;
	height: 100%;
}

.espc-row-thumb img,
.espc-row-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	margin: 0;
	border-radius: 0;
}

.espc-row-info {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
}

.espc-row-name {
	margin: 0;
	font-size: var(--espc-product-size);
	font-weight: 700;
	line-height: 1.3;
	color: var(--espc-ink);
	overflow-wrap: anywhere;
}

.espc-row-name a {
	color: inherit;
	text-decoration: none;
}

.espc-row-name a:hover {
	color: var(--espc-gold-text);
}

.espc-row-sku {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--espc-gold-text);
}

/* ------------------------------------------------------------------ *
 * Quantity stepper
 * ------------------------------------------------------------------ */

.espc-stepper {
	display: inline-flex;
	align-items: center;
	margin-top: 2px;
	padding: 2px;
	border: 1px solid var(--espc-border);
	border-radius: 999px;
	background: #fafafa;
}

.espc-step {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--espc-ink);
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.15s ease;
}

.espc-step:hover:not(:disabled) {
	background: #ececec;
}

.espc-step:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.espc-qty {
	width: 40px;
	padding: 0;
	border: 0;
	background: transparent;
	text-align: center;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	color: var(--espc-ink);
	-moz-appearance: textfield;
	appearance: textfield;
}

/* Strip the spinners some browsers add to numeric-looking inputs. */
.espc-qty::-webkit-outer-spin-button,
.espc-qty::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.espc-qty:focus {
	outline: none;
}

/* ------------------------------------------------------------------ *
 * Row end — remove button above the price
 * ------------------------------------------------------------------ */

.espc-row-end {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	justify-content: space-between;
	gap: 10px;
	align-self: stretch;
}

.espc-row-remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: #9a9a9a;
	cursor: pointer;
	transition: color 0.15s ease, background 0.15s ease;
}

.espc-row-remove:hover,
.espc-row-remove:focus-visible {
	color: #c0392b;
	background: #fdecea;
}

.espc-row-price {
	display: inline-flex;
	align-items: baseline;
	gap: 5px;
	white-space: nowrap;
	font-size: var(--espc-price-size);
	font-weight: 700;
	color: var(--espc-gold-text);
	font-variant-numeric: tabular-nums;
}

.espc-row-price .woocommerce-Price-amount {
	color: inherit;
	font-weight: inherit;
}

/* Sale rows show <del>old</del><ins>new</ins>; keep the strikethrough legible
   without letting it inherit the gold weight. */
.espc-row-price del {
	color: var(--espc-muted);
	font-weight: 500;
	text-decoration: line-through;
}

.espc-row-price ins {
	text-decoration: none;
}

.espc-mult {
	font-weight: 500;
	opacity: 0.75;
}

/* ------------------------------------------------------------------ *
 * Footer / checkout bar
 * ------------------------------------------------------------------ */

.espc-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 16px;
	margin-top: 20px;
	padding: 16px 18px;
	border-radius: var(--espc-radius);
	background: var(--espc-card-bg);
	border: 1px solid var(--espc-border);
}

.espc-has-sticky .espc-footer {
	position: sticky;
	bottom: 0;
	z-index: 20;
	box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.06);
}

.espc-footer-total {
	display: flex;
	align-items: baseline;
	gap: 10px;
}

.espc-footer-label {
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--espc-muted);
}

.espc-footer-amount {
	font-size: 20px;
	font-weight: 700;
	color: var(--espc-ink);
	font-variant-numeric: tabular-nums;
}

.espc-footer-actions {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.espc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 13px 24px;
	border: 0;
	border-radius: 999px;
	font-family: inherit;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	text-decoration: none;
	cursor: pointer;
	transition: filter 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.espc-btn-gold {
	background: linear-gradient(135deg, var(--espc-gold-a), var(--espc-gold-b));
	color: #070708;
	box-shadow: 0 4px 14px rgba(180, 123, 24, 0.28);
}

.espc-btn-gold:hover,
.espc-btn-gold:focus-visible {
	filter: brightness(1.06);
	color: #070708;
}

.espc-btn-ghost {
	background: transparent;
	border: 1px solid var(--espc-border);
	color: var(--espc-ink);
}

.espc-btn-ghost:hover,
.espc-btn-ghost:focus-visible {
	background: #f5f5f5;
	border-color: #d8d8d8;
	color: var(--espc-ink);
}

/* ------------------------------------------------------------------ *
 * Empty state + errors
 * ------------------------------------------------------------------ */

.espc-empty {
	padding: 64px 24px;
	border-radius: var(--espc-radius);
	background: var(--espc-card-bg);
	border: 1px solid var(--espc-border);
	text-align: center;
}

.espc-empty-text {
	margin: 0 0 20px;
	font-size: 16px;
	color: var(--espc-muted);
}

.espc-error {
	margin: 14px 0 0;
	padding: 12px 16px;
	border-radius: 10px;
	background: #fdecea;
	color: #a5281b;
	font-size: 13px;
}

.espc-error[hidden] {
	display: none;
}

/* ------------------------------------------------------------------ *
 * Responsive
 * ------------------------------------------------------------------ */

@media (max-width: 720px) {
	.espc-cart {
		--espc-thumb: 76px;
	}

	.espc-header-inner {
		padding: 16px var(--espc-gutter);
	}

	.espc-title {
		font-size: calc(var(--espc-heading-size) - 2px);
	}

	.espc-row {
		flex-wrap: wrap;
		align-items: flex-start;
		gap: 12px;
	}

	.espc-row-end {
		flex-direction: row;
		align-items: center;
		align-self: auto;
		justify-content: space-between;
		width: 100%;
		margin-top: 4px;
		/* Put the price before the trash icon when the row wraps. */
		order: 3;
	}

	.espc-row-price {
		order: -1;
	}

	.espc-footer {
		flex-direction: column;
		align-items: stretch;
	}

	.espc-footer-actions {
		flex-direction: column-reverse;
		align-items: stretch;
	}

	.espc-btn {
		width: 100%;
	}
}

/* Respect the OS "reduce motion" setting. */
@media (prefers-reduced-motion: reduce) {
	.espc-cart *,
	.espc-cart *::before,
	.espc-cart *::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}
}
