/* ─────────────────────────────────────────────
 * FPS Product Browser – Frontend Styles
 * ───────────────────────────────────────────── */

.fps-product-browser {
	color: inherit;
}

/* ── Toolbar ── */
.fps-pb-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin-bottom: 16px;
}

.fps-pb-toolbar__search {
	flex: 1 1 220px;
	min-width: 160px;
	padding: 8px 12px;
	border: 1px solid #444;
	border-radius: 6px;
	background: #2c2c2c;
	color: inherit;
}

.fps-pb-toolbar__sort {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 0.9em;
}

.fps-pb-toolbar__sort select {
	padding: 6px 8px;
	border: 1px solid #444;
	border-radius: 6px;
	background: #2c2c2c;
	color: inherit;
}

.fps-pb-toolbar__count {
	margin-left: auto;
	font-size: 0.9em;
	opacity: 0.8;
	white-space: nowrap;
}

/* ── Layout ── */
.fps-pb-layout {
	display: grid;
	grid-template-columns: 240px 1fr;
	gap: 24px;
	align-items: start;
}

@media (max-width: 782px) {
	.fps-pb-layout {
		grid-template-columns: 1fr;
	}
}

/* ── Filters sidebar ── */
.fps-pb-filters {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.fps-pb-facet {
	border: 1px solid #444;
	border-radius: 6px;
	background: #2c2c2c;
	padding: 0;
}

.fps-pb-facet__label {
	cursor: pointer;
	padding: 10px 12px;
	font-weight: 600;
	font-size: 0.9em;
	list-style: none;
}

.fps-pb-facet__label::-webkit-details-marker {
	display: none;
}

.fps-pb-facet__label::after {
	content: "▾";
	float: right;
	opacity: 0.6;
	transition: transform 0.15s ease;
}

.fps-pb-facet:not([open]) .fps-pb-facet__label::after {
	transform: rotate(-90deg);
}

.fps-pb-facet__options {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 0 12px 10px;
	max-height: 260px;
	overflow-y: auto;
}

.fps-pb-facet__option {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 0.88em;
	padding: 3px 0;
	cursor: pointer;
}

.fps-pb-facet__option.is-dimmed {
	opacity: 0.45;
}

.fps-pb-facet__value {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.fps-pb-facet__count {
	font-size: 0.85em;
	opacity: 0.65;
}

/* ── Price filter ── */
.fps-pb-price {
	border: 1px solid #444;
	border-radius: 6px;
	background: #2c2c2c;
	padding: 10px 12px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.fps-pb-price__label {
	font-weight: 600;
	font-size: 0.9em;
}

.fps-pb-price__inputs {
	display: flex;
	align-items: center;
	gap: 6px;
}

.fps-pb-price__inputs input {
	width: 100%;
	min-width: 0;
	padding: 5px 8px;
	border: 1px solid #444;
	border-radius: 4px;
	background: #222;
	color: inherit;
}

.fps-pb-price__sliders {
	position: relative;
	height: 20px;
}

.fps-pb-price__sliders input[type="range"] {
	position: absolute;
	inset: 0;
	width: 100%;
	margin: 0;
	background: transparent;
	pointer-events: none;
	-webkit-appearance: none;
	appearance: none;
}

.fps-pb-price__sliders input[type="range"]::-webkit-slider-runnable-track {
	height: 4px;
	background: #444;
	border-radius: 2px;
}

.fps-pb-price__sliders input[type="range"]::-moz-range-track {
	height: 4px;
	background: #444;
	border-radius: 2px;
}

.fps-pb-price__sliders input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	pointer-events: auto;
	width: 16px;
	height: 16px;
	margin-top: -6px;
	border-radius: 50%;
	background: #007cba;
	border: none;
	cursor: pointer;
}

.fps-pb-price__sliders input[type="range"]::-moz-range-thumb {
	pointer-events: auto;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #007cba;
	border: none;
	cursor: pointer;
}

/* ── Active filter chips ── */
.fps-pb-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 12px;
}

.fps-pb-chips:empty {
	display: none;
}

.fps-pb-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 10px;
	border-radius: 999px;
	background: #007cba;
	color: #fff;
	font-size: 0.82em;
	border: none;
	cursor: pointer;
}

.fps-pb-chip--clear {
	background: transparent;
	border: 1px solid #666;
	color: inherit;
}

/* ── Results grid & cards ── */
.fps-pb-grid {
	display: grid;
	gap: 20px;
	grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1024px) {
	.fps-pb-grid {
		grid-template-columns: repeat(2, 1fr) !important;
	}
}

@media (max-width: 600px) {
	.fps-pb-grid {
		grid-template-columns: 1fr !important;
	}
}

.fps-pb-grid.is-loading {
	opacity: 0.5;
	pointer-events: none;
	transition: opacity 0.15s ease;
}

.fps-pb-card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: #2c2c2c;
	border-radius: 6px;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fps-pb-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.fps-pb-card__compare {
	position: absolute;
	top: 8px;
	left: 8px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 3px 8px;
	border-radius: 4px;
	background: rgba(0, 0, 0, 0.65);
	color: #fff;
	font-size: 0.78em;
	cursor: pointer;
}

.fps-pb-card__media {
	position: relative;
	display: block;
	width: 100%;
	padding-top: 66.67%; /* 3:2 aspect ratio */
	overflow: hidden;
	background: #333;
}

.fps-pb-card__media img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.fps-pb-card:hover .fps-pb-card__media img {
	transform: scale(1.05);
}

.fps-pb-card__media-placeholder {
	position: absolute;
	inset: 0;
	background: repeating-linear-gradient(45deg, #333, #333 12px, #3a3a3a 12px, #3a3a3a 24px);
}

.fps-pb-card__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 12px 14px 14px;
}

.fps-pb-card__title {
	margin: 0;
	font-size: 1em;
	line-height: 1.3;
}

.fps-pb-card__title a {
	color: inherit;
	text-decoration: none;
}

.fps-pb-card__title a:hover {
	color: #007cba;
}

.fps-pb-card__specs {
	margin: 0;
	font-size: 0.82em;
	opacity: 0.75;
}

.fps-pb-empty {
	grid-column: 1 / -1;
	padding: 32px 0;
	text-align: center;
	opacity: 0.75;
}

/* ── Pagination ── */
.fps-pb-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 14px;
	margin-top: 20px;
	font-size: 0.9em;
}

.fps-pb-pagination:empty {
	display: none;
}

.fps-pb-pagination__link {
	padding: 6px 12px;
	border: 1px solid #444;
	border-radius: 6px;
	text-decoration: none;
	color: inherit;
	background: #2c2c2c;
}

.fps-pb-pagination__link:hover {
	border-color: #007cba;
}

.fps-pb-pagination__status {
	opacity: 0.8;
}

/* ── Compare tray ── */
.fps-pb-tray {
	position: sticky;
	bottom: 12px;
	z-index: 40;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-top: 20px;
	padding: 10px 14px;
	border: 1px solid #444;
	border-radius: 8px;
	background: #222;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.fps-pb-tray[hidden] {
	display: none;
}

.fps-pb-tray__items {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	flex: 1;
}

.fps-pb-tray__item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 10px;
	border-radius: 999px;
	background: #333;
	font-size: 0.82em;
	border: 1px solid #555;
	color: inherit;
	cursor: pointer;
}

.fps-pb-tray__hint {
	font-size: 0.8em;
	opacity: 0.7;
	flex-basis: 100%;
}

.fps-pb-tray__actions {
	display: flex;
	gap: 8px;
}

.fps-pb-tray__compare {
	padding: 8px 16px;
	border: none;
	border-radius: 6px;
	background: #007cba;
	color: #fff;
	font-weight: 600;
	cursor: pointer;
}

.fps-pb-tray__compare:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.fps-pb-tray__clear {
	padding: 8px 12px;
	border: 1px solid #555;
	border-radius: 6px;
	background: transparent;
	color: inherit;
	cursor: pointer;
}

/* ── Compare modal ── */
.fps-pb-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.fps-pb-modal[hidden] {
	display: none;
}

.fps-pb-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.7);
}

.fps-pb-modal__dialog {
	position: relative;
	max-width: min(1100px, 96vw);
	max-height: 88vh;
	width: 100%;
	display: flex;
	flex-direction: column;
	background: #262626;
	border-radius: 8px;
	box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}

.fps-pb-modal__close {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 2;
	width: 32px;
	height: 32px;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.1);
	color: inherit;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.fps-pb-modal__close:hover {
	background: rgba(255, 255, 255, 0.2);
}

.fps-pb-modal__body {
	overflow: auto;
	padding: 40px 20px 20px;
}

.fps-pb-modal__body table {
	min-width: 640px;
}

.fps-pb-modal__loading {
	padding: 48px;
	text-align: center;
	opacity: 0.75;
}

/* ── Best-price button + Content Egg modal ──
 * Mirrors .bestprice / .fps-bestprice-* from system-builder.css (also
 * duplicated in system-build.css) so browse pages don't need the builder
 * stylesheet. Keep the three copies in sync. */

.bestprice {
	display: inline-flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 1px;
	min-width: 132px;
	padding: 8px 12px;
	border-radius: 8px;
	border: 1px solid rgba(0, 124, 186, 0.34);
	background: linear-gradient(180deg, rgba(8, 43, 64, 0.95), rgba(22, 33, 44, 0.95));
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
	color: #f7fbff;
	font-variant-numeric: tabular-nums;
	text-align: left;
	text-decoration: none;
}

button.bestprice {
	cursor: pointer;
	font: inherit;
	appearance: none;
}

.bestprice.is-loading {
	opacity: 0.6;
	cursor: progress;
}

.bestprice:hover,
.fps-bestprice-wrap .bestprice:hover {
	border-color: rgba(89, 168, 216, 0.75);
	color: #fff;
	transform: translateY(-1px);
	transition: border-color 0.12s ease, transform 0.12s ease;
}

.fps-bestprice-wrap {
	display: inline-flex;
	align-items: stretch;
	position: relative;
	max-width: 100%;
}

/* Containment: unlike the builder's 0x0 overflow-visible proxy, hide the
 * proxy outright. The Content Egg popup markup inside it (modal + shop-info
 * offcanvases with merchant images) would otherwise render raw whenever the
 * CE bootstrap CSS isn't loaded yet, spilling full-width images across the
 * page. The proxy bootstrap moves the modal/offcanvas nodes to <body> before
 * opening them, so nothing that needs to display ever stays inside. */
.fps-bestprice__proxy {
	display: none;
}

/* Relocated shop-info offcanvases: keep them hidden until Bootstrap actually
 * opens them (.showing/.show), even if the CE stylesheet failed to load. */
.offcanvas[data-fps-bestprice-mounted]:not(.show):not(.showing),
.fps-bestprice-floating-ui[data-fps-bestprice-mounted] .offcanvas:not(.show):not(.showing) {
	display: none;
}

.fps-bestprice-floating-ui .modal-content {
	background: #313a47 !important;
	border-color: rgba(255, 255, 255, 0.1) !important;
	box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55) !important;
}

.fps-bestprice-floating-ui .modal-dialog {
	min-height: calc(100% - 1rem);
	display: flex;
	align-items: center;
	margin: 0.5rem auto;
	max-width: min(560px, calc(100vw - 2rem));
}

.fps-bestprice-floating-ui .modal-header,
.fps-bestprice-floating-ui .modal-footer {
	border-color: rgba(255, 255, 255, 0.08) !important;
}

.fps-bestprice-floating-ui .btn-close {
	filter: invert(1) grayscale(1) brightness(200%);
	opacity: 0.92;
}

.fps-bestprice-floating-ui .btn-close:hover,
.fps-bestprice-floating-ui .btn-close:focus {
	opacity: 1;
}

@media (min-width: 768px) {
	.fps-bestprice-floating-ui .modal-dialog {
		min-height: calc(100% - 3.5rem);
		margin: 1.75rem auto;
	}
}

.bestprice--sm {
	min-width: 118px;
	padding: 7px 10px;
}

.bestprice__k {
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #9fc7df;
}

.bestprice__amt {
	font-size: 20px;
	font-weight: 800;
	line-height: 1.05;
	color: #fff;
}

.bestprice__sub {
	font-size: 11px;
	color: #b7c7d2;
	line-height: 1.3;
}

/* Card placement: body grows so cards level out, and the button sits at the
 * bottom-left of the body at its natural width, inside the card padding. */
.fps-pb-card__body {
	flex: 1;
}

.fps-pb-card__body .fps-bestprice-wrap,
.fps-pb-card__body > .bestprice,
.fps-pb-card__body .fps-system-build__price-none {
	align-self: flex-start;
	margin-top: auto;
}

.fps-pb-card__body .fps-system-build__price-none {
	opacity: 0.5;
}
