/* ============================================================
 * WonderLab Account Suite — Wishlist storefront + page styles.
 *
 * Three button contexts (pdp / archive / related) share one base
 * .was-wishlist-btn and diverge on size + position. The heart icon
 * fills in burgundy when .is-active.
 * ============================================================ */

:root {
	--was-wishlist-burgundy:      #851625;
	--was-wishlist-burgundy-dark: #5e0f1a;
	--was-wishlist-burgundy-soft: #fff5f6;
	--was-wishlist-burgundy-line: rgba(133, 22, 37, 0.18);
	--was-wishlist-ink:           #2a1a14;
	--was-wishlist-ink-soft:      #6a5e54;
	--was-wishlist-line:          #ece4d6;
	--was-wishlist-tan:           #f6f1e8;
}


/* ============================================================
 * Toggle button — base
 * ============================================================ */
.was-wishlist-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	background: none;
	border: 1px solid var(--was-wishlist-burgundy-line);
	color: var(--was-wishlist-burgundy);
	border-radius: 999px;
	cursor: pointer;
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	line-height: 1;
	padding: 6px 10px;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
	text-decoration: none !important;
	white-space: nowrap;
}
.was-wishlist-btn:hover,
.was-wishlist-btn:focus-visible {
	background: var(--was-wishlist-burgundy-soft);
	border-color: var(--was-wishlist-burgundy);
	color: var(--was-wishlist-burgundy-dark);
	outline: 0;
}
.was-wishlist-btn:disabled { opacity: 0.6; pointer-events: none; }

.was-wishlist-btn .was-wishlist-heart {
	display: inline-block;
	transition: fill 0.15s ease, transform 0.15s ease;
	color: inherit;
}
.was-wishlist-btn.is-active .was-wishlist-heart {
	fill: var(--was-wishlist-burgundy);
	color: var(--was-wishlist-burgundy);
}
.was-wishlist-btn.is-active {
	background: var(--was-wishlist-burgundy-soft);
	border-color: var(--was-wishlist-burgundy);
}
.was-wishlist-btn.is-shake {
	animation: was-wishlist-shake 0.4s linear;
}
@keyframes was-wishlist-shake {
	0%, 100% { transform: translateX(0); }
	20% { transform: translateX(-4px); }
	40% { transform: translateX(4px); }
	60% { transform: translateX(-3px); }
	80% { transform: translateX(2px); }
}

/* Two label spans always sit inside the button; CSS hides the
   wrong one based on the .is-active state of the parent. This way
   the server-rendered markup is correct on first paint without the
   JS having to toggle [hidden] attributes (which produced "Add to
   wishlist Saved to wishlist" both visible until the JS executed). */
.was-wishlist-btn-label-add,
.was-wishlist-btn-label-done {
	display: inline-block;
}
.was-wishlist-btn:not(.is-active) .was-wishlist-btn-label-done { display: none; }
.was-wishlist-btn.is-active        .was-wishlist-btn-label-add  { display: none; }


/* ============================================================
 * PDP button — sits below add-to-cart, bigger touch target,
 * shows both icon + label.
 * ============================================================ */
.was-wishlist-pdp-wrap {
	margin: 14px 0 4px;
}
.was-wishlist-btn--pdp {
	/* Drop the burgundy outline on the PDP variant only (v1.15.20).
	   Marketing felt the bordered pill looked heavier than the Add
	   to Cart button on mobile; the heart icon + text are signal
	   enough. Archive/related variants keep their border because
	   they're icon-only chips that need visual definition. */
	border: 0;
	padding: 10px 18px;
	font-size: 14px;
	font-weight: 500;
}
.was-wishlist-btn--pdp .was-wishlist-heart {
	width: 18px;
	height: 18px;
}


/* ============================================================
 * Shop loop / archive button — icon-only, hovers in the top
 * corner of the card via wrapping product card if present.
 * ============================================================ */
.was-wishlist-btn--archive,
.was-wishlist-btn--related {
	padding: 6px;
	width: 32px;
	height: 32px;
	background: #fff;
	border-color: var(--was-wishlist-line);
	margin: 0 0 8px;
}
.was-wishlist-btn--archive .was-wishlist-heart,
.was-wishlist-btn--related .was-wishlist-heart {
	width: 16px;
	height: 16px;
}

/* Position absolutely if the parent has a product-card container —
   Storefront, Astra, Divi all wrap loop items in known containers.
   Falls back to inline-block for unknown themes. */
li.product .was-wishlist-btn--archive,
li.product .was-wishlist-btn--related,
.products li.product .was-wishlist-btn--archive,
.products li.product .was-wishlist-btn--related {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 3;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	margin: 0;
}
li.product { position: relative; }


/* ============================================================
 * Toast (ephemeral confirmation on PDP)
 * ============================================================ */
.was-wishlist-toast {
	display: inline-block;
	margin-left: 12px;
	padding: 6px 12px;
	background: var(--was-wishlist-burgundy);
	color: #fff !important;
	font-size: 12px;
	font-weight: 500;
	border-radius: 999px;
	opacity: 1;
	transition: opacity 0.4s ease, transform 0.4s ease;
}
.was-wishlist-toast.is-out {
	opacity: 0;
	transform: translateX(8px);
}


/* ============================================================
 * Header heart icon (shortcode [was_wishlist_icon])
 * ============================================================ */
/* Header heart — `color: inherit` picks up Divi's menu colour
   (`.et-cart-info` is also `color: inherit`, so the heart and the
   cart icon match automatically — both render in whatever the menu
   text colour is set to, typically solid black). Hover dims the
   icon instead of adding a background pill, so it stays
   indistinguishable from Divi's other icons. */
.was-wishlist-header-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: inherit !important;
	text-decoration: none !important;
	vertical-align: middle;
	line-height: 1;
	transition: color 0.2s ease;
}
/* Hover → burgundy. Matches the cart + search icon hover from
   the WonderLab Site plugin (which targets the Divi pseudo-
   elements `.et_pb_menu__cart-button:hover::after`); applying
   it here too keeps all four icons behaving identically. */
.was-wishlist-header-icon:hover,
.was-wishlist-header-icon:focus {
	color: rgb( 133, 22, 37 ) !important;
}
.was-wishlist-header-icon .was-wishlist-heart,
.was-wishlist-header-icon .was-account-glyph {
	width: 16px;
	height: 16px;
	/* Filled glyph in the header — matches the other solid icons
	   (cart, search). The storefront PDP heart keeps its
	   outline-when-empty / filled-when-saved state via the
	   .was-wishlist-btn rules above. */
	fill: currentColor;
	stroke: none;
}

/* Auto-injected variants — JS copies `et_pb_menu__icon` onto the
   injected anchor, so Divi's own rule `a.et_pb_menu__icon { margin:
   0 11px }` applies and the new icons space identically to the
   cart + search siblings. This block defensively pins the spacing
   in case Divi's selector ever changes — same value, higher
   specificity (class + class). */
.was-wishlist-header-icon-auto,
.was-account-header-icon-auto {
	margin: 0 11px !important;
}


/* ============================================================
 * /my-account/wishlist/ — page chrome
 * ============================================================ */
.wd-wishlist-page {
	font-family: 'Geologica', sans-serif;
	color: var(--was-wishlist-ink);
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.wd-wishlist-hero {
	background: linear-gradient(135deg, #fffbf1 0%, var(--was-wishlist-tan) 100%);
	border: 1px solid var(--was-wishlist-line);
	border-radius: 18px;
	padding: 26px 30px;
	box-shadow: 0 1px 0 var(--was-wishlist-burgundy-line), 0 12px 24px -16px rgba(94, 15, 26, 0.18);
}
.wd-wishlist-eyebrow {
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	color: var(--was-wishlist-burgundy);
	margin-bottom: 6px;
}
.wd-wishlist-title {
	font-size: 30px;
	font-weight: 700;
	margin: 0 0 6px;
	color: var(--was-wishlist-ink);
	line-height: 1.1;
}
.wd-wishlist-sub {
	margin: 0;
	color: var(--was-wishlist-ink-soft);
	font-size: 14px;
}

.wd-wishlist-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.wd-wishlist-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 16px;
}

.wd-wishlist-card {
	background: #fff;
	border: 1px solid var(--was-wishlist-line);
	border-radius: 12px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: border-color 0.15s ease, transform 0.15s ease, opacity 0.2s ease;
	box-shadow: 0 1px 0 var(--was-wishlist-burgundy-line);
}
.wd-wishlist-card:hover {
	border-color: var(--was-wishlist-burgundy-line);
	transform: translateY(-1px);
}
.wd-wishlist-card.is-removing {
	opacity: 0.5;
	pointer-events: none;
}

.wd-wishlist-thumb {
	display: block;
	background: var(--was-wishlist-tan);
	overflow: hidden;
	aspect-ratio: 1 / 1;
}
.wd-wishlist-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}
.wd-wishlist-card:hover .wd-wishlist-thumb img {
	transform: scale(1.04);
}

.wd-wishlist-body {
	padding: 16px 18px 6px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	flex: 1;
}
.wd-wishlist-name {
	font-size: 15px;
	font-weight: 600;
	color: var(--was-wishlist-ink);
	margin: 0;
	line-height: 1.3;
}
.wd-wishlist-name a {
	color: inherit !important;
	text-decoration: none !important;
}
.wd-wishlist-name a:hover { color: var(--was-wishlist-burgundy) !important; }
.wd-wishlist-variation {
	margin: 0;
	font-size: 12.5px;
	color: var(--was-wishlist-ink-soft);
}
.wd-wishlist-price {
	margin-top: 6px;
	font-weight: 600;
	color: var(--was-wishlist-burgundy);
	font-size: 15px;
}
.wd-wishlist-price del { color: #b0a297; font-weight: 400; }
.wd-wishlist-stock {
	margin-top: 4px;
}
.wd-wishlist-stock .wd-badge--in-stock {
	background: #e8f5e9;
	color: #1b5e20;
	font-size: 11px;
	font-weight: 600;
	padding: 2px 8px;
	border-radius: 999px;
}
.wd-wishlist-stock .wd-badge--out-stock {
	background: #fce8e8;
	color: #9b2222;
	font-size: 11px;
	font-weight: 600;
	padding: 2px 8px;
	border-radius: 999px;
}

.wd-wishlist-card-actions {
	padding: 0 18px 16px;
	display: flex;
	gap: 8px;
	align-items: center;
	justify-content: space-between;
	margin-top: auto;
}
.wd-wishlist-card-actions .wd-btn-primary,
.wd-wishlist-card-actions .wd-btn-secondary {
	flex: 1;
	text-align: center;
	justify-content: center;
	min-width: 0;
}
.wd-wishlist-remove {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: none;
	border: 1px solid var(--was-wishlist-line);
	color: var(--was-wishlist-ink-soft);
	font-family: inherit;
	font-size: 12px;
	font-weight: 500;
	padding: 7px 10px;
	border-radius: 999px;
	cursor: pointer;
	transition: all 0.15s ease;
	flex-shrink: 0;
}
.wd-wishlist-remove:hover {
	border-color: var(--was-wishlist-burgundy);
	color: var(--was-wishlist-burgundy);
	background: var(--was-wishlist-burgundy-soft);
}
.wd-wishlist-remove svg { flex-shrink: 0; }
.wd-wishlist-remove span { line-height: 1; }


/* ============================================================
 * Mobile rebuild (v1.15.8) — fixes the previous attempt's
 * structural bug. Template ships three card siblings:
 *
 *   .wd-wishlist-card → .wd-wishlist-thumb
 *                      .wd-wishlist-body
 *                      .wd-wishlist-card-actions
 *
 * The previous `flex-direction: row` rule flattened all three
 * into one horizontal strip, cramming the actions block into a
 * narrow third column where its full-width buttons rendered
 * tiny. The fix: switch the card to CSS Grid at ≤600 so the
 * thumb spans both rows on the left while body + actions stack
 * on the right.
 *
 *   ≤900 : single-column grid + tighter hero + full-width bulk
 *          action buttons.
 *   ≤600 : horizontal card via CSS Grid — thumb spans
 *          grid-row: 1 / -1 on the left; body sits top-right,
 *          actions sit bottom-right.
 *   ≤400 : narrower thumb, hero padding compresses.
 * ============================================================ */

/* ============================================================
 * PDP wishlist button — full-width on mobile (<=768px).
 * Matches the Add to Cart full-width treatment in
 * wonderlab-product-experience/assets/css/product-pages.css
 * section 7 — same breakpoint so the two buttons resize together
 * and visually pair as the stacked CTA group.
 * Toast also centers below the full-width button on mobile;
 * JS keeps only one toast visible at a time on this breakpoint.
 * ============================================================ */
@media (max-width: 768px) {
	.was-wishlist-btn--pdp {
		display: flex;
		width: 100%;
		max-width: 100%;
		justify-content: center;
		padding: 12px 18px;
	}

	.was-wishlist-toast {
		display: block;
		margin: 10px auto 0;
		width: fit-content;
		max-width: calc(100% - 32px);
		text-align: center;
	}
}

@media (max-width: 900px) {
	.wd-wishlist-hero { padding: 22px 22px; }
	.wd-wishlist-title { font-size: 24px; }
	.wd-wishlist-sub { font-size: 13px; }
	.wd-wishlist-grid { grid-template-columns: 1fr; gap: 12px; }

	.wd-wishlist-actions { gap: 8px; }
	.wd-wishlist-actions .wd-btn-primary,
	.wd-wishlist-actions .wd-btn-secondary {
		flex: 1;
		min-width: 0;
		text-align: center;
		justify-content: center;
		font-size: 13px;
	}
}

@media (max-width: 600px) {
	.wd-wishlist-card {
		display: grid;
		grid-template-columns: 140px 1fr;
		grid-template-rows: 1fr auto;
		flex-direction: initial;
		column-gap: 0;
	}
	.wd-wishlist-thumb {
		grid-column: 1;
		grid-row: 1 / -1;
		aspect-ratio: 1 / 1;
		width: 100%;
		height: 100%;
	}
	.wd-wishlist-body {
		grid-column: 2;
		grid-row: 1;
		padding: 12px 14px 6px;
		gap: 3px;
		min-width: 0;
	}
	.wd-wishlist-card-actions {
		grid-column: 2;
		grid-row: 2;
		padding: 0 14px 12px;
		display: flex;
		flex-direction: column;
		gap: 6px;
		margin-top: 0;
	}
	.wd-wishlist-name { font-size: 14px; }
	.wd-wishlist-variation { font-size: 11.5px; }
	.wd-wishlist-price { font-size: 14px; }
	.wd-wishlist-stock .wd-badge--in-stock,
	.wd-wishlist-stock .wd-badge--out-stock {
		font-size: 10.5px;
		padding: 2px 7px;
	}
	.wd-wishlist-card-actions .wd-btn-primary,
	.wd-wishlist-card-actions .wd-btn-secondary {
		flex: 0 0 auto;
		width: 100%;
		padding: 9px 12px;
		font-size: 12.5px;
	}
	.wd-wishlist-remove {
		flex: 0 0 auto;
		width: 100%;
		justify-content: center;
		padding: 7px 12px;
		font-size: 12px;
	}
}

@media (max-width: 400px) {
	.wd-wishlist-hero { padding: 18px 16px; border-radius: 14px; }
	.wd-wishlist-title { font-size: 22px; }
	.wd-wishlist-card { grid-template-columns: 108px 1fr; }
	.wd-wishlist-body { padding: 10px 12px 4px; }
	.wd-wishlist-card-actions { padding: 0 12px 10px; }
}
