* { 
  box-sizing: border-box; 
}

body { 
  margin: 0; 
  font-family: system-ui, Arial, sans-serif; 
  color:#222; 
}

main {  
  margin: 0 auto; 
  padding: 24px;
}

.catalogo h2 { 
  font-family: "Playfair Display", serif;
  font-size: 1.8rem; 
  margin: 0 0 20px; 
  text-align: center;
  color: var(--color-principal);
}

/* --- GRILLA FIJA --- */
.productos-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* siempre 4 columnas */
  gap: 16px;
  padding-bottom: 40px; 
}

.productos-grid article {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
  transition: transform .15s ease, box-shadow .15s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.productos-grid article:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
}

.productos-grid a { 
  display: block; 
  color: inherit; 
  text-decoration: none; 
}

.productos-grid figure { 
  margin: 0 0 8px; 
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.productos-grid img { 
  width: 100%; 
  height: 160px; 
  object-fit: contain; 
  display: block; 
}

.productos-grid h3 { 
  font-size: 1rem; 
  margin: 6px 0; 
  text-align: center; 
}

.productos-grid .price { 
  text-align: center; 
  font-weight: 700; 
  color: var(--color-principal); 
  margin: 4px 0 6px; 
}

/* --- MENSAJE DE CARGA DE PRODUCTOS --- */
.loading {
  position: fixed;                /* ocupa la pantalla completa */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;                  /* centra el contenido */
  justify-content: center;
  align-items: center;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--color-principal, #333);
  background: rgba(255, 255, 255, 0.9); /* fondo semitransparente */
  z-index: 1000;                  /* sobre todo */
  animation: fadeIn 0.3s ease;
}

/* animación sutil */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Spinner opcional */
.loading::after {
  content: "";
  margin-left: 12px;
  width: 20px;
  height: 20px;
  border: 3px solid #ccc;
  border-top: 3px solid var(--color-principal, #333);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- BOTONES --- */
.acciones {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 8px 16px; 
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  width: auto;          
  text-align: center;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-carrito {
  background: var(--color-principal);
  color: #fff;
}

.btn-carrito:hover {
  background: var(--color-detallesSuaves);
}

.btn-comprar {
  background: var(--color-principal);
  color: #fff;
}

.btn-comprar:hover {
  background: var(--color-detallesSuaves);
}

/* --- MOBILE: 2 productos por fila --- */
@media (max-width: 768px) {
  .productos-grid {
    grid-template-columns: repeat(2, 1fr); 
  }

  .productos-grid img {
    height: 120px; 
  }

  .btn {
    font-size: 0.8rem; 
    padding: 5px;
  }
}

