/* =========================
   GRID DE PRODUCTOS (Shop)
   Regalos Agency – estable, sin dependencias de tema
   ========================= */

/* ===== Grid: 2 (móvil) / 3 (laptop) / 4 (desktop) ===== */
.rg-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); /* móvil: 2 */
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 992px) {
  .rg-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)); /* laptop: 3 */
  }
}
@media (min-width: 1280px) {
  .rg-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)); /* desktop: 4 */
  }
}

/* ===== Card base ===== */
.rg-card {
  position: relative;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;               /* para empujar el botón al fondo */
  text-align: center;
  box-shadow: 0 8px 20px rgba(0,0,0,.06);
  transition: transform .2s ease, box-shadow .2s ease;
  min-height: 100%;
}
.rg-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(0,0,0,.10);
}

/* ===== Media: altura estable (evita tarjetas “rotas”) ===== */
.rg-card__link { display: block; color: inherit; text-decoration: none; }
.rg-card__media { display: block; }
.rg-card__thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;            /* ajusta si tu catálogo usa otra relación */
  background: #f8fafc;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.rg-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;               /* recorte uniforme */
  display: block;
}

/* Badge OFERTA redondo y estable */
.rg-badge {
  position: absolute;
  top: 10px; left: 10px;
  background: #e54848;
  color: #fff;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 999px;
  min-width: 56px;
  text-align: center; line-height: 1;
  z-index: 2;
}
.rg-badge--sale { background: #e54848; }

/* ===== Body (título, cats, rating, precio) ===== */
.rg-card__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px 0 12px;
}

.rg-card__title {
  margin: 6px 6px 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;         /* 2 líneas máx */
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;              /* altura visual estable */
  color: #232323;
}

.rg-card__cats {
  font-size: .85rem;
  color: #666;
}

.rg-card__rating { margin-top: 2px; }

/* Precio protagonista y estable (evita “bailes”) */
.rg-card__price {
  margin: 4px 0 0;
  color: #4b2ca2;                  /* morado de marca */
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ===== Countdown (opcional, debajo del precio) ===== */
.regalos-countdown {
  margin: 6px auto 8px;
  padding: 6px 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  background: #0ac5ca10;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 12px;
}
.regalos-countdown .pill {
  background: #0AC5CA;
  color: #4b2ca2;
  border: 1px solid rgba(0,0,0,.06);
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 800;
  min-width: 54px;
  text-align: center;
  line-height: 1.1;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.regalos-countdown .label {
  display: block;
  font-size: 11px;
  color: #ffffffcc;
  margin-top: 3px;
}

/* ===== Footer: botón anclado al fondo para columnas alineadas ===== */
.rg-card__footer {
  margin-top: auto;                /* <- empuja el footer al fondo */
  padding: 10px 12px 14px;
}
.rg-card__footer .button,
.rg-btn {
  display: inline-block;
  width: 100%;
  padding: 10px 14px;
  background: linear-gradient(135deg, #0AC5CA, #08aeb4);
  color: #fff;
  border: 0;
  border-radius: 12px;
  font-weight: 700;
  box-shadow: 0 6px 12px rgba(0,0,0,.12);
  transition: filter .2s ease, transform .2s ease;
}
.rg-card__footer .button:hover,
.rg-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

/* ===== Secciones de la tienda ===== */
.rg-section { margin-bottom: 28px; }
.rg-section__title {
  font-size: 1.25rem;
  font-weight: 800;
  text-align: center;
  margin: 8px 0 14px;
}
.rg-section__header--sr { position: absolute; left: -9999px; }

/* ===== Nota de compatibilidad =====
Si aún existen estilos globales de Woo/tema que afecten .products o .product,
asegúrate de que el <ul> del catálogo tenga la clase .rg-grid
y cada <li> de producto tenga .rg-card (como ya hicimos).
Con eso, este CSS domina sin usar !important.
*/
/* Base: usa grid en nuestras listas personalizadas */
.rg-grid.products {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px; /* ajusta a tu diseño */
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Anular defaults de Woo en los items */
.rg-grid.products li.product {
  width: auto !important;     /* Woo pone 100% en móvil */
  float: none !important;     /* por si el tema padre usa floats */
  clear: none !important;
}

/* Laptop (≈ <= 1024px): 3 columnas */
@media (max-width: 1024px) {
  .rg-grid.products {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Móvil (≈ <= 640px): 2 columnas */
@media (max-width: 640px) {
  .rg-grid.products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Si el bloque de ofertas necesita reglas propias, hereda del grid general */
.rg-grid--offers.products {
  /* normalmente no hace falta nada extra,
     pero puedes sobrescribir gap o márgenes aquí si quieres */
}
