/*
 Wishlist page (inc/modules/wishlist-page.php, assets/js/wishlist-page.js). Loaded on that page only.
 Woodmart's wishlist markup with: the title and a count pill, a "Share wishlist" button that opens a
 small panel (brand-coloured round icons, Copy link), a mint bar for ticked products under the title,
 and "Select" / Remove above each product. The product cards are Woodmart's, unchanged.
 Woodmart loads its wishlist styles in the page body, after this file, so the rules start with
 "body .wd-wishlist-content" to win over them.
*/

/* Empty wishlist: the message sits in the middle of the space beside the menu. :has() also finds it
   after Woodmart redraws the list when the last product is removed. */
body .woocommerce-MyAccount-content:has(.wd-empty-wishlist) {
	display: flex;
	flex-direction: column;
	justify-content: center;
}

/* Header: no line under it */
body .wd-wishlist-content .wd-wishlist-head {
	position: relative;
	margin-bottom: 20px;
	padding-bottom: 0;
	border-bottom: 0;
}
body .wd-wishlist-content .wd-wishlist-head .title {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 12px;
	font-size: 22px;
	font-weight: 600;
	text-transform: none;
	color: var(--wd-title-color);
}
.afm-wishlist-count {
	display: inline-flex;
	padding: 4px 10px;
	border-radius: 999px;
	background: #EAF2EC;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.4;
	color: #175536;
}

/* Share: one button, the icons in a panel under it */
.afm-wishlist-share {
	position: relative;
}
body .wd-wishlist-content .afm-wishlist-share__toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 42px;
	padding: 0 18px;
	border: 1px solid var(--wd-primary-color);
	border-radius: var(--btn-accented-brd-radius, 5px);
	background: var(--bgcolor-white, #fff);
	box-shadow: none;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	text-transform: uppercase;
	color: var(--wd-primary-color);
	cursor: pointer;
}
body .wd-wishlist-content .afm-wishlist-share__toggle:hover,
body .wd-wishlist-content .afm-wishlist-share.is-open .afm-wishlist-share__toggle {
	background: var(--wd-primary-color);
	color: #fff;
}
body .wd-wishlist-content .afm-wishlist-share__panel {
	position: absolute;
	top: calc(100% + 8px);
	inset-inline-end: 0;
	z-index: 40;
	display: flex;
	flex-direction: column;
	gap: 14px;
	box-sizing: border-box;
	width: 300px;
	padding: 18px;
	border-radius: 10px;
	background: var(--bgcolor-white, #fff);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 0 4px rgba(0, 0, 0, 0.12);
}
body .wd-wishlist-content .afm-wishlist-share__panel[hidden] {
	display: none;
}
.afm-wishlist-share__title {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	color: var(--wd-title-color);
}
/* Woodmart's share icons, round in each brand's colour */
body .wd-wishlist-content .afm-wishlist-share__panel .wd-social-icons {
	--wd-social-size: 44px;
	--wd-social-icon-size: 17px;
	--wd-social-gap: 8px;
	--wd-social-radius: 50%;
	--wd-social-color: #fff;
	--wd-social-color-hover: #fff;
	--wd-social-shadow-hover: inset 0 0 200px rgba(0, 0, 0, 0.15);
	--wd-align: space-between;
}
/* Woodmart's default style makes them auto-sized with padding; keep them 44px rounds. */
body .wd-wishlist-content .afm-wishlist-share__panel .wd-social-icons > a {
	--wd-social-bg: var(--wd-social-brand-color, var(--wd-primary-color));
	width: var(--wd-social-size);
	height: var(--wd-social-size);
	padding: 0;
}
body .wd-wishlist-content .afm-wishlist-share__panel .share-title {
	display: none;
}
.afm-wishlist-share__link {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 4px 4px 4px 12px;
	border: 1px solid var(--brdcolor-gray-300);
	border-radius: 5px;
}
.afm-wishlist-share__url {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	font-size: 13px;
	white-space: nowrap;
	text-overflow: ellipsis;
	color: #767676;
}
body .wd-wishlist-content .afm-wishlist-share__copy {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 6px;
	min-height: 36px;
	padding: 0 12px;
	border: 0;
	border-radius: 4px;
	background: #EAF2EC;
	box-shadow: none;
	font-size: 12px;
	font-weight: 600;
	line-height: 1;
	text-transform: uppercase;
	color: var(--wd-primary-color);
	cursor: pointer;
}
body .wd-wishlist-content .afm-wishlist-share__copy:hover,
body .wd-wishlist-content .afm-wishlist-share__copy.is-copied {
	background: var(--wd-primary-color);
	color: #fff;
}

/* Bar for ticked products (Woodmart's bulk actions): a mint bar under the title */
body .wd-wishlist-content .wd-wishlist-bulk-action {
	flex-wrap: nowrap;
	gap: 4px 12px;
	margin: 0;
	padding: 0 6px 0 20px;
	overflow: hidden;
	visibility: hidden;
	border-radius: 10px;
	background-color: #EAF2EC;
}
body .wd-wishlist-content .wd-wishlist-bulk-action.wd-visible {
	height: 56px;
	margin-bottom: 20px;
	visibility: visible;
	box-shadow: inset 0 0 0 1px #D5E5DA;
}
body .wd-wishlist-content .wd-wishlist-bulk-action::before {
	content: "";
	flex: 0 0 18px;
	height: 18px;
	background-color: var(--wd-primary-color);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.afm-wishlist-selected {
	order: 1;
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
	color: #175536;
}
body .wd-wishlist-content .wd-wishlist-bulk-action .wd-wishlist-select-all {
	--wd-action-color: var(--wd-primary-color);
	--wd-action-color-hover: #175536;
	order: 2;
	font-size: 14px;
}
body .wd-wishlist-content .wd-wishlist-bulk-action .wd-wishlist-select-all > a {
	height: auto;
	min-height: 44px;
	padding: 0 8px;
	/* The Direct Payments plugin sets "a { text-decoration: none !important }" on every page. */
	text-decoration: underline !important;
	text-underline-offset: 3px;
}
body .wd-wishlist-content .wd-wishlist-select-all .wd-action-icon {
	display: none;
}
body .wd-wishlist-content .wd-wishlist-bulk-action .wd-wishlist-remove-action {
	--wd-action-color: #fff;
	--wd-action-color-hover: #fff;
	order: 3;
	margin-inline-start: auto;
	font-size: 13px;
}
body .wd-wishlist-content .wd-wishlist-bulk-action .wd-wishlist-remove-action > a {
	height: 42px;
	padding: 0 18px;
	border-radius: var(--btn-accented-brd-radius, 5px);
	background-color: var(--wd-primary-color);
	text-transform: uppercase;
	white-space: nowrap;
}
body .wd-wishlist-content .wd-wishlist-bulk-action .wd-wishlist-remove-action > a:hover {
	background-color: #175536;
}
body .wd-wishlist-content .afm-wishlist-clear {
	display: flex;
	flex: 0 0 42px;
	order: 4;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	min-height: 0;
	padding: 0;
	border: 0;
	border-radius: 5px;
	background: none;
	box-shadow: none;
	color: #175536;
	cursor: pointer;
}
body .wd-wishlist-content .afm-wishlist-clear:hover {
	background: rgba(31, 107, 69, 0.1);
}

/* Remove buttons: a bin instead of the cross */
body .wd-wishlist-content :is(.wd-wishlist-remove-action, .wd-wishlist-product-remove) .wd-action-icon {
	display: inline-flex;
	margin-inline-end: 6px;
}
body .wd-wishlist-content :is(.wd-wishlist-remove-action, .wd-wishlist-product-remove) .wd-action-icon::before {
	content: "";
	display: block;
	width: 16px;
	height: 16px;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6M10 11v6M14 11v6'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6M10 11v6M14 11v6'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Above each product: Select on the left, Remove on the right */
body .wd-wishlist-content .wd-wishlist-product-actions {
	justify-content: space-between;
	height: auto;
	min-height: 40px;
	margin-bottom: 10px;
}
body .wd-wishlist-content .wd-wishlist-product-checkbox {
	flex: 0 1 auto;
	order: -1;
	font-size: 13px;
	text-align: start;
}
body .wd-wishlist-content .wd-wishlist-product-checkbox input {
	width: 20px;
	height: 20px;
	margin: 0;
	accent-color: var(--wd-primary-color);
	cursor: pointer;
}
.afm-wishlist-select {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	margin: 0;
	font-size: 13px;
	font-weight: 500;
	color: var(--wd-text-color);
	cursor: pointer;
}
body .wd-wishlist-content .wd-wishlist-product-remove {
	--wd-action-color: #5C5C5C;
	--wd-action-color-hover: var(--wd-title-color);
	font-size: 13px;
}
body .wd-wishlist-content .wd-wishlist-product-remove > a {
	height: auto;
	min-height: 40px;
}

/* Phones: Share as a round icon button, its panel full width */
@media (max-width: 575.98px) {
	body .wd-wishlist-content .wd-wishlist-head {
		flex-wrap: nowrap;
	}
	body .wd-wishlist-content .wd-wishlist-head .title {
		font-size: 20px;
	}
	.afm-wishlist-share {
		position: static;
	}
	body .wd-wishlist-content .afm-wishlist-share__toggle {
		justify-content: center;
		width: 44px;
		height: 44px;
		min-height: 44px;
		padding: 0;
		border-radius: 50%;
	}
	.afm-wishlist-share__label {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}
	body .wd-wishlist-content .afm-wishlist-share__panel {
		inset-inline: 0;
		width: auto;
	}
	body .wd-wishlist-content .wd-wishlist-bulk-action {
		gap: 4px 6px;
		padding-inline-start: 14px;
	}
	body .wd-wishlist-content .wd-wishlist-bulk-action::before {
		display: none;
	}
	body .wd-wishlist-content .wd-wishlist-bulk-action .wd-wishlist-remove-action > a {
		padding: 0 14px;
	}
}
