/* ================================
   EMGRAND – Configurador
================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

.emg-config {
  position: relative;
  max-width: 100%;
  padding: 80px 24px 88px;
  color: #03050f;

  margin-top: 0px !important;

  /* Fondo por defecto si no hay imagen */
  background-color: #e3e3e3;

  /* Imágenes desde CSS vars (inline style en PHP) */
  background-image: var(--emg-config-bg-desktop);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow-x: clip;
}
@supports not (overflow: clip) {
  .emg-config {
    overflow-x: hidden;
  }
}

.emg-config__inner,
.emg-config__top,
.emg-config__versions,
.emg-config__layout,
.emg-config__info {
  max-width: 100%;
  min-width: 0;
}

.emg-config__inner {
  max-width: 1240px;
  margin: 0 auto;
}

/* Top: título + tabs arriba */

.emg-config__top {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  align-items: flex-start;
  gap: 40px;
  margin: 0px 40px 40px 40px;
}

/* .emg-config__header {
  max-width: 420px;
} */

.emg-config__eyebrow {
  font-size: 14px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin: 0 0 10px;
  opacity: 0.8;
}

.emg-config__title {
  text-transform: uppercase;
  margin: 0;
  font-weight: 700;
  font-size: 24px;
  line-height: 30px;
  letter-spacing: 4px;
  vertical-align: middle;
  color: #0B0C0C;
  font-family: var(--font-geely);
}

/* Tabs de versiones (flotando arriba a la derecha tipo Figma) */

.emg-config__versions {
  position: absolute;
  top: 6px;
  right: 0;

  display: flex;
  align-items: stretch;

  background-color: rgba(255, 255, 255, 0.96);
  border-radius: 8px;
  box-shadow: 0px 4px 4px 0px #bdbdbd80;

  max-width: 100%;
}

.emg-config__version {
  font-family: var(--font-inter);
  border: none;
  padding: 8px 22px;
  border-radius: 0px;
  font-size: 16px;
  line-height: 22px;
  cursor: pointer;
  background: transparent;
  color: #444;
  transition: background 0.2s ease, color 0.2s ease;

  min-width: 0; /* permite encoger */
  flex: 1 1 auto; /* se distribuyen sin reventar ancho */
}

.emg-config__version:first-child {
  border-radius: 8px 0 0 8px;
}

.emg-config__version:last-child {
  border-radius: 0 8px 8px 0;
}

.emg-config__version.is-active {
  background: #0B0C0C;
  color: #fff;
}

/* Paneles */

.emg-config__panels {
  position: relative;
}

.emg-config__panel {
  display: none;
}

.emg-config__panel.is-active {
  display: block;
}

/* Layout principal: auto a la izquierda, info a la derecha */

.emg-config__layout {
  display: grid;
  grid-template-columns: 1fr;
  column-gap: 72px;
  align-items: center;
}

/* Visual (imagen + colores + 360) */

.emg-config__visual {
  position: relative;
}

.emg-config__image-wrapper {
  position: relative;
  width: 100%;
  max-width: 860px;
  margin-left: 50%;
  transform: translateX(-50%);
}

.emg-config__image {
  display: none;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 32px 40px rgba(0, 0, 0, 0.35));
}

.emg-config__image.is-active {
  display: block;
}

/* Específico para el viewer 360 */
.emg-config__image-360 {
  position: relative;
  min-height: 260px; /* ajusta según altura del auto */
  background: transparent;
}

.emg-config__visual {
  max-width: 100% !important;
  width: 100%;
}

/* Garantizar que el canvas/imagen interna ocupen el ancho */
.emg-config__image-360 canvas,
.emg-config__image-360 img {
  max-width: 100% !important;
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 16 / 9;
}

/* Tarjeta de colores tipo maqueta */

.emg-config__colors {
  position: absolute;
  left: 40px;
  top: 70px;
  padding: 32px 16px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 16px;
  box-shadow: 0px 4px 4px 0px #BDBDBD80;
  max-height: fit-content;
  background: linear-gradient(180deg, #FFFFFF 0%, #F0F0F0 50%, #D6D6D6 100%);
}

.emg-config__colors-label {
  font-family: var(--font-geely);
  font-weight: 700;
  font-size: 16px;
  line-height: normal;
  display: block;
  margin-bottom: 24px;
  color: #0b0c0c;
}

.emg-config__colors-list {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

.emg-config__color-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--emg-color, #ccc);
  cursor: pointer;
  padding: 0;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.16);
}

.emg-config__color-dot.is-active {
  border-color: #027bff;
}

/* Icono 360 centrado bajo el auto */

.emg-config__360 {
  position: absolute;
  left: 50%;
  bottom: -26px;
  transform: translateX(-50%);
}

.emg-config__360-img {
  width: 76px;
  height: auto;
  opacity: 0.9;
}

/* Info derecha */

.emg-config__info {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  margin: 0 97px;
}

/* El título de modelo solo se usa en mobile;
   en desktop ya tenemos el título grande arriba */
@media (min-width: 769px) {
  .emg-config__model-title {
    display: none;
  }
}

.emg-config__model-title {
  font-size: 22px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0 0 10px;
}

/* Franja inferior: 3 bloques (Precio, Aros, Hasta) */

.emg-config__bottom-grid {
  color: #000;
  margin-top: 56px;
  display: grid;
  grid-template-columns: 1fr 2fr; /* bloque de precio más ancho */
  column-gap: 64px;
  row-gap: 24px;
}

.emg-config__prices {
  margin-top: 4px;
}

.emg-config__price-label {
  margin: 0 0 6px;
  opacity: 0.75;
  font-family: var(--font-inter);
  font-weight: 500;
  font-size: 20px;
  line-height: 32px;
  letter-spacing: 0px;
  vertical-align: middle;
}

.emg-config__price-line {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.emg-config__price-usd,
.emg-config__price-local {
  display: block;
  font-weight: 700;
  font-size: 48px;
  line-height: 40px;
  letter-spacing: 0px;
  font-family: var(--font-geely);
}

.emg-config__price-or {
  font-family: var(--font-inter);
  font-weight: 500;
  font-size: 16px;
  line-height: 22px;
  letter-spacing: 0px;
  text-align: center;
  vertical-align: middle;
}

/* Specs: Aros y Hasta como bloques separados */

.emg-config__specs {
  display: flex;
  gap: 100px;
}

.emg-config__spec {
  min-width: 0;
}

.emg-config__spec-label {
  font-family: var(--font-inter);
  font-weight: 500;
  font-size: 20px;
  line-height: 32px;
  letter-spacing: 0px;
  vertical-align: middle;
  color: #0B0C0C;
}

.emg-config__spec-main {
  font-family: var(--font-geely);
  display: block;
  margin-top: 4px;
  font-weight: 700;
  font-size: 48px;
  line-height: 40px;
  letter-spacing: 0px;
}

.emg-config__spec-sub {
  display: block;
  margin-top: 2px;
  font-family: var(--font-inter);
  font-weight: 500;
  font-size: 20px;
  line-height: 32px;
  letter-spacing: 0px;
}

.emg-config__price-di {
  font-family: var(--font-inter);
  font-weight: 500;
  font-size: 20px;
  line-height: 32px;
  letter-spacing: 0px;
}

.emg-config__spec-ve {
  font-family: var(--font-inter);
  font-weight: 500;
  font-size: 20px;
  line-height: 32px;
  letter-spacing: 0px;
}

/* Botones */

.emg-config__cta-row {
  margin-top: 26px;
  display: flex;
  gap: 18px;
}

.emg-config__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 28px;
  font-size: 14px;
  text-decoration: none;
  border-radius: 0;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.emg-config__btn--primary {
  background: #03050f;
  color: #fff;
  border-color: #03050f;
}

.emg-config__btn--primary:hover {
  background: #202430;
}

.emg-config__btn--secondary {
  background: transparent;
  color: #03050f;
  border-color: #03050f;
}

/* ================================
   RESPONSIVE
================================ */

@media (max-width: 1200px) {
  .emg-config__layout {
    column-gap: 48px;
  }
  .emg-config__bottom-grid {
    grid-template-columns: 1fr max-content;
  }
}

@media (max-width: 1024px) {
  .emg-config__layout {
    grid-template-columns: 1fr;
    row-gap: 40px;
  }

  .emg-config__top {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  /* Tabs dejan de ser flotantes y pasan a ser normales */
  .emg-config__versions {
    position: static;
    justify-self: flex-start;
  }

  .emg-config__colors {
    left: 40px;
    bottom: 40px;
  }

  .emg-config__360 {
    bottom: 6px;
  }

  .emg-config__bottom-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .emg-config__specs {
    flex-direction: column;
    gap: 24px;
  }
}

@media (max-width: 768px) {
  .emg-config {
    padding: 40px 16px 16px;
    /* En mobile usamos la imagen mobile si existe */
    background-image: var(--emg-config-bg-mobile, var(--emg-config-bg-desktop));
    background-size: cover;
    background-position: center top;
  }

  /* El contenido se limita y centra, como en el diseño */
  .emg-config__inner {
    max-width: 420px;
    margin: 0 auto;
  }

  /* Título + tabs arriba */
  .emg-config__top {
    grid-template-columns: 1fr;
    gap: 20px;
    margin: 0 0 8px;
  }

  .emg-config__title {
    font-size: 32px;
    line-height: 40px;
  }

  .emg-config__version {
    flex: 0 0 auto; /* CLAVE */
    white-space: nowrap;
    min-width: max-content;

    padding: 10px 18px;
    font-size: 14px;
    text-align: center;
  }

  .emg-config__versions {
    position: relative;
    top: 0;
    right: 0;

    max-width: 100%;

    overflow-x: auto;
    overflow-y: hidden;

    -webkit-overflow-scrolling: touch;

    flex-wrap: nowrap;
  }

  .emg-config__versions::-webkit-scrollbar {
    display: none;
  }

  .emg-config__price-line {
    gap: 0px;
  }

  /* === TARJETA BLANCA === */
  .emg-config__panel {
    padding: 0px 0px 24px;
  }

  /* La tarjeta se apila en columna:
     primero INFO, luego VISUAL (auto + colores) */
  .emg-config__layout {
    display: flex;
    flex-direction: column;
    row-gap: 20px;
  }

  .emg-config__info {
    order: 1;
    margin: 0;
  }

  .emg-config__visual {
    order: 2;
  }

  /* Título de modelo visible en mobile */
  .emg-config__model-title {
    display: block;
    font-size: 16px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin: 0 0 8px;
  }

  /* Bloque precio + specs más compacto */
  .emg-config__bottom-grid {
    margin-top: 12px;
    grid-template-columns: 1fr;
    column-gap: 18px;
    row-gap: 18px;
  }

  .emg-config__price-label {
    font-size: 14px;
    line-height: 1.4;
  }

  .emg-config__price-usd,
  .emg-config__price-local,
  .emg-config__spec-main {
    font-size: 32px;
    line-height: 40px;
  }

  .emg-config__price-or,
  .emg-config__spec-label,
  .emg-config__spec-sub,
  .emg-config__price-di,
  .emg-config__spec-ve {
    font-size: 14px;
    line-height: 20px;
  }

  /* Auto centrado y más pequeño */
  .emg-config__image-wrapper {
    max-width: 100%;
    margin: 8px auto 50px;
    transform: translateX(0);
  }

  /* Colores debajo del auto, dentro de la tarjeta */
  .emg-config__colors {
    position: static;
    margin: 16px auto;
    padding: 16px 24px;
    max-width: 157px;
    text-align: center;
  }

  .emg-config__colors-label {
    font-size: 12px;
    margin-bottom: 8px;
  }

  .emg-config__colors-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-items: flex-start;
  }

  /* 360 debajo del selector de colores */
  .emg-config__360 {
    position: absolute;
    text-align: center;
    top: 190px;
    transform: translateX(-50%);
    height: fit-content;
  }

  .emg-config__360-img {
    width: 64px;
  }

  .emg-config__specs {
    flex-direction: row;
    gap: 24px;
  }

  .emg-config__spec {
    flex: 1;
  }

  /* CTAs en columna, full width (por si luego los activas) */
  .emg-config__cta-row {
    flex-direction: column;
    align-items: stretch;
    margin-top: 20px;
  }

  .emg-config__btn {
    width: 100%;
  }
}
