/**
 * Ambiz side cart drawer.
 *
 * Palette and shapes come from the saved design "ambi-jewelry-heritage":
 * rosewood accent, near-black ink, sharp corners, no decorative shadow beyond
 * the one the drawer needs to lift off the page. The reference screenshot's
 * navy is deliberately not used - the cart and checkout pages are #A3363F.
 *
 * Everything is namespaced under .ambiz-sidecart so no theme or WooCommerce
 * rule is touched.
 */

.ambiz-sidecart {
	--ambiz-sc-accent: #A3363F;
	--ambiz-sc-accent-dark: #8A2B33;
	--ambiz-sc-ink: #1A1A1A;
	--ambiz-sc-muted: #6B6B6B;
	--ambiz-sc-line: #E4E0DA;
	--ambiz-sc-surface: #F6F3EE;
	--ambiz-sc-save: #1F7A45;
	--ambiz-sc-width: 420px;

	position: fixed;
	inset: 0;
	z-index: 999999;
	visibility: hidden;
	pointer-events: none;
	font-family: Karla, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	color: var(--ambiz-sc-ink);
}

.ambiz-sidecart.is-open {
	visibility: visible;
	pointer-events: auto;
}

.ambiz-sidecart__overlay {
	position: absolute;
	inset: 0;
	background: rgba(26, 26, 26, 0.45);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.ambiz-sidecart.is-open .ambiz-sidecart__overlay {
	opacity: 1;
}

.ambiz-sidecart__panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: var(--ambiz-sc-width);
	max-width: 100%;
	background: #FFFFFF;
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 0.28s ease;
	box-shadow: -8px 0 28px rgba(0, 0, 0, 0.12);
}

.ambiz-sidecart.is-open .ambiz-sidecart__panel {
	transform: translateX(0);
}

/*
 * Busy state. The functional half is pointer-events: none - it stops a second
 * tap landing while a removal or qty change is still in flight, which would
 * otherwise fire the request twice.
 *
 * The panel is deliberately NOT dimmed. Fading the whole drawer to 0.65 let
 * the page show straight through it and read as a rendering fault rather than
 * as feedback. Only the row being acted on fades now - see .is-removing.
 */
.ambiz-sidecart.is-busy .ambiz-sidecart__panel {
	pointer-events: none;
}

.ambiz-sidecart__item.is-removing {
	opacity: 0.45;
	transition: opacity 0.15s ease;
}

/*
 * Scroll lock.
 *
 * overflow: hidden alone is not enough on Android/iOS - the page jumps to the
 * top the moment it lands, so the strip of page left visible beside the drawer
 * showed an empty header area instead of whatever the customer was looking at.
 * Pinning the body with position: fixed at a negative top holds it exactly
 * where it was; ambiz-side-cart.js sets that offset and restores the scroll
 * position on close.
 */
html.ambiz-sidecart-open,
html.ambiz-sidecart-open body {
	overflow: hidden;
}

html.ambiz-sidecart-open body {
	position: fixed;
	left: 0;
	right: 0;
	width: 100%;
}

.ambiz-sidecart-inner {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
}

.ambiz-sidecart__icon {
	width: 1em;
	height: 1em;
	display: block;
}

/* Head ------------------------------------------------------------------ */

.ambiz-sidecart__head {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 20px;
	border-bottom: 1px solid var(--ambiz-sc-line);
	background: #FFFFFF;
}

.ambiz-sidecart__bag {
	position: relative;
	font-size: 26px;
	color: var(--ambiz-sc-accent);
	line-height: 0;
}

.ambiz-sidecart__bag-count {
	position: absolute;
	top: -6px;
	right: -8px;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	border-radius: 9px;
	background: var(--ambiz-sc-accent);
	color: #FFFFFF;
	font-size: 11px;
	line-height: 18px;
	text-align: center;
	font-weight: 700;
}

.ambiz-sidecart__title {
	flex: 1 1 auto;
	margin: 0;
	text-align: center;
	font-family: 'Cormorant Garamond', Georgia, serif;
	font-weight: 700;
	font-size: 30px;
	line-height: 1.1;
	color: #000000;
}

.ambiz-sidecart__close {
	flex: 0 0 auto;
	border: 0;
	background: transparent;
	padding: 4px;
	font-size: 26px;
	line-height: 0;
	color: var(--ambiz-sc-accent);
	cursor: pointer;
}

.ambiz-sidecart__close:hover,
.ambiz-sidecart__close:focus {
	background: transparent;
	color: var(--ambiz-sc-accent-dark);
}

/* Free shipping nudge ---------------------------------------------------- */

.ambiz-sidecart__freeship {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 12px 16px;
	background: var(--ambiz-sc-surface);
	border-bottom: 1px solid var(--ambiz-sc-line);
	font-size: 15px;
	line-height: 1.3;
	color: var(--ambiz-sc-ink);
}

.ambiz-sidecart__freeship .ambiz-sidecart__icon {
	flex: 0 0 auto;
	width: 21px;
	height: 21px;
	color: var(--ambiz-sc-accent);
}

.ambiz-sidecart__freeship strong {
	font-weight: 700;
}

.ambiz-sidecart__freeship.is-unlocked {
	color: var(--ambiz-sc-save);
}

.ambiz-sidecart__freeship.is-unlocked .ambiz-sidecart__icon {
	color: var(--ambiz-sc-save);
}

/* Items ----------------------------------------------------------------- */

.ambiz-sidecart__items {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 16px;
	background: var(--ambiz-sc-surface);
}

.ambiz-sidecart__item {
	display: flex;
	gap: 12px;
	padding: 14px;
	background: #FFFFFF;
	border: 1px solid var(--ambiz-sc-line);
	border-radius: 2px;
}

.ambiz-sidecart__item + .ambiz-sidecart__item {
	margin-top: 12px;
}

.ambiz-sidecart__thumb {
	flex: 0 0 72px;
	width: 72px;
}

.ambiz-sidecart__thumb img {
	width: 100%;
	height: auto;
	display: block;
}

.ambiz-sidecart__details {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 14px;
}

.ambiz-sidecart__name {
	font-weight: 700;
	font-size: 15px;
	line-height: 1.3;
	margin-bottom: 6px;
}

.ambiz-sidecart__name a {
	color: var(--ambiz-sc-accent);
	text-decoration: none;
}

.ambiz-sidecart__name a:hover {
	text-decoration: underline;
}

.ambiz-sidecart__meta {
	font-size: 12px;
	color: var(--ambiz-sc-muted);
	margin-bottom: 6px;
}

.ambiz-sidecart__meta p {
	margin: 0;
}

.ambiz-sidecart__qty {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
}

.ambiz-sidecart__qty-label {
	color: var(--ambiz-sc-muted);
}

.ambiz-sidecart__stepper {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--ambiz-sc-line);
	border-radius: 2px;
}

.ambiz-sidecart__qty-btn {
	border: 0;
	background: transparent;
	padding: 3px 7px;
	font-size: 14px;
	line-height: 0;
	color: var(--ambiz-sc-ink);
	cursor: pointer;
}

.ambiz-sidecart__qty-btn:hover:not(:disabled) {
	background: var(--ambiz-sc-surface);
	color: var(--ambiz-sc-accent);
}

.ambiz-sidecart__qty-btn:disabled {
	opacity: 0.35;
	cursor: default;
}

.ambiz-sidecart__qty-value {
	min-width: 26px;
	text-align: center;
	font-weight: 700;
	font-size: 14px;
}

.ambiz-sidecart__save {
	display: inline-block;
	margin-bottom: 8px;
	padding: 4px 10px;
	border: 1px solid var(--ambiz-sc-save);
	border-radius: 2px;
	color: var(--ambiz-sc-save);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.04em;
}

.ambiz-sidecart__price {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 6px;
	font-size: 14px;
}

.ambiz-sidecart__price-label {
	color: var(--ambiz-sc-muted);
}

.ambiz-sidecart__price del {
	color: var(--ambiz-sc-muted);
	text-decoration: line-through;
	opacity: 0.8;
}

.ambiz-sidecart__price ins {
	background: transparent;
	text-decoration: none;
	font-weight: 700;
}

.ambiz-sidecart__line {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	justify-content: space-between;
	gap: 12px;
	text-align: right;
}

.ambiz-sidecart__remove {
	border: 0;
	background: transparent;
	padding: 2px;
	font-size: 18px;
	line-height: 0;
	color: var(--ambiz-sc-muted);
	cursor: pointer;
}

.ambiz-sidecart__remove:hover {
	background: transparent;
	color: var(--ambiz-sc-accent);
}

.ambiz-sidecart__line-total {
	font-weight: 700;
	font-size: 15px;
	white-space: nowrap;
}

/* Foot ------------------------------------------------------------------ */

.ambiz-sidecart__foot {
	flex: 0 0 auto;
	padding: 16px 20px 20px;
	border-top: 1px solid var(--ambiz-sc-line);
	background: #FFFFFF;
}

.ambiz-sidecart__trust {
	display: flex;
	justify-content: space-between;
	gap: 8px;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--ambiz-sc-line);
}

.ambiz-sidecart__trust span {
	flex: 1 1 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	font-size: 22px;
	color: var(--ambiz-sc-accent);
}

.ambiz-sidecart__trust em {
	font-size: 12px;
	font-style: italic;
	color: var(--ambiz-sc-muted);
	text-align: center;
}

.ambiz-sidecart__savings {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 12px 0 0;
	font-size: 14px;
	color: var(--ambiz-sc-save);
}

.ambiz-sidecart__savings strong {
	font-weight: 700;
}

.ambiz-sidecart__savings .woocommerce-Price-amount {
	color: var(--ambiz-sc-save);
}

.ambiz-sidecart__subtotal {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 0 16px;
	font-size: 17px;
	font-weight: 700;
}

.ambiz-sidecart__actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.ambiz-sidecart__btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	padding: 14px 12px;
	border-radius: 2px;
	font-size: 15px;
	font-weight: 700;
	text-align: center;
	text-decoration: none;
	line-height: 1.2;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.ambiz-sidecart__btn em {
	font-size: 13px;
	font-style: normal;
	font-weight: 400;
	opacity: 0.9;
}

.ambiz-sidecart__btn--solid,
.ambiz-sidecart__btn--solid:visited {
	background: var(--ambiz-sc-accent);
	color: #FFFFFF;
	border: 1px solid var(--ambiz-sc-accent);
}

.ambiz-sidecart__btn--solid:hover,
.ambiz-sidecart__btn--solid:focus {
	background: var(--ambiz-sc-accent-dark);
	border-color: var(--ambiz-sc-accent-dark);
	color: #FFFFFF;
}

.ambiz-sidecart__btn--ghost,
.ambiz-sidecart__btn--ghost:visited {
	background: #FFFFFF;
	color: var(--ambiz-sc-accent);
	border: 1px solid var(--ambiz-sc-accent);
}

.ambiz-sidecart__btn--ghost:hover,
.ambiz-sidecart__btn--ghost:focus {
	background: var(--ambiz-sc-accent);
	color: #FFFFFF;
}

/* Empty ----------------------------------------------------------------- */

.ambiz-sidecart__empty {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	padding: 40px 24px;
	text-align: center;
	font-size: 44px;
	color: var(--ambiz-sc-line);
}

.ambiz-sidecart__empty p {
	margin: 0;
	font-size: 16px;
	color: var(--ambiz-sc-muted);
}

.ambiz-sidecart__empty .ambiz-sidecart__btn {
	font-size: 15px;
	min-width: 200px;
}

/* Small screens --------------------------------------------------------- */

@media (max-width: 480px) {
	.ambiz-sidecart {
		/*
		 * Deliberately NOT 100%. A full-bleed panel reads as a page the
		 * customer navigated to, not a drawer they can dismiss - the strip of
		 * dimmed page beside it is what says "this slid over, tap outside to
		 * go back". Capped so it stays a drawer on the largest phones too.
		 */
		--ambiz-sc-width: min(86vw, 340px);
	}

	.ambiz-sidecart__item {
		gap: 10px;
		padding: 12px;
	}

	/* Two buttons side by side stop fitting once the panel is this narrow -
	   the Checkout label wraps mid-price. Stack them instead. */
	.ambiz-sidecart__actions {
		grid-template-columns: 1fr;
	}

	.ambiz-sidecart__title {
		font-size: 22px;
	}

	.ambiz-sidecart__items {
		padding: 12px;
	}

	.ambiz-sidecart__thumb {
		flex-basis: 60px;
		width: 60px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ambiz-sidecart__panel,
	.ambiz-sidecart__overlay {
		transition: none;
	}
}
