/* Search Parts BMW - V0.2.1 theme integration
   Scoped CSS : all rules are prefixed with .spb- to avoid impacting the shop theme. */
:root {
  --spb-red: #b10f18;
  --spb-red-dark: #830910;
  --spb-black: #1f1f1f;
  --spb-text: #2b2b2b;
  --spb-muted: #6e6e6e;
  --spb-line: #e7e7e7;
  --spb-bg: #f6f6f6;
  --spb-radius: 6px;
  --spb-shadow: 0 8px 22px rgba(0, 0, 0, .08);
}

.spb-page,
.spb-selector-block {
  color: var(--spb-text);
  margin-top: 1.5rem;
  margin-bottom: 2rem;
}

.spb-page a,
.spb-selector-block a {
  text-decoration: none;
}

.spb-card-shell {
  border: 1px solid rgba(0,0,0,.08);
  border-radius: var(--spb-radius);
  box-shadow: var(--spb-shadow);
}

.spb-hero,
.spb-selector-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .85fr);
  gap: 1.5rem;
  align-items: stretch;
  overflow: hidden;
  background:
    radial-gradient(circle at 95% 15%, rgba(255,255,255,.16) 0, rgba(255,255,255,.16) 68px, transparent 70px),
    linear-gradient(135deg, #171717 0%, #262626 54%, #b10f18 100%);
  color: #fff;
  padding: clamp(1.1rem, 2.5vw, 2rem);
}

.spb-hero::after,
.spb-selector-inner::after {
  content: "BMW";
  position: absolute;
  right: 1.5rem;
  bottom: -.45rem;
  color: rgba(255,255,255,.055);
  font-size: clamp(4rem, 12vw, 9rem);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -.08em;
  pointer-events: none;
}

.spb-hero-main,
.spb-search-panel,
.spb-selector-text,
.spb-selector-form {
  position: relative;
  z-index: 1;
}

.spb-back {
  display: inline-flex;
  align-items: center;
  margin-bottom: .6rem;
  color: rgba(255,255,255,.82) !important;
  font-size: .9rem;
}
.spb-back:hover { color: #fff !important; text-decoration: underline; }

.spb-kicker,
.spb-section-kicker {
  display: inline-block;
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.spb-kicker { color: #fff; opacity: .88; }
.spb-section-kicker { color: var(--spb-red); margin-bottom: .2rem; }

.spb-hero h1 {
  color: #fff;
  font-size: clamp(1.8rem, 3.4vw, 3rem);
  line-height: 1.04;
  margin: .3rem 0 .75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -.035em;
}

.spb-hero p {
  max-width: 760px;
  color: rgba(255,255,255,.9);
  font-size: 1.03rem;
  line-height: 1.55;
  margin: 0;
}

.spb-hero-badges,
.spb-badges {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}
.spb-hero-badges { margin-top: 1.1rem; }

.spb-hero-badges span,
.spb-badges span {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
  padding: .28rem .64rem;
}
.spb-hero-badges span { background: rgba(255,255,255,.14); color: #fff; }
.spb-badges span { background: #f0f0f0; color: #333; }
.spb-badges span:first-child { background: var(--spb-black); color: #fff; }
.spb-badges span:nth-child(2) { background: #f7e5e7; color: var(--spb-red-dark); }

.spb-search-panel {
  align-self: center;
  color: var(--spb-text);
  background: #fff;
  border-radius: var(--spb-radius);
  padding: 1.1rem;
  box-shadow: 0 12px 30px rgba(0,0,0,.18);
}

.spb-main-form,
.spb-search-form { display: flex; flex-direction: column; gap: .65rem; }
.spb-main-form label { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #444; margin: 0; }
.spb-form-row,
.spb-search-row,
.spb-selector-form { display: flex; gap: .65rem; align-items: stretch; }

.spb-main-form select,
.spb-selector-form select,
.spb-search-form input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 46px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  background: #fff;
  color: #333;
  padding: .78rem .88rem;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.spb-main-form select:focus,
.spb-selector-form select:focus,
.spb-search-form input:focus {
  border-color: var(--spb-red);
  box-shadow: 0 0 0 3px rgba(177,15,24,.12);
}

.spb-btn-primary,
.spb-main-form button,
.spb-selector-form button,
.spb-search-form button,
.spb-product-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 0;
  border-radius: 4px;
  background: var(--spb-red);
  color: #fff !important;
  padding: .78rem 1.05rem;
  cursor: pointer;
  text-align: center;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
  transition: background .16s ease, transform .16s ease, box-shadow .16s ease;
}
.spb-btn-primary:hover,
.spb-main-form button:hover,
.spb-selector-form button:hover,
.spb-search-form button:hover,
.spb-product-button:hover {
  background: var(--spb-red-dark);
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 7px 16px rgba(177,15,24,.22);
}

.spb-mini-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .45rem;
  margin-top: .8rem;
}
.spb-mini-steps span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  background: #f6f6f6;
  border: 1px solid #eee;
  border-radius: 4px;
  color: #555;
  font-size: .78rem;
  padding: .45rem .35rem;
}
.spb-mini-steps b {
  display: inline-flex;
  width: 19px;
  height: 19px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--spb-red);
  color: #fff;
  font-size: .72rem;
}

.spb-intro-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: .85rem;
  margin-top: 1rem;
}
.spb-info-card {
  background: #fff;
  border: 1px solid var(--spb-line);
  border-radius: var(--spb-radius);
  padding: 1rem;
  box-shadow: 0 4px 14px rgba(0,0,0,.04);
}
.spb-info-card strong { display: block; color: #222; font-size: .98rem; text-transform: uppercase; margin-bottom: .25rem; }
.spb-info-card span { color: var(--spb-muted); font-size: .9rem; line-height: 1.45; }

.spb-section { margin-top: 1.65rem; }
.spb-section-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: .95rem;
  padding-bottom: .75rem;
  border-bottom: 2px solid #ececec;
}
.spb-section-title h2,
.spb-results-head h2 {
  margin: 0;
  color: #222;
  font-size: 1.38rem;
  line-height: 1.18;
  text-transform: uppercase;
  font-weight: 900;
}
.spb-section-title p {
  margin: 0;
  color: var(--spb-muted);
  text-align: right;
  max-width: 560px;
  font-size: .93rem;
}

.spb-range-grid,
.spb-version-grid,
.spb-family-grid,
.spb-product-grid {
  display: grid;
  gap: .9rem;
}
.spb-range-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }
.spb-version-grid { grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); }
.spb-family-grid { grid-template-columns: repeat(auto-fill, minmax(188px, 1fr)); }
.spb-product-grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

.spb-range-card,
.spb-version-card,
.spb-family-card,
.spb-product-card,
.spb-empty,
.spb-toolbar {
  background: #fff;
  border: 1px solid var(--spb-line);
  border-radius: var(--spb-radius);
  box-shadow: 0 4px 14px rgba(0,0,0,.045);
}
.spb-range-card,
.spb-version-card,
.spb-family-card {
  color: inherit !important;
  text-decoration: none !important;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.spb-range-card:hover,
.spb-version-card:hover,
.spb-family-card:hover,
.spb-product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(0,0,0,.09);
  border-color: rgba(177,15,24,.35);
}

.spb-range-card {
  position: relative;
  min-height: 112px;
  padding: 1rem .95rem .95rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .25rem;
  overflow: hidden;
}
.spb-range-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--spb-red);
}
.spb-section-classic .spb-range-card::before { background: #333; }
.spb-range-icon {
  position: absolute;
  right: .65rem;
  bottom: -.45rem;
  color: rgba(0,0,0,.055);
  font-size: 4.25rem;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}
.spb-range-name { position: relative; display: block; color: #222; font-size: 1.22rem; font-weight: 900; }
.spb-range-meta { position: relative; color: var(--spb-muted); font-size: .78rem; line-height: 1.28; }

.spb-version-card {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-height: 118px;
}
.spb-version-card strong { color: #222; font-size: 1.05rem; }
.spb-version-card span,
.spb-version-card small { color: var(--spb-muted); font-size: .86rem; }

.spb-family-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  min-height: 210px;
  padding: .95rem;
  overflow: hidden;
}
.spb-family-code {
  position: absolute;
  z-index: 2;
  top: .75rem;
  left: .75rem;
  border-radius: 999px;
  padding: .22rem .58rem;
  background: var(--spb-red);
  color: #fff;
  font-weight: 900;
  font-size: .8rem;
}
.spb-family-img-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 112px;
  margin-top: .3rem;
  background: linear-gradient(180deg, #fafafa 0%, #f2f2f2 100%);
  border-radius: 5px;
  border: 1px solid #eee;
}
.spb-family-card img { max-width: 92%; max-height: 92px; object-fit: contain; }
.spb-family-card strong { color: #222; font-size: 1rem; line-height: 1.25; }
.spb-family-card small { color: var(--spb-muted); }

.spb-toolbar {
  display: grid;
  grid-template-columns: 1fr minmax(310px, 530px);
  align-items: center;
  gap: 1rem;
  margin: 1.35rem 0 1rem;
  padding: 1rem;
}
.spb-toolbar-text strong { display: block; color: #222; text-transform: uppercase; font-size: .98rem; }
.spb-toolbar-text span { display: block; color: var(--spb-muted); font-size: .9rem; }

.spb-results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.1rem 0 .75rem;
}
.spb-results-head span { color: var(--spb-muted); font-size: .9rem; }

.spb-product-card {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: .95rem;
  padding: .95rem;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.spb-product-image {
  width: 118px;
  height: 118px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 5px;
  background: #f7f7f7;
  color: #777;
  font-size: .78rem;
  text-align: center;
}
.spb-product-image img { width: 100%; height: 100%; object-fit: contain; }
.spb-product-content { min-width: 0; display: flex; flex-direction: column; gap: .35rem; }
.spb-product-title { color: #222 !important; font-weight: 900; line-height: 1.25; }
.spb-product-title:hover { color: var(--spb-red) !important; }
.spb-product-ref,
.spb-product-oem { color: var(--spb-muted); font-size: .84rem; }
.spb-product-bottom { display: flex; gap: .7rem; align-items: baseline; justify-content: space-between; margin-top: auto; }
.spb-product-bottom strong { color: var(--spb-red); font-size: 1.08rem; }
.spb-product-bottom small { color: #555; }
.spb-product-bottom small.is-stock { color: #287a36; font-weight: 700; }
.spb-product-bottom small.is-order { color: #8b6b00; font-weight: 700; }
.spb-product-button { width: fit-content; min-height: auto; margin-top: .45rem; padding: .62rem .86rem; font-size: .78rem; }

.spb-empty {
  margin-top: 1rem;
  padding: 1rem;
  color: #555;
}

.spb-selector-block { margin-top: 1.2rem; margin-bottom: 1.2rem; }
.spb-selector-inner { grid-template-columns: minmax(0, 1fr) minmax(300px, .8fr); padding: 1.1rem; }
.spb-selector-text strong { display: block; color: #fff; font-size: 1.25rem; line-height: 1.2; text-transform: uppercase; font-weight: 900; }
.spb-selector-text span:last-child { display: block; color: rgba(255,255,255,.86); margin-top: .25rem; }

@media (max-width: 991px) {
  .spb-hero,
  .spb-selector-inner,
  .spb-toolbar { grid-template-columns: 1fr; }
  .spb-section-title { align-items: flex-start; flex-direction: column; }
  .spb-section-title p { text-align: left; }
  .spb-intro-grid { grid-template-columns: 1fr; }
}

@media (max-width: 575px) {
  .spb-page,
  .spb-selector-block { margin-left: .25rem; margin-right: .25rem; }
  .spb-hero,
  .spb-selector-inner { padding: 1rem; }
  .spb-form-row,
  .spb-search-row,
  .spb-selector-form { flex-direction: column; }
  .spb-mini-steps { grid-template-columns: 1fr; }
  .spb-product-card { grid-template-columns: 1fr; }
  .spb-product-image { width: 100%; height: 170px; }
  .spb-results-head { align-items: flex-start; flex-direction: column; }
}

/* V0.2.2 - Blocs Creative Elements / Elementor */
.spb-ce-wrapper,
.spb-ce-block {
  box-sizing: border-box;
}

.spb-ce-wrapper {
  width: 100%;
}

.spb-ce-block {
  margin: 0 auto 2rem;
}

.spb-ce-searchbox {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 470px);
  gap: 1.5rem;
  align-items: center;
  padding: 2rem;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 18px;
  background: linear-gradient(135deg, #fff 0%, #f7f7f7 100%);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .08);
}

.spb-ce-searchbox__content h2 {
  margin: .35rem 0 .75rem;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  line-height: 1.12;
  font-weight: 800;
  color: #1d1d1b;
}

.spb-ce-searchbox__content p {
  margin: 0;
  max-width: 720px;
  color: #555;
  font-size: 1rem;
  line-height: 1.6;
}

.spb-ce-searchbox__form {
  display: flex;
  gap: .75rem;
  padding: .75rem;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
}

.spb-ce-searchbox__form select {
  min-width: 0;
  flex: 1 1 auto;
  height: 48px;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 0 .9rem;
  background: #fff;
}

.spb-ce-searchbox__form .spb-btn-primary {
  flex: 0 0 auto;
  white-space: nowrap;
}

.spb-ce-model-grids {
  display: grid;
  gap: 1.6rem;
}

.spb-ce-range-section {
  padding: 1.5rem;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .05);
}

.spb-section-heading {
  margin-bottom: 1rem;
}

.spb-section-heading h3 {
  margin: .25rem 0 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: #1d1d1b;
}

.spb-range-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
}

.spb-range-grid--compact .spb-range-card {
  min-height: 92px;
  justify-content: center;
  text-align: center;
}

@media (max-width: 767px) {
  .spb-ce-searchbox {
    grid-template-columns: 1fr;
    padding: 1.25rem;
  }

  .spb-ce-searchbox__form {
    flex-direction: column;
  }

  .spb-ce-searchbox__form .spb-btn-primary {
    width: 100%;
  }

  .spb-ce-range-section {
    padding: 1rem;
  }
}

/* V0.2.4 - navigation intégrée Creative Elements */
.spb-ce-dynamic { width: 100%; }
.spb-ce-topline { margin-bottom: 14px; }
.spb-ce-range-choice,
.spb-ce-family-choice,
.spb-ce-results { margin-top: 22px; }
.spb-ce-dynamic .spb-section-title h2 { margin-top: 0; }


/* V0.2.8 - listing produits façon boutique + images de gammes */
.spb-product-grid {
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 20px;
  align-items: stretch;
}

.spb-product-card--shop {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 18px 14px 16px;
  border: 1px solid #dedede;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.04);
  text-align: center;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.spb-product-card--shop:hover {
  transform: translateY(-2px);
  border-color: #cfcfcf;
  box-shadow: 0 8px 18px rgba(0,0,0,.08);
}

.spb-product-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 23px;
  margin-bottom: 10px;
  color: #1f1f1f;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.1;
}

.spb-product-card--shop .spb-product-title {
  display: -webkit-box;
  min-height: 42px;
  margin: 0 0 10px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: #111 !important;
  font-size: .9rem;
  font-weight: 900;
  line-height: 1.15;
  text-transform: uppercase;
}

.spb-product-card--shop .spb-product-image {
  width: 100%;
  height: 178px;
  margin: 0 auto 12px;
  border: 0;
  border-radius: 8px;
  background: #f8f8f8;
}

.spb-product-card--shop .spb-product-image img {
  width: 100%;
  height: 100%;
  padding: 8px;
  object-fit: contain;
}

.spb-product-card--shop .spb-product-ref,
.spb-product-card--shop .spb-product-oem {
  margin: 0 0 6px;
  color: #6f6f6f;
  font-size: .76rem;
  line-height: 1.25;
  text-transform: uppercase;
}

.spb-product-card--shop .spb-product-ref strong {
  color: #111;
  font-weight: 900;
}

.spb-product-card--shop .spb-product-oem {
  text-transform: none;
  font-size: .74rem;
}

.spb-product-price {
  margin: 8px 0 14px;
  color: #050505;
  font-size: 1.38rem;
  font-weight: 900;
  line-height: 1;
}

.spb-product-add {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-top: auto;
  padding: 10px 12px;
  border-radius: 7px;
  background: #161616;
  color: #fff !important;
  font-size: .86rem;
  font-weight: 900;
  line-height: 1.1;
  text-decoration: none !important;
  transition: background .15s ease, transform .15s ease;
}

.spb-product-add:hover {
  background: #000;
  color: #fff !important;
  transform: translateY(-1px);
}

.spb-product-details {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin-top: 10px;
  padding: 8px 12px;
  border: 1px solid #d7d7d7;
  border-radius: 7px;
  background: #fff;
  color: #111 !important;
  font-size: .82rem;
  text-decoration: none !important;
}

.spb-product-details:hover {
  border-color: #111;
}

.spb-badges--product {
  justify-content: center;
  margin-top: 12px;
}

.spb-badges--product span {
  padding: .28rem .55rem;
  border: 1px solid #e3e3e3;
  background: #f6f6f6;
  color: #333;
  font-size: .7rem;
  text-transform: none;
}

.spb-range-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.spb-range-grid--compact .spb-range-card {
  min-height: 146px;
  padding: 14px 12px;
  justify-content: flex-start;
  text-align: center;
}

.spb-range-grid--compact .spb-range-card::before {
  width: 100%;
  height: 4px;
  right: 0;
  bottom: auto;
}

.spb-range-image {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 70px;
  margin-bottom: 10px;
  border-radius: 8px;
  background: linear-gradient(180deg, #fafafa, #f1f1f1);
  border: 1px solid #ededed;
  overflow: hidden;
}

.spb-range-image img {
  width: 100%;
  height: 100%;
  padding: 6px;
  object-fit: contain;
}

.spb-range-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #171717;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 900;
}

@media (min-width: 1200px) {
  .spb-product-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .spb-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .spb-product-card--shop {
    padding: 12px 9px;
  }
  .spb-product-card--shop .spb-product-image {
    height: 132px;
  }
  .spb-product-price {
    font-size: 1.12rem;
  }
  .spb-product-add,
  .spb-product-details {
    font-size: .76rem;
  }
}
