/**
 * Elite Center — Server Parts microsite (/repuestos-servidores/).
 *
 * Scoped under #ec-server-parts-root.ec-sp-page (prefix `ec-sp-`, distinct from
 * the checkout's `ec-co-`). Consumes the Brand System v2 tokens from tokens.css
 * (loaded globally) so the microsite reads as a native, premium store section:
 * Exo 2 display / Montserrat body / JetBrains Mono prices / Rajdhani labels,
 * indigo #444ce7 accent on a light surface, product-card price blue #273f87.
 *
 * Register: product (a search tool that serves the buyer). Strategy: restrained
 * (tinted neutrals + one indigo accent). Technical B2B precision over decoration.
 *
 * Fase Comercial Repuestos de Servidores — task #9 (microsite-ui).
 */

/* -----------------------------------------------------------------------------
 * Root scope
 * -------------------------------------------------------------------------- */
#ec-server-parts-root.ec-sp-page {
  --ec-sp-max: 1240px;
  --ec-sp-price: #273f87; /* store card/transfer price blue (.azul convention) */
  font-family: var(--ec-font-body);
  color: var(--ec-text-primary);
  box-sizing: border-box;
}
#ec-server-parts-root.ec-sp-page *,
#ec-server-parts-root.ec-sp-page *::before,
#ec-server-parts-root.ec-sp-page *::after {
  box-sizing: border-box;
}
.ec-sp-page [hidden] {
  display: none !important;
}
.ec-sp-page ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.ec-sp-page h1,
.ec-sp-page h2,
.ec-sp-page h3 {
  margin: 0;
  font-family: var(--ec-font-display);
}
/* Defensive resets: the microsite renders inside Woodmart's content area whose
 * a:hover / anchor styles (class+pseudo specificity) would otherwise underline
 * or recolor the card links. Overspecify to win against theme leakage. */
.ec-sp-page a,
.ec-sp-page a:hover,
.ec-sp-page a:focus {
  color: inherit;
  text-decoration: none;
}

/* -----------------------------------------------------------------------------
 * Hero — search-first
 * -------------------------------------------------------------------------- */
.ec-sp-hero {
  position: relative;
  padding: clamp(40px, 7vw, 80px) var(--sp-lg) clamp(32px, 5vw, 56px);
  background:
    radial-gradient(
      120% 140% at 50% -20%,
      color-mix(in oklab, var(--ec-primary) 12%, transparent) 0%,
      transparent 60%
    ),
    var(--ec-surface-3);
  border-bottom: 1px solid var(--ec-border);
  overflow: hidden;
}
/* Faint technical grid — atmosphere without decoration overload. */
.ec-sp-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(
      to right,
      color-mix(in oklab, var(--ec-primary) 6%, transparent) 1px,
      transparent 1px
    ),
    linear-gradient(
      to bottom,
      color-mix(in oklab, var(--ec-primary) 6%, transparent) 1px,
      transparent 1px
    );
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(
    120% 90% at 50% 0%,
    #000 0%,
    transparent 72%
  );
  mask-image: radial-gradient(120% 90% at 50% 0%, #000 0%, transparent 72%);
  pointer-events: none;
}
.ec-sp-hero__inner {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}
.ec-sp-hero__eyebrow {
  display: inline-block;
  margin-bottom: var(--sp-sm);
}
.ec-sp-hero__title {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 1.05;
  font-size: clamp(30px, 5.2vw, 52px);
  color: var(--ec-text-primary);
}
.ec-sp-hero__subtitle {
  margin: var(--sp-md) auto 0;
  max-width: 56ch;
  font-size: clamp(15px, 1.6vw, 18px);
  line-height: 1.55;
  color: var(--ec-text-secondary);
}
.ec-sp-hero__hint {
  margin-top: var(--sp-md);
  font-family: var(--ec-font-label);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ec-text-muted);
}

/* -----------------------------------------------------------------------------
 * Search box + typeahead
 * -------------------------------------------------------------------------- */
.ec-sp-search {
  position: relative;
  max-width: 620px;
  margin: clamp(20px, 3vw, 32px) auto 0;
  text-align: left;
}
.ec-sp-search__box {
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
  height: 60px;
  padding: 0 8px 0 18px;
  background: var(--ec-surface);
  border: 1.5px solid var(--ec-border);
  border-radius: var(--ec-r-xl);
  box-shadow: var(--ec-shadow-card);
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}
.ec-sp-search__box:focus-within {
  border-color: var(--ec-primary);
  box-shadow:
    var(--ec-shadow-card),
    0 0 0 4px color-mix(in oklab, var(--ec-primary) 16%, transparent);
}
.ec-sp-search__icon {
  flex-shrink: 0;
  color: var(--ec-text-muted);
}
.ec-sp-search__box:focus-within .ec-sp-search__icon {
  color: var(--ec-primary);
}
.ec-sp-search__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--ec-font-body);
  font-size: 16px; /* >=16px: no iOS auto-zoom */
  color: var(--ec-text-primary);
}
.ec-sp-search__input::placeholder {
  color: var(--ec-text-hint);
}
.ec-sp-search__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}
.ec-sp-search__btn {
  flex-shrink: 0;
  height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--ec-r-md);
  background: var(--ec-primary);
  color: #fff;
  font-family: var(--ec-font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background 0.16s ease,
    transform 0.12s ease;
}
.ec-sp-search__btn:hover {
  background: var(--ec-primary-dark);
}
.ec-sp-search__btn:active {
  transform: translateY(1px);
}

.ec-sp-typeahead {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 340px;
  overflow-y: auto;
  background: var(--ec-surface);
  border: 1px solid var(--ec-border);
  border-radius: var(--ec-r-lg);
  box-shadow: var(--ec-shadow-overlay);
  padding: 6px;
}
.ec-sp-ta__opt {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--sp-sm);
  padding: 10px 12px;
  border-radius: var(--ec-r-md);
  cursor: pointer;
  transition: background 0.12s ease;
}
.ec-sp-ta__opt:hover,
.ec-sp-ta__opt[aria-selected="true"] {
  background: var(--ec-primary-light);
}
.ec-sp-ta__token {
  font-family: var(--ec-font-mono);
  font-weight: 600;
  font-size: 14px;
  color: var(--ec-text-primary);
}
.ec-sp-ta__family {
  font-size: 12px;
  color: var(--ec-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ec-sp-ta__count {
  font-family: var(--ec-font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ec-primary-dark);
  background: color-mix(in oklab, var(--ec-primary) 12%, transparent);
  border-radius: var(--ec-r-pill);
  padding: 2px 9px;
  min-width: 26px;
  text-align: center;
}
.ec-sp-ta__msg {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--ec-text-muted);
  line-height: 1.4;
}

/* Typeahead groups (feedback #16 F7): a "Números de parte" group renders under
 * the model suggestions when the part-number search returns hits. */
.ec-sp-ta__group {
  padding: 9px 12px 3px;
  font-family: var(--ec-font-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  color: var(--ec-text-muted);
}
.ec-sp-ta__group:not(:first-child) {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--ec-border);
}
/* Part-number option: part id | title (truncates) | price + condition stack.
 * Reuses the base .ec-sp-ta__opt grid (auto 1fr auto). */
.ec-sp-ta__part-id {
  font-family: var(--ec-font-mono);
  font-weight: 600;
  font-size: 13px;
  color: var(--ec-primary-dark);
}
.ec-sp-ta__part-title {
  min-width: 0;
  font-size: 12px;
  color: var(--ec-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ec-sp-ta__part-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}
.ec-sp-ta__part-price {
  font-family: var(--ec-font-mono);
  font-weight: 600;
  font-size: 13px;
  color: var(--ec-sp-price);
  font-variant-numeric: tabular-nums;
}
.ec-sp-ta__part-cond {
  font-family: var(--ec-font-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: var(--ec-r-sm);
}
.ec-sp-ta__part-cond.is-new {
  background: var(--ec-primary-light);
  color: var(--ec-primary-dark);
}
.ec-sp-ta__part-cond.is-refurb {
  background: var(--ec-black);
  color: #fff;
}

/* -----------------------------------------------------------------------------
 * Landing (tiles + brands + intro)
 * -------------------------------------------------------------------------- */
.ec-sp-landing {
  max-width: var(--ec-sp-max);
  margin: 0 auto;
  padding: clamp(36px, 5vw, 64px) var(--sp-lg) clamp(48px, 6vw, 80px);
}
.ec-sp-section-head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-md);
  margin-bottom: var(--sp-lg);
}
.ec-sp-section-head:not(:first-child) {
  margin-top: clamp(36px, 4vw, 56px);
}
.ec-sp-section-title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: clamp(18px, 2.4vw, 24px);
  color: var(--ec-text-primary);
}
.ec-sp-section-title::after {
  content: "";
  display: block;
  width: 44px;
  height: 3px;
  margin-top: 10px;
  background: var(--ec-primary);
  border-radius: var(--ec-r-pill);
}

/* Component-type tiles: compact icon + label rows (not big identical cards). */
.ec-sp-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: var(--sp-sm);
}
.ec-sp-tile {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 14px 16px;
  background: var(--ec-surface);
  border: 1px solid var(--ec-border);
  border-radius: var(--ec-r-lg);
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.12s ease;
}
.ec-sp-tile:hover {
  border-color: color-mix(in oklab, var(--ec-primary) 45%, var(--ec-border));
  box-shadow: var(--ec-shadow-card);
  transform: translateY(-2px);
}
.ec-sp-tile__icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--ec-r-md);
  background: var(--ec-primary-light);
  color: var(--ec-primary-dark);
}
.ec-sp-tile__label {
  flex: 1 1 auto;
  font-family: var(--ec-font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  line-height: 1.25;
  color: var(--ec-text-primary);
}
.ec-sp-tile__arrow {
  flex-shrink: 0;
  color: var(--ec-text-hint);
  transition:
    transform 0.16s ease,
    color 0.16s ease;
}
.ec-sp-tile:hover .ec-sp-tile__arrow {
  color: var(--ec-primary);
  transform: translateX(3px);
}

/* Brand chips */
.ec-sp-brands {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
}
.ec-sp-brand {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  border: 1px solid var(--ec-border);
  border-radius: var(--ec-r-pill);
  background: var(--ec-surface);
  font-family: var(--ec-font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.03em;
  color: var(--ec-text-secondary);
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    color 0.16s ease,
    background 0.16s ease;
}
.ec-sp-brand:hover {
  border-color: var(--ec-primary);
  color: var(--ec-primary-dark);
  background: var(--ec-primary-light);
}

/* Intro SEO prose */
.ec-sp-intro {
  margin-top: clamp(40px, 5vw, 64px);
  padding-top: clamp(28px, 3vw, 40px);
  border-top: 1px solid var(--ec-border);
  max-width: 74ch;
}
.ec-sp-intro__p {
  margin: 0 0 var(--sp-md);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ec-text-secondary);
}
.ec-sp-intro__p:last-child {
  margin-bottom: 0;
}

/* -----------------------------------------------------------------------------
 * Results wrapper
 * -------------------------------------------------------------------------- */
.ec-sp-results-wrap {
  max-width: var(--ec-sp-max);
  margin: 0 auto;
  padding: clamp(24px, 3vw, 40px) var(--sp-lg) clamp(48px, 6vw, 80px);
}
.ec-sp-results-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  flex-wrap: wrap;
  padding-bottom: var(--sp-md);
  margin-bottom: var(--sp-lg);
  border-bottom: 1px solid var(--ec-border);
}
.ec-sp-results-title {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--ec-font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  font-size: clamp(16px, 2vw, 22px);
  line-height: 1.2;
  color: var(--ec-text-primary);
}
.ec-sp-filters-toggle {
  display: none; /* shown on mobile */
  position: relative;
}
.ec-sp-filters-toggle__count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  margin-left: 2px;
  border-radius: var(--ec-r-pill);
  background: var(--ec-primary);
  color: #fff;
  font-family: var(--ec-font-mono);
  font-size: 11px;
  font-weight: 600;
}
.ec-sp-sort {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  flex-shrink: 0;
}
.ec-sp-sort__label {
  font-family: var(--ec-font-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--ec-text-muted);
}
.ec-sp-sort__select {
  height: 40px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--ec-border);
  border-radius: var(--ec-r-md);
  background: var(--ec-surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2375768a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  font-family: var(--ec-font-body);
  font-size: 13px;
  color: var(--ec-text-primary);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.ec-sp-sort__select:focus-visible {
  outline: 0;
  border-color: var(--ec-primary);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ec-primary) 18%, transparent);
}

/* Layout: sidebar + grid */
.ec-sp-results-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: clamp(20px, 3vw, 36px);
  align-items: start;
}

/* -----------------------------------------------------------------------------
 * Facet sidebar
 * -------------------------------------------------------------------------- */
.ec-sp-filters {
  position: sticky;
  top: 90px;
  /* Cap the sticky column to the viewport so a fully expanded sidebar scrolls
   * on its own instead of running past the fold (mobile overrides this below). */
  max-height: calc(100vh - 108px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.ec-sp-filters__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-md);
  padding-bottom: var(--sp-sm);
  border-bottom: 1px solid var(--ec-border);
}
.ec-sp-filters__title {
  font-family: var(--ec-font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 14px;
  color: var(--ec-text-primary);
}
.ec-sp-filters__clear {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: var(--ec-font-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  color: var(--ec-primary);
  padding: 4px 6px;
  border-radius: var(--ec-r-sm);
  transition: background 0.14s ease;
}
.ec-sp-filters__clear:hover {
  background: var(--ec-primary-light);
}

.ec-sp-facet {
  border-bottom: 1px solid var(--ec-border);
}
.ec-sp-facet:last-child {
  border-bottom: 0;
}
/* Accordion header (feedback #16 F6): the whole row toggles the facet open. */
.ec-sp-facet__heading {
  margin: 0;
}
.ec-sp-facet__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
  width: 100%;
  padding: 14px 2px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  border-radius: var(--ec-r-sm);
}
.ec-sp-facet__toggle:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ec-primary) 20%, transparent);
}
.ec-sp-facet__title {
  font-family: var(--ec-font-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--ec-text-muted);
}
.ec-sp-facet__toggle:hover .ec-sp-facet__title {
  color: var(--ec-text-secondary);
}
.ec-sp-facet__chevron {
  flex-shrink: 0;
  color: var(--ec-text-hint);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.ec-sp-facet.is-open .ec-sp-facet__chevron {
  transform: rotate(180deg);
}
/* Body collapsed by default; class-toggled (not [hidden], which the module's
 * global `[hidden]{display:none!important}` would otherwise pin shut). */
.ec-sp-facet__body {
  display: none;
  padding-bottom: 12px;
}
.ec-sp-facet.is-open .ec-sp-facet__body {
  display: block;
}
.ec-sp-facet__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ec-sp-facet__opt {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  width: 100%;
  padding: 8px 8px;
  border: 0;
  background: transparent;
  border-radius: var(--ec-r-sm);
  cursor: pointer;
  text-align: left;
  transition: background 0.14s ease;
}
.ec-sp-facet__opt:hover {
  background: var(--ec-surface-2);
}
.ec-sp-facet__box {
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  border: 1.5px solid var(--ec-border-hover);
  border-radius: 5px;
  background: var(--ec-surface);
  position: relative;
  transition:
    border-color 0.14s ease,
    background 0.14s ease;
}
.ec-sp-facet__opt.is-active .ec-sp-facet__box {
  border-color: var(--ec-primary);
  background: var(--ec-primary);
}
.ec-sp-facet__opt.is-active .ec-sp-facet__box::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.ec-sp-facet__name {
  flex: 1 1 auto;
  font-size: 13px;
  line-height: 1.35;
  color: var(--ec-text-secondary);
}
.ec-sp-facet__opt.is-active .ec-sp-facet__name {
  color: var(--ec-text-primary);
  font-weight: 600;
}
.ec-sp-facet__count {
  flex-shrink: 0;
  font-family: var(--ec-font-mono);
  font-size: 12px;
  color: var(--ec-text-hint);
  font-variant-numeric: tabular-nums;
}

/* Top-N + "Ver más" (feedback #16 F6): options past the 8th stay hidden until
 * the facet is expanded, keeping the sidebar short and coherent with the grid. */
.ec-sp-facet__item.is-overflow {
  display: none;
}
.ec-sp-facet.is-expanded .ec-sp-facet__item.is-overflow {
  display: block;
}
.ec-sp-facet__more {
  margin-top: 6px;
  padding: 5px 8px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: var(--ec-font-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  color: var(--ec-primary);
  border-radius: var(--ec-r-sm);
  transition: background 0.14s ease;
}
.ec-sp-facet__more:hover {
  background: var(--ec-primary-light);
}
.ec-sp-facet__more:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ec-primary) 20%, transparent);
}

/* Mobile-only apply button. Scoped with .ec-sp-page so the desktop `display:none`
 * outranks the global `.ec-cta` display and the button never leaks onto desktop. */
.ec-sp-page .ec-sp-filters__apply {
  display: none;
  width: 100%;
  justify-content: center;
  margin-top: var(--sp-md);
}

/* -----------------------------------------------------------------------------
 * Product grid + cards
 * -------------------------------------------------------------------------- */
.ec-sp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: var(--sp-md);
}
.ec-sp-card {
  display: flex;
  flex-direction: column;
  background: var(--ec-surface);
  border: 1px solid var(--ec-border);
  border-radius: var(--ec-r-lg);
  overflow: hidden;
  text-decoration: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.14s ease;
}
.ec-sp-card:hover {
  border-color: var(--ec-border-hover);
  box-shadow: var(--ec-shadow-card-hover);
  transform: translateY(-3px);
}
.ec-sp-card__media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--ec-surface-3);
  border-bottom: 1px solid var(--ec-border);
}
.ec-sp-card__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
  display: block;
}
div.ec-sp-card__img.ec-ph {
  padding: 0;
  min-height: 100%;
  display: grid;
  place-items: center;
}
.ec-sp-card__cond {
  position: absolute;
  top: 10px;
  left: 10px;
  font-family: var(--ec-font-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  padding: 4px 8px;
  border-radius: var(--ec-r-sm);
}
.ec-sp-card__cond.is-new {
  background: var(--ec-primary-light);
  color: var(--ec-primary-dark);
}
.ec-sp-card__cond.is-refurb {
  background: var(--ec-black);
  color: #fff;
}
.ec-sp-card__body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px;
  flex: 1 1 auto;
}
.ec-sp-card__brand {
  font-family: var(--ec-font-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  color: var(--ec-text-muted);
}
.ec-sp-card__sku {
  font-family: var(--ec-font-mono);
  font-size: 11px;
  color: var(--ec-text-hint);
}
.ec-sp-card__title {
  font-family: var(--ec-font-body);
  font-weight: 500;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ec-text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ec-sp-card__foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-xs);
  margin-top: auto;
  padding-top: var(--sp-xs);
}
.ec-sp-card__price {
  font-family: var(--ec-font-mono);
  font-weight: 600;
  font-size: 16px;
  color: var(--ec-sp-price);
  font-variant-numeric: tabular-nums;
}
.ec-sp-card__stock {
  font-family: var(--ec-font-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10px;
  white-space: nowrap;
}
.ec-sp-card__stock.is-in {
  color: var(--ec-success);
}
.ec-sp-card__stock.is-out {
  color: var(--ec-text-hint);
}

/* Skeleton cards */
.ec-sp-card--skel {
  pointer-events: none;
}
.ec-sp-card--skel .ec-sp-card__media {
  border-bottom: 0;
}
.ec-sp-card--skel .ec-sp-card__body {
  gap: 8px;
}

/* Staggered reveal */
@media (prefers-reduced-motion: no-preference) {
  .ec-sp-card--in {
    animation: ecSpCardIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) backwards;
    animation-delay: calc(var(--ec-sp-i, 0) * 40ms);
  }
  @keyframes ecSpCardIn {
    from {
      opacity: 0;
      transform: translateY(12px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* -----------------------------------------------------------------------------
 * Pagination
 * -------------------------------------------------------------------------- */
.ec-sp-pagination:empty {
  display: none;
}
.ec-sp-pagination {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-sm);
  margin-top: clamp(28px, 4vw, 44px);
}
.ec-sp-page-status {
  font-family: var(--ec-font-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  color: var(--ec-text-muted);
}
.ec-sp-page-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.ec-sp-page-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--ec-border);
  border-radius: var(--ec-r-md);
  background: var(--ec-surface);
  color: var(--ec-text-secondary);
  font-family: var(--ec-font-display);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  justify-content: center;
  transition:
    border-color 0.14s ease,
    background 0.14s ease,
    color 0.14s ease;
}
.ec-sp-page-btn:hover:not([disabled]):not(.is-current) {
  border-color: var(--ec-primary);
  color: var(--ec-primary-dark);
}
.ec-sp-page-btn.is-current {
  background: var(--ec-primary);
  border-color: var(--ec-primary);
  color: #fff;
  cursor: default;
}
.ec-sp-page-btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}
.ec-sp-page-prev span,
.ec-sp-page-next span {
  display: none;
}
.ec-sp-page-gap {
  color: var(--ec-text-hint);
  padding: 0 2px;
}

/* -----------------------------------------------------------------------------
 * States (empty / error) — wrap the shared .ec-empty
 * -------------------------------------------------------------------------- */
.ec-sp-state {
  grid-column: 1 / -1;
  border: 1px dashed var(--ec-border);
  border-radius: var(--ec-r-xl);
  background: var(--ec-surface-3);
}
.ec-sp-state__cta,
.ec-sp-state .ec-cta {
  margin-top: var(--sp-xs);
  text-decoration: none;
}
.ec-sp-state__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  margin-top: var(--sp-xs);
}
.ec-sp-state__actions .ec-cta,
.ec-sp-state__actions .ec-cta-outline {
  margin-top: 0;
  text-decoration: none;
  cursor: pointer;
}

/* -----------------------------------------------------------------------------
 * Mobile filters drawer backdrop
 * -------------------------------------------------------------------------- */
.ec-sp-backdrop {
  position: fixed;
  inset: 0;
  /* Above the store's fixed mobile chrome: PWA banner (z 9050) + bottom tabs
   * (z 9001) + chrome overlays (z 9100). Below Woodmart off-canvas (99999). */
  z-index: 9200;
  background: rgba(6, 6, 6, 0.5);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
}

/* Explicit close (×) for the mobile drawer — always reachable in the sticky
 * head, independent of the backdrop / apply button. Hidden on desktop.
 * Scoped with .ec-sp-page so `display:none` outranks Woodmart's global
 * `:is(button,...)` display:inline-flex, which otherwise leaks this button onto
 * desktop as a bare grey square (invisible before the SVG width fix above). */
.ec-sp-page .ec-sp-filters__close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 0;
  border-radius: var(--ec-r-md);
  background: var(--ec-surface-2);
  color: var(--ec-text-secondary);
  cursor: pointer;
  transition:
    background 0.14s ease,
    color 0.14s ease;
}
.ec-sp-filters__close:hover {
  background: var(--ec-border);
  color: var(--ec-text-primary);
}
/* The X itself. Woodmart's global SVG rules collapse an unsized inline SVG that
 * sits as a bare flex child to width:0 (height survives), which rendered the
 * close button as a solid grey square with no visible X. Pin the dimensions so
 * the icon always draws regardless of theme leakage. */
.ec-sp-filters__close svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

/* -----------------------------------------------------------------------------
 * Responsive
 * -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .ec-sp-results-layout {
    grid-template-columns: 210px minmax(0, 1fr);
    gap: var(--sp-lg);
  }
}

@media (max-width: 860px) {
  /* Sidebar becomes a bottom-sheet drawer. */
  .ec-sp-results-layout {
    grid-template-columns: 1fr;
  }
  .ec-sp-filters-toggle {
    display: inline-flex;
  }
  .ec-sp-filters {
    position: fixed;
    /* Above the store's fixed mobile chrome (bottom tabs z 9001, PWA banner
     * z 9050); the panel's opaque background then hides the bottom nav in its
     * area so the apply button is tappable, not occluded. */
    z-index: 9201;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    max-height: 82vh;
    overflow-y: auto;
    margin: 0;
    padding: var(--sp-lg) var(--sp-lg)
      calc(var(--sp-lg) + env(safe-area-inset-bottom, 0px));
    background: var(--ec-surface);
    border-top-left-radius: var(--ec-r-2xl);
    border-top-right-radius: var(--ec-r-2xl);
    box-shadow: var(--ec-shadow-overlay);
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .ec-sp-filters.is-open {
    transform: translateY(0);
  }
  .ec-sp-filters-open .ec-sp-backdrop {
    opacity: 1;
    visibility: visible;
  }
  .ec-sp-page .ec-sp-filters__apply {
    display: inline-flex;
    position: sticky;
    bottom: 0;
  }
  .ec-sp-filters__head {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--ec-surface);
  }
  .ec-sp-page .ec-sp-filters__close {
    display: inline-flex;
  }
}

@media (max-width: 560px) {
  .ec-sp-search__box {
    height: 56px;
    padding-left: 14px;
  }
  .ec-sp-search__btn {
    padding: 0 14px;
  }
  .ec-sp-tiles {
    grid-template-columns: 1fr 1fr;
  }
  .ec-sp-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-sm);
  }
  .ec-sp-card__body {
    padding: 11px;
  }
  .ec-sp-card__price {
    font-size: 15px;
  }
  /* Stack price over stock in the 2-col grid so the long CLP price never
   * squeezes / clips the stock chip (QA #26). */
  .ec-sp-card__foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }
  .ec-sp-card__stock {
    font-size: 9px;
  }
  .ec-sp-results-bar {
    gap: var(--sp-sm);
  }
  .ec-sp-results-title {
    order: 3;
    flex-basis: 100%;
  }
}

@media (max-width: 380px) {
  .ec-sp-tiles {
    grid-template-columns: 1fr;
  }
  .ec-sp-search__btn {
    font-size: 0;
    padding: 0 12px;
  }
  .ec-sp-search__btn::after {
    content: "\2192";
    font-size: 20px;
    line-height: 1;
  }
}

/* Reduced motion: neutralize hover transforms + drawer/reveal easing */
@media (prefers-reduced-motion: reduce) {
  .ec-sp-page [class*="ec-sp-"] {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .ec-sp-tile:hover,
  .ec-sp-card:hover {
    transform: none;
  }
}
