/* CUADRÍCULA CENTRADA Y DEFINIDA */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    justify-items: center;
    align-items: start;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* TARJETA DE PRODUCTO GENERAL */
.products-grid > div {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #ffffff;
    border: 1.5px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    max-width: 300px;
    width: 100%;
    height: 100%;
    text-align: left;
    transition: box-shadow 0.3s ease;
}

/* Estado inicial para animación de entrada */
/* TARJETA INVISIBLE AL INICIO */
.card-hidden {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

/* TARJETA VISIBLE CON ANIMACIÓN */
.card-visible {
    opacity: 1;
    transform: scale(1);
}


/* ANIMACIÓN HOVER: "levantar y rebote" */
.products-grid > div:hover {
    animation: liftBounce 0.4s ease forwards;
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

/* Definición de la animación */
@keyframes liftBounce {
    0% {
        transform: translateY(0);
    }
    60% {
        transform: translateY(-15px);
    }
    80% {
        transform: translateY(-8px);
    }
    100% {
        transform: translateY(-10px);
    }
}

/* IMAGEN CENTRADA */
.products-grid img {
    max-width: 100%;
    height: auto;
    margin: 0 auto 1rem;
    display: block;
    border-radius: 6px;
}

/* TÍTULO Y DESCRIPCIÓN */
.products-grid h3 {
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    margin: 0.5rem 0;
}

.products-grid p {
    text-align: justify;
    color: #555;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

/* PRECIO Y STOCK */
.products-grid .price,
.products-grid .stock {
    font-weight: bold;
    color: #333;
    font-size: 0.95rem;
}

/* BOTÓN BIEN CENTRADO */
.products-grid .btn-buy {
    background-color: #28a745;
    color: #fff;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.95rem;
    cursor: pointer;
    margin: 1rem auto 0;
    text-align: center;
    display: block;
    transition: background 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.2);
}

.products-grid .btn-buy:hover {
    background-color: #218838;
    transform: scale(1.05);
}
