/* Jett Woo — Cart Popup
 * Bottom-sheet on mobile, centered modal on desktop.
 * Flexbox centering, RTL-safe, theme-conflict resistant.
 */

#jett-woo-cart-popup.jw-popup {
	--jw-radius: 18px;
	--jw-radius-sm: 10px;
	--jw-bg: #ffffff;
	--jw-surface-muted: #f8fafc;
	--jw-border: #e2e8f0;
	--jw-text: #0f172a;
	--jw-text-muted: #64748b;
	--jw-shadow: 0 24px 60px -12px rgba(15, 23, 42, 0.28), 0 4px 12px -4px rgba(15, 23, 42, 0.12);
	--jw-scrim: rgba(15, 23, 42, 0.55);

	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 99999;
	display: none;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	padding: 16px;
	font-family: "Asaf", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Heebo", "Rubik", "Noto Sans Hebrew", sans-serif;
	color: var(--jw-text);
	font-size: 16px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

#jett-woo-cart-popup.jw-popup.is-open {
	display: flex;
}

#jett-woo-cart-popup.jw-popup *,
#jett-woo-cart-popup.jw-popup *::before,
#jett-woo-cart-popup.jw-popup *::after {
	box-sizing: border-box;
}

#jett-woo-cart-popup .jw-popup__backdrop {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: var(--jw-scrim);
	-webkit-backdrop-filter: blur(6px) saturate(1.05);
	backdrop-filter: blur(6px) saturate(1.05);
	opacity: 0;
	transition: opacity 220ms ease-out;
}

#jett-woo-cart-popup.is-open .jw-popup__backdrop {
	opacity: 1;
}

/* ---------- Dialog ---------- */

#jett-woo-cart-popup .jw-popup__dialog {
	position: relative;
	width: min(840px, 100%);
	max-height: calc(100vh - 32px);
	background: var(--jw-bg);
	border-radius: var(--jw-radius);
	box-shadow: var(--jw-shadow);
	overflow: hidden;
	display: grid;
	grid-template-columns: 1.05fr 1fr;
	opacity: 0;
	transform: translateY(16px) scale(0.98);
	transition: opacity 220ms ease-out, transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

#jett-woo-cart-popup.is-open .jw-popup__dialog {
	opacity: 1;
	transform: translateY(0) scale(1);
}

/* ---------- Handle (mobile only) ---------- */

#jett-woo-cart-popup .jw-popup__handle {
	display: none;
	position: absolute;
	top: 8px;
	left: 50%;
	transform: translateX(-50%);
	width: 40px;
	height: 4px;
	border-radius: 999px;
	background: #cbd5e1;
}

/* ---------- Close button ---------- */

#jett-woo-cart-popup .jw-popup__close {
	position: absolute;
	top: 12px;
	width: 36px;
	height: 36px;
	min-width: 36px;
	padding: 0;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.92);
	border: 1px solid var(--jw-border);
	color: var(--jw-text);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 2;
	box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
	transition: background-color 160ms ease, transform 160ms ease;
	font-family: inherit;
	line-height: 1;
}

#jett-woo-cart-popup:not(.is-rtl) .jw-popup__close { right: 12px; }
#jett-woo-cart-popup.is-rtl .jw-popup__close { left: 12px; }

#jett-woo-cart-popup .jw-popup__close:hover { background: #fff; }
#jett-woo-cart-popup .jw-popup__close:active { transform: scale(0.94); }
#jett-woo-cart-popup .jw-popup__close:focus-visible { outline: 2px solid var(--jw-accent); outline-offset: 2px; }

/* ---------- Media ---------- */

#jett-woo-cart-popup .jw-popup__media {
	background: var(--jw-surface-muted);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 28px;
	min-height: 220px;
}

#jett-woo-cart-popup .jw-popup__media img {
	max-width: 100%;
	max-height: 320px;
	height: auto;
	width: auto;
	object-fit: contain;
	display: block;
	border-radius: var(--jw-radius-sm);
	margin: 0;
}

/* ---------- Body ---------- */

#jett-woo-cart-popup .jw-popup__body {
	padding: 32px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	overflow-y: auto;
	text-align: start;
}

#jett-woo-cart-popup .jw-popup__eyebrow {
	margin: 0 0 2px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.06em;
	color: var(--jw-accent);
	font-family: inherit;
}

#jett-woo-cart-popup .jw-popup__name {
	margin: 0;
	font-size: 24px;
	line-height: 1.25;
	font-weight: 700;
	color: var(--jw-text);
	font-family: inherit;
}

#jett-woo-cart-popup .jw-popup__price {
	font-size: 20px;
	font-weight: 600;
	color: var(--jw-text);
	font-variant-numeric: tabular-nums;
	margin-top: 4px;
}

#jett-woo-cart-popup .jw-popup__price del {
	color: var(--jw-text-muted);
	font-weight: 400;
	margin-inline-end: 8px;
	text-decoration-thickness: 1.5px;
}

#jett-woo-cart-popup .jw-popup__price ins {
	text-decoration: none;
	color: var(--jw-accent);
}

#jett-woo-cart-popup .jw-popup__price .woocommerce-Price-amount {
	color: inherit;
}

/* ---------- Product picker (multi-product mode) ---------- */

#jett-woo-cart-popup .jw-popup__picks {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 6px;
	/* Take the space the dialog has left and scroll only past that, so a long
	   list never pushes the CTA out of reach. */
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
}

#jett-woo-cart-popup .jw-popup__pick {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	width: auto;
	margin: 0;
	padding: 10px;
	background: var(--jw-surface-muted);
	border: 2px solid transparent;
	border-radius: var(--jw-radius-sm);
	cursor: pointer;
	font-weight: 400;
	color: var(--jw-text);
	transition: border-color 160ms ease, background-color 160ms ease;
}

#jett-woo-cart-popup .jw-popup__pick input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

#jett-woo-cart-popup .jw-popup__pick-mark {
	flex: none;
	width: 20px;
	height: 20px;
	border-radius: 999px;
	background: #fff;
	box-shadow: inset 0 0 0 2px var(--jw-border);
	transition: box-shadow 160ms ease;
}

#jett-woo-cart-popup .jw-popup__pick-thumb {
	flex: none;
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: var(--jw-radius-sm);
	margin: 0;
	display: block;
}

#jett-woo-cart-popup .jw-popup__pick-info {
	flex: 1;
	min-width: 0;
}

#jett-woo-cart-popup .jw-popup__pick-name {
	display: block;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
}

#jett-woo-cart-popup .jw-popup__pick-price {
	display: block;
	font-size: 15px;
	color: var(--jw-text-muted);
	font-variant-numeric: tabular-nums;
	margin-top: 2px;
}

#jett-woo-cart-popup .jw-popup__pick-price del {
	margin-inline-end: 6px;
}

#jett-woo-cart-popup .jw-popup__pick-price ins {
	text-decoration: none;
	color: var(--jw-accent);
	font-weight: 600;
}

#jett-woo-cart-popup .jw-popup__pick:hover {
	border-color: var(--jw-border);
}

#jett-woo-cart-popup .jw-popup__pick.is-on {
	background: var(--jw-bg);
	border-color: var(--jw-accent);
}

#jett-woo-cart-popup .jw-popup__pick.is-on .jw-popup__pick-mark {
	box-shadow: inset 0 0 0 6px var(--jw-accent);
}

/* ---------- Threshold-discount note ---------- */

#jett-woo-cart-popup .jw-popup__deal {
	margin: 6px 0 0;
	padding: 8px 12px;
	border-radius: var(--jw-radius-sm);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.4;
	color: var(--jw-text-muted);
	background: var(--jw-surface-muted);
	border: 1px dashed var(--jw-border);
	font-family: inherit;
}

#jett-woo-cart-popup .jw-popup__deal.is-active {
	color: var(--jw-accent);
	background: color-mix(in srgb, var(--jw-accent) 10%, #ffffff);
	border-style: solid;
	border-color: color-mix(in srgb, var(--jw-accent) 35%, #ffffff);
}

#jett-woo-cart-popup .jw-popup__excerpt {
	color: var(--jw-text-muted);
	font-size: 14px;
	line-height: 1.55;
	margin-top: 4px;
	max-height: 8em;
	overflow: hidden;
}

#jett-woo-cart-popup .jw-popup__excerpt p { margin: 0 0 6px; }
#jett-woo-cart-popup .jw-popup__excerpt p:last-child { margin-bottom: 0; }

/* ---------- Actions ---------- */

#jett-woo-cart-popup .jw-popup__actions {
	margin-top: auto;
	padding-top: 20px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

@media (min-width: 480px) {
	#jett-woo-cart-popup .jw-popup__actions {
		flex-direction: row;
		justify-content: stretch;
	}
}

#jett-woo-cart-popup .jw-popup__btn {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	border: 0;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 48px;
	padding: 12px 22px;
	border-radius: 12px;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	font-family: inherit;
	letter-spacing: 0;
	text-transform: none;
	box-shadow: none;
	transition: transform 140ms ease, box-shadow 140ms ease, background-color 160ms ease, color 160ms ease, opacity 160ms ease, filter 160ms ease;
}

#jett-woo-cart-popup .jw-popup__btn:focus-visible {
	outline: 2px solid var(--jw-accent);
	outline-offset: 2px;
}

#jett-woo-cart-popup .jw-popup__btn--primary {
	background: var(--jw-primary-bg);
	color: var(--jw-primary-text);
	flex: 1 1 auto;
	box-shadow: 0 6px 18px -8px rgba(15, 23, 42, 0.45);
}

#jett-woo-cart-popup .jw-popup__btn--primary:hover { filter: brightness(0.92); color: var(--jw-primary-text); }
#jett-woo-cart-popup .jw-popup__btn--primary:active { transform: scale(0.985); }

#jett-woo-cart-popup .jw-popup__btn--secondary {
	background: var(--jw-secondary-bg);
	color: var(--jw-secondary-text);
	border: 1px solid var(--jw-border);
	flex: 0 0 auto;
}

#jett-woo-cart-popup .jw-popup__btn--secondary:hover { filter: brightness(0.97); color: var(--jw-secondary-text); }

#jett-woo-cart-popup .jw-popup__btn-spinner {
	display: none;
	animation: jw-spin 0.7s linear infinite;
}

#jett-woo-cart-popup .jw-popup__btn.is-loading { cursor: progress; }
#jett-woo-cart-popup .jw-popup__btn.is-loading .jw-popup__btn-label { opacity: 0.7; }
#jett-woo-cart-popup .jw-popup__btn.is-loading .jw-popup__btn-spinner { display: inline-block; }

@keyframes jw-spin {
	to { transform: rotate(360deg); }
}

/* ---------- Mobile: bottom sheet ---------- */

@media (max-width: 640px) {
	#jett-woo-cart-popup.jw-popup {
		align-items: flex-end;
		padding: 0;
	}

	#jett-woo-cart-popup .jw-popup__dialog {
		width: 100%;
		max-width: 100%;
		max-height: 92vh;
		border-radius: 20px 20px 0 0;
		grid-template-columns: 1fr;
		display: flex;
		flex-direction: column;
		transform: translateY(100%);
	}

	#jett-woo-cart-popup.is-open .jw-popup__dialog {
		transform: translateY(0);
	}

	#jett-woo-cart-popup .jw-popup__handle { display: block; }

	#jett-woo-cart-popup .jw-popup__close {
		top: 14px;
		width: 34px;
		height: 34px;
		min-width: 34px;
	}

	#jett-woo-cart-popup .jw-popup__media {
		padding: 28px 20px 12px;
		min-height: 0;
	}

	#jett-woo-cart-popup .jw-popup__media img {
		max-height: 200px;
	}

	#jett-woo-cart-popup .jw-popup__body {
		padding: 18px 20px calc(20px + env(safe-area-inset-bottom));
	}

	#jett-woo-cart-popup .jw-popup__name { font-size: 20px; }
	#jett-woo-cart-popup .jw-popup__price { font-size: 18px; }
}

/* ---------- Body lock ---------- */

body.jw-popup-open {
	overflow: hidden;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
	#jett-woo-cart-popup .jw-popup__backdrop,
	#jett-woo-cart-popup .jw-popup__dialog,
	#jett-woo-cart-popup .jw-popup__btn,
	#jett-woo-cart-popup .jw-popup__close {
		transition: none !important;
	}
	#jett-woo-cart-popup .jw-popup__btn-spinner { animation: none; }
}
