/**
 * DKM Wishlist.
 *
 * The heart is the whole design: outlined while the product is only being
 * looked at, filled once it is saved. Filling is a fill rather than a swap of
 * two icons, so the shape never moves - and it is animated on the way in,
 * because the press is the moment worth marking.
 */

.wcg-wl {
	--wcg-wl-accent: var(--text-danger);
	--wcg-wl-icon: var(--text-primary);
	--wcg-wl-border: var(--border-default);
	--wcg-wl-text: var(--text-primary);
	--wcg-wl-muted: var(--text-tertiary);
	/* The link style is interface, not branding, so it takes the shop's
	   interactive blue - the Elementor global Secondary, as the gallery and
	   the mini cart badge do. */
	--wcg-wl-link: var(--text-link);
	/* Not var(--wcg-accent): that is the gallery's accent, and the
	   settings screen writes every chosen colour onto every one of this
	   plugin's roots - so chaining through it made the gallery's colour
	   the wishlist counter's colour too. */
	--wcg-wl-badge-bg: var(--action-primary);
	--wcg-wl-badge-text: var(--text-inverse);
	--wcg-wl-height: var(--control-md);
	--wcg-wl-icon-size: 22px;
	--wcg-wl-font-size: 15px;
	/* The heart on its own carries the whole button, so it is drawn larger
	   than the one that sits beside words - half a button of empty ring reads
	   as a button waiting for something that never arrives. */
	--wcg-wl-icon-alone: 26px;

	display: block;
	margin: 0;
	padding: 0;
}

/* The three control heights of the design system. The heart and the words
   scale with the button, or a small button holds a full-size icon and a large
   one looks empty. */
.wcg-wl--size-sm {
	--wcg-wl-height: var(--control-sm);
	--wcg-wl-icon-size: 18px;
	--wcg-wl-icon-alone: 20px;
	--wcg-wl-font-size: 13px;
}

.wcg-wl--size-md {
	--wcg-wl-height: var(--control-md);
	--wcg-wl-icon-size: 22px;
	--wcg-wl-icon-alone: 26px;
	--wcg-wl-font-size: 15px;
}

.wcg-wl--size-lg {
	--wcg-wl-height: var(--control-lg);
	--wcg-wl-icon-size: 26px;
	--wcg-wl-icon-alone: 32px;
	--wcg-wl-font-size: 16px;
}

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

/* Doubled class for the same reason as everywhere else in this plugin: a
   WooCommerce theme reaches buttons as `.woocommerce button.button` and
   Elementor as `.elementor button`, both of which outrank a single class. */
.wcg-wl .wcg-wl__button.wcg-wl__button {
	display: inline-flex;
	align-items: center;
	box-sizing: border-box;
	gap: 8px;
	min-height: var(--wcg-wl-height);
	margin: 0;
	padding: 0 16px;
	border: 1px solid transparent;
	/* DS v3.4: every button shares radius-sm; solid is the secondary level,
	   plain and outline the tertiary one. */
	border-radius: var(--button-radius);
	background: transparent;
	color: var(--wcg-wl-text);
	font: inherit;
	font-size: var(--wcg-wl-font-size);
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: var(--motion-control);
}

.wcg-wl .wcg-wl__button--outline.wcg-wl__button--outline {
	border-color: var(--wcg-wl-border);
	background: var(--bg-surface);
}

.wcg-wl .wcg-wl__button--plain.wcg-wl__button--plain {
	padding: 0 8px;
	border-color: transparent;
	background: transparent;
}

.wcg-wl .wcg-wl__button--solid.wcg-wl__button--solid {
	border-color: transparent;
	background: var(--button-secondary-bg);
	color: var(--button-secondary-text);
}

/* Link: the words and the heart in the shop's blue, with nothing around
   them - it reads as one of the shop's text links. Saved fills the same heart
   in the same blue rather than turning it red, so the line stays one colour. */
.wcg-wl .wcg-wl__button--link.wcg-wl__button--link {
	position: relative;
	gap: 6px;
	/* As tall as its words, like a text link: the 32px of a button left a
	   band of empty space above and below a line with no box to fill it. */
	min-height: 0;
	padding: 0;
	border-color: transparent;
	background: transparent;
	color: var(--wcg-wl-link);
}

/* The finger still gets a button's worth to hit, without the page seeing it. */
.wcg-wl .wcg-wl__button--link.wcg-wl__button--link::after {
	content: "";
	position: absolute;
	inset: -8px -4px;
}

/* :focus is deliberately not here, only :focus-visible. A mouse click leaves
   the button focused, so a button that changes on focus keeps the change until
   something else is clicked - which is exactly what "stuck in hover" is. A
   keyboard user still gets the ring below.

   Hover is a change of colour, as on every other button of this plugin - the
   add to cart and the account buttons darken - never a border appearing. */
.wcg-wl .wcg-wl__button.wcg-wl__button:hover,
.wcg-wl .wcg-wl__button.wcg-wl__button:focus-visible {
	color: var(--wcg-wl-text);
}

.wcg-wl .wcg-wl__button--outline.wcg-wl__button--outline:hover,
.wcg-wl .wcg-wl__button--plain.wcg-wl__button--plain:hover {
	background: var(--button-tertiary-hover-bg);
}

.wcg-wl .wcg-wl__button--solid.wcg-wl__button--solid:hover {
	background: var(--button-secondary-hover-bg);
}

.wcg-wl .wcg-wl__button.wcg-wl__button:focus {
	outline: none;
}

.wcg-wl .wcg-wl__button.wcg-wl__button:focus-visible {
	outline: 2px solid var(--wcg-wl-accent);
	outline-offset: 2px;
}

.wcg-wl__icon {
	width: var(--wcg-wl-icon-size);
	height: var(--wcg-wl-icon-size);
	flex: none;
	color: var(--wcg-wl-icon);
	fill: none;
	transition: var(--motion-control);
}

/* Saved. The same outline, filled - the shape does not move, so the eye is
   told one thing and not two. */
.wcg-wl__button.is-active .wcg-wl__icon,
.wcg-wl__counter .wcg-wl__icon {
	color: var(--wcg-wl-accent);
}

.wcg-wl__button.is-active .wcg-wl__icon {
	fill: var(--wcg-wl-accent);
	animation: wcg-wl-pop 0.28s cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* After the shared hover and saved rules, which would otherwise give the
   link a red border and a black label. */
.wcg-wl .wcg-wl__button--link.wcg-wl__button--link:hover,
.wcg-wl .wcg-wl__button--link.wcg-wl__button--link:focus-visible {
	border-color: transparent;
	color: var(--wcg-wl-link);
}

.wcg-wl .wcg-wl__button--link.wcg-wl__button--link:hover .wcg-wl__label {
	text-decoration: underline;
	text-underline-offset: 2px;
}

.wcg-wl .wcg-wl__button--link.wcg-wl__button--link:focus-visible {
	outline-color: var(--wcg-wl-link);
}

.wcg-wl .wcg-wl__button--link .wcg-wl__icon {
	color: var(--wcg-wl-link);
}

.wcg-wl .wcg-wl__button--link.is-active .wcg-wl__icon {
	fill: var(--wcg-wl-link);
}

.wcg-wl__button.is-busy {
	opacity: 0.7;
}

@keyframes wcg-wl-pop {
	0% { transform: scale(0.7); }
	60% { transform: scale(1.18); }
	100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
	.wcg-wl__button.is-active .wcg-wl__icon {
		animation: none;
	}
}

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

/* --------------------------------------------------------------- counter */

.wcg-wl__counter {
	position: relative;
	display: inline-flex;
	align-items: center;
	color: var(--wcg-wl-text);
	text-decoration: none;
}

.wcg-wl__icon-wrap {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wcg-wl__badge {
	position: absolute;
	top: -6px;
	right: -8px;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: var(--radius-full);
	background: var(--wcg-wl-badge-bg);
	color: var(--wcg-wl-badge-text);
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
}

.wcg-wl__badge[hidden] {
	display: none;
}

/* ------------------------------------------------------------------ list */

.wcg-wl__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.wcg-wl__item {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 16px 0;
	border-bottom: var(--border-hairline) solid var(--border-subtle);
	transition: opacity 0.2s ease;
}

.wcg-wl__item.is-going {
	opacity: 0.45;
}

.wcg-wl__thumb {
	flex: none;
	width: 80px;
	line-height: 0;
}

.wcg-wl__thumb img {
	width: 100%;
	height: auto;
	border-radius: var(--radius-md);
}

.wcg-wl__details {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.wcg-wl .wcg-wl__name {
	color: var(--wcg-wl-text);
	font-weight: 600;
	text-decoration: none;
}

.wcg-wl .wcg-wl__name:hover {
	color: var(--wcg-link-hover, var(--text-link-hover));
	text-decoration: none;
}

.wcg-wl__price {
	color: var(--wcg-wl-text);
}

.wcg-wl__price del {
	color: var(--wcg-wl-muted);
}

.wcg-wl__stock {
	color: var(--text-danger);
	font-size: 0.875em;
	font-weight: 600;
}

.wcg-wl__actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: none;
}

.wcg-wl .wcg-wl__remove.wcg-wl__remove {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--control-md);
	height: var(--control-md);
	flex: none;
	padding: 0;
	border: 0;
	border-radius: var(--button-radius);
	background: var(--button-tertiary-bg);
	color: var(--wcg-wl-muted);
	cursor: pointer;
}

.wcg-wl .wcg-wl__remove.wcg-wl__remove:hover,
.wcg-wl .wcg-wl__remove.wcg-wl__remove:focus-visible {
	background: var(--button-tertiary-hover-bg);
	color: var(--wcg-wl-text);
}

.wcg-wl__remove .wcg-wl__icon {
	width: 18px;
	height: 18px;
	color: inherit;
}

/* "Add to cart" on a saved product: WooCommerce's own link, so its script
   adds without a page load, drawn as the design system's primary button. The
   doubled class outranks the theme's `.woocommerce a.button`. */
.wcg-wl .wcg-wl__add.wcg-wl__add {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-height: var(--control-md);
	margin: 0;
	padding: 0 18px;
	border: 0;
	border-radius: var(--button-radius);
	background: var(--button-primary-bg);
	box-shadow: none;
	color: var(--button-primary-text);
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	text-transform: none;
	white-space: nowrap;
}

.wcg-wl .wcg-wl__add.wcg-wl__add:hover {
	background: var(--button-primary-hover-bg);
	color: var(--button-primary-text);
}

.wcg-wl .wcg-wl__add.wcg-wl__add:active {
	background: var(--button-primary-press-bg);
}

.wcg-wl .wcg-wl__add.wcg-wl__add:focus-visible {
	outline: 2px solid var(--border-focus);
	outline-offset: 2px;
}

/* WooCommerce's "View cart" link after an add, beside the button. */
.wcg-wl .added_to_cart {
	color: var(--text-link);
	font-size: 14px;
	font-weight: 600;
}

.wcg-wl__empty {
	margin: 0;
	color: var(--wcg-wl-muted);
}

@media (max-width: 480px) {
	.wcg-wl__item {
		flex-wrap: wrap;
	}

	.wcg-wl__actions {
		width: 100%;
		justify-content: space-between;
	}
}

/* ------------------------------------------------------------- the heart alone

   Doubled class again: the padding being undone here is set by a doubled
   selector, and a single one would not reach it. A button with nothing but an
   icon in it is square - equal padding would leave it wider than it is tall. */

.wcg-wl--show-icon .wcg-wl__label {
	display: none;
}

.wcg-wl--show-icon .wcg-wl__button.wcg-wl__button {
	gap: 0;
	width: var(--wcg-wl-height);
	padding: 0;
	justify-content: center;
}

/* The box stays the control's height - a 44px target is a 44px target, and
   shrinking it on a phone is the wrong direction - so what closes the gap is
   the heart growing into it. */
.wcg-wl--show-icon .wcg-wl__icon {
	width: var(--wcg-wl-icon-alone);
	height: var(--wcg-wl-icon-alone);
}

@media (max-width: 767px) {
	.wcg-wl--m-icon .wcg-wl__label {
		display: none;
	}

	.wcg-wl--m-icon .wcg-wl__button.wcg-wl__button {
		gap: 0;
		width: var(--wcg-wl-height);
		padding: 0;
		justify-content: center;
	}

	.wcg-wl--m-icon .wcg-wl__icon {
		width: var(--wcg-wl-icon-alone);
		height: var(--wcg-wl-icon-alone);
	}

	/* The other way round: a button stripped on desktop keeps its words on a
	   phone only if the shop renders any, which is the module's setting. */
	.wcg-wl--m-inherit .wcg-wl__label {
		display: revert;
	}

	.wcg-wl--m-inherit .wcg-wl__button.wcg-wl__button {
		gap: 8px;
		width: auto;
		padding: 0 16px;
	}

	.wcg-wl--m-inherit .wcg-wl__button--plain.wcg-wl__button--plain {
		padding: 0 8px;
	}

	/* Words are back, so the heart goes back to the size that sits beside
	   them. */
	.wcg-wl--m-inherit .wcg-wl__icon {
		width: var(--wcg-wl-icon-size);
		height: var(--wcg-wl-icon-size);
	}
}

/* ------------------------------------------------------------ signing in */

/* The wishlist page for someone who is not signed in: why the list is not
   there, and the way in. */
.wcg-wl__signin {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 12px;
}

.wcg-wl .wcg-wl__signin-link.wcg-wl__signin-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-height: var(--control-md);
	margin: 0;
	padding: 0 18px;
	border: 0;
	border-radius: var(--button-radius);
	background: var(--button-primary-bg);
	color: var(--button-primary-text);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
}

.wcg-wl .wcg-wl__signin-link.wcg-wl__signin-link:hover {
	background: var(--button-primary-hover-bg);
	color: var(--button-primary-text);
}

.wcg-wl .wcg-wl__signin-link.wcg-wl__signin-link:focus-visible {
	outline: 2px solid var(--border-focus);
	outline-offset: 2px;
}

/* The line the heart puts under the DKM Account sign-in title, so the panel
   says why it opened. Outside .wcg-wl: it is inside the panel. */
.wcg-acc .wcg-wl-signin-note {
	margin: 0 0 14px;
	padding: 10px 12px;
	border-radius: var(--radius-sm);
	background: var(--bg-subtle);
	color: var(--text-primary);
	font-family: var(--font-sans);
	font-size: 14px;
	line-height: 1.4;
}

/* No panel on the page: a box at the foot of the screen, where the card the
   heart sits in can never cut it off. */
.wcg-wl-prompt {
	position: fixed;
	right: 16px;
	bottom: 16px;
	left: 16px;
	z-index: 99999;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	box-sizing: border-box;
	max-width: 420px;
	margin: 0 auto;
	padding: 16px 48px 16px 16px;
	border: var(--border-hairline) solid var(--border-default);
	border-radius: var(--modal-radius, var(--radius-lg));
	background: var(--bg-surface);
	box-shadow: var(--shadow-lg);
	color: var(--text-primary);
	font-family: var(--font-sans);
	animation: wcg-wl-prompt-in 160ms ease-out;
}

.wcg-wl-prompt__text {
	flex: 1 1 100%;
	margin: 0;
	font-size: 15px;
	line-height: 1.4;
}

.wcg-wl-prompt .wcg-wl-prompt__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-height: var(--control-md);
	padding: 0 18px;
	border-radius: var(--button-radius);
	background: var(--button-primary-bg);
	color: var(--button-primary-text);
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
}

.wcg-wl-prompt .wcg-wl-prompt__link:hover {
	background: var(--button-primary-hover-bg);
	color: var(--button-primary-text);
}

.wcg-wl-prompt .wcg-wl-prompt__link:focus-visible,
.wcg-wl-prompt .wcg-wl-prompt__close:focus-visible {
	outline: 2px solid var(--border-focus);
	outline-offset: 2px;
}

.wcg-wl-prompt .wcg-wl-prompt__close {
	position: absolute;
	top: 8px;
	right: 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: var(--radius-full);
	background: transparent;
	color: var(--text-secondary);
	cursor: pointer;
}

.wcg-wl-prompt .wcg-wl-prompt__close:hover {
	background: var(--bg-subtle);
	color: var(--text-primary);
}

.wcg-wl-prompt__close svg {
	width: 20px;
	height: 20px;
}

@keyframes wcg-wl-prompt-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.wcg-wl-prompt {
		animation: none;
	}
}
