/* ──────────────────────────────────────────────────────────────
   LA GRATA · Sticky Add-to-Cart Bar
   Clean stylesheet — extracted from reference/sticky-bar.css
   Uses CSS custom properties defined in the parent theme. Either
   redeclare these in :root or map them to your theme variables.
   ────────────────────────────────────────────────────────────── */

:root {
  --cacao: #70442D;
  --cacao-deep: #4F2F1F;
  --carbon: #2B1F18;
  --crema: #F3EAD1;
  --blanco: #FFFFFF;
  --dorado: #D4A536;
  --font-display: 'Fraunces', 'Times New Roman', serif;
  --font-body: 'Inter', system-ui, -apple-system, Arial, sans-serif;
}

/* ── Container — slides up from bottom when .is-visible is added ── */
.sab-wrap {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  pointer-events: none;
  transform: translateY(100%);
  opacity: 0;
  transition:
    transform 0.42s cubic-bezier(.22,.61,.36,1),
    opacity 0.32s ease;
}
.sab-wrap.is-visible {
  transform: translateY(0);
  opacity: 1;
}
.sab-wrap > * { pointer-events: auto; }

/* Hide-on-mobile helper (set from PHP option) */
.sab-wrap.is-hidden-mobile { display: flex; }
@media (max-width: 720px) {
  .sab-wrap.is-hidden-mobile { display: none !important; }
}

/* Disabled CTA state (out of stock or mid-flight) */
.sab-wrap .sab-cta[disabled],
.sab-wrap .sab-cta.is-loading {
  opacity: 0.65;
  cursor: not-allowed;
}
.sab-wrap .sab-cta.is-added {
  background: var(--dorado) !important;
  color: var(--cacao-deep) !important;
}

/* Force price color across WooCommerce nested markup
   (price_html ships as <span class="woocommerce-Price-amount amount"><bdi>...</bdi></span>
   and some themes override the color from outside). */
.sab-wrap .sab-num,
.sab-wrap .sab-num *,
.sab-wrap .sab-num .amount,
.sab-wrap .sab-num bdi,
.sab-wrap .sab-num ins,
.sab-wrap .sab-num del,
.sab-wrap .sab-num .woocommerce-Price-amount,
.sab-wrap .sab-num .woocommerce-Price-currencySymbol {
  color: inherit !important;
  text-decoration: none;
}
.sab-wrap .sab-num del { opacity: 0.55; margin-right: 6px; }


/* ════════════════════════════════════════════════════════════════
   VARIANT A · Full-width bar
   ════════════════════════════════════════════════════════════════ */
.sab-bar {
  width: 100%;
  background: var(--cacao-deep);
  color: var(--crema);
  border-top: 1px solid rgba(243,234,209,0.10);
  box-shadow: 0 -20px 40px -20px rgba(0,0,0,0.35);
  padding: 14px 56px;
}
.sab-bar-inner {
  width: 1280px;
  max-width: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 28px;
  align-items: center;
}
.sab-bar .sab-thumb { display: flex; align-items: center; gap: 16px; }
.sab-bar .sab-thumb-img {
  width: 54px; height: 54px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--cacao);
  flex-shrink: 0;
  border: 1px solid rgba(243,234,209,0.14);
}
.sab-bar .sab-thumb-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 60%;
}
.sab-bar .sab-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--crema);
}
.sab-bar .sab-name em {
  font-style: italic;
  color: var(--dorado);
  font-weight: 400;
}
.sab-bar .sab-meta {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(243,234,209,0.6);
  margin-top: 3px;
  font-weight: 500;
}
.sab-bar .sab-meta strong { color: rgba(243,234,209,0.9); font-weight: 600; }

.sab-bar .sab-qty {
  display: inline-flex;
  align-items: center;
  background: rgba(243,234,209,0.08);
  border: 1px solid rgba(243,234,209,0.18);
  border-radius: 12px;
  overflow: hidden;
}
.sab-bar .sab-qty button {
  width: 38px; height: 44px;
  background: transparent;
  border: none;
  color: var(--crema);
  font-size: 16px;
  cursor: pointer;
}
.sab-bar .sab-qty button:hover { background: rgba(243,234,209,0.10); }
.sab-bar .sab-qty .sab-qty-v {
  min-width: 30px;
  text-align: center;
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 14px;
  font-weight: 600;
}

.sab-bar .sab-price { text-align: right; padding-right: 4px; }
.sab-bar .sab-price .sab-num {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}
.sab-bar .sab-price .sab-per {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(243,234,209,0.65);
  margin-top: 4px;
  font-weight: 500;
}

.sab-bar .sab-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--crema);
  color: var(--cacao-deep);
  padding: 16px 26px;
  border-radius: 50px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  transition: background 0.18s;
}
.sab-bar .sab-cta:hover { background: var(--blanco); }
.sab-bar .sab-cta svg {
  width: 14px; height: 14px;
  stroke: currentColor; fill: none; stroke-width: 2.2;
}


/* ════════════════════════════════════════════════════════════════
   VARIANT B · Floating pill (glass, centered island)
   ════════════════════════════════════════════════════════════════ */
.sab-pill {
  margin: 0 24px 22px;
  background: rgba(79,47,31,0.92);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  color: var(--crema);
  border: 1px solid rgba(243,234,209,0.18);
  border-radius: 80px;
  padding: 10px 12px 10px 12px;
  box-shadow:
    0 24px 60px -20px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(243,234,209,0.10);
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 75%;
  width: 100%;
}
.sab-pill .sab-thumb-img {
  width: 48px; height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--cacao);
  flex-shrink: 0;
  border: 1px solid rgba(243,234,209,0.18);
}
.sab-pill .sab-thumb-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 60%;
}
.sab-pill .sab-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.sab-pill .sab-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.1;
  color: var(--crema);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sab-pill .sab-name em {
  font-style: italic;
  color: var(--dorado);
  font-weight: 400;
}
.sab-pill .sab-sub {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(243,234,209,0.55);
  font-weight: 500;
}

/* Inline qty stepper inside the pill */
.sab-pill-qty {
  display: inline-flex;
  align-items: center;
  background: rgba(243,234,209,0.08);
  border: 1px solid rgba(243,234,209,0.18);
  border-radius: 50px;
  overflow: hidden;
  flex-shrink: 0;
}
.sab-pill-qty button {
  width: 34px; height: 40px;
  background: transparent;
  border: none;
  color: var(--crema);
  font-size: 15px;
  cursor: pointer;
  transition: background 0.18s;
}
.sab-pill-qty button:hover { background: rgba(243,234,209,0.10); }
.sab-pill-qty .sab-pill-qty-v {
  min-width: 26px;
  text-align: center;
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--crema);
}

/* Inline format segmented control inside the pill */
.sab-pill-fmt {
  flex: 1;
  display: inline-flex;
  align-items: center;
  background: rgba(243,234,209,0.08);
  border: 1px solid rgba(243,234,209,0.18);
  border-radius: 50px;
  padding: 4px;
  gap: 2px;
  margin: 0 6px;
}
.sab-pill-fmt button {
  flex: 1;
  border: none;
  background: transparent;
  color: rgba(243,234,209,0.65);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 9px 14px;
  border-radius: 50px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s, color 0.18s;
}
.sab-pill-fmt button:hover { color: var(--crema); }
.sab-pill-fmt button.is-active {
  background: var(--crema);
  color: var(--cacao-deep);
}

/* Fallback select for >3 variations or multi-attribute products */
.sab-pill-fmt-select {
  flex: 1;
  margin: 0 6px;
  background: rgba(243,234,209,0.08);
  border: 1px solid rgba(243,234,209,0.18);
  border-radius: 50px;
  color: var(--crema);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 16px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.sab-pill-fmt-select option { color: #111; background: #fff; }

.sab-pill .sab-price { text-align: right; padding-right: 6px; }
.sab-pill .sab-num {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1;
  color: var(--crema);
  white-space: nowrap;
}

.sab-pill .sab-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--dorado);
  color: var(--cacao-deep);
  padding: 14px 22px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  transition: background 0.18s;
}
.sab-pill .sab-cta:hover { background: var(--blanco); }
.sab-pill .sab-cta svg {
  width: 13px; height: 13px;
  stroke: currentColor; fill: none; stroke-width: 2.2;
}


/* ════════════════════════════════════════════════════════════════
   VARIANT C · Minimal floating CTA (single dark capsule)
   ════════════════════════════════════════════════════════════════ */
.sab-mini { margin: 0 0 26px; }
.sab-mini .sab-cta {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  background: var(--cacao-deep);
  color: var(--crema);
  padding: 18px 28px;
  border-radius: 80px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  box-shadow:
    0 24px 60px -16px rgba(79,47,31,0.55),
    inset 0 1px 0 rgba(243,234,209,0.12);
  transition: transform 0.18s, box-shadow 0.18s, background 0.18s;
}
.sab-mini .sab-cta:hover {
  background: var(--carbon);
  transform: translateY(-1px);
  box-shadow: 0 30px 70px -16px rgba(79,47,31,0.65);
}
.sab-mini .sab-cta .sab-divider {
  width: 1px; height: 18px;
  background: rgba(243,234,209,0.25);
}
.sab-mini .sab-cta .sab-num {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.015em;
  text-transform: none;
  /* Mismo color que el texto del botón (crema sobre cacao-deep). */
  color: var(--crema);
}
.sab-mini .sab-cta svg {
  width: 14px; height: 14px;
  stroke: currentColor; fill: none; stroke-width: 2.2;
}


/* ════════════════════════════════════════════════════════════════
   A11y · focus visible
   ════════════════════════════════════════════════════════════════ */
.sab-wrap button:focus-visible,
.sab-wrap select:focus-visible {
  outline: 2px solid var(--crema);
  outline-offset: 2px;
}


/* ════════════════════════════════════════════════════════════════
   Responsive — collapse to mini on narrow viewports
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 720px) {
  .sab-bar { padding: 10px 16px; }
  .sab-bar-inner { grid-template-columns: 1fr auto; gap: 12px; }
  .sab-bar .sab-thumb-img,
  .sab-bar .sab-qty,
  .sab-bar .sab-price .sab-per { display: none; }
  .sab-bar .sab-price .sab-num { font-size: 22px; }
  .sab-pill {
    flex-wrap: wrap;
    border-radius: 24px;
    padding: 14px;
    gap: 10px;
  }
  .sab-pill-fmt { order: 3; flex-basis: 100%; margin: 0; }
  .sab-pill-fmt-select { order: 3; flex-basis: 100%; margin: 0; }
  .sab-pill-qty { order: 4; }
  .sab-pill .sab-cta { padding: 12px 18px; }
}


/* ════════════════════════════════════════════════════════════════
   Reduced motion
   ════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .sab-wrap {
    transition: opacity 0.18s ease;
    transform: none;
  }
  .sab-wrap:not(.is-visible) { transform: none; }
}
