/* MG Bundle - ficha de producto. Los colores se ajustan con estas variables. */
.mgbundle {
  --mgb-accent: #b8892b;
  --mgb-accent-soft: #fbf7ef;
  --mgb-border: #e3e3e3;
  --mgb-muted: #777;
  --mgb-save: #2e7d32;
  --mgb-text: #222;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: clip; /* nunca ensancha la página aunque el tema meta algo raro */
  margin: 1.25rem 0;
}

.mgbundle *, .mgbundle *::before, .mgbundle *::after { box-sizing: border-box; }

/* Si el tema lo coloca dentro de una fila de Bootstrap (.row), ocupa la fila entera */
.mgbundle.mgbundle--in-row { flex: 0 0 100%; }

.mgbundle.mgbundle--moved { margin: 1rem 0 1.25rem; }

/* ---------- Secciones ---------- */

.mgbundle .mgb-section { margin-bottom: 1rem; }

.mgbundle .mgb-head {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: .5rem;
}

/* ---------- Tarjetas ---------- */

.mgbundle .mgb-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
  min-width: 0;
  gap: .6rem;
}

@media (max-width: 575px) {
  .mgbundle .mgb-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
}

.mgbundle .mgb-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  min-width: 0;
  min-height: 72px;
  -webkit-appearance: none;
  appearance: none;
  white-space: normal;
  margin: 0;
  padding: .6rem 2.1rem .6rem .6rem;
  border: 1px solid var(--mgb-border);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}

/* Solo con ratón: en el móvil el :hover se queda "pegado" tras tocar y parece marcada */
@media (hover: hover) {
  .mgbundle .mgb-card:hover { border-color: var(--mgb-accent); }
}

.mgbundle .mgb-card:focus-visible {
  outline: 2px solid var(--mgb-accent);
  outline-offset: 2px;
}

.mgbundle .mgb-card.is-selected {
  border-color: var(--mgb-accent);
  background: var(--mgb-accent-soft);
  box-shadow: 0 0 0 1px var(--mgb-accent) inset;
}

.mgbundle .mgb-card.is-disabled {
  opacity: .5;
  cursor: not-allowed;
}

.mgbundle .mgb-card-img {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

.mgbundle .mgb-card-body {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
  line-height: 1.25;
}

.mgbundle .mgb-card-name {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: .9rem;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mgbundle .mgb-card-price { font-size: .8rem; color: var(--mgb-muted); }

.mgbundle .mgb-card-save {
  font-size: .8rem;
  font-weight: 600;
  color: var(--mgb-save);
}

/* Círculo "+" que pasa a "✓" al marcar */
.mgbundle .mgb-check {
  position: absolute;
  top: 50%;
  right: .6rem;
  width: 22px;
  height: 22px;
  margin-top: -11px;
  border: 1.5px solid var(--mgb-accent);
  border-radius: 50%;
  background: #fff;
}

.mgbundle .mgb-check::before {
  content: "+";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  color: var(--mgb-accent);
}

.mgbundle .mgb-card.is-selected .mgb-check { background: var(--mgb-accent); }

.mgbundle .mgb-card.is-selected .mgb-check::before {
  content: "✓";
  font-size: 13px;
  color: #fff;
}

@media (max-width: 575px) {
  .mgbundle .mgb-card {
    flex-direction: column;
    align-items: flex-start;
    padding: .6rem;
    padding-top: .6rem;
  }
  .mgbundle .mgb-card-img { width: 56px; height: 56px; }
  .mgbundle .mgb-check { top: .6rem; margin-top: 0; }
}

.mgbundle .mgb-oos { color: #c0392b; font-size: .8rem; }

/* ---------- Packs de varios complementos ---------- */

.mgbundle .mgb-combos {
  list-style: none;
  margin: -.25rem 0 1rem;
  padding: 0;
  font-size: .85rem;
  color: var(--mgb-muted);
}

.mgbundle .mgb-combos strong { color: var(--mgb-save); }
.mgbundle .mgb-combos .mgb-pack.is-active { color: inherit; font-weight: 600; }
.mgbundle .mgb-combos .mgb-pack.is-active::before { content: "✓ "; color: var(--mgb-save); }

/* ---------- Opciones del complemento marcado ---------- */

.mgbundle .mgb-config {
  margin-bottom: .75rem;
  padding: .75rem;
  border: 1px solid var(--mgb-border);
  border-radius: 8px;
  background: #fafafa;
}

.mgbundle .mgb-summary {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .6rem;
}

.mgbundle .mgb-summary-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

.mgbundle .mgb-summary-text { display: flex; flex-direction: column; line-height: 1.3; }
.mgbundle .mgb-summary-price { color: var(--mgb-accent); font-weight: 600; }
.mgbundle .mgb-summary-hint { color: var(--mgb-muted); font-size: .85rem; }

.mgbundle .mgb-attr { margin-bottom: .5rem; }
.mgbundle .mgb-attr:last-child { margin-bottom: 0; }

.mgbundle .mgb-attr-label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: .3rem;
}

.mgbundle .mgb-pills { display: flex; flex-wrap: wrap; gap: .4rem; }

.mgbundle .mgb-pill {
  border: 1px solid var(--mgb-border);
  background: #fff;
  border-radius: 999px;
  padding: .3rem .9rem;
  font: inherit;
  font-size: .85rem;
  line-height: 1.3;
  color: var(--mgb-text); /* Safari en iPhone pinta los botones en azul si no */
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.mgbundle .mgb-pill.is-active {
  border-color: var(--mgb-accent);
  background: var(--mgb-accent);
  color: #fff;
}

.mgbundle .mgb-pill.is-unavailable { text-decoration: line-through; opacity: .45; }
.mgbundle .mgb-pill[disabled] { cursor: not-allowed; }

.mgbundle .mgb-select { max-width: 260px; }

/* ---------- Total ---------- */

.mgbundle .mgb-total {
  padding: .6rem 0;
  border-top: 1px solid var(--mgb-border);
}

.mgbundle .mgb-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 1rem;
}

.mgbundle .mgb-total-row strong { font-size: 1.15rem; white-space: nowrap; }
.mgbundle .mgb-total-row > span:last-child { text-align: right; }
.mgbundle .mgb-total-old { color: var(--mgb-muted); font-size: .9rem; margin-right: .25rem; }
.mgbundle .mgb-total-save { text-align: right; color: var(--mgb-save); font-weight: 600; font-size: .9rem; }
.mgbundle .mgb-total-note { text-align: right; color: var(--mgb-muted); font-size: .8rem; }

.mgbundle .mgb-error {
  margin-top: .5rem;
  padding: .5rem .75rem;
  border-radius: 4px;
  background: #fdecea;
  color: #a12a1f;
  font-size: .9rem;
}
