/* ============================================================
   FICHA DE PRODUCTO (ventana de detalle). Ver build/js/ficha.js
   Ojo: en esta web 1rem = 10px (html { font-size: 62.5% })
   ============================================================ */

body.ficha-bloqueo {
  overflow: hidden;
}

.ficha-fondo {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(20, 20, 20, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.ficha-fondo.abierta {
  opacity: 1;
  visibility: visible;
}

.ficha {
  position: relative;
  background: #fff;
  width: 100%;
  max-width: 980px;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  font-family: "Montserrat", sans-serif;
  transform: translateY(16px);
  transition: transform 0.2s ease;
}
.ficha-fondo.abierta .ficha {
  transform: none;
}

.ficha-cerrar {
  position: sticky;
  top: 1rem;
  float: right;
  margin: 1rem 1rem 0 0;
  z-index: 2;
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  border: none;
  background: #f2f2f2;
  color: #333;
  font-size: 2.8rem;
  line-height: 1;
  cursor: pointer;
}
.ficha-cerrar:hover {
  background: #e5e5e5;
}

.ficha-cargando {
  padding: 6rem 2rem;
  text-align: center;
  font-size: 1.6rem;
  color: #777;
}

.ficha-principal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 3rem;
  padding: 3rem;
}

/* ---------- Foto con zoom ---------- */
.ficha-foto {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #f7f7f7;
  aspect-ratio: 1 / 1;
  cursor: zoom-in;
}
.ficha-foto img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.25s ease;
}
.ficha-foto.con-zoom {
  cursor: zoom-out;
}
.ficha-foto.con-zoom img {
  transform: scale(2.2);
}
.ficha-lupa {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  width: 3.6rem;
  height: 3.6rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  pointer-events: none;
}
.ficha-foto.con-zoom .ficha-lupa {
  display: none;
}

/* ---------- Datos ---------- */
.ficha-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 1rem;
  min-width: 0;
  text-align: left;
}
.ficha-info p {
  margin: 0;
}
.ficha-categoria {
  font-size: 1.3rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #999;
}
.ficha-nombre {
  margin: 0;
  font-size: 2.6rem;
  line-height: 1.2;
  color: #222;
  text-align: left;
}
.ficha-precio {
  font-size: 3rem;
  font-weight: 900;
  color: #000;
}
.ficha-mayorista {
  font-size: 1.6rem;
  color: #1e7e44;
}
.ficha-aviso-mayorista {
  font-size: 1.3rem;
  color: #777;
}
.ficha-aviso-mayorista a {
  color: #b91616;
  font-weight: 700;
}
.ficha-stock {
  font-size: 1.4rem;
  font-weight: 600;
}
.ficha-stock.con-stock {
  color: #1e7e44;
}
.ficha-stock.sin-stock {
  color: #b91616;
}
.ficha-descripcion {
  font-size: 1.5rem;
  line-height: 1.55;
  color: #555;
  border-top: 1px solid #eee;
  padding-top: 1rem;
}

/* ---------- Cantidad + agregar ---------- */
.ficha-comprar {
  display: flex;
  gap: 1rem;
  margin-top: 0.6rem;
}
.ficha-cantidad {
  display: flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
}
.ficha-cantidad button {
  width: 4.4rem;
  height: 100%;
  min-height: 4.8rem;
  border: none;
  background: #f5f5f5;
  font-size: 2rem;
  cursor: pointer;
}
.ficha-cant-num {
  min-width: 4rem;
  text-align: center;
  font-size: 1.7rem;
  font-weight: 700;
}
.ficha-agregar,
.ficha-consultar {
  flex: 1;
  min-height: 4.8rem;
  border: none;
  border-radius: 8px;
  background: #00a046;
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.ficha-agregar:hover {
  background: #008c3a;
}
.ficha-consultar {
  background: #25d366;
  margin-top: 0.6rem;
}
.ficha-consultar:hover {
  background: #1ebe5b;
}

.ficha-compartir {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.ficha-compartir button {
  flex: 1;
  min-height: 4.2rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  color: #333;
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.ficha-compartir button:hover {
  background: #f7f7f7;
}
.ficha-compartir .fa-whatsapp {
  color: #25d366;
}

/* ---------- También te puede gustar ---------- */
.ficha-relacionados {
  padding: 0 3rem 3rem;
}
.ficha-relacionados h3 {
  font-size: 1.8rem;
  margin: 0 0 1.4rem;
  color: #222;
}
.ficha-rel-lista {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.4rem;
}
.ficha-rel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.ficha-rel img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #f7f7f7;
  border-radius: 8px;
  transition: transform 0.2s ease;
}
.ficha-rel:hover img {
  transform: scale(1.03);
}
.ficha-rel-nombre {
  font-size: 1.3rem;
  color: #333;
  line-height: 1.3;
}
.ficha-rel-precio {
  font-size: 1.4rem;
  font-weight: 800;
  color: #000;
}

/* Tarjetas del catálogo: el nombre también abre la ficha */
.card .producto-nombre {
  cursor: pointer;
}

/* ---------- Celular: ocupa toda la pantalla ---------- */
@media (max-width: 760px) {
  .ficha-fondo {
    padding: 0;
    align-items: stretch;
  }
  .ficha {
    max-height: none;
    height: 100%;
    border-radius: 0;
  }
  .ficha-principal {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.6rem;
    padding: 0 1.6rem 2rem;
  }
  .ficha-cerrar {
    margin: 1rem 1rem -5rem 0;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  }
  .ficha-foto {
    border-radius: 0;
    margin: 0 -1.6rem;
  }
  .ficha-nombre {
    font-size: 2.2rem;
  }
  .ficha-precio {
    font-size: 2.6rem;
  }
  .ficha-relacionados {
    padding: 0 1.6rem 2.4rem;
  }
  .ficha-rel-lista {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
