/* GM Configurador — estilos (basado en las capturas de diseño) */

.gmc {
  --gmc-bg: #f5f3ee;
  --gmc-card: #ffffff;
  --gmc-text: #1c1c1e;
  --gmc-muted: #a9a49b;
  --gmc-accent: #8c1f28;
  --gmc-border: #e7e3da;
  --gmc-radius: 12px;

  background: var(--gmc-bg);
  color: var(--gmc-text);
  border-radius: 16px;
  padding: 2.2rem 2.4rem 1.6rem;
  display: flex;
  flex-direction: column;
  min-height: 480px;
}

/* contenedor original de WPO, ya vaciado por el JS */
.gmc-source {
  display: none !important;
}
.gmc .gmc-hidden {
  display: none !important;
}
/* el título del grupo de WPO se sustituye por el título del paso */
.gmc [class*='group-name'] {
  display: none;
}

/* ---------------------------------------------------------------- cabecera */

.gmc-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 1.6rem;
  letter-spacing: -0.01em;
}

/* ------------------------------------------------------------------- pasos */

.gmc-body {
  flex: 1 1 auto;
}

.gmc-step {
  display: none;
}
.gmc-step.is-active {
  display: block;
  animation: gmc-fade 0.25s ease;
}
@keyframes gmc-fade {
  from {
    opacity: 0;
    transform: translateX(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .gmc-step.is-active {
    animation: none;
  }
}

.gmc-step-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.8rem;
}
.gmc-step-title {
  font-size: 1.15rem;
  font-weight: 500;
  margin: 0;
}
.gmc-counter {
  font-size: 1.05rem;
  color: var(--gmc-muted);
}

/* ------------------------------------------------------- campos de WPO */

/* etiqueta a la izquierda, control a la derecha (captura 1) */
.gmc .wpo-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  margin: 0 0 1.2rem;
  flex-wrap: wrap;
}
.gmc .wpo-field > .wpo-field-label,
.gmc .wpo-field > legend,
.gmc .wpo-field > label {
  font-size: 0.95rem;
  font-weight: 400;
  margin: 0;
  flex: 1 1 auto;
}
.gmc .wpo-field input[type='text'],
.gmc .wpo-field input[type='number'],
.gmc .wpo-field select {
  background: var(--gmc-card);
  border: 1px solid var(--gmc-border);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  min-width: 130px;
  max-width: 160px;
  text-align: center;
  font-size: 0.95rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.gmc .wpo-field-description {
  flex-basis: 100%;
  font-size: 0.8rem;
  color: var(--gmc-muted);
  margin: 0.2rem 0 0;
}

/* radios estilo "punto rojo" (¿Hay zócalo?) — no aplica a los campos con imagen */
.gmc
  .wpo-field
  input[type='radio']:not(.gmc-acabados input):not(
    .wpo-field-with-choice-images input
  ) {
  appearance: none;
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gmc-card);
  border: 1px solid var(--gmc-border);
  cursor: pointer;
  vertical-align: middle;
  position: relative;
  transition: box-shadow 0.15s ease;
}
.gmc
  .wpo-field
  input[type='radio']:checked:not(.gmc-acabados input):not(
    .wpo-field-with-choice-images input
  )::after {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--gmc-accent);
}
.gmc .wpo-field input[type='radio']:focus-visible {
  outline: 2px solid var(--gmc-accent);
  outline-offset: 2px;
}

/* --------------------------------------------------- paleta de acabados */

/* neutralizar los estilos de <button> del tema en chips y paleta */
.gmc-chip,
.gmc-swatch {
  color: var(--gmc-text);
  font-family: inherit;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  box-shadow: none;
  min-height: 0;
}
.gmc-chip:hover,
.gmc-chip:focus {
  color: var(--gmc-text);
  background: none;
}
.gmc-swatch:hover,
.gmc-swatch:focus {
  color: var(--gmc-text);
}

.gmc-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.6rem;
}
.gmc-chip {
  background: none;
  border: 0;
  padding: 0.4rem 0;
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.6rem;
  align-items: center;
  border-bottom: 2px solid transparent;
}
.gmc-chip.is-active {
  border-bottom-color: var(--gmc-accent);
}
.gmc-chip-name {
  grid-column: 1 / -1;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gmc-text);
  margin-bottom: 0.35rem;
}
.gmc-chip-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--gmc-card);
  border: 1px solid var(--gmc-border);
}
.gmc-chip-swatch img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gmc-chip-value {
  font-size: 0.85rem;
  color: var(--gmc-muted);
}

.gmc-warn {
  color: var(--gmc-accent);
  font-size: 0.85rem;
  min-height: 1.2em;
  margin: 0 0 0.8rem;
}

.gmc-palette {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem 1.4rem;
}
.gmc-swatch {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--gmc-radius);
  padding: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  cursor: pointer;
  text-align: left;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}
.gmc-swatch:hover {
  background: rgba(255, 255, 255, 0.6);
}
.gmc-swatch.is-selected {
  background: var(--gmc-card);
  border-color: var(--gmc-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.gmc-swatch-img {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  flex: 0 0 auto;
  background: #ddd;
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.gmc-swatch-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gmc-swatch-label {
  font-size: 0.85rem;
  line-height: 1.3;
  color: var(--gmc-text);
}
.gmc-swatch-label strong {
  display: block;
  font-weight: 600;
}
.gmc-swatch-label span {
  display: block;
  font-weight: 400;
}

/* ---------------------- opciones tipo "caja" (campos con imagen de opción) */

/* el campo pasa a bloque: título arriba, cajas debajo a ancho completo */
.gmc .wpo-field-with-choice-images {
  display: block;
}
.gmc .wpo-field-with-choice-images .wpo-option-name {
  margin: 0 0 0.9rem;
}

.gmc .wpo-field-with-choice-images .wpo-choice-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem 1.6rem;
}
.gmc .wpo-field-with-choice-images .wpo-choice-item {
  margin: 0;
}

.gmc .wpo-field-with-choice-images .wpo-choice-item > label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.6rem;
  min-height: 56px;
  background: transparent;
  border: 1px solid var(--gmc-border);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  margin: 0;
  cursor: pointer;
  text-align: center;
  font-size: 0.9rem;
  color: var(--gmc-text);
  transition:
    background 0.15s ease,
    box-shadow 0.15s ease;
}
.gmc .wpo-field-with-choice-images .wpo-choice-item > label:hover {
  background: rgba(255, 255, 255, 0.55);
}
.gmc .wpo-field-with-choice-images .wpo-choice-item > label.is-checked {
  background: var(--gmc-card);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ocultar el control nativo (punto del radio / cuadro del checkbox) */
.gmc .wpo-field-with-choice-images .wpo-choice-item input,
.gmc .wpo-field-with-choice-images .wpo-radio-inner,
.gmc .wpo-field-with-choice-images .wpo-checkbox-inner {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  margin: 0;
  border: 0;
}

.gmc .wpo-field-with-choice-images .wpo-choice-image {
  width: 22px;
  height: 22px;
  object-fit: contain;
}
.gmc .wpo-field-with-choice-images .wpo-choice-label {
  line-height: 1.2;
}
.gmc .wpo-field-with-choice-images .wpo-price-container {
  flex-basis: 100%;
  font-size: 0.75rem;
  color: var(--gmc-muted);
  margin-top: -0.2rem;
}

/* foco por teclado visible sobre la caja */
.gmc .wpo-field-with-choice-images .wpo-choice-item > label:focus-within {
  outline: 2px solid var(--gmc-accent);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .gmc .wpo-field-with-choice-images .wpo-choice-list {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------- resumen */

.gmc-summary {
  background: var(--gmc-card);
  border-radius: var(--gmc-radius);
  padding: 1.8rem 2rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}
.gmc-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.8rem 2.4rem;
}
.gmc-summary-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.9rem;
}
.gmc-summary-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.45rem 1.4rem;
  margin: 0;
  font-size: 0.87rem;
}
.gmc-summary-list dt {
  color: var(--gmc-text);
  font-weight: 400;
  margin: 0;
}
.gmc-summary-list dd {
  color: #5c5a55;
  margin: 0;
  text-align: left;
}
.gmc-summary-file {
  font-size: 0.87rem;
  color: #5c5a55;
  margin: 0 0 0.4rem;
}

/* cantidad + añadir al carrito + totales, fuera del configurador */
.gmc-after {
  margin-top: 1.4rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}
/* el bloque de totales de WPO queda oculto: es la fuente de datos de .gmc-price */
.gmc-after .wpo-totals-container {
  display: none !important;
}
.gmc-after .quantity {
  margin: 0;
}

.gmc-price {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--gmc-text, #1c1c1e);
  margin-right: 0.4rem;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- footer */

.gmc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2.4rem;
}
.gmc-help {
  font-size: 0.9rem;
  color: var(--gmc-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.gmc-nav {
  display: flex;
  gap: 1.2rem;
}
.gmc-arrow {
  background: none;
  border: 0;
  padding: 0.3rem;
  cursor: pointer;
  color: var(--gmc-text);
  line-height: 0;
  transition:
    transform 0.15s ease,
    opacity 0.15s ease;
}
.gmc-arrow:hover {
  transform: translateX(2px);
}
.gmc-prev:hover {
  transform: translateX(-2px);
}
.gmc-arrow.is-hidden {
  visibility: hidden;
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 640px) {
  .gmc {
    padding: 1.5rem 1.2rem 1.2rem;
  }
  .gmc-palette,
  .gmc-summary-grid {
    grid-template-columns: 1fr;
  }
  .gmc-chips {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
  }
  .gmc .wpo-field input[type='text'],
  .gmc .wpo-field input[type='number'],
  .gmc .wpo-field select {
    min-width: 110px;
  }
}

/* Modo "solo medidas" (configuración distinta de Personalizado) */
form.cart.gmc-solo-medidas .gmc-step {
  display: none !important;
}
form.cart.gmc-solo-medidas .gmc-step--medidas {
  display: block !important;
}
form.cart.gmc-solo-medidas .gmc-step--medidas .gmc-counter {
  display: none !important;
}
form.cart.gmc-solo-medidas .gmc-nav {
  display: none !important;
}

.gm-brand__text a strong {
  font-weight: 500;
}
