* { box-sizing: border-box; }

:root {
  --fondo: #1e1e1e;
  --tarjeta: #262626;
  --borde: #3a3a3a;
  --texto: #ffffff;
  --gris: #bdbdbd;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--fondo);
  color: var(--texto);
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
[hidden] { display: none !important; }

/* ======================
   BOTONES FLOTANTES
====================== */
.boton-menu,
.boton-carrito {
  position: fixed;
  top: 14px;
  z-index: 9000;
  height: 46px;
  border: 0;
  border-radius: 10px;
  background: #000;
  color: #fff;
  box-shadow: 0 4px 12px #0007;
}

.boton-menu {
  left: 14px;
  width: 46px;
  font-size: 24px;
}

.boton-carrito {
  right: 14px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  text-decoration: none;
  font-weight: 700;
}

/* ======================
   MENÚ LATERAL
====================== */
.fondo-menu {
  position: fixed;
  inset: 0;
  z-index: 9001;
  background: #000a;
}

.menu-lateral {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9002;
  width: 280px;
  max-width: 80vw;
  height: 100%;
  padding: 70px 22px 24px;
  background: #111;
  box-shadow: 4px 0 20px #000a;
  transform: translateX(-100%);
  transition: transform .3s ease;
}

.menu-lateral.abierto { transform: translateX(0); }

.titulo-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
  font-size: 20px;
  font-weight: 700;
}

.logo-menu {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 10px;
}

.menu-lateral nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-lateral a {
  color: #fff;
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
  padding: 12px 14px;
  border-radius: 8px;
}

.menu-lateral a:hover { background: #2a2a2a; }

.cerrar-menu {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #333;
  color: #fff;
  font-size: 26px;
  line-height: 1;
}

/* ======================
   PORTADA
====================== */
.portada {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 75vh;
  padding: 90px 6% 50px;
  background: linear-gradient(135deg, #bdbdbd, #8a8a8a);
  overflow: hidden;
}

.portada-texto h1 {
  margin: 0 0 24px;
  font-size: clamp(40px, 9vw, 84px);
  line-height: 1;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 4px 12px #0005;
}

.boton-portada {
  display: inline-block;
  padding: 14px 28px;
  border-radius: 999px;
  background: #000;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.portada-imagen {
  width: 40%;
  max-width: 380px;
  min-width: 150px;
  object-fit: contain;
  filter: drop-shadow(0 16px 24px #0006);
}

/* ======================
   PRODUCTOS
====================== */
.seccion-productos {
  padding: 50px 5% 30px;
}

.seccion-productos h2 {
  margin: 0 0 24px;
  text-align: center;
  font-size: 30px;
}

#buscador,
#filtro-categoria {
  display: block;
  width: 100%;
  max-width: 500px;
  margin: 0 auto 14px;
  padding: 12px 16px;
  border: 1px solid var(--borde);
  border-radius: 10px;
  background: #2a2a2a;
  color: #fff;
}

#filtro-categoria {
  max-width: 300px;
  margin-bottom: 26px;
}

#sin-resultados {
  text-align: center;
  color: var(--gris);
}

.productos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 280px));
  justify-content: center;
  gap: 22px;
}

.productos article {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: 16px;
  cursor: pointer;
  transition: transform .2s;
}

.productos article:hover { transform: translateY(-3px); }

.imagen-producto {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 12px;
}

.nombre-producto {
  margin: 0;
  font-size: 18px;
  text-align: center;
}

.precio {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

/* Datos que se ven en la ventana de detalles, no en la tarjeta */
.categoria,
.descripcion-producto,
.stock {
  display: none;
}

.acciones-producto {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.acciones-producto button {
  padding: 10px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: #111;
  font-weight: 700;
}

.acciones-producto .comprar-directo {
  background: #000;
  color: #fff;
  border: 1px solid #555;
}

/* ======================
   VENTANA DE DETALLES
====================== */
.modal-producto {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #000b;
  overflow-y: auto;
}

.modal-producto.abierto { display: flex; }

.modal-contenido {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  width: 100%;
  max-width: 850px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  background: #fff;
  color: #111;
  border-radius: 18px;
}

.cerrar-modal {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #eee;
  font-size: 26px;
  line-height: 1;
}

#modal-imagen-principal {
  width: 100%;
  height: 330px;
  object-fit: contain;
  background: #f5f5f5;
  border-radius: 12px;
}

.modal-miniaturas {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.modal-miniatura {
  width: 62px;
  height: 62px;
  padding: 3px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
}

.modal-miniatura.activa { border: 2px solid #111; }

.modal-miniatura img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 5px;
}

.modal-informacion h2 {
  margin: 8px 0 14px;
  font-size: 26px;
}

.modal-categoria,
.modal-stock {
  color: #666;
  font-size: 14px;
}

.modal-precio {
  font-size: 24px;
  font-weight: 700;
}

.modal-acciones {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.modal-acciones button {
  padding: 12px;
  border: 0;
  border-radius: 8px;
  font-weight: 700;
}

#modal-agregar { background: #111; color: #fff; }
#modal-comprar { background: #e8e8e8; color: #111; }

body.modal-abierto { overflow: hidden; }

/* ======================
   CARRITO
====================== */
#carrito {
  max-width: 480px;
  margin: 0 auto;
  padding: 40px 20px 30px;
}

#carrito h2 {
  margin: 0 0 24px;
  text-align: center;
  font-size: 30px;
}

#lista-carrito {
  display: grid;
  gap: 14px;
}

#lista-carrito > p {
  text-align: center;
  color: var(--gris);
}

.producto-carrito {
  padding: 16px;
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: 14px;
  text-align: center;
}

.producto-carrito h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.producto-carrito img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 10px;
}

.producto-carrito p {
  margin: 6px 0;
  color: var(--gris);
}

.producto-carrito button {
  margin: 4px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: #111;
  font-weight: 700;
}

.producto-carrito .eliminar-producto {
  display: block;
  width: 100%;
  margin-top: 8px;
  background: #c62828;
  color: #fff;
}

#total-carrito {
  margin: 20px 0;
  padding: 14px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  background: var(--tarjeta);
  border-radius: 10px;
}

#carrito label {
  display: block;
  margin: 14px 0 6px;
  font-weight: 700;
}

#carrito input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--borde);
  border-radius: 10px;
  background: #2a2a2a;
  color: #fff;
}

#carrito input:focus {
  outline: none;
  border-color: #fff;
}

#carrito > button {
  display: block;
  width: 100%;
  margin: 10px 0;
  padding: 13px;
  border: 0;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
}

#enviar-whatsapp { background: #25d366; color: #fff; }
#vaciar-carrito { background: #333; color: #fff; }
#seguir-comprando { background: transparent; color: #fff; border: 2px solid #fff; }

.resumen-compra {
  margin-top: 16px;
  padding: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--tarjeta);
  border-radius: 12px;
  color: var(--gris);
  font-size: 14px;
  line-height: 1.6;
}

.resumen-compra:empty { display: none; }

.tutorial {
  margin-top: 24px;
  padding: 16px 20px;
  background: var(--tarjeta);
  border-radius: 12px;
  color: var(--gris);
  font-size: 15px;
  line-height: 1.6;
}

.tutorial h3 {
  margin-top: 0;
  color: #fff;
}

.tutorial ol {
  padding-left: 20px;
}

footer {
  padding: 24px;
  text-align: center;
  background: #111;
  color: var(--gris);
  font-size: 14px;
}

footer p { margin: 0; }

/* ======================
   CELULAR
====================== */
@media (max-width: 650px) {
  .portada {
    flex-direction: column;
    text-align: center;
    padding: 90px 6% 40px;
  }

  .portada-imagen { width: 70%; }

  .modal-contenido {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 18px;
  }

  #modal-imagen-principal { height: 240px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

.grid-productos {
  display: flex;
  gap: 20px;
  justify-content: center;
  padding: 30px 20px;
  background: #1e1e1e;
}

.producto {
  background: #1e1e1e;
  border: 1px solid #888;
  border-radius: 18px;
  padding: 10px;
  width: 170px;
  text-align: center;
  color: #fff;
  cursor: pointer;
  font-family: "Poppins", sans-serif;
}

.producto img {
  width: 100%;
  height: 150px;
  object-fit: contain;
  background: #fff;
  border-radius: 14px;
  padding: 6px;
}

.producto .precio {
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  margin: 10px 0 4px;
}

.producto .separador {
  border-top: 2px solid #aaa;
  position: relative;
  margin: 4px 0 8px;
}

.producto .separador::before,
.producto .separador::after {
  content: "";
  position: absolute;
  top: -5px;
  width: 8px;
  height: 8px;
  background: #aaa;
  transform: rotate(45deg);
}
.producto .separador::before { left: -4px; }
.producto .separador::after { right: -4px; }

.producto h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}

.grid-productos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 20px 12px;
  background: #1e1e1e;
}

.producto {
  width: auto;
}

@media (max-width: 600px) {
  .grid-productos {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .producto img {
    height: 120px;
  }
}

@media (max-width: 650px) {
  .productos {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}