/* SmartBundle storefront widgets. Colors follow the theme; the accent comes from the app embed. */
.sb {
  --sb-accent: #111;
  --sb-accent-text: #fff;
  --sb-border: rgba(0, 0, 0, 0.12);
  --sb-soft: rgba(0, 0, 0, 0.04);
  --sb-radius: 10px;
  --sb-sale: #c0392b;
  --sb-badge: #d0021b;
  margin: 16px 0;
  max-width: var(--sb-max-width, none);
  font-family: var(--sb-font, inherit);
  font-size: var(--sb-size, 14px);
  color: var(--sb-text, inherit);
  line-height: 1.4;
}
.sb *, .sb *::before, .sb *::after { box-sizing: border-box; }
.sb-box { border: 1px solid var(--sb-border); border-radius: var(--sb-radius); padding: 16px; display: grid; gap: 12px; background: inherit; }
.sb-box--slim { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.sb-title { margin: 0; font-size: 1.15em; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sb-muted { margin: 0; opacity: 0.7; font-size: 0.93em; }
.sb-badge { display: inline-block; background: var(--sb-accent); color: var(--sb-accent-text); border-radius: 999px; padding: 2px 10px; font-size: 0.8em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }

/* buttons and inputs */
.sb-btn { appearance: none; border: 1.5px solid var(--sb-accent); border-radius: 8px; background: var(--sb-btn-bg, var(--sb-accent)); color: var(--sb-btn-color, var(--sb-accent-text)); font: inherit; font-weight: 600; padding: var(--sb-btn-pad, 12px 18px); cursor: pointer; width: var(--sb-btn-width, 100%); justify-self: var(--sb-btn-align, stretch); text-align: center; text-decoration: none; display: inline-block; transition: opacity 0.15s; }
.sb-btn:hover { opacity: 0.88; }
.sb-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.sb-btn--small { width: auto; padding: 8px 12px; font-size: 0.93em; }
.sb-card .sb-btn--small { width: 100%; justify-self: stretch; }
.sb-btn--ghost { background: transparent; color: inherit; border: 1px solid var(--sb-accent); width: auto; }
.sb-box--slim .sb-btn { width: auto; }
.sb-select { font: inherit; font-size: 0.93em; padding: 6px 8px; border: 1px solid var(--sb-border); border-radius: 6px; background: inherit; color: inherit; max-width: 100%; }
.sb-check { width: 18px; height: 18px; accent-color: var(--sb-accent); flex: none; }
.sb-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* prices */
.sb-price { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
.sb-price__sale { font-weight: 600; }
.sb-price__was { opacity: 0.55; font-size: 0.86em; }
.sb-total { display: flex; justify-content: space-between; align-items: center; font-weight: 600; padding-top: 10px; border-top: 1px solid var(--sb-border); }
.sb-total .sb-price { flex-direction: row; align-items: baseline; gap: 8px; font-size: 1.15em; }

/* images */
.sb-img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: var(--sb-soft); flex: none; display: block; }
.sb-img--empty { display: inline-block; }

/* tiers (volume, buy X get Y) */
.sb-plain { display: grid; gap: 12px; }
.sb-heading { display: flex; align-items: center; gap: 12px; margin: 0; font-size: 1.15em; font-weight: 500; }
.sb-heading::after { content: ""; flex: 1; height: 1px; background: var(--sb-border); }
.sb-sr { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.sb-tiers { display: grid; gap: 14px; }
.sb-tier { position: relative; display: flex; align-items: center; gap: 14px; border: 1px solid var(--sb-border); border-radius: var(--sb-radius); padding: 14px 16px; min-height: 68px; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.sb-tier:hover { border-color: rgba(0, 0, 0, 0.35); }
.sb-tier.is-selected { border-color: var(--sb-accent); box-shadow: 0 0 0 1px var(--sb-accent); }
.sb-tier:focus-within { outline: 2px solid var(--sb-accent); outline-offset: 2px; }
.sb-thumb { position: relative; flex: none; width: 42px; height: 42px; border: 1px solid var(--sb-border); border-radius: 6px; padding: 2px; background: #fff; }
.sb-thumb .sb-img { width: 100%; height: 100%; border-radius: 4px; }
.sb-thumb__n { position: absolute; top: -7px; right: -9px; background: var(--sb-accent); color: var(--sb-accent-text); border-radius: 999px; padding: 1px 6px; font-size: 0.72em; font-weight: 700; line-height: 1.5; }
.sb-tier__main { display: grid; gap: 2px; flex: 1; min-width: 0; }
.sb-tier__title { font-size: 1.15em; }
.sb-tier__sub { font-size: 0.93em; color: var(--sb-sale); }
.sb-tier__gift { font-size: 0.86em; opacity: 0.8; }
.sb-tier .sb-price__sale { font-size: 1.15em; font-weight: 500; }
.sb-tier .sb-badge { position: absolute; top: -11px; right: 10px; background: var(--sb-badge); color: #fff; border-radius: 0; text-transform: none; letter-spacing: 0; font-size: 0.86em; padding: 3px 14px; clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 50%, 100% 100%, 0 100%, 7px 50%); }
.sb-tiers--quick_picks { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.sb-tiers--quick_picks .sb-tier { flex-direction: column; align-items: center; text-align: center; padding: 18px 10px 12px; }
.sb-tiers--quick_picks .sb-tier input { position: absolute; opacity: 0; }
.sb-tiers--quick_picks .sb-price { align-items: center; }
.sb-tiers--visual .sb-thumb { width: 64px; height: 64px; }
.sb-tiers__extra:empty { display: none; }
.sb-tiers__extra { display: grid; gap: 8px; }

/* product rows (fixed bundle, FBT, add-ons, gifts) */
.sb-items { display: grid; gap: 10px; }
.sb-item { display: flex; align-items: center; gap: 12px; }
.sb-item__main { display: grid; gap: 4px; flex: 1; min-width: 0; }
.sb-item__title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
label.sb-item { cursor: pointer; }
.sb-item input[type="radio"] { accent-color: var(--sb-accent); width: 18px; height: 18px; flex: none; }
.sb-items--plus .sb-item + .sb-item { position: relative; }
.sb-items--plus { gap: 20px; }
.sb-items--plus .sb-item + .sb-item::before { content: "+"; position: absolute; top: -18px; left: 20px; width: 16px; height: 16px; border-radius: 50%; background: var(--sb-accent); color: var(--sb-accent-text); font-size: 0.86em; line-height: 16px; text-align: center; font-weight: 700; }

/* product grid (cross-sell, mix & match) */
.sb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.sb-card { position: relative; display: flex; flex-direction: column; gap: 6px; border: 1.5px solid var(--sb-border); border-radius: var(--sb-radius); padding: 10px; }
.sb-card.is-selected { border-color: var(--sb-accent); }
.sb-card .sb-img { width: 100%; height: auto; aspect-ratio: 1; }
.sb-card .sb-price { align-items: flex-start; flex-direction: row; gap: 6px; align-items: baseline; }
.sb-card .sb-btn { width: 100%; margin-top: auto; }
.sb-count { position: absolute; top: 14px; right: 14px; background: var(--sb-accent); color: var(--sb-accent-text); border-radius: 999px; padding: 2px 8px; font-size: 0.86em; font-weight: 700; }
.sb-section { grid-column: 1 / -1; margin: 6px 0 0; font-weight: 600; }

/* mix & match */
.sb-steps { display: flex; gap: 8px; flex-wrap: wrap; }
.sb-step { border: 1px dashed var(--sb-accent); border-radius: 8px; padding: 6px 10px; font-size: 0.93em; }
.sb-tabs:empty { display: none; }
.sb-tabs { display: flex; gap: 6px; overflow-x: auto; border-bottom: 1px solid var(--sb-border); }
.sb-tab { appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; font: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
.sb-tab.is-active { border-bottom-color: var(--sb-accent); font-weight: 600; }
.sb-footer { display: grid; gap: 10px; background: var(--sb-bg, #fff); padding-top: 12px; border-top: 1px solid var(--sb-border); }
.sb-progress { margin: 0; font-weight: 600; font-size: 0.93em; }
.sb-progress:empty { display: none; }
.sb-tray { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; min-height: 40px; }
.sb-chip { position: relative; }
.sb-chip .sb-img { width: 44px; height: 44px; }
.sb-chip__x { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: #000; color: #fff; font-size: 0.86em; line-height: 18px; padding: 0; cursor: pointer; }

/* "Build your own bundle" card on product pages */
.sb-promo { position: relative; overflow: hidden; gap: 10px; padding: 20px; border: 2px solid var(--sb-accent); background: linear-gradient(135deg, rgba(0, 0, 0, 0.045), rgba(0, 0, 0, 0) 55%); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08); }
.sb-promo__ribbon { position: absolute; top: 18px; right: -42px; transform: rotate(35deg); background: var(--sb-badge); color: #fff; font-size: 0.8em; font-weight: 700; padding: 5px 48px; white-space: nowrap; }
.sb-promo__eyebrow { font-size: 0.78em; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sb-badge); }
.sb-promo__title { margin: 0; padding-right: 90px; font-size: 1.4em; font-weight: 700; line-height: 1.2; }
.sb-promo__thumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sb-promo__thumbs .sb-img { width: 58px; height: 58px; border-radius: 10px; border: 2px solid #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.18); }
.sb-promo__more { font-weight: 700; opacity: 0.7; }
.sb-promo .sb-btn { font-size: 1.07em; }

/* pop-up */
.sb-modal { position: fixed; inset: 0; z-index: 2147483000; margin: 0; border: 0; width: 100%; height: 100%; max-width: none; max-height: none; background: rgba(0, 0, 0, 0.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.sb-modal:not([open]) { display: none; }
.sb-modal::backdrop { background: transparent; }
.sb-modal__box { box-sizing: border-box; background: var(--sb-bg, #fff); color: var(--sb-text, #111); border-radius: 14px; width: min(720px, 100%); max-height: 90vh; overflow: auto; padding: 18px; display: grid; gap: 12px; }
.sb-modal__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sb-modal__x { appearance: none; border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: inherit; }
.sb-modal .sb-box { border: 0; padding: 0; }
.sb-modal .sb-box > .sb-title:first-child { display: none; }
.sb-modal .sb-btn--ghost { width: 100%; }

/* bundle-builder page */
.sb-page { padding-top: 32px; padding-bottom: 48px; }
.sb-page__title { margin: 0 0 16px; }

@media (max-width: 480px) {
  .sb-box { padding: 12px; }
  .sb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .sb-img { width: 48px; height: 48px; }
}
