/*
 * Product archive: sticky filter column, result counts, VIEW MORE button.
 * Loaded on product archives only, by novamira-sandbox/ri-shop-view-more.php.
 *
 * The filter column is matched as ".col-lg-3:has(> #spc-sidebar)" because the
 * three archive templates (woocommerce.php's two branches and the generic
 * category template) wrap it differently; #spc-sidebar is the one constant.
 */

/* ---------- Result total next to "Filter" ---------- */

.ri-result-total {
	font-weight: 400;
	color: var(--secondary);
	margin-left: 6px;
	white-space: nowrap;
}

/* ---------- Sticky filter column (desktop) ---------- */

@media only screen and (min-width: 992px) {
	/*
	 * #wrapper is overflow: hidden, which turns it into the scroll container
	 * position: sticky measures against, so nothing ever sticks. clip keeps the
	 * same visual clipping without that side effect; flow-root keeps the block
	 * formatting context hidden used to create.
	 */
	#wrapper:has(#spc-sidebar) {
		overflow: clip;
		display: flow-root;
	}

	.col-lg-3:has(> #spc-sidebar) {
		position: sticky;
		top: var(--ri-shop-sticky-top, 120px);
		align-self: flex-start;
		max-height: calc(100vh - var(--ri-shop-sticky-top, 120px) - 20px);
		overflow-y: auto;
		overscroll-behavior: contain;
		scrollbar-width: thin;
		scrollbar-color: #cccccc transparent;
	}

	/*
	 * The "Filter" bar is a mobile-only toggle; on desktop it becomes the top of
	 * the grey filter panel: "Filter" left, "(12 Results)" right, no caret, and
	 * no gap before the first filter group.
	 */
	.col-lg-3:has(> #spc-sidebar) > #accordion-main {
		display: block !important;
		/* Its click handler toggles the mobile panel; nothing to click on desktop. */
		pointer-events: none;
		margin-bottom: 0;
		padding: 20px 20px 10px;
		background-color: #F7F7F7;
	}

	.col-lg-3:has(> #spc-sidebar) > #accordion-main:after {
		display: none;
	}

	/*
	 * "Floor Options" and "(36 Results)" need ~258px; the column is narrower than
	 * that below ~1300px, so the count drops under the label there instead of
	 * the label breaking across two lines.
	 */
	.col-lg-3:has(> #spc-sidebar) > #accordion-main h6 {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		align-items: baseline;
		gap: 4px 10px;
		white-space: nowrap;
		font-size: 22px;
		font-weight: 700;
		line-height: 1.2;
		color: var(--dark);
	}

	.col-lg-3:has(> #spc-sidebar) > #accordion-main .ri-result-total {
		margin-left: 0;
		font-size: 16px;
	}
}

/*
 * Filter options: 20px checkboxes, 32px text indent, 16px text at every width.
 * Overrides the theme's per-breakpoint sizes (style.css + responsive.css):
 * 22px / 40px / 18px from 1600px and 15px / 25px / 13px on phones.
 */
#spc-sidebar .yith-wcan-list li a {
	padding-left: 32px;
	font-size: 16px;
}

#spc-sidebar .yith-wcan-list li a::before,
#spc-sidebar .yith-wcan-list li a::after {
	width: 20px !important;
	height: 20px !important;
}

/*
 * ri-impact-lvp-filter-labels.php sets the collection names to nowrap so they
 * sit on one line. They do from ~1200px up, but between 992 and ~1200px the
 * column is too narrow and the names ran past the panel (now into the sticky
 * column's own scroll area). normal still keeps one line wherever it fits.
 * The extra .widget out-ranks that rule, which prints later in <head>.
 */
#spc-sidebar .widget .yith-wcan-list li a {
	white-space: normal;
}

/* ---------- Count + VIEW MORE under the grid ---------- */

.ri-shop-toolbar {
	text-align: center;
	padding-top: 30px;
}

.ri-shop-toolbar .tool-bar-title {
	font-size: 14px;
	margin-bottom: 15px;
	min-width: 0;
}
/*
 * Numbered pagination stays in the markup as the no-JS fallback.
 * !important because YITH sets an inline display on it after each filter.
 */
.ri-shop-toolbar.ri-js .showing-container {
	display: none !important;
}

.ri-view-more {
	display: inline-block;
	min-width: 220px;
	padding: 16px 40px;
	border: 0;
	border-radius: 0;
	background-color: var(--primary);
	color: #ffffff;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.ri-view-more:hover,
.ri-view-more:focus-visible {
	background-color: #5a9a24;
}

.ri-view-more:focus-visible {
	outline: 2px solid var(--dark);
	outline-offset: 3px;
}

.ri-view-more[aria-busy="true"] {
	opacity: 0.7;
	cursor: progress;
}

.ri-view-more[hidden] {
	display: none;
}
