/* =========================================
   LAYOUT GENERAL DE LA PÁGINA DE PRODUCTOS
   (solo afecta productos.php)
========================================= */

body {
  font-family: "Manrope", sans-serif;
  background-color: var(--bg-body);
  color: var(--text-body);
}

/* FILTRO SUPERIOR */
.productos-filtros {
  padding: 32px 16px 8px;
}

.contenedor-filtros {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.contenedor-filtros h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
}

/* Filtro tipo Shopify */
.filtro-shopify select {
  min-width: 210px;
  padding: 10px 40px 10px 16px;
  border-radius: 999px;
  border: 1px solid #ddd;
  background-color: #fff;
  font-size: 14px;
  color: #333;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 8L10 12L14 8' stroke='%239CA3AF' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.filtro-shopify select:hover {
  border-color: #aaa;
}

.filtro-shopify select:focus {
  border-color: var(--primary-color, #4CAF50);
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
}

/* Responsive filtros */
@media (max-width: 768px) {
  .contenedor-filtros {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .filtro-shopify {
    width: 100%;
  }

  .filtro-shopify select {
    width: 100%;
  }
}

/* =========================================================
   6. PRODUCTOS DESTACADOS (GRID)
========================================================= */

.productos {
  padding: var(--padding-xl) 5% var(--spacing-lg);
  background: var(--bg-white);
}

.titulo-productos {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-extrabold);
  color: var(--color-secondary-dark);
  text-align: center;
  margin-bottom: var(--padding-xl);
  letter-spacing: -0.03em;
}

.productos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  padding: 1rem;
  justify-content: center;
}

/* Forzamos siempre 2 columnas mínimo en móviles */
@media (max-width: 500px) {
  .productos-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Adaptamos a 3 o más en tablet o escritorio */
@media (min-width: 768px) {
  .productos-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

/* 🟣 Tarjeta compacta y alineada */
.producto-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
  padding: 0.75rem;
  position: relative;
  height: 100%; /* Permite a la grid alinear todas igual */
}

/* Imagen centrada y ajustada */
.producto-card-img {
  width: 100%;
  aspect-ratio: 1 / 1.1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-light);
  margin-bottom: 0.4rem;
}
.producto-card-img img {
  max-height: 120px;
  object-fit: contain;
}

/* Badge descuento */
.badge-descuento {
  position: absolute;
  top: 12px;
  left: 12px;
  background-color: #e53935;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 12px;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Info texto */
.producto-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  text-align: center;
  gap: 0.4rem;
}

/* Título limitado a 2 líneas */
.producto-info h3 {
  font-size: 0.92rem;
  line-height: 1.2;
  font-weight: 600;
  margin: 0;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2; /* ✅ Máximo 2 líneas */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  height: calc(1.2em * 2); /* ✅ Altura exacta para 2 líneas */
}


/* Estrellas compactas */
.estrellas-php {
  font-size: 0.8rem;
  margin: 0;
}

/* 🟣 Precio seguro */
.precio,
.precio-descuento,
.precio-original {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  max-width: 100%;
}

.precio.promo {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0.3rem 0;
}

.precio-original {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: line-through;
  opacity: 0.7;
  font-weight: 500;
}

.precio-descuento {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
}

/* 🟢 Botón alineado abajo */
.btn-agregar-carrito {
  width: 100%;
  padding: 0.45rem 0.8rem;
  background: var(--gradient-button);
  color: var(--text-white);
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: background var(--transition-normal), transform var(--transition-fast), box-shadow var(--transition-normal);
  box-shadow: var(--shadow-button);
  margin-top: auto;
}


.btn-agregar-carrito:hover {
  background: var(--color-secondary-dark);
  box-shadow: var(--shadow-button-hover);
}

.btn-agregar-carrito:active {
  transform: scale(0.97);
  box-shadow: 0 6px 16px rgba(174, 99, 117, 0.3);
}