/**
 * Share cart styling.
 *
 * The toggle sits next to the green "Ik ga bestellen" checkout button and
 * mirrors its shape/size/typography, but in a quiet grey so it stays the
 * secondary action. The panel is an absolutely positioned dropdown.
 * Brand palette: navy #0C1E40, amber #FCA907.
 *
 * NOTE: the surrounding .wc-proceed-to-checkout container sets font-size:0
 * (a whitespace-collapsing trick), so all sizing here is in absolute px and
 * the panel resets its own font-size. Never use em/% units in this file.
 */

.share-cart {
	--sc-navy: #0C1E40;
	--sc-amber: #FCA907;
	--sc-amber-hover: #ffb838;
	--sc-grey: #e9ebee;
	--sc-grey-hover: #dcdfe4;
	--sc-border: #DFE3E8;
	--sc-muted: #6B7280;
	--sc-field-bg: #f7f8fa;
	--sc-success: #1a7f37;

	position: relative;
	display: inline-block;
	margin: 0;
}

/* Keep the two checkout-row buttons vertically aligned with a small gap. */
.wc-proceed-to-checkout {
	align-items: center;
	gap: 15px;
	flex-wrap: wrap;
}

.share-cart__icon {
	width: 16px;
	height: 16px;
	flex: 0 0 auto;
}

/* Toggle button — same footprint as the checkout button, grey instead of green. */
.share-cart__toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 20px 40px;
	border: 0;
	border-radius: 3px;
	background: var(--sc-grey);
	color: var(--sc-navy);
	font-family: 'Open Sans', sans-serif;
	font-weight: 700;
	font-size: 20px;
	line-height: 20px;
	cursor: pointer;
	transition: background-color 0.18s ease;
}

.share-cart__toggle:hover {
	background: var(--sc-grey-hover);
}

.share-cart__toggle:focus-visible {
	outline: 3px solid rgba(12, 30, 64, 0.35);
	outline-offset: 2px;
}

/* Panel — dropdown anchored under the toggle. Resets font-size (see note). */
.share-cart__panel {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	z-index: 20;
	width: 360px;
	max-width: 90vw;
	padding: 18px 20px;
	background: #fff;
	border: 1px solid var(--sc-border);
	border-top: 3px solid var(--sc-amber);
	border-radius: 14px;
	box-shadow: 0 12px 32px rgba(12, 30, 64, 0.14);
	text-align: left;
	font-size: 15px;
	line-height: 1.4;
	animation: share-cart-in 0.28s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.share-cart__panel[hidden] {
	display: none;
}

@keyframes share-cart-in {
	from {
		opacity: 0;
		transform: translateY(-10px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

/*
 * A parent theme .container has overflow:hidden, which clips the bottom of the
 * absolutely positioned panel. Reserve extra space below the checkout row while
 * the panel is open so the container grows and the panel is no longer cut off.
 */
.wc-proceed-to-checkout:has(.share-cart__panel:not([hidden])) {
	padding-bottom: 150px;
}

/* Loader — shown while the share link is being generated. */
.share-cart__loader {
	display: none;
	align-items: center;
	gap: 8px;
	color: var(--sc-muted);
	font-size: 14px;
	line-height: 1.4;
}

.share-cart.is-loading .share-cart__loader {
	display: flex;
}

.share-cart.is-loading .share-cart__link,
.share-cart.is-loading .share-cart__status {
	display: none;
}

.share-cart__spinner {
	width: 16px;
	height: 16px;
	flex: 0 0 auto;
	border: 2px solid var(--sc-border);
	border-top-color: var(--sc-amber);
	border-radius: 50%;
	animation: share-cart-spin 0.7s linear infinite;
}

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

/* Link row */
.share-cart__link {
	display: flex;
	gap: 8px;
	align-items: stretch;
}

.share-cart__url {
	flex: 1 1 auto;
	min-width: 0;
	padding: 10px 12px;
	border: 1px solid var(--sc-border);
	border-radius: 8px;
	background: var(--sc-field-bg);
	color: var(--sc-navy);
	font-size: 14px;
	line-height: 1.3;
	transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.share-cart__url:focus {
	outline: none;
	border-color: var(--sc-navy);
	box-shadow: 0 0 0 3px rgba(12, 30, 64, 0.12);
}

/* Copy button */
.share-cart__copy {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 16px;
	border: 0;
	border-radius: 8px;
	background: var(--sc-amber);
	color: var(--sc-navy);
	font-family: 'Open Sans', sans-serif;
	font-weight: 700;
	font-size: 14px;
	line-height: 1.2;
	white-space: nowrap;
	cursor: pointer;
	transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.share-cart__copy:hover {
	background: var(--sc-amber-hover);
	transform: translateY(-2px);
	box-shadow: 0 8px 18px rgba(252, 169, 7, 0.4);
}

.share-cart__copy:active {
	transform: translateY(0);
}

.share-cart__copy:focus-visible {
	outline: 3px solid rgba(12, 30, 64, 0.4);
	outline-offset: 2px;
}

/* Brief pulse when the link was copied. */
.share-cart__copy.is-copied {
	animation: share-cart-pulse 0.45s ease;
}

@keyframes share-cart-pulse {
	0% {
		transform: scale(1);
	}
	40% {
		transform: scale(1.08);
	}
	100% {
		transform: scale(1);
	}
}

/* Status line */
.share-cart__status {
	margin: 12px 0 0;
	min-height: 18px;
	font-size: 13px;
	line-height: 1.4;
	color: var(--sc-muted);
	transition: color 0.18s ease;
}

.share-cart__status.is-success {
	color: var(--sc-success);
	font-weight: 600;
}

/* On small screens let the checkout row stack; keep the toggle full width. */
@media (max-width: 767px) {
	.share-cart,
	.share-cart__toggle {
		width: 100%;
	}

	.share-cart__panel {
		right: auto;
		left: 0;
		width: 100%;
	}
}

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
	.share-cart__toggle,
	.share-cart__copy,
	.share-cart__url,
	.share-cart__panel,
	.share-cart__copy.is-copied {
		animation: none;
		transition: none;
	}
}
