/**
 * Saved properties tray.
 *
 * Kept apart from the widget stylesheet and small enough to load site-wide:
 * the heart appears on any page showing a card, and the tray has to be
 * reachable from all of them.
 *
 * Selectors carry their element type (button.pc-saved__toggle) for the same
 * reason as the widget pack — themes style every button on the site, and this
 * one sits over the page where a stray background would be obvious.
 */

.pc-saved {
	/* Same palette as the widgets, read from the tokens PC_Typography prints
	   so the tray cannot drift from the rest of the plugin. */
	--pc-saved-ink: var(--pc-navy, #000030);
	--pc-saved-muted: #5b6072;
	--pc-saved-line: #dfe3ec;
	--pc-saved-heart: #ff4d68;

	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 9990;
	font-family: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Same approach as the widget pack: set the body face once and let it
   inherit, rather than naming every element and overriding icon fonts. */
.pc-saved {
	font-family: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.pc-saved button { font-family: inherit; }

.pc-saved h2.pc-saved__title,
.pc-saved .pc-saved__price {
	font-family: "Fraunces", Georgia, "Times New Roman", serif;
}

.pc-saved[hidden] { display: none; }

/* Toggle */
/* Same reasoning as the widget stylesheet: the theme paints every button and
 * sizes every svg, and a floating control that inherits the theme's button
 * colour looks like a bug rather than a feature. Scoped to this plugin's own
 * elements. */
.pc-saved button.pc-saved__toggle {
	-webkit-appearance: none;
	appearance: none;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px !important;
	height: 56px !important;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0 !important;
	border: 0;
	border-radius: 50% !important;
	background: #fff !important;
	color: var(--pc-saved-heart);
	box-shadow: 0 6px 22px rgba(10, 14, 30, .22);
	cursor: pointer;
	font: inherit;
	line-height: 1;
	transition: transform .18s ease, box-shadow .18s ease;
}

.pc-saved button.pc-saved__toggle:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(10, 14, 30, .28); }
.pc-saved button.pc-saved__toggle:focus-visible { outline: 2px solid var(--pc-saved-ink); outline-offset: 3px; }

.pc-saved button.pc-saved__toggle svg {
	display: block;
	width: 26px !important;
	height: 26px !important;
	max-width: none !important;
	max-height: none !important;
	/* Filled rather than outlined: at 26px inside a white disc, an outline
	   heart reads as a ring. */
	fill: currentColor;
	stroke: none;
}

.pc-saved__count {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 999px;
	background: var(--pc-saved-ink);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
}

/* Panel */
.pc-saved__panel {
	position: absolute;
	right: 0;
	bottom: 68px;
	width: min(330px, calc(100vw - 32px));
	max-height: min(58vh, 460px);
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid var(--pc-saved-line);
	border-radius: 14px;
	box-shadow: 0 18px 46px rgba(10, 14, 30, .26);
	overflow: hidden;
	transform-origin: bottom right;
	animation: pc-saved-in .16s ease;
}

.pc-saved__panel[hidden] { display: none; }

@keyframes pc-saved-in {
	from { opacity: 0; transform: translateY(6px) scale(.98); }
	to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.pc-saved__panel { animation: none; }
	.pc-saved button.pc-saved__toggle:hover { transform: none; }
}

.pc-saved__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 11px 14px;
	border-bottom: 1px solid var(--pc-saved-line);
}

/* The theme styles h2 site-wide — in a 360px panel that produced a heading
 * large enough to wrap onto two lines and push the list out of view. Every
 * property a theme is likely to set on a heading is pinned here. */
.pc-saved h2.pc-saved__title {
	margin: 0 !important;
	padding: 0 !important;
	font-family: "Fraunces", Georgia, serif !important;
	font-size: 15px !important;
	line-height: 1.25 !important;
	font-weight: 600 !important;
	letter-spacing: 0 !important;
	text-transform: none !important;
	color: var(--pc-saved-ink) !important;
}

.pc-saved button.pc-saved__close {
	-webkit-appearance: none;
	appearance: none;
	width: 28px;
	height: 28px;
	min-width: 0;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: none !important;
	color: var(--pc-saved-muted);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

.pc-saved button.pc-saved__close:hover { color: var(--pc-saved-ink); }

.pc-saved__list { overflow-y: auto; padding: 7px; flex: 1; }
.pc-saved__list[aria-busy="true"] { opacity: .5; }

.pc-saved__item {
	position: relative;
	display: grid;
	grid-template-columns: 54px 1fr 26px;
	gap: 10px;
	align-items: center;
	padding: 7px;
	border-radius: 9px;
}

.pc-saved__item:hover { background: #f6f8fc; }

.pc-saved__thumb { display: block; width: 54px; height: 44px; border-radius: 7px; overflow: hidden; background: #eef1f6; }
.pc-saved__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-saved__blank { display: block; width: 100%; height: 100%; background: repeating-linear-gradient(45deg, #eef1f6, #eef1f6 8px, #e5eaf2 8px, #e5eaf2 16px); }

.pc-saved__meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.pc-saved__name {
	color: var(--pc-saved-ink);
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pc-saved__name:hover { text-decoration: underline; }
.pc-saved__price { font-size: 13px; font-weight: 700; color: var(--pc-saved-ink); }
.pc-saved__where { font-size: 11.5px; color: var(--pc-saved-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pc-saved button.pc-saved__remove {
	-webkit-appearance: none;
	appearance: none;
	width: 26px;
	height: 26px;
	min-width: 0;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: none !important;
	color: var(--pc-saved-muted);
	font-size: 19px;
	line-height: 1;
	cursor: pointer;
}

.pc-saved button.pc-saved__remove:hover { color: #b3261e; }

.pc-saved__empty { margin: 0; padding: 26px 18px; text-align: center; color: var(--pc-saved-muted); font-size: 13px; line-height: 1.6; }

.pc-saved__foot { padding: 9px 14px; border-top: 1px solid var(--pc-saved-line); }

/* Themes commonly set uppercase, wide letter-spacing and a large font on
 * buttons. At panel width that turned "Clear all" into the loudest thing on
 * screen, above the listings it clears. */
.pc-saved button.pc-saved__clear {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	min-height: 0 !important;
	padding: 8px !important;
	margin: 0 !important;
	border: 1px solid var(--pc-saved-line) !important;
	border-radius: 7px !important;
	background: #fff !important;
	color: var(--pc-saved-muted) !important;
	font-family: inherit !important;
	font-size: 12.5px !important;
	font-weight: 600 !important;
	line-height: 1.3 !important;
	letter-spacing: 0 !important;
	text-transform: none !important;
	cursor: pointer;
}

.pc-saved button.pc-saved__clear:hover { border-color: #b3261e; color: #b3261e; }

@media (max-width: 600px) {
	.pc-saved { right: 14px; bottom: 14px; }
	.pc-saved button.pc-saved__toggle { width: 52px; height: 52px; }
	.pc-saved__panel { width: calc(100vw - 28px); max-height: 66vh; }
}
