/*
 * WP Engine Commerce Connect Bundle Configurator: configurator styles.
 *
 * Every colour and size is a custom property on .cc-bundle with a neutral default, so a theme or
 * client plugin can reskin the configurator by redefining a few of them in one small stylesheet.
 */

.cc-bundle {
  --cc-bundle-text: #1f2426;
  --cc-bundle-muted: #555;
  --cc-bundle-label: #333;
  --cc-bundle-border: #e2e2e2;
  --cc-bundle-surface: #fafafa;
  --cc-bundle-surface-alt: #fff;
  --cc-bundle-radius: 6px;
  --cc-bundle-radius-sm: 4px;
  --cc-bundle-accent: #1f2426;
  --cc-bundle-price: #1f2426;
  --cc-bundle-compare: #777;
  --cc-bundle-danger: #cc2200;
  --cc-bundle-danger-surface: #fdf2f2;
  --cc-bundle-danger-border: #f5c6cb;
  --cc-bundle-danger-text: #721c24;
  --cc-bundle-success: #1e6b34;
  --cc-bundle-success-surface: #e6f4ea;
  --cc-bundle-out-surface: #fdecea;
  --cc-bundle-out-text: #8a1c13;
  --cc-bundle-focus: #0073aa;
  --cc-bundle-input-border: #ccc;
  --cc-bundle-button-bg: #1f2426;
  --cc-bundle-button-bg-hover: #333;
  --cc-bundle-button-text: #fff;

  margin-top: 1.5rem;
  padding: 1.5rem;
  border: 2px solid var(--cc-bundle-border);
  border-radius: var(--cc-bundle-radius);
  background: var(--cc-bundle-surface);
  font-family: inherit;
}

.cc-bundle [hidden] {
  display: none;
}

/* ── Header: title, SKU and total ───────────────────────────────────────── */
.cc-bundle__header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  align-items: baseline;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--cc-bundle-border);
}

.cc-bundle__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--cc-bundle-text);
  flex-basis: 100%;
}

.cc-bundle__sku {
  font-size: 0.9rem;
  color: var(--cc-bundle-muted);
}

.cc-bundle__total {
  font-size: 1.2rem;
  color: var(--cc-bundle-text);
}

.cc-bundle__total strong {
  font-size: 1.4rem;
  color: var(--cc-bundle-accent);
}

/* ── Components ─────────────────────────────────────────────────────────── */
.cc-bundle__components {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.cc-bundle-component {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cc-bundle-component__label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--cc-bundle-label);
}

.cc-bundle-component__help {
  margin: 0.15rem 0 0.5rem;
  font-size: 0.85rem;
  color: var(--cc-bundle-muted);
}

.cc-bundle-component__select {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--cc-bundle-input-border);
  border-radius: var(--cc-bundle-radius-sm);
  font-size: 0.9rem;
  background: var(--cc-bundle-surface-alt);
  cursor: pointer;
}

.cc-bundle-component__select:focus {
  outline: 2px solid var(--cc-bundle-focus);
  border-color: var(--cc-bundle-focus);
}

.cc-bundle-component--invalid .cc-bundle-component__label {
  color: var(--cc-bundle-danger);
}

.cc-bundle-component--invalid .cc-bundle-component__select {
  border-color: var(--cc-bundle-danger);
  box-shadow: 0 0 0 1px var(--cc-bundle-danger);
}

.cc-bundle-component__error {
  margin: 0.35rem 0 0;
  color: var(--cc-bundle-danger);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ── Selected item card ─────────────────────────────────────────────────── */
.cc-bundle-component__card {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1rem;
  align-items: start;
  margin-top: 0.75rem;
}

.cc-bundle-component__card:not([hidden]):not(:has(.cc-bundle-component__media:not([hidden]))) {
  grid-template-columns: 1fr;
}

.cc-bundle-component__image {
  display: block;
  width: 160px;
  height: auto;
  max-height: 160px;
  object-fit: contain;
  border-radius: var(--cc-bundle-radius-sm);
}

.cc-bundle-component__name {
  margin: 0 0 0.35rem;
  font-weight: 700;
}

.cc-bundle-component__quantity {
  font-weight: 600;
}

.cc-bundle-component__description {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--cc-bundle-muted);
}

.cc-bundle-component__pricing {
  margin: 0 0 0.5rem;
}

.cc-bundle-component__compare {
  margin-right: 0.35rem;
  color: var(--cc-bundle-compare);
}

.cc-bundle-component__price {
  font-size: 1.15rem;
  color: var(--cc-bundle-price);
}

.cc-bundle-component__each {
  margin-left: 0.25rem;
  font-weight: 600;
  color: var(--cc-bundle-price);
}

.cc-bundle-component__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin: 0;
}

.cc-bundle-component__stock {
  padding: 0.15rem 0.6rem;
  background: var(--cc-bundle-success-surface);
  color: var(--cc-bundle-success);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.cc-bundle-component__stock--out {
  background: var(--cc-bundle-out-surface);
  color: var(--cc-bundle-out-text);
}

.cc-bundle-component__clear {
  padding: 0;
  background: none;
  border: 0;
  color: var(--cc-bundle-danger);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

/* ── What's included ────────────────────────────────────────────────────── */
.cc-bundle__included {
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--cc-bundle-surface-alt);
  border: 1px solid var(--cc-bundle-border);
  border-radius: var(--cc-bundle-radius-sm);
}

.cc-bundle__included h4 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--cc-bundle-text);
}

/* ── Actions and notices ────────────────────────────────────────────────── */
.cc-bundle__actions {
  margin-bottom: 1rem;
}

.cc-bundle__button {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: var(--cc-bundle-radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.cc-bundle__button--primary {
  background: var(--cc-bundle-button-bg);
  color: var(--cc-bundle-button-text);
}

.cc-bundle__button--primary:hover {
  background: var(--cc-bundle-button-bg-hover);
}

.cc-bundle__added {
  margin-top: 0.75rem;
  color: var(--cc-bundle-success);
  font-size: 0.875rem;
}

.cc-bundle__error {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--cc-bundle-danger-surface);
  border: 1px solid var(--cc-bundle-danger-border);
  border-radius: var(--cc-bundle-radius-sm);
  color: var(--cc-bundle-danger-text);
  font-size: 0.875rem;
}

/* ── Component list layout ──────────────────────────────────────────────── */
.cc-bundle--list .cc-bundle__components {
  gap: 0.5rem;
}

.cc-bundle--list .cc-bundle-component {
  padding: 0.75rem;
  background: var(--cc-bundle-surface-alt);
  border: 1px solid var(--cc-bundle-border);
  border-radius: var(--cc-bundle-radius-sm);
}

.cc-bundle--list .cc-bundle-component__card {
  grid-template-columns: 96px 1fr;
  margin-top: 0.5rem;
}

.cc-bundle--list .cc-bundle-component__card:not([hidden]):not(:has(.cc-bundle-component__media:not([hidden]))) {
  grid-template-columns: 1fr;
}

.cc-bundle--list .cc-bundle-component__image {
  width: 96px;
  max-height: 96px;
}

.cc-bundle__toggle-wrap {
  margin: 0 0 1.25rem;
}

.cc-bundle__toggle {
  padding: 0;
  background: none;
  border: 0;
  color: var(--cc-bundle-muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}
