/* =========================
   RESET GENERAL
========================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  image-rendering: auto;
}

body {
  font-family: 'Press Start 2P', monospace;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 24px;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.22)),
    url("img/A3.png") center / cover no-repeat fixed;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.22);
  pointer-events: none;
  z-index: 0;
}

/* =========================
   CONTENEDOR GENERAL
========================= */
.contenedor-total {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 1;
}

/* =========================
   MAQUINA PRINCIPAL
========================= */
.maquina-vending {
  width: min(90vw, 720px);
  background: linear-gradient(to bottom, #fb5a05 0%, #d35f49 58%, #d35f49 100%);
  border: 4px solid #000;
  border-radius: 12px;
  box-shadow:
    0 14px 0 #1b1b1e,
    14px 14px 0 rgba(50, 15, 1, 0.9);
  padding: 16px 16px 12px;
  position: relative;
  transform: scale(0.96);
  transform-origin: center;
}

.maquina-vending::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 8px;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}

/* =========================
   ENCABEZADO
========================= */
.encabezado-maquina {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.focos.laterales {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 62px;
}

.foco {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #ffe9c4;
  animation: parpadeoLed 1.6s infinite alternate;
}

.rojo {
  background: #d0ff00;
  box-shadow: 0 0 8px #d0ff00;
}

.amarillo {
  background: #ff0404;
  box-shadow: 0 0 8px #ffc3c3;
  animation-delay: .3s;
}

.verde {
  background: #000000;
  animation-delay: .6s;
}

@keyframes parpadeoLed {
  from {
    transform: scale(1);
    opacity: 0.9;
  }
  to {
    transform: scale(1.08);
    opacity: 1;
  }
}

.logo-maquina {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.logo-maquina img {
  width: 170px;
  max-width: 100%;
  height: auto;
  image-rendering: auto;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.1));
}

/* =========================
   CUERPO PRINCIPAL
========================= */
.cuerpo-maquina {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

/* =========================
   LADO IZQUIERDO
========================= */
.lado-izquierdo {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* =========================
   VITRINA
========================= */
.vitrina {
  width: 100%;
  background: #6b0022ae;
  border: 4px solid #000;
  padding: 10px;
  box-shadow:
    inset 0 0 14px rgba(0, 0, 0, 0.16),
    inset 0 1px 0 rgba(255,255,255,0.18);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vitrina::before {
  content: "";
  position: absolute;
  top: 0;
  left: -140%;
  width: 42%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255,255,255,0.20) 40%,
    rgba(255,255,255,0.42) 52%,
    rgba(255,255,255,0.12) 62%,
    transparent 100%
  );
  pointer-events: none;
}

.vitrina.reflejo-activo::before {
  animation: reflejoVitrina 1s ease-out;
}

@keyframes reflejoVitrina {
  0% {
    left: -140%;
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    left: 140%;
    opacity: 0;
  }
}

/* =========================
   REPISAS
========================= */
.nivel-repisa {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.luz-repisa {
  width: 100%;
  height: 4px;
  border: 1px solid #000;
  background: linear-gradient(to right, #fff1a0, #ffffff, #fff1a0);
  box-shadow: 0 0 6px rgba(255, 241, 160, 0.35);
}

.repisa {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 90px;
  background: #ff6849;
  border: 3px solid #000;
  padding: 8px 8px;
  position: relative;
}

.producto-con-etiqueta {
  width: calc(16.666% - 4px);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* =========================
   CAPSULAS / PRODUCTOS
========================= */
.producto {
  width: 62px;
  height: 62px;
  object-fit: cover;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #ffffff 0%, #f7f7f7 34%, #dcdcdc 70%, #cfcfcf 100%);
  border: 3px solid #000;
  box-shadow:
    0 4px 0 #000,
    inset 0 2px 7px rgba(0,0,0,0.20);
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.producto:hover {
  transform: translateY(-2px) scale(1.04);
  filter: brightness(1.04);
}

.producto-con-etiqueta::after {
  content: "";
  position: absolute;
  top: 9px;
  left: calc(50% - 13px);
  width: 14px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.55);
  transform: rotate(-25deg);
  pointer-events: none;
}

.producto-con-etiqueta.producto-activo .producto {
  transform: translateY(-2px) scale(1.06);
  box-shadow:
    0 4px 0 #000,
    inset 0 2px 7px rgba(0,0,0,0.20),
    0 0 12px #ffe600,
    0 0 24px rgba(255, 230, 0, 0.35);
}

/* =========================
   ETIQUETAS OCULTAS
========================= */
.etiqueta {
  display: none;
}

/* =========================
   ENTREGA
========================= */
.entrega {
  width: 66%;
  min-height: 76px;
  background: linear-gradient(to bottom, #151515, #050505);
  border: 4px solid #000;
  border-radius: 4px;
  box-shadow:
    inset 0 7px 12px rgba(255,255,255,0.05),
    inset 0 -10px 12px rgba(0,0,0,0.35),
    0 4px 0 #000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px;
  position: relative;
  overflow: hidden;
}

.entrega::before {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent 20%,
    rgba(255,255,255,0.08) 50%,
    transparent 80%
  );
  animation: brilloEntrega 5s linear infinite;
}

@keyframes brilloEntrega {
  0% {
    left: -60%;
  }
  100% {
    left: 130%;
  }
}

.entrega p {
  color: #ffffff;
  font-size: 11px;
  text-align: center;
  line-height: 1.5;
  text-shadow: 0 0 4px rgba(255, 230, 0, 0.35);
  position: relative;
  z-index: 1;
}

.producto-animado {
  width: 54px;
  height: 54px;
  object-fit: contain;
  position: relative;
  z-index: 1;
  animation: bajarProducto 0.7s ease-out;
}

@keyframes bajarProducto {
  0% {
    transform: translateY(-120px) scale(0.6);
    opacity: 0;
  }
  80% {
    transform: translateY(4px) scale(1.06);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

.zona-entrega-activa {
  animation: brilloLed 0.55s infinite alternate;
}

@keyframes brilloLed {
  0% {
    box-shadow:
      inset 0 7px 12px rgba(255,255,255,0.05),
      inset 0 -10px 12px rgba(0,0,0,0.35),
      0 0 6px #fff09a;
  }
  100% {
    box-shadow:
      inset 0 7px 12px rgba(255,255,255,0.05),
      inset 0 -10px 12px rgba(0,0,0,0.35),
      0 0 16px #ffe600;
  }
}

/* =========================
   LADO DERECHO
========================= */
.lado-derecho {
  width: 200px;
  flex-shrink: 0;
}

.modulo-control-lateral {
  width: 100%;
}

.panel-seleccion-enmarcado {
  width: 100%;
  background: #6b0022ae;
  border: 4px solid #000;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow:
    inset 0 0 8px rgba(255,255,255,0.12),
    0 3px 0 rgba(0,0,0,0.2);
}

/* =========================
   PANTALLA PROMOCIONAL
========================= */
.pantalla-promocional {
  width: 100%;
  height: 260px;
  background: #040404;
  border: 4px solid #000;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow:
    inset 0 0 18px rgba(255,255,255,0.03),
    inset 0 0 22px rgba(0,0,0,0.7);
  position: relative;
}

.pantalla-promocional::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(255,255,255,0.04),
    transparent 20%,
    transparent 80%,
    rgba(255,255,255,0.02)
  );
  pointer-events: none;
}

.pantalla-promocional img,
.pantalla-promocional video,
.pantalla-promocional canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* =========================
   DISPLAY
========================= */
.pantalla-seleccion {
  width: 100%;
  min-height: 36px;
  background: #000;
  color: #effff9;
  border: 3px solid #e7fff6;
  border-radius: 4px;
  font-size: 9px;
  text-align: center;
  line-height: 1.4;
  text-shadow: 0 0 5px #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px 8px;
  box-shadow: inset 0 0 10px rgba(0,255,156,0.08);
}

/* =========================
   INPUT CODIGO
========================= */
.codigo-box {
  width: 100%;
}

.input-codigo {
  width: 100%;
  min-height: 38px;
  background: linear-gradient(to bottom, #f1f1f1, #e5e5e5);
  border: 3px solid #000;
  border-radius: 2px;
  padding: 8px 10px;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: #111;
  text-align: center;
  outline: none;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.16);
  text-transform: uppercase;
}

.input-codigo::placeholder {
  color: #6b6b6b;
  opacity: 1;
}

.input-codigo:focus {
  background: #fffde8;
  box-shadow:
    inset 0 0 4px rgba(0,0,0,0.16),
    0 0 0 2px rgba(255, 230, 0, 0.22);
}

/* =========================
   BOTONES
========================= */
.botones-linea {
  display: flex;
  gap: 10px;
  width: 100%;
}

.btn-agregar,
.btn-push-grande {
  flex: 1;
  min-height: 40px;
  background: linear-gradient(to bottom, #fff100, #f3dc00);
  border: 4px solid #000;
  color: #000;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  cursor: pointer;
  box-shadow:
    0 4px 0 #000,
    inset 0 1px 0 rgba(255,255,255,0.28);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease;
}

.btn-agregar:hover,
.btn-push-grande:hover {
  filter: brightness(1.03);
}

.btn-agregar:active,
.btn-push-grande:active {
  transform: translate(2px, 2px);
  box-shadow: 0 1px 0 #000;
}

.btn-push-grande:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  filter: grayscale(0.1);
}

/* =========================
   BASE
========================= */
.base-maquina {
  width: 100%;
  height: 16px;
  margin-top: 16px;
  background: #4d0000;
  border-top: 4px solid #000;
  border-radius: 0 0 6px 6px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

/* =========================
   POPUP
========================= */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.74);
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
  z-index: 9999;
}

.popup-overlay.activo {
  display: flex;
}

.popup-card {
  width: 100%;
  max-width: 340px;
  background: #fff7ef;
  border: 4px solid #000;
  border-radius: 8px;
  box-shadow: 8px 8px 0 #000;
  overflow: hidden;
  position: relative;
  animation: popupEntrada 0.22s ease;
}

@keyframes popupEntrada {
  from {
    transform: scale(0.94) translateY(8px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.popup-header {
  background: #ffe600;
  border-bottom: 3px solid #000;
  color: #000;
  font-size: 13px;
  text-align: center;
  line-height: 1.4;
  padding: 12px 10px;
}

.popup-cerrar {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 2px solid #000;
  background: #ff4757;
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  cursor: pointer;
}

.popup-img-wrap {
  min-height: 180px;
  background: linear-gradient(to bottom, #fffdf5, #ffe7e7);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

.popup-img-wrap img {
  max-width: 100%;
  max-height: 350px;
  object-fit: contain;
  display: block;
}

.popup-info {
  padding: 16px;
  text-align: center;
}

.popup-info h3 {
  font-size: 14px;
  color: #111;
  line-height: 1.5;
  margin-bottom: 10px;
}

.popup-info p {
  font-size: 10px;
  color: #333;
  line-height: 1.6;
  margin-bottom: 10px;
}

.popup-info small {
  display: block;
  font-size: 9px;
  color: #666;
  line-height: 1.5;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 900px) {
  .maquina-vending {
    width: min(92vw, 700px);
    transform: scale(0.98);
  }

  .cuerpo-maquina {
    gap: 16px;
  }
}

@media (max-width: 760px) {
  body {
    padding: 14px;
    align-items: flex-start;
  }

  .maquina-vending {
    width: 100%;
    transform: none;
  }

  .cuerpo-maquina {
    flex-direction: column;
  }

  .lado-derecho {
    width: 100%;
  }

  .entrega {
    width: 100%;
  }

  .pantalla-promocional {
    height: 230px;
  }
}

@media (max-width: 560px) {
  .logo-maquina img {
    width: 130px;
  }

  .foco {
    width: 11px;
    height: 11px;
  }

  .repisa {
    flex-wrap: wrap;
    justify-content: center;
    min-height: auto;
  }

  .producto-con-etiqueta {
    width: 30%;
  }

  .producto {
    width: 50px;
    height: 50px;
  }

  .botones-linea {
    flex-direction: column;
  }

  .btn-agregar,
  .btn-push-grande {
    width: 100%;
  }

  .pantalla-seleccion,
  .input-codigo {
    font-size: 8px;
  }
}

.disclaimer{
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 10px;
  line-height: 1.4;
  color: #d8cfe6;
  font-family: Arial, sans-serif;
  padding: 8px 14px;
  background: rgba(0,0,0,0.45);
  box-sizing: border-box;
  z-index: 999;
}

.boton-codigo-wrap{
  width:100%;
  margin-top:12px;
}

.btn-obtener-codigo{
  width:100%;
  padding:14px 10px;
  background:#000000;
  border:none;
  color:rgb(255, 255, 255);
  font-family:'Press Start 2P', cursive;
  font-size:10px;
  letter-spacing:1px;
  cursor:pointer;
  border-radius:6px;
  transition:0.2s;
}

.btn-obtener-codigo:hover{
  background:#ff5f2e;
  transform:scale(1.02);
}