/**
 * Africa Gaming Builder — front-end styles.
 * Premium gaming theme: red (#dc2626) accent on a white background.
 *
 * v3 — Layout rewrite
 * All original class names are preserved so existing markup/JS keeps working.
 * The only structural addition is one new, purely additive wrapper class,
 * `.apcb-content`, which now holds the toolbar/carousel/pagination that used
 * to live directly under `.apcb-main`. See the notes above `.apcb-main`
 * below for why this replaces the old CSS Grid sidebar hack.
 */

.apcb-builder {
	--apcb-primary: #dc2626;
	--apcb-primary-dark: #b91c1c;
	--apcb-primary-light: #ef4444;
	--apcb-bg: #ffffff;
	--apcb-surface: #f8f9fb;
	--apcb-surface-alt: #f3f4f6;
	--apcb-border: #e5e7eb;
	--apcb-text: #111827;
	--apcb-text-muted: #6b7280;
	--apcb-success: #16a34a;
	--apcb-success-light: #22c55e;
	--apcb-warning: #d97706;
	--apcb-danger: #dc2626;
	--apcb-radius: 14px;
	--apcb-radius-sm: 10px;
	--apcb-shadow: 0 2px 10px rgba(17, 24, 39, 0.06);
	--apcb-shadow-hover: 0 10px 30px rgba(220, 38, 38, 0.12);
	--apcb-shadow-lg: 0 20px 45px rgba(17, 24, 39, 0.12);
	--apcb-glow: 0 0 0 2px rgba(220, 38, 38, 0.16), 0 0 22px rgba(220, 38, 38, 0.28);
	--apcb-ease: cubic-bezier(0.22, 1, 0.36, 1);
	--apcb-sidebar-w: 232px;

	box-sizing: border-box;
	background: var(--apcb-bg);
	color: var(--apcb-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
	max-width: 1400px;
	margin: 0 auto;
	position: relative;
	contain: layout paint;
}

.apcb-builder *,
.apcb-builder *::before,
.apcb-builder *::after {
	box-sizing: border-box;
}

@media (prefers-reduced-motion: reduce) {
	.apcb-builder *,
	.apcb-builder *::before,
	.apcb-builder *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* ---------- Loading ---------- */
.apcb-loading {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 40px 0;
	color: var(--apcb-text-muted);
	font-size: 14px;
}

.apcb-spinner {
	width: 18px;
	height: 18px;
	border: 3px solid var(--apcb-border);
	border-top-color: var(--apcb-primary);
	border-radius: 50%;
	animation: apcb-spin 0.8s linear infinite;
}

@keyframes apcb-spin {
	to {
		transform: rotate(360deg);
	}
}

/* ==========================================================================
   LAYOUT
   `.apcb-app` = main column + summary column (unchanged: still a simple
   two-column grid, that part was never the problem).

   `.apcb-main` = category sidebar + `.apcb-content` (toolbar, carousel,
   pagination). These two are now plain FLEX SIBLINGS, not a CSS Grid with
   one child spanning rows the others implicitly populate.

   WHY THE OLD LAYOUT CREATED EMPTY ROWS
   The previous version made `.apcb-main` a grid with
   `grid-template-columns: max-content 1fr; grid-auto-rows: min-content`,
   pinned `.apcb-categories` to `grid-column: 1 / grid-row: 1 / -1`, and
   pushed every *other* child to column 2 via a blanket `.apcb-main > *`
   rule. That only produces a correct result if the grid's implicit
   row-track count and content stay perfectly in sync with the sidebar's
   row span — but the toolbar/grid/pagination are DOM children built and
   re-rendered independently by JS (`.apcb-grid` gets its innerHTML replaced
   on every AJAX category/page/search change). Any mismatch between the
   number of auto-generated row tracks and what the sidebar was spanning
   left column 2 without a track to sit in for that row, while column 1
   (the sidebar) kept reserving the space — which reads as a blank white
   band before the toolbar and another before the carousel. It was a timing
   / track-count coupling bug baked into the architecture, not something a
   spacing tweak could fix.

   WHY THE NEW LAYOUT CANNOT DO THAT
   There is no shared track system left to desync. `.apcb-categories` and
   `.apcb-content` are two independent flex items placed left-to-right (or
   stacked top-to-bottom on small screens) by the flexbox algorithm, which
   only ever looks at the actual rendered size of each item — never a
   pre-committed grid of rows. Re-rendering the contents of `.apcb-content`
   (grid swap, pagination swap) cannot leave a gap next to the sidebar
   because the sidebar was never sharing a row with it in the first place.
   ========================================================================== */

.apcb-app {
	display: grid;
	grid-template-columns: 1fr 340px;
	gap: 24px;
	align-items: start;
}

@media (max-width: 960px) {
	.apcb-app {
		grid-template-columns: 1fr;
	}
}

.apcb-main {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.apcb-content {
	display: flex;
	flex-direction: column;
	gap: 16px;
	min-width: 0;
}

@media (min-width: 960px) {
	.apcb-main {
		flex-direction: row;
		align-items: flex-start;
		gap: 28px;
	}

	.apcb-categories {
		flex: 0 0 var(--apcb-sidebar-w);
	}

	.apcb-content {
		flex: 1 1 auto;
	}
}

/* ==========================================================================
   1. BUILD PROGRESS TRACKER
   New block. Purely additive — safe to omit from markup if unused.
   Expected markup:
   <div class="apcb-progress">
     <div class="apcb-progress-track"><div class="apcb-progress-fill" style="width:40%"></div></div>
     <ul class="apcb-progress-list">
       <li class="apcb-progress-step is-complete" data-cat="cpu"><span class="apcb-progress-dot">✓</span>CPU</li>
       <li class="apcb-progress-step" data-cat="gpu"><span class="apcb-progress-dot">2</span>GPU</li>
       ...
     </ul>
   </div>
   ========================================================================== */
.apcb-progress {
	margin-bottom: 20px;
	padding: 14px 16px;
	background: var(--apcb-surface);
	border: 1px solid var(--apcb-border);
	border-radius: var(--apcb-radius);
}

.apcb-progress-track {
	position: relative;
	height: 4px;
	background: var(--apcb-border);
	border-radius: 999px;
	margin-bottom: 14px;
	overflow: hidden;
}

.apcb-progress-fill {
	position: absolute;
	inset: 0 auto 0 0;
	height: 100%;
	background: linear-gradient(90deg, var(--apcb-primary-light), var(--apcb-primary));
	border-radius: 999px;
	transition: width 0.4s var(--apcb-ease);
}

.apcb-progress-list {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 8px 18px;
	margin: 0;
	padding: 0;
}

.apcb-progress-step {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--apcb-text-muted);
	white-space: nowrap;
}

.apcb-progress-dot {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	border: 1.5px solid var(--apcb-border);
	color: var(--apcb-text-muted);
	font-size: 10px;
	font-weight: 800;
	transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.apcb-progress-step.is-complete {
	color: var(--apcb-text);
}

.apcb-progress-step.is-complete .apcb-progress-dot {
	background: var(--apcb-success);
	border-color: var(--apcb-success);
	color: #fff;
	transform: scale(1.05);
}

.apcb-progress-step.is-required:not(.is-complete) .apcb-progress-dot {
	border-color: var(--apcb-primary);
	color: var(--apcb-primary);
}

.apcb-progress-step.is-active .apcb-progress-dot {
	box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.14);
}

/* ---------- Category nav ----------
   Mobile/tablet default: horizontal pill row, scrollable if it overflows.
   Desktop (>=960px, see media query further below): becomes the sticky
   vertical sidebar. Same element, same class, no markup change either way.
   ---------------------------------- */
.apcb-categories {
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	gap: 8px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: var(--apcb-border) transparent;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--apcb-border);
}

.apcb-category-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex: 0 0 auto;
	padding: 10px 16px;
	border-radius: 999px;
	border: 1px solid var(--apcb-border);
	background: var(--apcb-surface);
	color: var(--apcb-text);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}

.apcb-category-btn:hover {
	transform: translateY(-1px);
	border-color: var(--apcb-primary);
}

/* Icon always on the left of the label, whichever indicator is present
   (check ✓, required dot, or status dot) — flex `order` only, no markup
   change needed since these spans already exist after the label. */
.apcb-category-btn .apcb-check,
.apcb-category-btn .apcb-required-dot,
.apcb-category-btn .apcb-status-dot {
	order: -1;
}

.apcb-category-btn.is-active {
	background: linear-gradient(135deg, var(--apcb-primary-light), var(--apcb-primary-dark));
	border-color: transparent;
	color: #fff;
	box-shadow: 0 6px 16px rgba(220, 38, 38, 0.28);
}

.apcb-category-btn .apcb-check {
	display: inline-flex;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--apcb-success);
	color: #fff;
	font-size: 10px;
	align-items: center;
	justify-content: center;
	line-height: 1;
	flex-shrink: 0;
}

/* Incomplete-but-required category shows a red dot instead of a green check */
.apcb-category-btn .apcb-status-dot {
	display: inline-flex;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--apcb-danger);
	flex-shrink: 0;
}

.apcb-category-btn.is-active .apcb-status-dot {
	background: #fff;
}

.apcb-category-btn .apcb-required-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--apcb-primary);
	display: inline-block;
}

.apcb-category-btn.is-active .apcb-required-dot {
	background: #fff;
}

/* ==========================================================================
   Desktop: category nav becomes the sticky vertical sidebar.
   Just a display/direction switch on the flex item — `.apcb-main` already
   arranged `.apcb-categories` and `.apcb-content` side by side above
   (min-width: 960px), so this only restyles the sidebar's own contents.
   ========================================================================== */
@media (min-width: 960px) {
	.apcb-categories {
		flex-direction: column;
		flex-wrap: nowrap;
		gap: 4px;
		overflow-x: visible;
		overflow-y: auto;
		padding: 4px 10px 4px 0;
		border-bottom: none;
		border-right: 1px solid var(--apcb-border);
		position: sticky;
		top: 16px;
		align-self: flex-start;
		max-height: calc(100vh - 32px);
	}

	.apcb-category-btn {
		width: 100%;
		justify-content: flex-start;
		border-radius: 9px;
		background: transparent;
		border-color: transparent;
		padding: 11px 14px 11px 16px;
	}

	/* Slide-bar indicator: a thin accent bar on the left edge instead of a
	   full pill background, like a premium sidebar nav / tab rail. */
	.apcb-category-btn::before {
		content: "";
		position: absolute;
		left: 0;
		top: 8px;
		bottom: 8px;
		width: 3px;
		border-radius: 3px;
		background: transparent;
		transition: background 0.18s ease;
	}

	.apcb-category-btn:hover {
		background: var(--apcb-surface);
		border-color: transparent;
		transform: none;
	}

	.apcb-category-btn.is-active {
		background: rgba(220, 38, 38, 0.08);
		border-color: transparent;
		color: var(--apcb-primary-dark);
		box-shadow: none;
	}

	.apcb-category-btn.is-active::before {
		background: var(--apcb-primary);
	}

	.apcb-category-btn.is-active .apcb-required-dot {
		background: var(--apcb-primary);
	}
}

/* ---------- Toolbar: tabs + search ---------- */
.apcb-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: center;
	justify-content: space-between;
}

/* ---------- Tabs (AMD/Intel, DDR4/DDR5, Socket) ---------- */
.apcb-tabs {
	display: inline-flex;
	background: var(--apcb-surface);
	border: 1px solid var(--apcb-border);
	border-radius: 10px;
	padding: 3px;
	gap: 2px;
}

.apcb-tab-btn {
	position: relative;
	border: none;
	background: transparent;
	padding: 7px 14px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	color: var(--apcb-text-muted);
	transition: background 0.15s ease, color 0.15s ease;
}

.apcb-tab-btn.is-active {
	background: var(--apcb-primary);
	color: #fff;
}

/* Incompatible tab (e.g. DDR4 when an AM5/DDR5-only CPU is selected) */
.apcb-tab-btn:disabled,
.apcb-tab-btn.is-incompatible {
	color: #c4c8d0;
	cursor: not-allowed;
	text-decoration: line-through;
	text-decoration-color: #d1d5db;
}

.apcb-tab-btn:disabled:hover,
.apcb-tab-btn.is-incompatible:hover {
	background: transparent;
}

.apcb-tab-btn .apcb-tab-hint {
	display: block;
	font-size: 9.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--apcb-primary);
	margin-top: 1px;
}

.apcb-tab-btn.is-active .apcb-tab-hint {
	color: rgba(255, 255, 255, 0.85);
}

/* ---------- Socket filter select ---------- */
.apcb-socket-wrap {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.apcb-socket-select {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-color: var(--apcb-surface);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.084l3.71-3.855a.75.75 0 111.08 1.04l-4.24 4.41a.75.75 0 01-1.08 0l-4.24-4.41a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 16px;
	border: 1px solid var(--apcb-border);
	border-radius: 10px;
	color: var(--apcb-text);
	font-size: 13px;
	font-weight: 600;
	padding: 8px 32px 8px 14px;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.apcb-socket-select:hover {
	border-color: var(--apcb-primary);
}

.apcb-socket-select:focus {
	outline: none;
	border-color: var(--apcb-primary);
	box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.apcb-socket-select.is-locked {
	background-color: rgba(220, 38, 38, 0.06);
	border-color: rgba(220, 38, 38, 0.35);
	color: var(--apcb-primary-dark);
	cursor: not-allowed;
	opacity: 1;
}

.apcb-socket-lock-hint {
	font-size: 11px;
	font-weight: 600;
	color: var(--apcb-text-muted);
	white-space: nowrap;
}

.apcb-search-wrap {
	position: relative;
	flex: 1;
	min-width: 200px;
	max-width: 360px;
}

.apcb-search-input {
	width: 100%;
	padding: 10px 14px;
	border-radius: 10px;
	border: 1px solid var(--apcb-border);
	font-size: 14px;
	background: var(--apcb-surface);
	color: var(--apcb-text);
}

.apcb-search-input:focus {
	outline: none;
	border-color: var(--apcb-primary);
	background: #fff;
}

/* ==========================================================================
   2. PRODUCT CAROUSEL
   A true "N-per-view" paged slider: .apcb-grid stays a flex row (same
   element, same class, no markup change) but each .apcb-card is now sized
   as a percentage of the visible track so exactly 4 / 2-3 / 1-2 cards show
   per breakpoint, with native scroll-snap paging and touch swipe — all
   without any JS. --apcb-card-h controls the fixed card height used
   everywhere below, so the whole row (and the reserved space during an
   AJAX reload) never jumps vertically.
   ========================================================================== */
.apcb-builder {
	--apcb-card-h: 392px;
	--apcb-card-gap: 16px;
	--apcb-scroll-offset: 84px;
}

/* ==========================================================================
   AUTO-SCROLL LANDING OFFSET
   Used by apcb-auto-scroll.js (scrollIntoView) so the next category lands
   fully visible at the top of the viewport instead of sliding under a
   sticky header/category nav. Apply data-apcb-section="{slug}" to each
   category section wrapper — no other markup change required.
   ========================================================================== */
[data-apcb-section] {
	scroll-margin-top: var(--apcb-scroll-offset);
}

@media (max-width: 640px) {
	.apcb-builder {
		--apcb-scroll-offset: 64px;
	}
}


.apcb-carousel {
	position: relative;
}

.apcb-grid {
	display: flex;
	align-items: stretch;
	gap: var(--apcb-card-gap);
	min-height: calc(var(--apcb-card-h) + 8px);
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scroll-padding-left: 4px;
	padding: 4px 4px 14px;
	-webkit-overflow-scrolling: touch;
	touch-action: pan-x;
	overscroll-behavior-x: contain;
	scrollbar-width: thin;
	scrollbar-color: var(--apcb-border) transparent;
	/* Reserve layout space up front so an AJAX swap of children never
	   collapses/re-expands the row height. */
	contain: layout;
}

.apcb-grid::-webkit-scrollbar {
	height: 6px;
}

.apcb-grid::-webkit-scrollbar-thumb {
	background: var(--apcb-border);
	border-radius: 999px;
}

.apcb-grid::-webkit-scrollbar-thumb:hover {
	background: var(--apcb-primary);
}

/* Grid fallback: add this class instead of removing .apcb-grid entirely if a
   traditional wrapped grid is ever needed (e.g. a "view all" expanded state) */
.apcb-grid.apcb-grid--wrap {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	overflow: visible;
}

/* ---------- Per-view sizing: 4 desktop / 2-3 tablet / 1-2 mobile ---------- */
/* Desktop: 4 cards per view */
.apcb-card {
	flex: 0 0 calc((100% - (3 * var(--apcb-card-gap))) / 4);
}

/* Small laptops / large tablets: 3 cards per view */
@media (max-width: 1180px) {
	.apcb-card {
		flex-basis: calc((100% - (2 * var(--apcb-card-gap))) / 3);
	}
}

/* Tablet: 2 cards per view */
@media (max-width: 860px) {
	.apcb-card {
		flex-basis: calc((100% - var(--apcb-card-gap)) / 2);
	}
}

/* Large mobile: still 2, tighter gap */
@media (max-width: 640px) {
	.apcb-builder {
		--apcb-card-gap: 10px;
		--apcb-card-h: 356px;
	}

	.apcb-card {
		flex-basis: calc((100% - var(--apcb-card-gap)) / 2);
	}
}

/* Small mobile: 1 card per view, full-bleed swipe */
@media (max-width: 420px) {
	.apcb-card {
		flex-basis: calc(100% - 28px);
	}
}

.apcb-carousel-arrow {
	position: absolute;
	top: calc(50% - 7px);
	transform: translateY(-50%);
	width: 42px;
	height: 42px;
	border-radius: 50%;
	border: 1px solid var(--apcb-border);
	background: #fff;
	color: var(--apcb-text);
	font-size: 17px;
	font-weight: 700;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--apcb-shadow-hover);
	z-index: 3;
	transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease,
		opacity 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.apcb-carousel-arrow:hover {
	background: var(--apcb-primary);
	border-color: var(--apcb-primary);
	color: #fff;
	transform: translateY(-50%) scale(1.06);
	box-shadow: 0 10px 24px rgba(220, 38, 38, 0.3);
}

.apcb-carousel-arrow:active {
	transform: translateY(-50%) scale(0.96);
}

.apcb-carousel-arrow:disabled {
	opacity: 0;
	pointer-events: none;
}

.apcb-carousel-arrow.prev {
	left: -18px;
}

.apcb-carousel-arrow.next {
	right: -18px;
}

@media (max-width: 1240px) {
	.apcb-carousel-arrow.prev {
		left: -6px;
	}

	.apcb-carousel-arrow.next {
		right: -6px;
	}
}

/* On touch/mobile the swipe gesture is the primary interaction; arrows step
   out of the way so they never sit on top of a card. */
@media (max-width: 640px) {
	.apcb-carousel-arrow {
		display: none;
	}
}

/* Edge fade so the carousel reads as "more content this way" */
.apcb-carousel::before,
.apcb-carousel::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 14px;
	width: 32px;
	pointer-events: none;
	z-index: 2;
}

.apcb-carousel::before {
	left: 0;
	background: linear-gradient(90deg, #fff, rgba(255, 255, 255, 0));
}

.apcb-carousel::after {
	right: 0;
	background: linear-gradient(270deg, #fff, rgba(255, 255, 255, 0));
}

/* ---------- Product cards ---------- */
.apcb-card {
	position: relative;
	height: var(--apcb-card-h);
	scroll-snap-align: start;
	scroll-snap-stop: always;
	background: #fff;
	border: 1px solid var(--apcb-border);
	border-radius: var(--apcb-radius);
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	box-shadow: var(--apcb-shadow);
	transition: box-shadow 0.22s var(--apcb-ease), border-color 0.22s var(--apcb-ease), transform 0.18s var(--apcb-ease);
	will-change: transform;
}

.apcb-card:hover {
	box-shadow: var(--apcb-shadow-hover);
	border-color: rgba(220, 38, 38, 0.35);
	transform: translateY(-5px);
}

/* Selected state: red border, red glow, and an animated check badge —
   built entirely with ::after/::before so no new markup is required. */
.apcb-card.is-selected {
	border-color: var(--apcb-primary);
	border-width: 2px;
	padding: 13px;
	box-shadow: var(--apcb-glow);
	animation: apcb-select-pulse 0.5s var(--apcb-ease);
}

@keyframes apcb-select-pulse {
	0% {
		box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45);
	}
	60% {
		box-shadow: 0 0 0 10px rgba(220, 38, 38, 0);
	}
	100% {
		box-shadow: var(--apcb-glow);
	}
}

.apcb-card.is-selected::after {
	content: "✓";
	position: absolute;
	top: 10px;
	right: 10px;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--apcb-primary);
	color: #fff;
	font-size: 13px;
	font-weight: 800;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 10px rgba(220, 38, 38, 0.4);
	z-index: 2;
	animation: apcb-check-in 0.32s var(--apcb-ease) 0.08s both;
}

@keyframes apcb-check-in {
	from {
		opacity: 0;
		transform: scale(0.4) rotate(-45deg);
	}
	to {
		opacity: 1;
		transform: scale(1) rotate(0deg);
	}
}

.apcb-card.is-disabled,
.apcb-card.is-incompatible {
	opacity: 0.45;
	pointer-events: none;
	filter: grayscale(0.4);
}

.apcb-card.is-incompatible .apcb-card-image {
	background-image: repeating-linear-gradient(
		135deg,
		rgba(17, 24, 39, 0.04),
		rgba(17, 24, 39, 0.04) 6px,
		transparent 6px,
		transparent 12px
	);
}

/* Fixed-height image zone: large, centered, identical footprint on every
   card regardless of the source image's aspect ratio. */
.apcb-card-image {
	width: 100%;
	height: 168px;
	flex: 0 0 168px;
	display: block;
	margin: 0 auto;
	object-fit: contain;
	object-position: center;
	background: var(--apcb-surface);
	border-radius: 10px;
	transition: transform 0.25s var(--apcb-ease);
}

.apcb-card:hover .apcb-card-image {
	transform: scale(1.04);
}

@media (max-width: 640px) {
	.apcb-card-image {
		height: 140px;
		flex-basis: 140px;
	}
}

/* Fixed-height name zone: clamps to 2 lines so every card's text block is
   identical, keeping price/badge/footer pinned to the same row every time. */
.apcb-card-name {
	font-size: 13.5px;
	font-weight: 600;
	line-height: 1.35;
	height: 36px;
	flex: 0 0 36px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.apcb-card-price {
	flex: 0 0 auto;
	font-size: 15px;
	font-weight: 700;
	color: var(--apcb-primary-dark);
}

.apcb-badge {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 4px;
	font-size: 11px;
	font-weight: 700;
	padding: 3px 8px;
	border-radius: 999px;
	width: fit-content;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.apcb-badge.in-stock {
	background: rgba(22, 163, 74, 0.12);
	color: var(--apcb-success);
}

.apcb-badge.low-stock {
	background: rgba(217, 119, 6, 0.12);
	color: var(--apcb-warning);
}

.apcb-badge.out-of-stock {
	background: rgba(220, 38, 38, 0.1);
	color: var(--apcb-danger);
}

.apcb-badge.incompatible {
	background: rgba(17, 24, 39, 0.06);
	color: var(--apcb-text-muted);
}

.apcb-card-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-top: auto;
}

.apcb-qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--apcb-border);
	border-radius: 8px;
	overflow: hidden;
}

.apcb-qty button {
	background: var(--apcb-surface);
	border: none;
	width: 26px;
	height: 26px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 700;
	color: var(--apcb-text);
}

.apcb-qty input {
	width: 32px;
	border: none;
	text-align: center;
	font-size: 13px;
	-moz-appearance: textfield;
}

/* Large, prominent select button (per spec: "Large select button") */
.apcb-select-btn {
	width: 100%;
	border: 1.5px solid var(--apcb-primary);
	background: #fff;
	color: var(--apcb-primary);
	font-size: 13px;
	font-weight: 800;
	padding: 10px 12px;
	border-radius: 9px;
	cursor: pointer;
	transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
	white-space: nowrap;
}

.apcb-select-btn:hover {
	background: var(--apcb-primary);
	color: #fff;
	box-shadow: 0 6px 16px rgba(220, 38, 38, 0.22);
}

.apcb-select-btn:active {
	transform: scale(0.97);
}

.apcb-select-btn.is-selected {
	background: var(--apcb-primary);
	color: #fff;
}

.apcb-select-btn.is-selected::before {
	content: "✓ ";
	font-weight: 800;
}

.apcb-empty,
.apcb-error {
	flex: 1 0 100%;
	text-align: center;
	padding: 40px 12px;
	color: var(--apcb-text-muted);
	font-size: 14px;
}

.apcb-pagination {
	display: flex;
	justify-content: center;
	gap: 8px;
}

.apcb-pagination button {
	border: 1px solid var(--apcb-border);
	background: #fff;
	border-radius: 8px;
	padding: 6px 12px;
	font-size: 13px;
	cursor: pointer;
}

.apcb-pagination button.is-active {
	background: var(--apcb-primary);
	color: #fff;
	border-color: var(--apcb-primary);
}

.apcb-pagination button:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

/* ==========================================================================
   3. SUMMARY SIDEBAR — premium checkout builder feel
   ========================================================================== */
.apcb-summary {
	position: sticky;
	top: 16px;
	background: #fff;
	border: 1px solid var(--apcb-border);
	border-radius: var(--apcb-radius);
	padding: 18px;
	box-shadow: var(--apcb-shadow-lg);
}

.apcb-summary h3 {
	margin: 0 0 12px;
	font-size: 16px;
	font-weight: 800;
	display: flex;
	align-items: center;
	gap: 8px;
}

.apcb-summary h3::before {
	content: "";
	width: 4px;
	height: 16px;
	background: var(--apcb-primary);
	border-radius: 2px;
	display: inline-block;
}

.apcb-summary-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
	max-height: 340px;
	overflow-y: auto;
	margin-bottom: 14px;
}

.apcb-summary-item {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 12.5px;
	padding-bottom: 10px;
	border-bottom: 1px dashed var(--apcb-border);
	animation: apcb-item-in 0.25s var(--apcb-ease);
}

@keyframes apcb-item-in {
	from {
		opacity: 0;
		transform: translateX(6px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

.apcb-summary-item img {
	width: 38px;
	height: 38px;
	object-fit: contain;
	background: var(--apcb-surface);
	border-radius: 6px;
	flex-shrink: 0;
}

.apcb-summary-item .apcb-si-info {
	flex: 1;
	min-width: 0;
}

.apcb-summary-item .apcb-si-cat {
	color: var(--apcb-text-muted);
	text-transform: uppercase;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.03em;
}

.apcb-summary-item .apcb-si-name {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.apcb-summary-item .apcb-si-price {
	font-weight: 700;
	color: var(--apcb-text);
	white-space: nowrap;
}

.apcb-summary-item .apcb-si-remove {
	border: none;
	background: none;
	color: var(--apcb-text-muted);
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
	padding: 2px 4px;
	border-radius: 6px;
	transition: background 0.15s ease, color 0.15s ease;
}

.apcb-summary-item .apcb-si-remove:hover {
	color: #fff;
	background: var(--apcb-primary);
}

.apcb-summary-empty {
	font-size: 13px;
	color: var(--apcb-text-muted);
	padding: 16px 0;
	text-align: center;
}

.apcb-power-box {
	background: var(--apcb-surface);
	border-radius: 10px;
	padding: 12px;
	font-size: 12.5px;
	margin-bottom: 14px;
}

.apcb-power-row {
	display: flex;
	justify-content: space-between;
	margin-bottom: 4px;
}

.apcb-power-row:last-child {
	margin-bottom: 0;
}

.apcb-power-status {
	margin-top: 8px;
	padding: 6px 8px;
	border-radius: 6px;
	font-weight: 700;
	font-size: 11.5px;
	text-align: center;
}

.apcb-power-status.ok {
	background: rgba(22, 163, 74, 0.12);
	color: var(--apcb-success);
}

.apcb-power-status.tight {
	background: rgba(217, 119, 6, 0.12);
	color: var(--apcb-warning);
}

.apcb-power-status.insufficient {
	background: rgba(220, 38, 38, 0.1);
	color: var(--apcb-danger);
}

.apcb-messages {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 12px;
}

.apcb-message {
	font-size: 12px;
	padding: 8px 10px;
	border-radius: 8px;
	line-height: 1.4;
}

.apcb-message.error {
	background: rgba(220, 38, 38, 0.08);
	color: var(--apcb-danger);
	border: 1px solid rgba(220, 38, 38, 0.25);
}

.apcb-message.warning {
	background: rgba(217, 119, 6, 0.08);
	color: var(--apcb-warning);
	border: 1px solid rgba(217, 119, 6, 0.25);
}

.apcb-total-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	font-size: 15px;
	font-weight: 800;
	margin-bottom: 14px;
	padding-top: 10px;
	border-top: 1px solid var(--apcb-border);
}

.apcb-total-row .apcb-total-amount {
	color: var(--apcb-primary-dark);
	font-size: 20px;
}

/* Premium add-to-cart button with shimmer sweep on hover */
.apcb-add-to-cart {
	position: relative;
	width: 100%;
	background: linear-gradient(135deg, var(--apcb-primary-light), var(--apcb-primary-dark));
	color: #fff;
	border: none;
	padding: 14px 16px;
	border-radius: 10px;
	font-size: 14.5px;
	font-weight: 800;
	letter-spacing: 0.01em;
	cursor: pointer;
	overflow: hidden;
	transition: transform 0.15s ease, box-shadow 0.2s ease;
	box-shadow: 0 8px 20px rgba(220, 38, 38, 0.25);
}

.apcb-add-to-cart::before {
	content: "";
	position: absolute;
	top: 0;
	left: -60%;
	width: 40%;
	height: 100%;
	background: linear-gradient(115deg, transparent, rgba(255, 255, 255, 0.35), transparent);
	transform: skewX(-20deg);
	transition: left 0.6s ease;
}

.apcb-add-to-cart:hover:not(:disabled) {
	transform: translateY(-1px);
	box-shadow: 0 12px 26px rgba(220, 38, 38, 0.32);
}

.apcb-add-to-cart:hover:not(:disabled)::before {
	left: 130%;
}

.apcb-add-to-cart:active:not(:disabled) {
	transform: translateY(0) scale(0.99);
}

.apcb-add-to-cart:disabled {
	background: #d1d5db;
	box-shadow: none;
	cursor: not-allowed;
}

.apcb-toast {
	position: fixed;
	bottom: 20px;
	right: 20px;
	background: var(--apcb-text);
	color: #fff;
	padding: 12px 18px;
	border-radius: 10px;
	font-size: 13px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
	z-index: 9999;
	max-width: 320px;
	animation: apcb-toast-in 0.2s ease;
}

.apcb-toast.success {
	background: var(--apcb-success);
}

.apcb-toast.error {
	background: var(--apcb-danger);
}

@keyframes apcb-toast-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (max-width: 600px) {
	.apcb-summary {
		position: static;
	}
}