/*
 * ERP bundle widget styles. All selectors namespaced under .erp-bundle*
 * so nothing leaks into the host theme.
 */

/* ── Page layout ─────────────────────────────────────────── */
.product-bundle-page { max-width: 1200px; margin: 2em auto; padding: 0 1em; }
.erp-bundle__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}
@media (max-width: 900px) {
  .erp-bundle__layout { grid-template-columns: 1fr; gap: 24px; }
}

/* ── Hero ────────────────────────────────────────────────── */
.erp-bundle__hero {
  position: sticky;
  top: 24px;
  border-radius: 12px;
  overflow: hidden;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}
@media (max-width: 900px) { .erp-bundle__hero { position: static; } }
.erp-bundle__hero-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}
.erp-bundle__hero--placeholder {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.erp-bundle__hero-letter {
  font-size: 6rem;
  font-weight: 700;
  color: #d1d5db;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.erp-bundle__hero--collage { aspect-ratio: 1 / 1; display: grid; grid-template-columns: 2fr 1fr; gap: 4px; padding: 4px; background: #fff; }
.erp-bundle__hero-primary { background: #f9fafb; border-radius: 8px; overflow: hidden; }
.erp-bundle__hero-primary img { width: 100%; height: 100%; object-fit: cover; }
.erp-bundle__hero-grid { display: grid; grid-template-rows: repeat(3, 1fr); gap: 4px; }
.erp-bundle__hero-grid--mosaic {
  /* 2 columns × 3 rows — fits 4-6 secondaries (5-7 total images)
     while keeping the primary panel the same size on the left. */
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(3, 1fr);
}
.erp-bundle__hero-grid-cell {
  background: #f9fafb;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}
.erp-bundle__hero-grid-cell img { width: 100%; height: 100%; object-fit: cover; }
/* Last cell when we've truncated — darkened tile with "+N more". */
.erp-bundle__hero-grid-cell--overflow::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, .55);
  pointer-events: none;
}
.erp-bundle__hero-grid-overflow-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: .95rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  z-index: 1;
}

/* ── Info column ─────────────────────────────────────────── */
.erp-bundle__info { min-width: 0; }
.erp-bundle__title {
  font-size: 1.875rem;
  font-weight: 700;
  margin: 0 0 .5em;
  line-height: 1.2;
  color: #111;
  letter-spacing: -.01em;
}
.erp-bundle__description {
  color: #4b5563;
  font-size: .9375rem;
  line-height: 1.6;
  margin: 0 0 1.25em;
}

/* ── Price row ───────────────────────────────────────────── */
.erp-bundle__price-row { display: flex; align-items: baseline; gap: .75em; flex-wrap: wrap; margin: 0 0 .75em; }
.erp-bundle__price { font-size: 2rem; font-weight: 700; color: #111; line-height: 1; }
.erp-bundle__price-strikethrough {
  font-size: 1.125rem;
  color: #9ca3af;
  text-decoration: line-through;
  font-weight: 500;
}

/* ── Savings banner ───────────────────────────────────────── */
.erp-bundle__savings-banner {
  background: linear-gradient(90deg, #d1fae5 0%, #ecfccb 100%);
  border: 1px solid #34d399;
  border-radius: 10px;
  padding: .875em 1.125em;
  margin: 0 0 1.5em;
  display: flex;
  align-items: center;
  gap: .75em;
}
.erp-bundle__savings-banner::before {
  content: '★';
  font-size: 1.25rem;
  color: #047857;
}
.erp-bundle__savings-banner-amount { font-size: 1.125rem; font-weight: 700; color: #065f46; line-height: 1.1; }
.erp-bundle__savings-banner-detail { font-size: .8125rem; color: #047857; margin-top: .15em; }

/* ── OOS banner ──────────────────────────────────────────── */
.erp-bundle__oos-banner {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: .75em 1em;
  margin: 0 0 1.25em;
  color: #991b1b;
  font-size: .875rem;
  line-height: 1.4;
}

/* ── Components heading + list ──────────────────────────── */
.erp-bundle__heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 1.5em 0 .5em;
}
.erp-bundle__heading-text {
  font-size: .8125rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #4b5563;
  margin: 0;
  font-weight: 600;
}
.erp-bundle__count { font-size: .75rem; color: #6b7280; }

.erp-bundle__components { list-style: none; margin: 0; padding: 0; }
.erp-bundle-component {
  display: flex;
  gap: .875em;
  padding: 1em 0;
  border-top: 1px solid #e5e7eb;
  align-items: center;
}
.erp-bundle-component:last-child { border-bottom: 1px solid #e5e7eb; }
.erp-bundle-component--oos { opacity: .55; }
.erp-bundle-component__thumb {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 8px;
  object-fit: cover;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
}
.erp-bundle-component__thumb--placeholder { display: flex; align-items: center; justify-content: center; }
.erp-bundle-component__thumb-letter {
  font-weight: 700;
  font-size: 1.5rem;
  color: #9ca3af;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.erp-bundle-component__body { flex: 1; min-width: 0; }
.erp-bundle-component__title-row {
  display: flex;
  justify-content: space-between;
  gap: .5em;
  align-items: baseline;
}
.erp-bundle-component__title { font-weight: 500; color: #111; line-height: 1.35; word-break: break-word; }
.erp-bundle-component__qty { color: #6b7280; font-size: .875rem; white-space: nowrap; font-weight: 500; }
.erp-bundle-component__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5em;
  margin-top: .35em;
}

/* ── Slot dropdown inside a component card ──────────────── */
.erp-bundle-component__select-row {
  margin-top: .4em;
}
.erp-bundle-component__select {
  font: inherit;
  font-size: .875rem;
  padding: .375em .625em;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  min-width: 180px;
  max-width: 100%;
  color: #111;
  cursor: pointer;
}
.erp-bundle-component__select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, .2);
}
.erp-bundle-component__option-name {
  font-size: .875rem;
  color: #4b5563;
}
.erp-bundle-component__text-input {
  font: inherit;
  font-size: .875rem;
  padding: .5em .75em;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  width: 100%;
  max-width: 360px;
  color: #111;
}
.erp-bundle-component__text-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, .2);
}
/* Data slots have no thumbnail — drop the gap so the field aligns
   with the title row above. */
.erp-bundle-component--data .erp-bundle-component__body { min-width: 0; }
.erp-bundle-component--data { padding: .75em 0; }
.erp-bundle-component__meta-left { display: flex; align-items: center; gap: .625em; flex-wrap: wrap; min-width: 0; }
.erp-bundle-component__sku {
  color: #6b7280;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .75rem;
}
.erp-bundle-component__price { color: #374151; font-weight: 500; white-space: nowrap; font-size: .875rem; }

/* ── Stock pills ─────────────────────────────────────────── */
.erp-bundle-component__stock {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  line-height: 1.6;
}
.erp-bundle-component__stock--ok      { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.erp-bundle-component__stock--limited { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; }
.erp-bundle-component__stock--out     { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }

/* ── CTA ─────────────────────────────────────────────────── */
.erp-bundle__add-btn {
  width: 100%;
  margin-top: 1.5em;
  padding: 1.125em 1em;
  font-size: 1rem;
  font-weight: 600;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color .15s ease, transform .05s ease;
  letter-spacing: .01em;
}
.erp-bundle__add-btn:hover:not(:disabled) { background: #1f2937; }
.erp-bundle__add-btn:active:not(:disabled) { transform: translateY(1px); }
.erp-bundle__add-btn:disabled,
.erp-bundle__add-btn--disabled {
  background: #e5e7eb;
  color: #6b7280;
  cursor: not-allowed;
}

/* ── Trust list ─────────────────────────────────────────── */
.erp-bundle__trust {
  margin-top: 1em;
  display: flex;
  flex-direction: column;
  gap: .25em;
  font-size: .8125rem;
  color: #6b7280;
}

.erp-bundle__synced-stamp {
  font-size: .6875rem;
  color: #9ca3af;
  margin-top: 1em;
  text-align: right;
}

.erp-bundle-error {
  margin-top: .5em;
  padding: .5em .75em;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 4px;
  font-size: .875rem;
}

/* ── Skeleton placeholder (before JS runs) ─────────────── */
.erp-bundle__skeleton {
  display: flex;
  flex-direction: column;
  gap: .75em;
  padding: 1em 0;
}
.erp-bundle__skeleton-title,
.erp-bundle__skeleton-price,
.erp-bundle__skeleton-row,
.erp-bundle__skeleton-btn {
  background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 50%, #f3f4f6 100%);
  background-size: 200% 100%;
  border-radius: 6px;
  animation: erp-bundle-pulse 1.5s ease-in-out infinite;
}
.erp-bundle__skeleton-title { height: 36px; width: 60%; }
.erp-bundle__skeleton-price { height: 28px; width: 30%; }
.erp-bundle__skeleton-row { height: 60px; }
.erp-bundle__skeleton-btn { height: 56px; margin-top: 1em; }
@keyframes erp-bundle-pulse {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ── Mobile (≤480px) ─────────────────────────────────────── */
@media (max-width: 480px) {
  .erp-bundle__title { font-size: 1.375rem; }
  .erp-bundle__price { font-size: 1.625rem; }
  .erp-bundle-component__thumb { width: 56px; height: 56px; }
  .erp-bundle-component { gap: .75em; padding: .75em 0; }
  .erp-bundle-component__title-row { flex-direction: column; gap: .1em; }
  .erp-bundle-component__qty { align-self: flex-start; }
  .erp-bundle-component__meta { flex-direction: column; align-items: flex-start; gap: .25em; }
  .erp-bundle__savings-banner { padding: .75em .875em; }
  .erp-bundle__savings-banner-amount { font-size: 1rem; }
  .erp-bundle__add-btn { padding: 1em; font-size: .9375rem; }
}
