/**
 * Discover Favorites — New Arrivals / Best Sellers tabs, each backed by a
 * horizontal scroll-snap product slider (3 cards tall per column, scrolling
 * sideways) with prev/next nav and a progress bar.
 */

.zozia-discover-favorites {
	max-width: var(--wp--style--global--wide-size, 1200px);
	margin: 0 auto;
}

.zozia-discover-favorites__header {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--lg);
	flex-wrap: wrap;
	margin-bottom: var(--wp--preset--spacing--lg);
}

.zozia-discover-favorites__tabs {
	display: flex;
	align-items: center;
	gap: 28px;
}

.zozia-discover-favorites__tab {
	background: none;
	border: none;
	border-bottom: 2px solid transparent;
	padding: 0 0 8px;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 400;
	color: var(--wp--preset--color--muted);
	cursor: pointer;
}

.zozia-discover-favorites__tab.is-active {
	font-weight: 600;
	color: var(--wp--preset--color--ink);
	border-bottom-color: var(--wp--preset--color--ink);
}

.zozia-discover-favorites__panel {
	display: none;
}

.zozia-discover-favorites__panel.is-active {
	display: block;
}

/* Grid (not flex) so cards stack 3-tall per column while the row still
   scrolls horizontally like a carousel — grid-auto-flow: column fills
   each column top-to-bottom before starting the next one. The scroll
   container's width/scroll math (assets/js/discover-favorites.js) is
   unchanged by this: it only reads row.scrollWidth/clientWidth and card
   width, both still valid under grid. */
.zozia-discover-favorites__row {
	display: grid;
	grid-auto-flow: column;
	grid-template-rows: repeat(3, auto);
	grid-auto-columns: 220px;
	gap: 16px;
	margin: 0;
	padding: 4px 4px 8px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.zozia-discover-favorites__row::-webkit-scrollbar {
	display: none;
}

/* Sizing/scroll-snap only — the card's look (image, badge, wishlist
   heart, title, price) is the canonical `.zozia-product-card` design in
   assets/css/product-card.css, dual-classed onto this element via
   zozia_render_product_card()'s `extra_class` arg. */
.zozia-discover-favorites__card {
	width: 220px;
	scroll-snap-align: start;
}

.zozia-discover-favorites__empty {
	margin: 0;
	padding: 40px 0;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--medium);
	color: var(--wp--preset--color--muted);
}

.zozia-discover-favorites__footer {
	display: flex;
	align-items: center;
	gap: 20px;
	margin-top: 20px;
}

.zozia-discover-favorites__slider-controls {
	display: flex;
	align-items: center;
	gap: 20px;
	flex: 1;
}

/* No scrollbar/arrows needed once every card already fits on screen. Only
   the slider chrome hides — the View All link (a sibling in the footer)
   stays visible either way. */
.zozia-discover-favorites__slider-controls.is-hidden {
	display: none;
}

.zozia-discover-favorites__view-all {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	height: 40px;
	padding: 0 22px;
	border-radius: 999px;
	border: 1.5px solid var(--wp--preset--color--ink);
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 600;
	color: var(--wp--preset--color--ink);
	text-decoration: none;
	white-space: nowrap;
}

.zozia-discover-favorites__view-all:hover {
	background-color: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--white);
}

.zozia-discover-favorites__progress-track {
	position: relative;
	flex: 1;
	height: 20px;
	cursor: pointer;
	touch-action: none;
	-webkit-user-select: none;
	user-select: none;
}

.zozia-discover-favorites__progress-track::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 0;
	right: 0;
	height: 2px;
	transform: translateY(-50%);
	background-color: var(--wp--preset--color--border-light);
}

.zozia-discover-favorites__progress-fill {
	position: absolute;
	top: 50%;
	left: 0;
	width: 25%;
	height: 4px;
	border-radius: 999px;
	background-color: var(--wp--preset--color--ink);
	transform: translateY(-50%);
	transition: left 0.2s ease;
	cursor: grab;
}

.zozia-discover-favorites__progress-track.is-dragging {
	cursor: grabbing;
}

.zozia-discover-favorites__progress-track.is-dragging .zozia-discover-favorites__progress-fill {
	cursor: grabbing;
	transition: none;
}

.zozia-discover-favorites__nav {
	display: flex;
	gap: 10px;
	flex-shrink: 0;
}

.zozia-discover-favorites__nav-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 999px;
	border: 1px solid var(--wp--preset--color--border-light);
	background-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--muted);
	cursor: pointer;
	padding: 0;
}

.zozia-discover-favorites__nav-btn svg {
	width: 16px;
	height: 16px;
	display: block;
}

.zozia-discover-favorites__nav-btn--next {
	border-color: var(--wp--preset--color--ink);
	border-width: 1.5px;
	color: var(--wp--preset--color--ink);
}

.zozia-discover-favorites__nav-btn:hover {
	background-color: var(--wp--preset--color--surface);
}

.zozia-discover-favorites__nav-btn:disabled {
	opacity: 0.35;
	cursor: default;
	pointer-events: none;
}

/* Tablet: 3 cards per view. grid-auto-columns already sizes each column to
   one-third of the row, so the card just needs to fill its column — giving
   it that same calc() again would take a third of a third, leaving most of
   the column blank. */
@media (max-width: 1024px) {
	.zozia-discover-favorites__row {
		grid-auto-columns: calc((100% - 2 * 16px) / 3);
	}

	.zozia-discover-favorites__card {
		width: 100%;
	}
}

/* Mobile: 2 cards per view; tabs and heading stack. Same reasoning as the
   tablet breakpoint above — the card fills its already-correctly-sized
   column instead of re-halving it. */
@media (max-width: 599px) {
	.zozia-discover-favorites__header {
		align-items: flex-start;
	}

	.zozia-discover-favorites__row {
		grid-auto-columns: calc((100% - 16px) / 2);
	}

	.zozia-discover-favorites__card {
		width: 100%;
	}

	.zozia-discover-favorites__footer {
		flex-wrap: wrap;
	}

	.zozia-discover-favorites__view-all {
		order: 1;
		width: auto;
	}

	.zozia-discover-favorites__slider-controls {
		order: 2;
	}
}
