/*!
 * Schematic Parts – front.css
 * Build: 2025-12-02T23:55:00+02:00
 * Commit: sku-search-radius-override
 * Path: assets/front.css
 */

/* =========================================
   SP CSS kihid — teemad v/s SP
   ========================================= */
@layer base, theme, sp, sp-overrides;

/* =========================================
   BAAS: kõik SP komponendid
   ========================================= */
@layer sp {

/* ================================
   Muutujad (globaalsed)
   ================================ */
:root {
    /* külje-paddingud */
    --sp-pad-sm: 1rem;
    --sp-pad-md: 2rem;
    --sp-pad-lg: 2rem;
    --sp-pad-xl: 2rem;

    /* vahed ja mõõdud */
    --sp-gap-grid: 20px;
    --sp-meta-gap: 8px;
    --sp-thumb-pad: 10px;

    /* kontuur + varjud */
    --sp-border-color: #e6e8ec;
    --sp-border: 1px solid var(--sp-border-color);
    --sp-shadow-hover: 0 6px 20px rgba(0,0,0,0.1);

    /* fondid */
    --sp-fs-breadcrumbs: 14px;
    --sp-fs-block-no: 13px;
    --sp-fs-block-name: 14px;

    /* värvid */
    --sp-bg-card: #fff;
    --sp-muted-bg: #eeeff1;
    --sp-row-alt-bg: #fafbfc;

    /* nurgaraadius */
    --sp-radius: 10px;

    /* sticky offset */
    --sp-sticky-top: 0px;
    --sp-sticky-gap: 0px;

    /* brändivärv */
    --tm-red: #e10600;
    --tm-red-dark: #b00000;

    /* nupud (tabeli must variant jääb muutujasse, kuid nuppude värv on allpool üle sõidetud) */
    --sp-btn-bg: #111;
    --sp-btn-bg-hover: #000;
    --sp-btn-text: #fff;

    /* ATC ikoon – välisest meediafailist */
    --sp-cart-icon-url: url("https://new.schematic.parts/wp-content/uploads/2025/11/SP-shopping-cart.svg");

    /* Lightbox lõuendi padi */
    --sp-lb-pad: 12px;
}
body.admin-bar { --sp-sticky-top: 0px; }
.has-sticky-theme-header { --sp-sticky-top: 60px; }

/* ================================
   SP globaalkonteiner (kogu SP sisu)
   ================================ */
.sp-page {
  padding: var(--sp-pad-md);
  max-width: 1440px;
  margin-inline: auto;
  box-sizing: border-box;
}
@media (min-width: 768px)  { .sp-page { padding: var(--sp-pad-lg); } }
@media (min-width: 1200px) { .sp-page { padding: var(--sp-pad-xl); } }

/* Mobile: vähenda üldist ülaruumi ja külgi */
@media (max-width: 480px) {
  /* Trim Astra konteineri padja (H1 enne suur tühi ala) */
  .ast-plain-container .site-content > .ast-container { padding-top: 6px !important; }

  .sp-page {
    padding-top: 8px;            /* varem 2rem → liigne */
    padding-left: 10px;
    padding-right: 10px;
  }
}
@media (max-width: 360px) {
  .sp-page { padding-left: 8px; padding-right: 8px; }
}

/* H1 konteineri sees */
.sp-page > h1 {
  margin-top: 0;
  margin-bottom: 18px;
  line-height: 1.15;
}

/* ================================
   Breadcrumbs (ilma kastita)
   ================================ */
.sp-breadcrumbs {
    margin: 10px 0;
    font-size: var(--sp-fs-breadcrumbs);
    border: none;
    background: transparent;
    padding: 0;
}
/* Mobiilis veel kompaktsem */
@media (max-width: 480px) {
  .sp-breadcrumbs { margin: 6px 0; }
}

/* ================================
   Vehicle selector (responsive)
   ================================ */
.sp-selector .sp-select-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  margin: 10px 0;
  width: 100%;
}
.sp-selector select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 8px 36px 8px 10px;
  min-height: 38px;
}
@media (max-width: 1024px) {
  .sp-selector .sp-select-row { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
}
@media (max-width: 640px) {
  .sp-selector .sp-select-row { grid-template-columns: 1fr; }
}

/* Ühtlustatud väljad */
.sp-field,
.sp-selector select,
.sp-sku-search input[type="text"],
.sp-sku-search input[type="search"] {
  border: var(--sp-border);
  border-radius: var(--sp-radius);
  background: #fff;
  outline: none;
}

/* === Vertikaalne variant === */
.sp-selector.is-vertical { display: block; width: 100%; max-width: 420px; }
.sp-selector.is-vertical .sp-field-block { display: block; margin: 0 0 12px 0; }
.sp-selector.is-vertical .sp-field-block:last-child { margin-bottom: 0; }
.sp-selector.is-vertical .sp-label { display: block; margin: 0 0 6px 2px; font-weight: 600; font-size: 14px; line-height: 1.2; }
.sp-selector.is-vertical select.sp-sel { width: 100%; min-height: 40px; padding: 8px 36px 8px 10px; }
.sp-selector.is-vertical select:disabled { opacity: .6; cursor: not-allowed; }

/* ================================
   SKU search (input + flyout)
   ================================ */
.sp-sku-search { position: relative; margin: 10px 0 20px; }
.sp-sku-search input[type="text"],
.sp-sku-search input[type="search"],
#sp-sku {
    height: 40px;
    padding: 8px 12px;
    width: 100%;
    box-sizing: border-box;
}
#sp-sku-fly-dd {
  position: fixed;
  display: none;
  z-index: 100000;
  min-width: 260px;
  max-width: 600px;
  max-height: 60vh;
  overflow: auto;
  background: #fff;
  border: var(--sp-border);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  border-radius: 8px;
  padding: 4px 0;
  font-size: 14px;
  line-height: 1.35;
  box-sizing: border-box;
}
#sp-sku-fly-dd .sp-item { list-style: none; margin: 0; padding: 0; }
#sp-sku-fly-dd a.sp-link { display: flex; gap: 10px; align-items: center; padding: 8px 12px; text-decoration: none; color: inherit; }
#sp-sku-fly-dd a.sp-link img.sp-thumb { width: 32px; height: 32px; object-fit: cover; flex: 0 0 32px; border-radius: 4px; }
#sp-sku-fly-dd .sku  { font-weight: 600; color: #111; }
#sp-sku-fly-dd .dash { opacity: .6; padding: 0 4px; }
#sp-sku-fly-dd .name { color: #222; }
#sp-sku-fly-dd a.sp-link:hover .sku,
#sp-sku-fly-dd a.sp-link:hover .name,
#sp-sku-fly-dd a.sp-link[data-active="1"] .sku,
#sp-sku-fly-dd a.sp-link[data-active="1"] .name { color: var(--tm-red); }
#sp-sku-fly-dd .sp-empty { padding: 10px 12px; color: #666; }

/* ================================
   Years grid
   ================================ */
.sp-years .sp-year-list {
    list-style: none;
    padding: 0;
    margin: 10px 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
}
.sp-years .sp-year-list li a {
    display: block;
    padding: 10px;
    border: var(--sp-border);
    text-align: center;
    background: #fff;
    text-decoration: none;
    color: inherit;
    border-radius: var(--sp-radius);
}

/* ================================
   Blocks grid + kaardid
   ================================ */
.sp-blocks-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: var(--sp-gap-grid);
    margin-top: 12px;
}
@media (min-width: 768px)  { .sp-blocks-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .sp-blocks-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1280px) { .sp-blocks-grid { grid-template-columns: repeat(4, 1fr); } }

.sp-block-card { display: block; position: relative; overflow: hidden; border: var(--sp-border); background: var(--sp-bg-card); text-decoration: none; color: inherit; border-radius: var(--sp-radius); transition: box-shadow 200ms ease; }
.sp-block-card__inner { height: 100%; display: flex; flex-direction: column; transition: transform 200ms ease; transform-origin: center; will-change: transform; }
.sp-block-card:hover .sp-block-card__inner { transform: scale(1.03); }
.sp-block-card:hover { box-shadow: var(--sp-shadow-hover); }

/* === Blocks: pilt === */
.sp-block-thumb { aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; padding: var(--sp-thumb-pad); background: transparent !important; overflow: hidden; }
.sp-block-thumb img { width: 100%; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; display: block; background: transparent !important; }

/* Meta rida */
.sp-block-meta { display: flex; align-items: center; gap: var(--sp-meta-gap); padding: 15px 20px 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-block-no { font-weight: 800; font-size: var(--sp-fs-block-no); flex: 0 0 auto; }
.sp-block-name, .sp-block-title { font-size: var(--sp-fs-block-name); flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ================================
   Block detail layout
   ================================ */
.sp-block-detail { display: grid; grid-template-columns: minmax(0, 70%) minmax(320px, 30%); gap: 16px; }
.sp-block-left { min-width: 0; }
.sp-block-aside { position: sticky; top: calc(var(--sp-sticky-top) + var(--sp-sticky-gap)); }
.sp-block-image { width: 100%; height: auto; object-fit: contain; background: transparent; border: var(--sp-border); border-radius: var(--sp-radius); max-height: 70vh; }
@media (max-width: 980px) {
  .sp-block-detail { grid-template-columns: 1fr; }
  .sp-block-right { order: 1; }
  .sp-block-left  { order: 2; }
  .sp-block-aside { position: static; margin-bottom: 16px; }
  .sp-block-image { display: block; }
}

/* ================================
   Parts table (baas)
   ================================ */
.sp-table-wrap { border: var(--sp-border); border-radius: var(--sp-radius); background: #fff; overflow: visible; max-width: 100%; box-sizing: border-box; }
.sp-table-wrap table { width: 100%; border-collapse: separate; border-spacing: 0; border: 0 !important; }
.sp-parts-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }

.sp-parts-table thead th {
  position: sticky;
  top: calc(var(--sp-sticky-top) + var(--sp-sticky-gap));
  z-index: 6;
  background: var(--sp-muted-bg) !important;
  font-weight: 600;
  border-bottom: 1px solid var(--sp-border-color) !important;
  box-shadow: 0 1px 0 var(--sp-border-color), 0 6px 10px rgba(0,0,0,0.03);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-table-wrap .sp-parts-table tbody th,
.sp-table-wrap .sp-parts-table tbody td {
    padding: 8px;
    vertical-align: middle !important;
    background: #fff;
    border-bottom: 1px solid var(--sp-border-color) !important;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sp-table-wrap .sp-parts-table thead th + th,
.sp-table-wrap .sp-parts-table tbody th + th,
.sp-table-wrap .sp-parts-table tbody td + td { border-left: 1px solid var(--sp-border-color) !important; }
.sp-table-wrap .sp-parts-table tbody tr:nth-child(even) td { background: var(--sp-row-alt-bg); }

.sp-parts-table .sp-col-idx    { text-align: center; color:#666; }
.sp-parts-table .sp-col-sku    { white-space: nowrap; word-break: normal; hyphens: none; }
.sp-parts-table .sp-col-image  { text-align: center; vertical-align: middle; padding: 6px 8px; }
.sp-parts-table .sp-col-name   { overflow: hidden; }
.sp-parts-table .sp-col-name .sp-part-name { overflow-wrap: anywhere; }
.sp-parts-table .sp-col-qty    { text-align: center; }
.sp-parts-table .sp-col-price  { text-align: right; white-space: nowrap; }
.sp-parts-table .sp-col-actions{ text-align: center; }

.sp-parts-table .sp-sku-link { text-decoration: none; font-weight: 600; color: #111 !important; border-bottom: 1px dashed transparent; }
.sp-parts-table .sp-sku-link:hover { color: var(--tm-red) !important; border-bottom-color: var(--tm-red); }

.sp-part-thumb { width: 64px; height: auto; max-width: 100%; object-fit: contain; display: block; margin: 0 auto; background: #fff; border: 1px solid rgba(0,0,0,.06); border-radius: 6px; padding: 2px; }

.sp-part-name { white-space: normal; }
.sp-subline   { font-size: 12px; color: #444; }
.sp-parts-table tbody tr { height: 72px; }

.sp-qty { width: 64px; min-width: 64px; text-align: center; padding: 6px 4px; border: var(--sp-border); border-radius: 6px; height: 36px; box-sizing: border-box; }
.sp-col-price { font-weight: 600; line-height: 1.25; }
.sp-price-line { display: block; font-weight: 700; }

/* === CTA veerg: YITH ainult ikoon & ATC ikoon-nupp tabelis === */
.sp-col-actions .yith-wcwl-add-to-wishlist a span:not(.yith-wcwl-icon),
.sp-col-actions .yith-wcwl-add-to-wishlist_button_label,
.sp-col-actions .yith-wcwl-add-to-wishlist-button__label { display: none !important; }
.sp-parts-table .sp-col-actions a.added_to_cart.wc-forward { display: none !important; }

/* TABELI ATC – alguses punane, added → tumepunane; ikoon pseudo-elemendina */
.sp-col-actions .button.add_to_cart_button.sp-atc--icon,
.sp-col-actions .button.sp-atc--icon {
  appearance: none;
  background: var(--tm-red);
  color: var(--sp-btn-text);
  border: 0;
  width: 42px;
  height: 36px;
  padding: 0 !important;
  min-width: 42px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color .15s ease, transform .06s ease, opacity .15s ease;
  font-size: 0;
  line-height: 0;
}
.sp-col-actions .button.sp-atc--icon::before {
  content: "";
  width: 18px;
  height: 18px;
  display: block;
  background-image: var(--sp-cart-icon-url);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px 18px;
}
.sp-col-actions .button.sp-atc--icon:hover { background: var(--tm-red-dark); }
.sp-col-actions .button.sp-atc--icon:active { transform: translateY(1px); }
.sp-col-actions .button.sp-atc--icon.added { background: var(--tm-red-dark) !important; }

/* ================================
   Stacked card vaade (<=1024px)
   ================================ */
@media (max-width: 1024px) {
  .sp-parts-table thead { display: none; }
  .sp-parts-table tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr 64px;
    grid-template-areas:
      "idx sku img"
      "name qty price"
      "actions actions actions";
    gap: 8px 12px;
    padding: 12px;
    border-bottom: 1px solid var(--sp-border-color);
  }
  .sp-table-wrap tbody tr { background: #fff; }
  .sp-table-wrap tbody tr:nth-child(even) td { background: #fff; }

  .sp-col-idx     { grid-area: idx; text-align: center; color:#888; }
  .sp-col-sku     { grid-area: sku; }
  .sp-col-image   { grid-area: img; }
  .sp-col-name    { grid-area: name; }
  .sp-col-qty     { grid-area: qty; align-self: start; text-align: center; }
  .sp-col-price   { grid-area: price; align-self: start; text-align: right; }
  .sp-col-actions { grid-area: actions; align-self: center; text-align: center; }

  .sp-part-thumb { width: 56px; }

  .sp-name-wrap .sp-subtext, .sp-col-name .sp-subtext {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .sp-name-wrap.is-expanded .sp-subtext, .sp-col-name.is-expanded .sp-subtext {
    display: block !important; overflow: visible !important; -webkit-line-clamp: unset !important;
  }

  .sp-col-actions form { justify-content: stretch; }
  .sp-col-actions .button { width: auto; }
}

/* Väga kitsas telefon (<=480px) – TABLE VIEW */
@media (max-width: 480px) {
  .sp-parts-table tbody tr {
    grid-template-columns: 1fr 56px;
    grid-template-areas:
      "idx    img"
      "sku    img"
      "name   name"
      "qty    price"
      "actions actions";
  }
  .sp-part-thumb { width: 56px; }
  .sp-col-actions { text-align: left; }
}

/* ================================
   Responsiivsus (muu)
   ================================ */
@media (max-width: 980px) {
    .sp-block-detail { grid-template-columns: 1fr; }
    .sp-block-aside { position: static; }
}
@media (max-width: 640px) {
    .sp-parts-table tbody tr { height: auto; }
}

/* ================================
   Lightbox (SP) — A versioon (Astra/Woo sarnane “fit + gutter”)
   ================================ */
.sp-lb-clickable { cursor: zoom-in; }

/* host */
#sp-lightbox {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 99999;
}
#sp-lightbox.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* tume taust */
#sp-lightbox .sp-lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.86);
  cursor: zoom-out;
}

/* figure = keskne “stage” (ilma valge kastita) */
#sp-lightbox .sp-lb-figure {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  pointer-events: none; /* nupud/pilt saavad eraldi */
}

/* pilt – proportsioonis, jätab ümber “gutteri” */
#sp-lightbox img {
  pointer-events: auto;
  width: auto;
  height: auto;
  max-width: min(92vw, 1200px);
  max-height: 84vh;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(0,0,0,.45);
  will-change: transform;
}

/* pealkiri – tagasihoidlik, nagu Woo */
#sp-lightbox .sp-lb-caption {
  pointer-events: none;
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  margin: 0;
  padding: 0;
  color: rgba(255,255,255,.92);
  font-size: 13px;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0,0,0,.55);
  background: transparent;
  word-break: break-word;
}

/* sulge nupp – tagasihoidlik (mitte punane kast) */
#sp-lightbox .sp-lb-close {
  pointer-events: auto;
  position: fixed;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(0,0,0,.45);
  color: rgba(255,255,255,.92);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  z-index: 2;
}
#sp-lightbox .sp-lb-close:hover {
  background: rgba(0,0,0,.65);
}
#sp-lightbox .sp-lb-close:active {
  transform: scale(.98);
}

html.sp-lb-open { overflow: hidden; }

@media (max-width: 480px) {
  #sp-lightbox img {
    max-width: 94vw;
    max-height: 78vh;
    border-radius: 10px;
  }
  #sp-lightbox .sp-lb-close {
    width: 40px;
    height: 40px;
    top: 12px;
    right: 12px;
    font-size: 18px;
  }
  #sp-lightbox .sp-lb-caption {
    bottom: 12px;
    font-size: 12px;
  }
}

/* ================================
   Väikesed visuaalsed täpsustused
   ================================ */
.sp-page-section { margin-top: 16px; }

/* „Show more” */
.sp-name-wrap { position: relative; }
.sp-name-wrap .sp-subtext { display: block; overflow: visible; -webkit-line-clamp: unset; -webkit-box-orient: vertical; }
.sp-more-toggle {
  display: inline-block; margin-top: 6px; font-size: 12px; line-height: 1;
  background: #FFF; border: 0; color: #dd0000; cursor: pointer; padding: 4px 8px;
  transition: background-color .15s ease, color .15s ease;
}
.sp-more-toggle:hover { text-decoration: none; }

/* ===== Mobile “cards” (≤480px) ===== */
@media (max-width: 480px) {
  :root { --spm-thumb: 72px; --spm-gap: 12px; }

  /* Eemalda topelt-külje-padding – joondub H1 järgi */
  .spm-block { padding: 0; }

  /* Ploki hero – 100% lai, ilma halli tausta ja servadeta */
  .spm-block-hero img {
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
    background: transparent;
    border-radius: 0;
    object-fit: contain;
  }

  .spm-block-title { font-size: 18px; font-weight: 700; margin: 12px 0; }

  .spm-cards { display: grid; gap: 12px; }

  .sp-card {
    width: 100%; padding: 12px; border-radius: 12px;
    border: 1px solid #E6E8EC; background: #fff; box-sizing: border-box;
  }

  .sp-card__header { display: grid; grid-template-columns: 32px 1fr; column-gap: 8px; align-items: start; }
  .sp-card__badge { width: 32px; height: 32px; border-radius: 50%; background: #111; color: #fff; font-weight: 700; display:flex; align-items:center; justify-content:center; font-size: 13px; }

  /* SKU/Name samale vasakjoonele nagu Qty ala (thumb + gap) */
  .sp-card__sku, .sp-card__name, .sp-card__meta { padding-left: calc(var(--spm-thumb) + var(--spm-gap)); }
  .sp-card__sku { font-size: 14px; font-weight: 700; color:#111; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
  .sp-card__name { font-size: 16px; font-weight: 600; color: #d32; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 6px; }

  .sp-card__meta { margin-top: 8px; }
  .spm-field { display:flex; gap:6px; line-height: 1.2; margin-bottom: 6px; }
  .spm-label { font-size: 12px; font-weight: 600; color: #6B7280; }
  .spm-val { font-size: 12px; color: #1F2937; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .spm-chip { padding: 2px 6px; border: 1px solid #E6E8EC; border-radius: 8px; max-width: 100%; display:inline-block; }

  .sp-card__sep { border: 0; border-top: 1px solid #EAECEF; margin: 8px 0 12px; }

  /* Footer: thumb | sisu | CTA ; vahe võrdselt column-gap’iga */
  .sp-card__footer {
    display: grid;
    grid-template-columns: var(--spm-thumb) 1fr minmax(112px, max-content);
    align-items: center;
    column-gap: var(--spm-gap);
  }

  .sp-card__thumb img, .spm-thumb--placeholder {
    width: var(--spm-thumb); height: var(--spm-thumb);
    border-radius: 10px; object-fit: cover; background: #f5f6f8; display:block; cursor: zoom-in;
  }

  .sp-card__qty { display:flex; align-items:center; justify-content:center; min-width: 96px; gap: 10px; }
  .spm-btn {
    width: 40px; height: 40px; border-radius: 12px; border: 1px solid #E6E8EC; background: #fff;
    font-size: 20px; line-height: 1; color:#111; -webkit-appearance: none; appearance: none;
    display:inline-flex; align-items:center; justify-content:center; font-weight:600;
  }
  .spm-qty { min-width: 28px; text-align:center; font-weight: 600; font-size: 16px; border: none; background: transparent; color:#111; }
  input.spm-qty::-webkit-outer-spin-button, input.spm-qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
  input.spm-qty[type=number] { -moz-appearance: textfield; }

  /* CTA – hind paremas servas alati */
  .sp-card__cta { display:flex; flex-direction: column; align-items: flex-end; min-width: 0; text-align: right; }
  .sp-card__price { font-size: 18px; font-weight: 700; margin-bottom: 8px; }

  /* ADD TO CART – mobiilikaardis: punane; .added → tumepunane; ikoon pseudo-elemendina */
  .spm-add.btn-primary.is-icon {
    width: 40px; height: 40px; min-width: 0; padding: 0;
    border-radius: 12px; background: var(--tm-red) !important; color:#fff !important;
    font-weight:600; display:inline-flex; align-items:center; justify-content:center; position: relative;
  }
  .spm-add.btn-primary.is-icon::before {
    content: ""; width: 20px; height: 20px; display: block;
    background-image: var(--sp-cart-icon-url); background-repeat: no-repeat; background-position: center; background-size: 20px 20px;
  }
  .spm-add.btn-primary.is-icon:hover { background: var(--tm-red-dark) !important; }
  .spm-add.btn-primary.is-icon.added { background: var(--tm-red-dark) !important; }

  /* Wishlist ikoon – aktiivne mustaks, OOS-il kuvatakse ainult see */
  .spm-wishlist {
    width: 36px; height: 36px; border: 1px solid var(--sp-border-color); border-radius: 8px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center; background:#fff;
    transition: border-color .15s ease, box-shadow .15s ease, color .15s ease, opacity .15s ease; color:#9ca3af;
  }
  .spm-wishlist .spm-heart, .spm-wishlist .spm-heart * { fill: currentColor; stroke: currentColor; }
  .spm-wishlist:hover { box-shadow: var(--sp-shadow-hover); color: var(--tm-red); }
  .spm-wishlist.is-active,
  .spm-wishlist[data-exists="1"],
  .spm-wishlist[data-exists="true"] { color: #111; border-color:#e5e7eb; } /* aktiivne = must */

  .sp-card[data-instock="0"] .sp-card__qty, .sp-card[data-instock="0"] .spm-add { display: none; }
  .sp-card[data-instock="1"] .spm-wishlist { display: none; }

  .spm-btn:focus-visible, .spm-add:focus-visible, .spm-wishlist:focus-visible { outline: 2px solid #111; outline-offset: 2px; }
}

/* Väga kitsas telefon (≤360px) */
@media (max-width: 360px) {
  :root { --spm-thumb: 56px; --spm-gap: 8px; }
  .spm-add.btn-primary.is-icon { width: 36px; height: 36px; }
  .spm-add.btn-primary.is-icon::before { width: 18px; height: 18px; background-size: 18px 18px; }
  .spm-btn { width: 36px; height: 36px; }
}

/* Väiksem padding ploki pildile kitsal ekraanil */
@media (max-width: 480px) { .sp-block-thumb { padding: 6px; } }

/* ====== ATC toast – MIDDLE/CENTER ====== */
#sp-toast-wrap{ position:fixed; inset:0; display:grid; place-items:center; padding:16px; z-index:99999; pointer-events:none; }
.sp-toast{
  position:relative; pointer-events:auto; background:#fff; color:#111; border-radius:12px; padding:16px 18px 14px;
  box-shadow:0 12px 40px rgba(0,0,0,.20); max-width:min(620px, 92vw); border:1px solid #e6e8ec;
  font-size:14px; line-height:1.45; text-align:center; animation:spToastIn .16s ease-out both;
}
.sp-toast .sp-row { column-gap: 16px; }
.sp-toast .sp-msg { padding-right: 72px; }
.sp-toast .sp-title{ font-weight:700; }
.sp-toast .sp-meta{ opacity:.75; }
.sp-toast .sp-actions{ display:flex; justify-content:center; gap:14px; margin-top:12px; padding-top:10px; border-top:1px solid #EEF0F3; }
.sp-toast .sp-link{ text-decoration:none; font-weight:700; color:var(--tm-red); }
.sp-toast .sp-link:hover{ text-decoration:underline; }
.sp-toast .sp-x{
  position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border: 0; border-radius: 8px;
  background: var(--tm-red); color: #fff; font-weight: 700; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.sp-toast .sp-x:hover{ filter: brightness(0.92); }
.sp-toast .sp-x:active{ transform: translateY(1px); }
@keyframes spToastIn{ from{ opacity:0; transform:scale(.98); } to{ opacity:1; transform:scale(1); } }

} /* @layer sp end */

/* --- ATC: ikoon-ainult nupp (tabelivaates – dubleerkaitse väljaspool layer’it) --- */
.sp-parts-table .sp-col-actions .sp-atc--icon {
  position: relative; width: 40px; height: 40px; padding: 0 !important; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0 !important; line-height: 0 !important; color: inherit !important;
}
.sp-parts-table .sp-col-actions .sp-atc--icon:hover { background: var(--tm-red-dark); }
.sp-parts-table .sp-col-actions .sp-atc--icon.added { background: var(--tm-red-dark) !important; }

/* --- Qty veeru keskjoon (desktop) --- */
.sp-parts-table .sp-col-qty { text-align: center; }

/* --- Sticky table header --- */
.sp-table-wrap thead th {
  position: sticky; top: calc(var(--sp-sticky-top) + var(--sp-sticky-gap)); background: #fff; z-index: 2; box-shadow: 0 1px 0 rgba(0,0,0,0.06);
}

/* Kui teema lisab thead'ile overflow'i või borderit, nulli see SP vaates */
.sp-table-wrap thead { border: 0; }

/* =======================================================
   LAYER: sp-overrides — kõrgem prioriteet (teema/YITH üle)
   ======================================================= */
@layer sp-overrides {
  /* Mobile hero – igal juhul täislaius ja ilma teemastiilideta */
  .sp-view .spm-block-hero img { background: transparent !important; border: 0 !important; width: 100% !important; height: auto !important; }

  /* YITH wishlist: ikon-only – peida tekst igal juhul */
  .sp-wishlist-icon-only .yith-wcwl-add-to-wishlist a span:not(.yith-wcwl-icon),
  .sp-card__cta .yith-wcwl-add-to-wishlist a span:not(.yith-wcwl-icon) { display: none !important; }

  /* YITH ikon raami normaliseerimine mobiilikaardis */
  .sp-card__cta .yith-wcwl-add-to-wishlist a {
    width: 36px; height: 36px; padding: 0 !important; border-radius: 8px !important;
    display: inline-flex !important; align-items: center; justify-content: center;
    border: 1px solid var(--sp-border-color) !important; background: #fff !important;
  }
  .sp-card[data-instock="1"] .sp-wishlist-icon-only,
  .sp-card[data-instock="1"] .yith-wcwl-add-to-wishlist { display: none !important; }

  /* Tabeli ATC – sunni punaseks ka siis, kui Woo/teema laeb hiljem */
  .sp-parts-table .sp-col-actions .button.sp-atc--icon {
    background: var(--tm-red) !important; color: #fff !important; border: 0 !important;
  }

  /* Mobiilikaardi CTA joondused (teema utility klassid ei tohi üle sõita) */
  .sp-card__cta { align-items: flex-end !important; text-align: right !important; }
  .sp-card__price { margin-bottom: 8px !important; }

  /* Mobiilikaardi ATC ikoon – garanteeri taust/olek */
  .spm-add.btn-primary.is-icon { background: var(--tm-red) !important; color: #fff !important; }
  .spm-add.btn-primary.is-icon.added { background: var(--tm-red-dark) !important; }

  /* Lightbox: hoia teema img-reeglid eemal (mõned teemad panevad width/height 100%) */
  #sp-lightbox img {
    width: auto !important;
    height: auto !important;
    max-width: min(92vw, 1200px) !important;
    max-height: 84vh !important;
  }

  /* === FIX: Brand select & SKU search ühtne 3px nurgaraadius — ülekirjuta WooCommerce reegel === */
  .woocommerce .sp-sku-search input[type="search"],
  .woocommerce-page .sp-sku-search input[type="search"],
  .woocommerce .sp-sku-search input[type="text"],
  .woocommerce-page .sp-sku-search input[type="text"],
  .sp-view .sp-sku-search input[type="search"],
  .sp-view .sp-sku-search input[type="text"],
  .sp-page .sp-sku-search input[type="search"],
  .sp-page .sp-sku-search input[type="text"],
  .sp-selector select,
  .sp-selector .sp-field,
  #sp-sku {
    border-radius: 3px !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    background-clip: padding-box !important;
  }
}
