/* Components: products grid and product card presentation. */

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 15px;
    padding-bottom: 80px;
    grid-auto-rows: auto !important;
}

.product-card {
    background-color: var(--white);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 280px !important; /* Fixed exact height for all cards */
    width: 100% !important; /* Full width within the grid cell */
    border: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 15px;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 25px rgba(50, 50, 93, 0.1), 0 5px 10px rgba(0, 0, 0, 0.05);
}

.product-image {
    height: 150px !important; /* Exact height */
    width: 100% !important;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--light-gray);
    position: relative;
    flex-shrink: 0; /* Prevent shrinking */
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* This ensures images cover the area consistently */
}

.product-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to top, rgba(255,255,255,0.8), transparent);
}

.product-info {
    padding: 10px !important;
    display: flex;
    flex-direction: column;
    height: 130px !important; /* Exact height */
    justify-content: space-between;
    flex-shrink: 0; /* Prevent shrinking */
}

.product-info h3 {
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    margin-bottom: 10px !important;
    color: var(--text-color);
    line-height: 1.4 !important;
    height: 40px !important; /* Exact height */
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
}

.price {
    font-size: 1rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin: 5px 0 !important;
    height: 20px !important; /* Exact height */
    display: block;
}

.add-to-cart {
    width: 100%;
    padding: 10px;
    background-color: var(--secondary-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 600;
    height: 40px !important; /* Exact height */
}

.add-to-cart:hover {
    background-color: #25a870;
    transform: translateY(-2px);
}

.product-card {
    min-height: auto !important; /* Return to automatic height */
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* تضمین پوشش کامل فضا */
    transition: transform 0.3s ease;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-info h3 {
    font-size: 1.1rem !important; /* Reduce to 1.1rem */
    font-weight: 600 !important; /* Slightly reduce the font weight */
    margin-bottom: 10px !important;
    color: var(--text-color);
    line-height: 1.4 !important;
    max-height: 2.8em !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
}

.price {
    font-size: 1rem; /* Keep this smaller than the product name */
    font-weight: 600;
    color: var(--secondary-color);
    margin: 10px 0;
    display: block;
}

.add-to-cart {
    width: 100%;
    padding: 10px;
    background-color: var(--secondary-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem; /* Keep this smaller than the product name */
    font-weight: 600;
}

.add-to-cart:hover {
    background-color: #27ae60;
}
