/* bundle.css — 5-step accordion bundle. Scoped under #my-custom-bundle.
   Colours/corners come from style presets (--gbbCustom-*); layout matches the screenshots. */

#my-custom-bundle {
  --bundle-accent: var(--gbbCustom-accent, var(--gbbCustom-primary, #111));
  /* Brand colour used for badges, active/selected borders, checkmark, total, etc.
     Driven by the Design panel's Primary colour (falls back to near-black). */
  --bundle-brand: var(--gbbCustom-primary, #1a1a1a);
  --bundle-border: #e6e6e6;
  --bundle-muted: #8a8a8a;

  box-sizing: border-box;
  max-width: 640px;
  margin: 24px auto;
  padding: 0;
  font-family: inherit;
  font-size: var(--gbbCustom-body-size, 14px);
  font-weight: var(--gbbCustom-body-weight, 400);
  color: var(--gbbCustom-text, #1a1a1a);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#my-custom-bundle *,
#my-custom-bundle *::before,
#my-custom-bundle *::after { box-sizing: inherit; }

#my-custom-bundle h3 {
  margin: 0;
  font-family: inherit;
  letter-spacing: normal;
  text-transform: none;
  line-height: 1.3;
}
#my-custom-bundle button {
  font-family: inherit;
  letter-spacing: normal;
  text-transform: none;
}
#my-custom-bundle button:focus-visible {
  outline: 2px solid var(--bundle-accent);
  outline-offset: 2px;
}

/* ── Accordion ─────────────────────────────────────────────────────────── */
#my-custom-bundle .bundle__accordion {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#my-custom-bundle .bundle__step-panel {
  border: 1px solid var(--bundle-border);
  border-radius: var(--gbbCustom-radius-card, 12px);
  background: #fff;
  overflow: hidden;
  transition: border-color 0.15s ease;
}
#my-custom-bundle .bundle__step-panel.is-active {
  border-color: var(--bundle-brand);
}
#my-custom-bundle .bundle__step-panel.is-locked {
  opacity: 0.5;
  pointer-events: none;
}

#my-custom-bundle .bundle__step-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}
#my-custom-bundle .bundle__step-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
#my-custom-bundle .bundle__step-badge {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--bundle-brand);
  color: var(--gbbCustom-btn-text, #fff);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
#my-custom-bundle .bundle__step-title {
  font-size: var(--gbbCustom-font-size, 16px);
  font-weight: var(--gbbCustom-font-weight, 600);
  color: var(--gbbCustom-text, #1a1a1a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#my-custom-bundle .bundle__step-chosen {
  font-size: 12px;
  color: var(--bundle-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#my-custom-bundle .bundle__step-chevron {
  flex: 0 0 auto;
  font-size: 12px;
  color: #666;
}

#my-custom-bundle .bundle__step-body {
  padding: 0 16px 16px;
}

/* ── Product grid ──────────────────────────────────────────────────────── */
#my-custom-bundle .bundle__products {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
#my-custom-bundle .bundle__card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1.5px solid var(--bundle-border);
  border-radius: var(--gbbCustom-radius-card, 10px);
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#my-custom-bundle .bundle__card:hover { border-color: #bcbcbc; }
#my-custom-bundle .bundle__card.is-selected {
  border-color: var(--bundle-brand);
  box-shadow: 0 0 0 1px var(--bundle-brand);
}
#my-custom-bundle .bundle__card-img-wrap {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #f5f5f5;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
#my-custom-bundle .bundle__card-img {
  width: 100%;
  height: 100%;
  object-fit: var(--gbbCustom-img-fit, cover);
}
#my-custom-bundle .bundle__card-title {
  flex: 1 1 auto;
  font-size: var(--gbbCustom-secondary-size, 13px);
  font-weight: var(--gbbCustom-secondary-weight, 600);
  color: var(--gbbCustom-text, #1a1a1a);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Corner checkmark badge — only visible on the selected card. */
#my-custom-bundle .bundle__card-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bundle-brand);
  display: none;
  align-items: center;
  justify-content: center;
}
#my-custom-bundle .bundle__card.is-selected .bundle__card-check {
  display: flex;
}

/* ── Variant swatches (revealed after product select) ──────────────────── */
#my-custom-bundle .bundle__swatch-wrap {
  margin-top: 14px;
}
#my-custom-bundle .bundle__swatch-hint {
  font-size: 12px;
  color: var(--bundle-muted);
  margin-bottom: 8px;
}
#my-custom-bundle .bundle__swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#my-custom-bundle .bundle__swatch {
  min-width: 42px;
  min-height: 42px;
  padding: 6px 8px;
  border: 1.5px solid var(--bundle-border);
  border-radius: 8px;
  background: #f5f5f5;
  color: #333;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
/* Chips carrying a variant image sit on a white background with the thumb above the code. */
#my-custom-bundle .bundle__swatch.has-img {
  background: #fff;
  min-width: 60px;
}
#my-custom-bundle .bundle__swatch-img-wrap {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  overflow: hidden;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
}
#my-custom-bundle .bundle__swatch-img {
  width: 100%;
  height: 100%;
  object-fit: var(--gbbCustom-img-fit, cover);
}
#my-custom-bundle .bundle__swatch:hover { border-color: #bcbcbc; }
#my-custom-bundle .bundle__swatch.is-selected {
  border-color: var(--bundle-brand);
  box-shadow: 0 0 0 1px var(--bundle-brand);
  background: #fff;
}
#my-custom-bundle .bundle__swatch:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: line-through;
}
#my-custom-bundle .bundle__swatch-code {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Inline states ─────────────────────────────────────────────────────── */
#my-custom-bundle .bundle__empty,
#my-custom-bundle .bundle__loading-inline {
  padding: 20px;
  text-align: center;
  color: var(--bundle-muted);
  font-size: 13px;
}

/* ── Summary block ─────────────────────────────────────────────────────── */
#my-custom-bundle .bundle__summary-block {
  border: 1px solid var(--bundle-border);
  border-radius: var(--gbbCustom-radius-card, 12px);
  background: #fff;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#my-custom-bundle .bundle__summary-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}
#my-custom-bundle .bundle__summary-title {
  font-size: var(--gbbCustom-font-size, 16px);
  font-weight: var(--gbbCustom-font-weight, 600);
  color: var(--gbbCustom-text, #1a1a1a);
}
#my-custom-bundle .bundle__summary-chevron {
  flex: 0 0 auto;
  font-size: 12px;
  color: #666;
}
#my-custom-bundle .bundle__summary-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#my-custom-bundle .bundle__summary-list.is-collapsed {
  display: none;
}
#my-custom-bundle .bundle__summary-empty {
  color: var(--bundle-muted);
  font-size: 13px;
  padding: 4px 0;
}
#my-custom-bundle .bundle__summary-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
#my-custom-bundle .bundle__summary-thumb {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #f5f5f5;
  overflow: hidden;
}
#my-custom-bundle .bundle__summary-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#my-custom-bundle .bundle__summary-info {
  flex: 1 1 auto;
  min-width: 0;
}
#my-custom-bundle .bundle__summary-name {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#my-custom-bundle .bundle__summary-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 2px;
}
#my-custom-bundle .bundle__summary-price-current {
  font-size: 13px;
  font-weight: 600;
}
#my-custom-bundle .bundle__summary-price-original {
  font-size: 12px;
  color: var(--bundle-muted);
  text-decoration: line-through;
}

#my-custom-bundle .bundle__discount-msg {
  font-size: 13px;
  font-weight: 600;
  color: var(--bundle-accent);
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  text-align: center;
}

#my-custom-bundle .bundle__total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--bundle-border);
}
#my-custom-bundle .bundle__total-label {
  font-size: 13px;
  color: var(--bundle-muted);
}
#my-custom-bundle .bundle__total-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--bundle-brand);
}

#my-custom-bundle .bundle__validation {
  font-size: 12px;
  line-height: 1.3;
  color: #b3261e;
  text-align: center;
}

#my-custom-bundle .bundle__atc-btn {
  width: 100%;
  padding: 14px 24px;
  border: 0;
  background: var(--bundle-accent);
  color: var(--gbbCustom-btn-text, #fff);
  border-radius: var(--gbbCustom-radius-btn, 8px);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease;
}
#my-custom-bundle .bundle__atc-btn:hover { filter: brightness(1.12); }
#my-custom-bundle .bundle__atc-btn:disabled {
  background: #cfcfcf;
  cursor: not-allowed;
}

/* ── Loader ────────────────────────────────────────────────────────────── */
#my-custom-bundle .bundle__loader {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--bundle-muted);
  font-size: 14px;
}
#my-custom-bundle .bundle__loader::before {
  content: "";
  width: 14px;
  height: 14px;
  margin-right: 10px;
  border: 2px solid #ccc;
  border-top-color: #1a1a1a;
  border-radius: 50%;
  animation: bundle-spin 0.9s linear infinite;
}
@keyframes bundle-spin { to { transform: rotate(360deg); } }

/* ── Mobile ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #my-custom-bundle { margin: 16px auto; }
  #my-custom-bundle .bundle__step-header { padding: 14px 12px; }
  #my-custom-bundle .bundle__step-body { padding: 0 12px 14px; }

  /* Product cards: stack image over title so the name has the full card width and
     isn't squeezed next to the thumbnail (the main cause of cut-off names). */
  #my-custom-bundle .bundle__products { gap: 8px; }
  #my-custom-bundle .bundle__card {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 8px;
  }
  #my-custom-bundle .bundle__card-img-wrap {
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }
  #my-custom-bundle .bundle__card-title {
    font-size: 12.5px;
    -webkit-line-clamp: 3;
    width: 100%;
  }
  #my-custom-bundle .bundle__card-check { top: 6px; right: 6px; }

  /* Let the collapsed step's chosen-product subtitle wrap under the title instead of
     ellipsising away, but keep it from pushing the badge/chevron around. */
  #my-custom-bundle .bundle__step-head-left { flex-wrap: wrap; }
  #my-custom-bundle .bundle__step-chosen {
    flex-basis: 100%;
    white-space: normal;
    margin-left: 38px;
  }

  /* Summary names wrap fully on mobile so nothing is truncated. */
  #my-custom-bundle .bundle__summary-name {
    white-space: normal;
    overflow: visible;
  }

  /* Roomier swatches for touch. */
  #my-custom-bundle .bundle__swatch { min-height: 44px; }
  #my-custom-bundle .bundle__swatch.has-img .bundle__swatch-img-wrap { width: 50px; height: 50px; }
}