/**
 * Woningkiezer favorites.
 * Override in your theme, e.g. .wk-favs { --wk-fav-color: #c0392b; }
 */

:where(.woning-card, .wk-favs, .wk-fav-count, .woningkiezer) {
	--wk-fav-color: #ffd23f;      /* heart, counter, favorite shapes */
	--wk-fav-text: #000;          /* text on --wk-fav-color */
}

/* Heart in the card header */
.woning-card__header {
	position: relative;
}

.woning-card__fav {
	position: absolute;
	top: 50%;
	right: 12px;
	width: 34px;
	height: 34px;
	margin: 0;
	padding: 6px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	line-height: 0;
	cursor: pointer;
	transform: translateY(-50%);
	transition: transform .15s ease;
}

.woning-card__fav svg {
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
}

.woning-card__fav:hover {
	transform: translateY(-50%) scale(1.12);
}

.woning-card__fav[aria-pressed="true"] svg {
	fill: var(--wk-fav-color);
	stroke: #fff;
}

/* Close button (touch) sits top right too: move the heart left */
.woningkiezer__tooltip.is-pinned .woning-card__fav {
	right: 48px;
}

/* Favorite shapes in the SVG: whole shape in the favorite colour */
.woningkiezer .woningkiezer__unit.is-favorite {
	fill: var(--wk-fav-color);
	fill-opacity: .85;
	opacity: 1;
}

.woningkiezer .woningkiezer__unit.is-favorite:hover,
.woningkiezer .woningkiezer__unit.is-favorite.is-active {
	fill-opacity: 1;
}

/* Menu counter */
.wk-fav-count {
	position: relative;
	top: -.2em; /* raise next to the heart; adjust in theme if needed */
	display: inline-block;
	min-width: 1.5em;
	margin-left: .4em;
	padding: 0 .4em;
	border-radius: 1em;
	background: var(--wk-fav-color);
	color: var(--wk-fav-text);
	font-size: .75em;
	line-height: 1.5em;
	text-align: center;
}

.wk-fav-count.is-empty {
	opacity: .5;
}

/* Panel + inline list */
.wk-favs {
	color: #000;
	font-size: 15px;
	line-height: 1.3;
	text-align: left;
}

.wk-favs--panel {
	position: fixed;
	z-index: 99999;
	width: 340px;
	max-width: calc(100vw - 20px);
	background: #fff;
	border: 1px solid #333;
	box-shadow: 0 4px 20px rgba(0, 0, 0, .15);
	visibility: hidden;
	opacity: 0;
	transition: opacity .15s ease;
}

.wk-favs--panel.is-open {
	visibility: visible;
	opacity: 1;
}

@media (max-width: 767px) {
	.wk-favs--panel {
		top: 70px;
		left: 10px;
		right: 10px;
		width: auto;
		max-width: none;
	}
}

.wk-favs__head {
	position: relative;
	padding: 12px 44px 12px 16px;
	background: #000;
	color: #fff;
	font-weight: 700;
	text-transform: uppercase;
}

.wk-favs__close {
	position: absolute;
	top: 0;
	right: 0;
	width: 44px;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

.wk-favs__body {
	padding: 6px 16px 16px;
}

.wk-favs__empty {
	margin: 10px 0 0;
}

.wk-favs__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.wk-favs__item {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 2px 10px;
	padding: 10px 0;
	border-bottom: 1px solid #ddd;
}

.wk-favs__rank {
	grid-column: 1;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
}

.wk-favs__label {
	grid-column: 1;
	font-weight: 700;
}

.wk-favs__meta {
	grid-column: 1;
	font-size: 13px;
	white-space: nowrap;
	opacity: .75;
}

.wk-favs__actions {
	grid-column: 2;
	grid-row: 1 / span 4;
	align-self: center;
	white-space: nowrap;
}

.wk-favs__btn {
	width: 30px;
	height: 30px;
	margin: 0 0 0 2px;
	padding: 0;
	border: 1px solid #ccc;
	background: #fff;
	color: #000;
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
}

.wk-favs__btn:disabled {
	opacity: .3;
	cursor: default;
}

.wk-favs__submit,
.wk-favs__submit:visited {
	display: block;
	margin-top: 14px;
	padding: 12px 16px;
	background: #000;
	color: #fff;
	font-weight: 700;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
}

.wk-favs__submit:hover,
.wk-favs__submit:focus {
	background: #222;
	color: #fff;
}

/* Message when a 4th favorite is chosen */
.wk-toast {
	position: fixed;
	top: 100px; /* just below the menu */
	left: 50%;
	z-index: 100000;
	max-width: calc(100vw - 32px);
	padding: 12px 18px;
	background: #000;
	color: #fff;
	font-size: 15px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, .25);
	visibility: hidden;
	opacity: 0;
	transform: translate(-50%, -10px);
	transition: opacity .2s ease, transform .2s ease;
}

.wk-toast.is-visible {
	visibility: visible;
	opacity: 1;
	transform: translate(-50%, 0);
}

.wk-toast__heart {
	width: 1em;
	height: 1em;
	vertical-align: -.15em;
	fill: currentColor;
}
