/* Favorites — heart buttons, archive trigger and popup. */

:root {
	/* No brand token for red (the palette is all-cool); scoped to this feature. */
	--mf-fav-red:      #e0526b;
	--mf-fav-red-deep: #c73f57;
}

/* HEART BUTTON */

/* Positioning context for the card heart — set here so listings.css stays untouched. */
.mf-event-card,
.mf-coach-card,
.mf-ehero__banner,
.mf-single-coach__photo {
	position: relative;
}

/* Every box property is !important: on single pages the theme's generic <button>
   styling would otherwise win, and the heart must look identical everywhere. */
.mf-fav-btn {
	appearance: none !important;
	-webkit-appearance: none !important;
	box-sizing: border-box !important;
	border: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	cursor: pointer !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 40px !important;
	height: 40px !important;
	min-width: 0 !important;
	min-height: 0 !important;
	border-radius: 50% !important;
	background: rgba(255, 255, 255, 0.92) !important;
	box-shadow: 0 2px 8px rgba(10, 43, 84, 0.18) !important;
	color: var(--mf-fav-red) !important; /* red heart when idle */
	transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	outline: none !important;
	text-decoration: none !important;
	line-height: 1 !important;
}

/* Card variant: floats over the media, above the card link. */
.mf-fav-btn--card {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 3; /* above .mf-*-card__link */
}

/* Solo variant: inline, for single-page heroes without a media anchor. */
.mf-fav-btn--solo {
	position: relative;
	width: 44px !important;
	height: 44px !important;
}

.mf-fav-btn__icon {
	display: inline-flex;
	width: 20px;
	height: 20px;
}

.mf-fav-btn--solo .mf-fav-btn__icon {
	width: 22px;
	height: 22px;
}

/* Labelled variant (single-page rail). Shared rules pin box props !important, so override with !important too. */
.mf-fav-btn--label {
	position: relative;
	width: 100% !important;
	height: auto !important;
	min-height: 44px !important;
	gap: 9px;
	padding: 11px 16px !important;
	border: 1px solid var(--mf-line) !important;
	border-radius: var(--mf-radius, 12px) !important;
	background: var(--mf-card-bg, #fff) !important;
	box-shadow: none !important;
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
	color: var(--mf-navy) !important;
	font: inherit;
	font-size: 0.95rem !important;
	font-weight: 600 !important;
}

.mf-fav-btn--label .mf-fav-btn__icon {
	width: 20px;
	height: 20px;
	flex: 0 0 auto;
}

.mf-fav-btn--label:hover {
	transform: none;
	border-color: var(--mf-fav-red) !important;
	background: #fff5f6 !important;
	box-shadow: none !important;
}

.mf-fav-btn__text-on {
	display: none;
}

.mf-fav-btn--label.is-active .mf-fav-btn__text-add {
	display: none;
}

.mf-fav-btn--label.is-active .mf-fav-btn__text-on {
	display: inline;
}

.mf-fav-btn--label.is-active {
	border-color: var(--mf-fav-red) !important;
	background: #fff5f6 !important;
	color: var(--mf-fav-red-deep) !important;
}

/* Stroke pinned to the feature red, NOT currentColor, so an ancestor's colour can't bleed in. */
.mf-fav-btn__icon svg {
	width: 100%;
	height: 100%;
	fill: none !important;
	stroke: var(--mf-fav-red) !important;
	stroke-width: 2;
	stroke-linejoin: round;
}

.mf-fav-btn:hover {
	transform: scale(1.08);
	background: #fff !important;
	color: var(--mf-fav-red) !important;
	box-shadow: 0 4px 14px rgba(10, 43, 84, 0.24) !important;
}

.mf-fav-btn:hover .mf-fav-btn__icon svg {
	stroke: var(--mf-fav-red) !important;
}

/* Active (favorited) — filled red heart. */
.mf-fav-btn.is-active {
	color: var(--mf-fav-red) !important;
	background: #fff !important;
}

.mf-fav-btn.is-active .mf-fav-btn__icon svg {
	fill: var(--mf-fav-red) !important;
	stroke: var(--mf-fav-red) !important;
}

.mf-fav-btn.is-active:hover {
	color: var(--mf-fav-red-deep) !important;
}

.mf-fav-btn.is-active:hover .mf-fav-btn__icon svg {
	fill: var(--mf-fav-red-deep) !important;
	stroke: var(--mf-fav-red-deep) !important;
}

/* A little pop when it becomes active. */
.mf-fav-btn.is-bump .mf-fav-btn__icon {
	animation: mf-fav-bump 0.32s ease;
}

@keyframes mf-fav-bump {
	0%   { transform: scale(1); }
	35%  { transform: scale(1.35); }
	70%  { transform: scale(0.9); }
	100% { transform: scale(1); }
}

.mf-fav-btn:focus-visible {
	outline: 2px solid var(--mf-fav-red);
	outline-offset: 2px;
}

/* ARCHIVE FAVORITES BTN */

.mf-fav-open,
.mf-fav-open:hover,
.mf-fav-open:focus,
.mf-fav-open:active {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	position: relative;
	flex: 0 0 auto;
	width: 54px;
	height: 54px;
	border-radius: 14px;
	border: 1px solid var(--mf-line) !important;
	background: var(--mf-card-bg) !important;
	color: var(--mf-fav-red) !important;
	box-shadow: var(--mf-shadow);
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.mf-fav-open:hover {
	border-color: var(--mf-fav-red) !important;
	background: #fff5f6 !important;
	transform: translateY(-1px);
}

.mf-fav-open__icon {
	display: inline-flex;
	width: 22px;
	height: 22px;
}

.mf-fav-open__icon svg {
	width: 100%;
	height: 100%;
	fill: currentColor;
}

/* Count badge — shows how many favorites the visitor has. Hidden at zero. */
.mf-fav-open__count {
	position: absolute;
	top: -6px;
	right: -6px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 10px;
	background: var(--mf-fav-red);
	color: #fff;
	font-size: 0.72rem;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
	box-shadow: 0 2px 6px rgba(199, 63, 87, 0.4);
}

.mf-fav-open__count[hidden] {
	display: none;
}

/* POPUP / MODAL */

.mf-fav-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 40px 16px;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
	overflow-y: auto;
}

.mf-fav-modal.is-open {
	opacity: 1;
	visibility: visible;
}

.mf-fav-modal__backdrop {
	position: fixed;
	inset: 0;
	background: rgba(10, 43, 84, 0.42);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
}

.mf-fav-modal__dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 1320px;
	margin: auto;
	background: var(--mf-bg, #fff);
	border-radius: 18px;
	box-shadow: var(--mf-shadow-float);
	padding: 26px 26px 30px;
	transform: translateY(12px);
	transition: transform 0.24s ease;
}

.mf-fav-modal.is-open .mf-fav-modal__dialog {
	transform: translateY(0);
}

.mf-fav-modal__head {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 20px;
}

.mf-fav-modal__title {
	margin: 0;
	font-size: 1.35rem;
	font-weight: 700;
	color: var(--mf-navy);
	display: flex;
	align-items: center;
	gap: 10px;
}

.mf-fav-modal__title-icon {
	display: inline-flex;
	width: 22px;
	height: 22px;
	color: var(--mf-fav-red);
}

.mf-fav-modal__title-icon svg { width: 100%; height: 100%; fill: currentColor; }

.mf-fav-modal__close {
	margin-left: auto;
	appearance: none;
	-webkit-appearance: none;
	border: 0;
	background: var(--mf-light-blue, #eef3fb);
	color: var(--mf-navy);
	width: 38px;
	height: 38px;
	border-radius: 50%;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.15s ease;
}

.mf-fav-modal__close:hover {
	background: var(--mf-mid-blue, #dde7f5);
}

.mf-fav-modal__section-title {
	margin: 18px 0 12px;
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--mf-navy);
}

.mf-fav-modal__section:first-child .mf-fav-modal__section-title {
	margin-top: 0;
}

/* tabs (events / coaches) */

/* The dialog is --mf-bg, near-identical to --mf-light-blue: the track needs its own fill + hairline to read. */
.mf-fav-tabs {
	display: flex;
	gap: 4px;
	margin-bottom: 20px;
	padding: 4px;
	background: #dfe9f6;
	box-shadow: inset 0 0 0 1px var(--mf-mid-blue, #aec6e6);
	border-radius: 999px;
}

/* Theme paints bare <button>s red (and a tap latches :focus/:active on mobile).
   This block pins the UNSELECTED state transparent; .is-active repaints at higher specificity. */
.mf-fav-tab,
.mf-fav-tab:hover,
.mf-fav-tab:focus,
.mf-fav-tab:focus-visible,
.mf-fav-tab:active {
	appearance: none !important;
	-webkit-appearance: none !important;
	box-sizing: border-box !important;
	flex: 1 1 0 !important;
	border: 0 !important;
	border-radius: 999px !important;
	background: transparent !important;
	background-color: transparent !important;
	background-image: none !important;
	box-shadow: none !important;
	padding: 11px 14px !important;
	margin: 0 !important;
	font-size: 0.95rem !important;
	font-weight: 600 !important;
	line-height: 1.3 !important;
	color: var(--mf-gray, #414a5c) !important;
	text-decoration: none !important;
	text-transform: none !important;
	cursor: pointer;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

/* :not(.is-active), so hover can never wash out the selected fill. */
.mf-fav-tab:not(.is-active):hover {
	background: rgba(255, 255, 255, 0.6) !important;
	color: var(--mf-navy) !important;
}

/* The red line is an inset box-shadow, not a border: the base pins border:0
   !important, and a border would change the box height. Insets first. */
.mf-fav-tab.is-active,
.mf-fav-tab.is-active:hover,
.mf-fav-tab.is-active:focus,
.mf-fav-tab.is-active:active {
	background: var(--mf-white, #fff) !important;
	background-color: var(--mf-white, #fff) !important;
	color: var(--mf-dark-blue, #0a2b54) !important;
	font-weight: 700 !important;
	box-shadow:
		inset 0 -2px 0 0 var(--mf-fav-red),
		0 1px 3px rgba(10, 43, 84, 0.14),
		0 2px 10px rgba(10, 43, 84, 0.08) !important;
}

.mf-fav-tab:focus-visible {
	outline: 2px solid var(--mf-fav-red) !important;
	outline-offset: 2px;
}

/* Pinned: theme rules on the button's descendants would recolour it. */
.mf-fav-tab__count {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	min-width: 21px;
	height: 21px;
	padding: 0 6px !important;
	border: 0 !important;
	border-radius: 999px !important;
	background: rgba(255, 255, 255, 0.75) !important;
	color: var(--mf-gray, #414a5c) !important;
	font-size: 0.78rem !important;
	font-weight: 700 !important;
	line-height: 1 !important;
}

.mf-fav-tab.is-active .mf-fav-tab__count {
	background: var(--mf-fav-red) !important;
	color: #fff !important;
}

.mf-fav-modal__tab-empty {
	text-align: center;
	color: var(--mf-muted);
	padding: 36px 10px 30px;
}

.mf-fav-modal__empty {
	text-align: center;
	color: var(--mf-muted);
	padding: 40px 10px 30px;
}

.mf-fav-modal__empty-icon {
	display: inline-flex;
	width: 48px;
	height: 48px;
	color: var(--mf-mid-blue, #cdd9ea);
	margin-bottom: 12px;
}

.mf-fav-modal__empty-icon svg { width: 100%; height: 100%; fill: currentColor; }

.mf-fav-modal__loading {
	text-align: center;
	color: var(--mf-muted);
	padding: 40px 0;
}

/* Fixed 3 tracks, not auto-fill: at 1320px auto-fill gives five cramped columns. */
.mf-fav-modal .mf-event-grid {
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 18px;
}

@media (max-width: 860px) {
	.mf-fav-modal .mf-event-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.mf-fav-modal .mf-event-card.is-removing,
.mf-fav-modal .mf-coach-card.is-removing {
	opacity: 0;
	transform: scale(0.96);
	transition: opacity 0.25s ease, transform 0.25s ease;
	pointer-events: none;
}

@media (max-width: 600px) {
	.mf-fav-modal { padding: 0; }
	.mf-fav-modal__dialog {
		max-width: none;
		min-height: 100%;
		border-radius: 0;
		padding: 20px 16px 28px;
	}
	.mf-fav-modal .mf-event-grid {
		grid-template-columns: 1fr;
	}
	/* Bigger, bolder close (X) on mobile so it's an easy tap target. */
	.mf-fav-modal__close {
		width: 48px !important;
		height: 48px !important;
		font-size: 34px !important;
		font-weight: 700 !important;
	}
	.mf-fav-tabs {
		gap: 3px;
		padding: 3px;
	}
	.mf-fav-tab,
	.mf-fav-tab:hover,
	.mf-fav-tab:focus,
	.mf-fav-tab:active {
		padding: 11px 10px !important;
		gap: 6px;
	}
}
