/* =========================================================================
   Agrolatvija — Rezerves daļas (spare parts) V1.0
   Scoped to .agro-sp. Renders inside a WoodMart page.
   Breakpoints: 1200 / 900 / 640
   ========================================================================= */
.agro-sp {
	/* Colours/fonts inherit WoodMart Theme Settings (Colors/Typography); the values
	   after the comma are only fallbacks used when an option isn't set. */
	--brand: var(--wd-primary-color, #0F3D2E);
	--brand-2: color-mix(in srgb, var(--wd-primary-color, #0F3D2E) 82%, #fff);
	--brand-ink: color-mix(in srgb, var(--wd-primary-color, #0F3D2E) 60%, #000);
	--accent: var(--wd-alternative-color, #E8B84C); --ok: #3E8A5A; --red: #B43A2E;
	--bg: var(--wd-main-bgcolor, #F6F4EF); --surface: #FFFFFF; --surface-2: #EFEBE2;
	--ink: var(--wd-title-color, #121512); --muted: var(--wd-text-color, #5c6660); --line: var(--wd-form-brd-color, #E3DFD5);
	--pill: 999px; --shadow: 0 6px 22px rgba(18,21,18,.08);
	--font: var(--wd-text-font, "Inter Tight", system-ui, sans-serif);
	font-family: var(--font);
	color: var(--ink); background: var(--bg);
}
.agro-sp * { box-sizing: border-box; }
/* Page width follows WoodMart's Site Width setting (--wd-container-w). */
.agro-sp .wrap-wide { max-width: var(--wd-container-w, 1320px); margin: 0 auto; padding: 0 clamp(14px, 2vw, 28px); }
.agro-sp h1, .agro-sp h2, .agro-sp h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
.agro-sp a { text-decoration: none; color: inherit; }
.sp-eyebrow, .sp-stat__n, .sp-row__sku, .sp-card__count { font-family: "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.agro-sp :focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.sp-ic { flex: none; }

/* ---- buttons ---- */
.sp-btn { display: inline-flex; align-items: center; gap: 7px; border-radius: var(--pill); padding: 10px 18px;
	font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid transparent; font-family: inherit; transition: .15s; }
.sp-btn--primary { background: var(--brand); color: #fff; }
.sp-btn--primary:hover { background: var(--brand-2); }
.sp-btn--accent { background: var(--accent); color: var(--ink); }
.sp-btn--accent:hover { filter: brightness(.96); }
.sp-btn--ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.sp-btn--ghost:hover { border-color: var(--brand); }
.sp-btn--ghost-light { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); color: #fff; }
.sp-btn--muted { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }

/* ---- breadcrumb ---- */
.sp-crumbs { padding: 18px 0 8px; }
.sp-crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.sp-crumbs li { display: inline-flex; align-items: center; gap: 6px; }
.sp-crumbs li:not(:last-child)::after { content: "/"; color: var(--line); }
.sp-crumbs a:hover { color: var(--brand); }
.sp-crumbs [aria-current] { color: var(--ink); font-weight: 600; }

/* =========================================================================
   2. HERO
   ========================================================================= */
.sp-hero {
	display: grid; grid-template-columns: 1.45fr 1fr; gap: 24px; margin-top: 6px;
	background: var(--brand-ink); background: linear-gradient(135deg, var(--brand-ink) 0%, var(--brand) 100%);
	border-radius: 22px; padding: 40px; color: #fff; position: relative; overflow: hidden;
}
.sp-hero::before { /* fine stripe texture */
	content: ""; position: absolute; inset: 0; pointer-events: none;
	background: repeating-linear-gradient(135deg, rgba(255,255,255,.05) 0 12px, rgba(255,255,255,0) 12px 24px);
}
.sp-hero::after { /* decorative ring */
	content: ""; position: absolute; width: 340px; height: 340px; right: -120px; top: -120px; border-radius: 50%;
	border: 40px solid rgba(255,255,255,.05); pointer-events: none;
}
.sp-hero__main, .sp-help { position: relative; z-index: 1; }
.sp-eyebrow { display: inline-block; font-size: 12.5px; letter-spacing: .05em; text-transform: uppercase; color: rgba(255,255,255,.7); }
.sp-h1 { font-size: clamp(30px, 3.4vw, 48px); line-height: 1.08; margin: 10px 0 12px; color: #fff; }
.sp-h1 em { color: var(--accent); font-style: normal; }
.sp-hero__desc { color: rgba(255,255,255,.85); font-size: 15px; max-width: 56ch; margin: 0 0 20px; }

/* global search */
.sp-search { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: var(--pill);
	padding: 6px 8px 6px 16px; box-shadow: var(--shadow); max-width: 560px; }
.sp-search .sp-ic { color: var(--muted); width: 20px; height: 20px; }
.sp-search input { flex: 1; border: none; outline: none; background: none; font-size: 15px; font-family: inherit; padding: 10px 0; color: var(--ink); }
.sp-search__clear { border: none; background: var(--surface-2); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 17px; color: var(--muted); }

.sp-hero__stats { display: flex; gap: 30px; margin-top: 24px; flex-wrap: wrap; }
.sp-stat { display: flex; flex-direction: column; }
.sp-stat__n { font-size: 22px; font-weight: 600; }
.sp-stat__l { font-size: 12px; color: rgba(255,255,255,.65); text-transform: uppercase; letter-spacing: .03em; }

/* help card */
.sp-help { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); border-radius: 18px; padding: 24px; align-self: start; }
.sp-help .sp-ic { color: var(--accent); width: 30px; height: 30px; }
.sp-help h3 { font-size: 18px; margin: 12px 0 6px; color: #fff; }
.sp-help p { color: rgba(255,255,255,.82); font-size: 14px; margin: 0 0 16px; }
.sp-help__acts { display: flex; flex-wrap: wrap; gap: 10px; }

/* =========================================================================
   A. CATEGORY CARDS
   ========================================================================= */
.sp-state { margin-top: 40px; }
.sp-step { font-size: 15px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 16px; }
.sp-subcats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.sp-card { display: flex; flex-direction: column; gap: 8px; text-align: left; cursor: pointer;
	background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; transition: .16s; font-family: inherit; }
.sp-card:hover { transform: translateY(-3px); border-color: var(--brand); box-shadow: var(--shadow); }
.sp-card__ic { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; color: var(--brand); }
.sp-card__name { font-size: 16px; font-weight: 700; }
.sp-card__desc { font-size: 13px; color: var(--muted); flex: 1; }
.sp-card__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.sp-card__count { font-size: 12px; color: var(--muted); }
.sp-card__go { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--brand); }
.sp-card__go .sp-ic { width: 15px; height: 15px; }

/* =========================================================================
   B. RAIL + FINDER + TIPS
   ========================================================================= */
.sp-back { display: inline-flex; align-items: center; gap: 6px; background: none; border: none; cursor: pointer;
	color: var(--brand); font-weight: 600; font-size: 14px; padding: 0; margin-bottom: 16px; font-family: inherit; }
.sp-back .sp-ic { width: 18px; height: 18px; }
.sp-rail { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 20px; }
.sp-rail__item { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; cursor: pointer;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--pill); padding: 9px 16px; font-size: 13.5px; font-weight: 500; font-family: inherit; color: var(--ink); }
.sp-rail__item .sp-ic { width: 18px; height: 18px; color: var(--muted); }
.sp-rail__item:hover { border-color: var(--brand); }
.sp-rail__item.is-active { background: var(--brand); color: #fff; border-color: var(--brand); }
.sp-rail__item.is-active .sp-ic { color: var(--accent); }

.sp-layout { display: grid; grid-template-columns: 1.7fr 1fr; gap: 24px; align-items: start; }
.sp-finder { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; }
.sp-finder__head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.sp-badge { background: var(--surface-2); color: var(--brand); font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: var(--pill); text-transform: uppercase; letter-spacing: .03em; }
.sp-finder__head h3 { font-size: 22px; }
.finder-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.sp-field { display: flex; flex-direction: column; gap: 5px; }
.sp-field label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.sp-field input, .sp-field select { height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px;
	font-size: 14px; font-family: inherit; background: var(--surface); color: var(--ink); }
.sp-field input:focus, .sp-field select:focus { border-color: var(--brand); outline: none; }
.sp-finder__acts { display: flex; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.sp-finder__result { font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sp-finder__diagram { grid-column: 1 / -1; background: var(--surface-2); border-radius: 12px; padding: 14px; display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; }
.sp-finder__diagram svg { flex: none; color: var(--brand); }

.sp-tips { background: var(--surface-2); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.sp-tips h4 { margin: 0 0 8px; font-size: 15px; }
.sp-tips p { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.sp-tips__desc { color: var(--ink) !important; font-weight: 500; }

/* =========================================================================
   3. RESULTS
   ========================================================================= */
.sp-results { margin-top: 40px; }
.sp-results__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.sp-results__head h2 { font-size: 20px; }
.sp-results__tools { display: flex; align-items: center; gap: 14px; }
.sp-check { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; cursor: pointer; }
.sp-check input { width: 17px; height: 17px; accent-color: var(--brand); }
.sp-select { height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; background: var(--surface); font-family: inherit; font-size: 13.5px; cursor: pointer; }

.sp-list { display: flex; flex-direction: column; gap: 10px; }
.sp-row { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; transition: border-color .15s; }
.sp-row.is-out { opacity: .8; }
.sp-row__main { width: 100%; display: grid; grid-template-columns: 64px 1fr auto auto; gap: 16px; align-items: center;
	padding: 12px 16px; background: none; border: none; cursor: pointer; text-align: left; font-family: inherit; }
.sp-row[aria-expanded] .sp-row__main, .sp-row__main[aria-expanded="true"] { }
.sp-row:has([aria-expanded="true"]) { border-color: var(--brand); box-shadow: var(--shadow); }
.sp-row__thumb { width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.sp-row__thumb img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.sp-row__id { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sp-row__sku { font-size: 12px; color: var(--muted); }
.sp-row__name { font-size: 15px; font-weight: 600; color: var(--ink); }
.sp-row__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 2px; }
.sp-row__brand, .sp-row__fits { font-size: 12px; color: var(--muted); }
.sp-row__fits::before { content: "· "; }
.sp-row__price { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sp-row__price del { color: var(--muted); font-weight: 400; font-size: 13px; }
.sp-row__price ins { text-decoration: none; color: var(--red); }
.sp-row__specsbtn { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--brand); }
.sp-row__main[aria-expanded="true"] .sp-row__specsbtn svg { transform: rotate(180deg); }
.sp-row__specsbtn svg { transition: transform .2s; }

.sp-row__panel { padding: 0 16px 16px 96px; border-top: 1px solid var(--line); }
.sp-specs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 14px 0; }
.sp-specs__item { display: flex; flex-direction: column; gap: 2px; }
.sp-specs__k { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.sp-specs__v { font-size: 14px; font-weight: 600; }
.sp-specs__empty { color: var(--muted); font-size: 13.5px; padding: 12px 0; }
.sp-fits { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-bottom: 12px; }
.sp-fits__lbl { font-size: 12.5px; color: var(--muted); margin-right: 4px; }
.sp-fits__chip { font-size: 12px; background: var(--surface-2); border-radius: var(--pill); padding: 3px 10px; }
.sp-row__buy { display: flex; gap: 10px; padding-top: 6px; }

/* stock chip */
.sp-chip { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: var(--pill); }
.sp-chip--ok { background: rgba(62,138,90,.14); color: var(--ok); }
.sp-chip--low { background: rgba(232,184,76,.2); color: #9a7415; }
.sp-chip--out { background: var(--surface-2); color: var(--muted); }

.sp-empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.sp-empty .sp-ic { width: 40px; height: 40px; margin-bottom: 10px; color: var(--line); }
.sp-list__loading { display: grid; place-items: center; padding: 30px; }
.sp-list__loading span { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: sp-spin .8s linear infinite; }
@keyframes sp-spin { to { transform: rotate(360deg); } }

/* =========================================================================
   4. SERVICE BANNER
   ========================================================================= */
.sp-service { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; margin: 44px 0; align-items: center;
	background: var(--brand-ink); background: linear-gradient(135deg, var(--brand-ink), var(--brand)); border-radius: 22px; padding: 36px; color: #fff; }
.sp-service__cta h2 { font-size: 26px; color: #fff; }
.sp-service__cta p { color: rgba(255,255,255,.82); font-size: 15px; margin: 10px 0 20px; }
.sp-service__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sp-benefit { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.sp-benefit .sp-ic { color: var(--accent); width: 24px; height: 24px; margin-bottom: 4px; }
.sp-benefit strong { font-size: 14.5px; }
.sp-benefit span { font-size: 12.5px; color: rgba(255,255,255,.72); }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1200px) {
	.sp-layout { grid-template-columns: 1fr; }
	.finder-grid { grid-template-columns: repeat(2, 1fr); }
	.sp-subcats { grid-template-columns: repeat(2, 1fr); }
	.sp-specs { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
	.agro-sp .wrap-wide { padding: 0 18px; }
	.sp-hero { grid-template-columns: 1fr; padding: 28px; }
	.sp-service { grid-template-columns: 1fr; }
	.sp-hero__stats { gap: 20px; }
	.sp-row__main { grid-template-columns: 56px 1fr; grid-template-areas: "thumb id" "price acts"; row-gap: 8px; }
	.sp-row__thumb { grid-area: thumb; } .sp-row__id { grid-area: id; }
	.sp-row__price { grid-area: price; } .sp-row__acts { grid-area: acts; justify-self: end; }
	.sp-row__panel { padding-left: 16px; }
}
@media (max-width: 640px) {
	.agro-sp .wrap-wide { padding: 0 14px; }
	.sp-subcats { grid-template-columns: 1fr; }
	.finder-grid { grid-template-columns: 1fr; }
	.sp-specs { grid-template-columns: 1fr; }
	.sp-service__grid { grid-template-columns: 1fr; }
}
