/*
 * GOU Moto Parts: front-end styles.
 * Logical properties only (English LTR and Arabic RTL).
 * Layout reacts to the width of the box the component sits in (container
 * queries), so the filter works in the shop sidebar, the filters drawer,
 * above the products and inside page builders on every screen size.
 */
:root {
	--gmp-accent: var(--nx-primary, var(--nexus-primary, #e11d48));
	--gmp-accent-contrast: #fff;
	--gmp-line: color-mix(in srgb, currentColor 16%, transparent);
	--gmp-soft: color-mix(in srgb, currentColor 5%, transparent);
	--gmp-muted: var(--nx-muted, var(--nexus-text-muted, color-mix(in srgb, currentColor 60%, transparent)));
	--gmp-surface: var(--nx-surface, var(--nexus-bg, #fff));
	--gmp-radius: 12px;
	--gmp-new: #16a34a;
	--gmp-used: #d97706;
	--gmp-new-bg: #dcfce7;
	--gmp-new-fg: #166534;
	--gmp-used-bg: #fef3c7;
	--gmp-used-fg: #92400e;
}

.gmp-icon { flex: none; }

/* Years, part numbers, bike names: always left to right, even inside Arabic text. */
.gmp-ltr { direction: ltr; unicode-bidi: isolate; }

/* ---------- Condition ---------- */
.gmp-cond {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 2px 10px;
	border-radius: 999px;
	font-size: .75rem;
	font-weight: 600;
	line-height: 1.6;
}
.gmp-cond::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.gmp-cond--new { background: var(--gmp-new-bg); color: var(--gmp-new-fg); }
.gmp-cond--used { background: var(--gmp-used-bg); color: var(--gmp-used-fg); }

/* Condition tag on the product image */
.gmp-ribbon {
	position: absolute;
	inset-inline-start: .6rem;
	inset-block-end: .6rem;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	gap: .4rem;
	padding: .28rem .65rem;
	border-radius: 4px;
	font-size: .68rem;
	font-weight: 800;
	line-height: 1.3;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
	pointer-events: none;
}
.gmp-ribbon--new { background: var(--gmp-new); }
.gmp-ribbon--used { background: var(--gmp-used); }

/* Part number */
.gmp-pn {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: .85em;
	font-weight: 600;
	letter-spacing: .02em;
	overflow-wrap: anywhere;
}

.gmp-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Product card: "fitment ticket" ----------
   Bike on top, a perforated line with ticket notches, then chips (year, part
   number) that wrap by themselves: any card width, nothing squeezed. */
.gmp-fit {
	--gmp-fit-line: color-mix(in srgb, var(--gmp-accent) 20%, transparent);
	container: gmpfit / inline-size;
	position: relative;
	min-width: 0;
	margin-block: .45rem .55rem;
	border: 1px solid var(--gmp-fit-line);
	border-radius: 12px;
	background: linear-gradient(135deg, color-mix(in srgb, var(--gmp-accent) 8%, var(--gmp-surface)) 0%, var(--gmp-surface) 72%);
	text-align: start;
	transition: border-color .2s ease, box-shadow .2s ease;
}
li.product:hover .gmp-fit,
.product:focus-within .gmp-fit { border-color: color-mix(in srgb, var(--gmp-accent) 38%, transparent); box-shadow: 0 6px 16px -10px color-mix(in srgb, var(--gmp-accent) 45%, transparent); }
.gmp-fit__head { display: flex; align-items: center; gap: .55rem; min-width: 0; padding: .55rem .65rem; }
.gmp-fit__icon {
	display: grid;
	place-items: center;
	flex: none;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: color-mix(in srgb, var(--gmp-accent) 14%, transparent);
	color: var(--gmp-accent);
}
.gmp-fit__icon .gmp-icon { width: 17px; height: 17px; }
.gmp-fit__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.gmp-fit__label { font-size: .64rem; font-weight: 800; color: var(--gmp-accent); }
.gmp-fit__bike {
	font-size: .88rem;
	font-weight: 500;
	overflow-wrap: anywhere;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.gmp-fit__bike b { font-weight: 800; }

.gmp-fit__chips {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	gap: .35rem;
	margin: 0;
	padding: .55rem .65rem .6rem;
	list-style: none;
	border-block-start: 1.5px dashed var(--gmp-fit-line);
}
.gmp-fit--nobike .gmp-fit__chips { border-block-start: 0; }
/* Ticket notches: half circles cut into both edges of the perforation. */
.gmp-fit:not(.gmp-fit--nobike) .gmp-fit__chips::before,
.gmp-fit:not(.gmp-fit--nobike) .gmp-fit__chips::after {
	content: "";
	position: absolute;
	top: -7px;
	width: 7px;
	height: 12px;
	background: var(--gmp-surface);
	border: 1px solid var(--gmp-fit-line);
}
.gmp-fit:not(.gmp-fit--nobike) .gmp-fit__chips::before { inset-inline-start: -1px; border-inline-start: 0; border-start-end-radius: 12px; border-end-end-radius: 12px; }
.gmp-fit:not(.gmp-fit--nobike) .gmp-fit__chips::after { inset-inline-end: -1px; border-inline-end: 0; border-start-start-radius: 12px; border-end-start-radius: 12px; }
.gmp-fit__chip {
	display: inline-flex;
	align-items: center;
	gap: .3rem;
	min-width: 0;
	max-width: 100%;
	margin: 0;
	padding: .22rem .55rem;
	border: 1px solid var(--gmp-line);
	border-radius: 999px;
	background: var(--gmp-surface);
	font-size: .76rem;
	font-weight: 700;
	line-height: 1.35;
}
.gmp-fit__chip .gmp-icon { flex: none; width: 13px; height: 13px; color: var(--gmp-accent); }
.gmp-fit__val { min-width: 0; overflow-wrap: anywhere; }
.gmp-fit__chip .gmp-pn { font-size: .76rem; letter-spacing: 0; }
.gmp-fit__chip--new { border-color: transparent; background: var(--gmp-new-bg); color: var(--gmp-new-fg); }
.gmp-fit__chip--used { border-color: transparent; background: var(--gmp-used-bg); color: var(--gmp-used-fg); }
.gmp-fit__chip--new .gmp-icon, .gmp-fit__chip--used .gmp-icon { color: inherit; }

@container gmpfit (max-width: 200px) {
	.gmp-fit__head { gap: .45rem; padding: .5rem .55rem; }
	.gmp-fit__icon { width: 26px; height: 26px; }
	.gmp-fit__icon .gmp-icon { width: 15px; height: 15px; }
	.gmp-fit__bike { font-size: .82rem; }
	.gmp-fit__chips { gap: .3rem; padding: .5rem .55rem .55rem; }
	.gmp-fit__chip { padding: .2rem .45rem; font-size: .72rem; }
	.gmp-fit__chip .gmp-pn { font-size: .72rem; }
}

/* ---------- Product page / quick view: "fitment card" ---------- */
.gmp-spec {
	--gmp-fit-line: color-mix(in srgb, var(--gmp-accent) 22%, transparent);
	container: gmpspec / inline-size;
	margin-block: 1rem 1.25rem;
	border: 1px solid var(--gmp-line);
	border-radius: 16px;
	overflow: hidden;
	background: var(--gmp-surface);
	text-align: start;
}
.gmp-spec__hero {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .6rem .85rem;
	padding: 1rem 1.1rem;
	background: linear-gradient(135deg, color-mix(in srgb, var(--gmp-accent) 11%, var(--gmp-surface)) 0%, var(--gmp-surface) 78%);
	border-block-end: 1.5px dashed var(--gmp-fit-line);
}
.gmp-spec__heroicon {
	display: grid;
	place-items: center;
	flex: none;
	width: 46px;
	height: 46px;
	border-radius: 14px;
	background: var(--gmp-accent);
	color: var(--gmp-accent-contrast);
	box-shadow: 0 8px 18px -10px var(--gmp-accent);
}
.gmp-spec__heroicon .gmp-icon { width: 24px; height: 24px; }
.gmp-spec__herotext { flex: 1 1 10rem; min-width: 0; }
.gmp-spec__kicker { margin: 0; font-size: .72rem; font-weight: 800; color: var(--gmp-accent); }
.gmp-spec__bike { margin: .1rem 0 0; font-size: 1.15rem; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.gmp-spec__bike b { font-weight: 800; }
.gmp-spec__years {
	display: inline-flex;
	align-items: center;
	gap: .35rem;
	flex: none;
	padding: .35rem .75rem;
	border: 1px solid var(--gmp-fit-line);
	border-radius: 999px;
	background: var(--gmp-surface);
	font-size: .88rem;
	font-weight: 700;
}
.gmp-spec__years .gmp-icon { width: 15px; height: 15px; color: var(--gmp-accent); }
.gmp-spec__title { display: flex; align-items: center; gap: .5rem; margin: 0; padding: .9rem 1.1rem; font-size: 1rem; font-weight: 700; border-block-end: 1px solid var(--gmp-line); }
.gmp-spec__title .gmp-icon { color: var(--gmp-accent); width: 18px; height: 18px; }

.gmp-spec__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem; margin: 0; padding: .85rem; }
.gmp-spec__tile {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	align-items: center;
	column-gap: .65rem;
	min-width: 0;
	margin: 0;
	padding: .65rem .75rem;
	border-radius: 12px;
	background: var(--gmp-soft);
}
.gmp-spec__icon {
	grid-row: 1 / 3;
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	border-radius: 10px;
	background: color-mix(in srgb, var(--gmp-accent) 12%, transparent);
	color: var(--gmp-accent);
}
.gmp-spec__icon .gmp-icon { width: 17px; height: 17px; }
.gmp-spec__label { margin: 0; font-size: .72rem; font-weight: 600; color: var(--gmp-muted); line-height: 1.3; }
.gmp-spec__value { margin: 0; font-size: .95rem; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }

.gmp-spec__pn {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .5rem .85rem;
	padding: .85rem 1.1rem;
	border-block-start: 1px solid var(--gmp-line);
	background: repeating-linear-gradient(-45deg, transparent 0 9px, color-mix(in srgb, currentColor 2.5%, transparent) 9px 18px);
}
.gmp-spec__pnlabel { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 600; color: var(--gmp-muted); }
.gmp-spec__pnlabel .gmp-icon { width: 15px; height: 15px; color: var(--gmp-accent); }
.gmp-spec__pnvalue { flex: 1 1 8rem; min-width: 0; font-size: 1.15rem; font-weight: 800; overflow-wrap: anywhere; }
.gmp-spec__pnvalue .gmp-pn { font-size: inherit; letter-spacing: .02em; }

.gmp-copy {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 1px solid var(--gmp-line);
	border-radius: 8px;
	background: transparent;
	color: inherit;
	cursor: pointer;
}
.gmp-copy:hover { background: var(--gmp-soft); border-color: var(--gmp-accent); color: var(--gmp-accent); }
.gmp-copy:focus-visible { outline: 2px solid var(--gmp-accent); outline-offset: 2px; }
.gmp-copy.is-copied { border-color: var(--gmp-new); color: var(--gmp-new); }
.gmp-copy__msg {
	position: absolute;
	inset-block-end: calc(100% + 6px);
	inset-inline-end: 0;
	padding: .15rem .55rem;
	border-radius: 6px;
	background: #111827;
	color: #fff;
	font-size: .72rem;
	font-weight: 600;
	white-space: nowrap;
	pointer-events: none;
}
.gmp-copy__msg:empty { display: none; }

/* Quick view and narrow columns. */
.gmp-spec--compact { margin-block: .75rem; border-radius: 12px; }
.gmp-spec--compact .gmp-spec__hero { padding: .75rem .85rem; }
.gmp-spec--compact .gmp-spec__heroicon { width: 38px; height: 38px; border-radius: 11px; }
.gmp-spec--compact .gmp-spec__bike { font-size: 1rem; }
.gmp-spec--compact .gmp-spec__grid { padding: .65rem; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.gmp-spec--compact .gmp-spec__tile:last-child:nth-child(odd):not(:first-child) { grid-column: 1 / -1; }
.gmp-spec--compact .gmp-spec__pn { padding: .7rem .85rem; }
@container gmpspec (max-width: 360px) {
	.gmp-spec__hero { padding: .85rem; }
	.gmp-spec__heroicon { width: 40px; height: 40px; }
	.gmp-spec__bike { font-size: 1.02rem; }
	.gmp-spec__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: .65rem; gap: .4rem; }
	.gmp-spec__tile { grid-template-columns: minmax(0, 1fr); row-gap: .35rem; padding: .6rem; }
	.gmp-spec__tile:last-child:nth-child(odd) { grid-column: 1 / -1; } /* no lone half tile */
	.gmp-spec__icon { grid-row: auto; width: 30px; height: 30px; }
	.gmp-spec__pn { padding: .75rem .85rem; }
	.gmp-spec__pnvalue { font-size: 1.02rem; }
}

/* ---------- Filter ----------
   Open by default. Layout from the width of the box it sits in (container
   queries): shop top bar, sidebar, filters drawer or a builder column. */
.gmp-filter-wrap { container: gmp / inline-size; margin-block-end: 1.25rem; }
.gmp-filter {
	padding: 1rem;
	border: 1px solid var(--gmp-line);
	border-radius: var(--gmp-radius);
	background: var(--gmp-surface);
	box-shadow: 0 1px 2px rgba(17, 24, 39, .04);
	box-sizing: border-box;
}
.gmp-filter--vertical { padding: 0; border: 0; background: transparent; box-shadow: none; }

.gmp-filter__head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-block-end: .9rem; }
.gmp-filter__title { display: flex; align-items: center; gap: .5rem; margin: 0; font-size: 1.05rem; font-weight: 700; line-height: 1.3; }
.gmp-filter__title .gmp-icon { color: var(--gmp-accent); width: 20px; height: 20px; }

/* Collapse button: narrow boxes only (the filter starts open). */
.gmp-filter__toggle {
	display: inline-flex;
	align-items: center;
	gap: .4rem;
	min-height: 40px;
	padding: .35rem .9rem;
	border: 1px solid var(--gmp-line);
	border-radius: 999px;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: .85rem;
	font-weight: 600;
	cursor: pointer;
}
.gmp-filter__toggle::after {
	content: "";
	width: 7px;
	height: 7px;
	border-inline-end: 2px solid currentColor;
	border-block-end: 2px solid currentColor;
	transform: rotate(45deg) translateY(-2px);
	transition: transform .2s ease;
}
.gmp-filter.is-open .gmp-filter__toggle::after { transform: rotate(225deg); }
.gmp-filter__count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 999px;
	background: var(--gmp-accent);
	color: var(--gmp-accent-contrast);
	font-size: .7rem;
}
.gmp-filter--collapsible:not(.is-open) .gmp-filter__body { display: none; }
.gmp-filter--collapsible:not(.is-open) .gmp-filter__head { margin-block-end: 0; }

/* Fields: one column in very narrow boxes. */
.gmp-filter__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: .8rem; align-items: end; } /* long labels wrap; inputs stay level */
.gmp-field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.gmp-field > label,
.gmp-field > legend {
	float: none;
	width: 100%;
	margin: 0;
	padding: 0;
	font-size: .78rem;
	font-weight: 600;
	line-height: 1.4;
	color: var(--gmp-muted);
	overflow-wrap: break-word;
	text-wrap: balance;
}

.gmp-filter input[type="search"],
.gmp-filter input[type="number"],
.gmp-filter select {
	width: 100%;
	min-height: 44px;
	margin: 0;
	padding: .5rem .8rem;
	border: 1px solid var(--gmp-line);
	border-radius: 8px;
	background-color: var(--gmp-surface);
	color: inherit;
	font: inherit;
	font-size: 16px; /* stops iOS from zooming on focus */
	line-height: 1.3;
	box-sizing: border-box;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.gmp-filter input:focus,
.gmp-filter select:focus { outline: none; border-color: var(--gmp-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gmp-accent) 18%, transparent); }
.gmp-btn:focus-visible,
.gmp-seg input:focus-visible + label,
.gmp-filter__toggle:focus-visible { outline: 2px solid var(--gmp-accent); outline-offset: 2px; }

/* New / Used segmented control */
.gmp-seg { position: relative; display: flex; min-height: 44px; border: 1px solid var(--gmp-line); border-radius: 8px; overflow: hidden; background: var(--gmp-surface); }
.gmp-seg input { position: absolute; opacity: 0; pointer-events: none; }
.gmp-seg label {
	flex: 1 1 0;
	min-width: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: .4rem .45rem;
	font-size: .86rem;
	font-weight: 600;
	color: inherit;
	white-space: nowrap;
	cursor: pointer;
	user-select: none;
	transition: background-color .15s ease, color .15s ease;
}
.gmp-seg label + input + label { border-inline-start: 1px solid var(--gmp-line); }
.gmp-seg input:checked + label { background: var(--gmp-accent); color: var(--gmp-accent-contrast); }

/* Price: one box holding both amounts and the currency. */
.gmp-price {
	display: flex;
	align-items: center;
	gap: .25rem;
	min-height: 44px;
	padding-inline: .2rem .75rem;
	border: 1px solid var(--gmp-line);
	border-radius: 8px;
	background: var(--gmp-surface);
	box-sizing: border-box;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.gmp-price:focus-within { border-color: var(--gmp-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gmp-accent) 18%, transparent); }
.gmp-filter .gmp-price input[type="number"] { flex: 1 1 0; min-width: 0; min-height: 40px; border: 0; box-shadow: none; background: transparent; text-align: center; -moz-appearance: textfield; }
.gmp-filter .gmp-price input::-webkit-outer-spin-button,
.gmp-filter .gmp-price input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.gmp-price__sep,
.gmp-price__cur { flex: none; color: var(--gmp-muted); font-size: .85rem; }

/* Buttons */
.gmp-filter__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-block-start: 1rem; }
.gmp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: .5rem 1.25rem;
	border: 1px solid transparent;
	border-radius: 8px;
	font: inherit;
	font-size: .92rem;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: filter .15s ease, background-color .15s ease;
}
.gmp-btn--primary { flex: 1 1 auto; background: var(--gmp-accent); color: var(--gmp-accent-contrast); }
.gmp-btn--primary:hover { filter: brightness(.92); color: var(--gmp-accent-contrast); }
.gmp-btn--ghost { border-color: var(--gmp-line); background: transparent; color: inherit; }
.gmp-btn--ghost:hover { background: var(--gmp-soft); color: inherit; }

/* Active filter chips */
.gmp-active { display: flex; flex-wrap: wrap; gap: .4rem; margin: .9rem 0 0; padding: 0; list-style: none; }
.gmp-active li { margin: 0; }
.gmp-chip {
	display: inline-flex;
	align-items: center;
	gap: .4rem;
	max-width: 100%;
	padding: 3px 10px;
	border: 1px solid var(--gmp-line);
	border-radius: 999px;
	font-size: .78rem;
	font-weight: 500;
	line-height: 1.6;
	color: inherit;
	text-decoration: none;
}
.gmp-chip span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gmp-chip--remove { background: var(--gmp-soft); }
.gmp-chip--remove:hover { border-color: var(--gmp-accent); color: var(--gmp-accent); }

/* Phones, tablets, sidebar, drawer (≥ 300px): two columns —
   search / brand · model / year · price / condition. */
@container gmp (min-width: 300px) {
	.gmp-filter__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.gmp-field--q,
	.gmp-field--cond { grid-column: 1 / -1; }
}
/* Too narrow for the price beside the year. */
@container gmp (min-width: 300px) and (max-width: 379px) {
	.gmp-field--year,
	.gmp-field--price { grid-column: 1 / -1; }
}
/* Wide boxes (≥ 760px): no collapse button, four columns —
   search · brand · model / year · price · condition. */
@container gmp (min-width: 760px) {
	.gmp-filter--horizontal { padding: 1.1rem 1.25rem; }
	.gmp-filter--horizontal .gmp-filter__toggle { display: none; }
	.gmp-filter--horizontal.gmp-filter--collapsible .gmp-filter__body { display: block; }
	.gmp-filter--horizontal.gmp-filter--collapsible .gmp-filter__head { margin-block-end: .9rem; }
	.gmp-filter--horizontal .gmp-filter__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
	.gmp-filter--horizontal .gmp-field--q { grid-column: span 2; }
	.gmp-filter--horizontal .gmp-field--price { grid-column: span 2; }
	.gmp-filter--horizontal .gmp-field--cond { grid-column: span 1; }
	.gmp-filter--horizontal .gmp-filter__actions { justify-content: flex-end; }
	.gmp-filter--horizontal .gmp-btn--primary { flex: 0 0 auto; min-width: 190px; }
}

@media (prefers-reduced-motion: reduce) {
	.gmp-btn, .gmp-filter__toggle::after { transition: none; }
}
