/* Custom styles for product cards */

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    /* Made products smaller */
    gap: 20px;
    padding: 20px 0;
    justify-items: start;
    /* Added for centering and preventing stretch */
}

.product-card {
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 10px;
    /* Reduced padding */
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    min-height: 300px;
    /* Increased min-height for consistent card size */
}

.product-card:hover {
    transform: translateY(-5px);
    /* More noticeable lift */
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    /* Stronger shadow on hover */
}

.product-img {
    width: 100%;
    height: 200px;
    /* Changed height to 200px for 2/3 of card height */
    object-fit: cover;
    /* Ensures image covers the area */
    border-radius: 8px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.product-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 0;
    /* Ensures no margin-bottom */
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    /* Ensure it behaves as a block for truncation */
    width: 100%;
    /* Ensure it takes full width for truncation */
    min-width: 0;
    flex-shrink: 0;
    line-height: 1.2em;
    /* Strict line height */
    max-height: 1.2em;
    /* Ensures single line height */
}

.product-price {
    font-size: 13px;
    color: #e91e63;
    font-weight: 700;
    margin-bottom: 0;
    /* Ensures no margin-bottom */
    flex-shrink: 0;
}

.product-posted-date {
    font-size: 12px;
    color: #666;
    margin-bottom: 0;
    /* Ensures no margin-bottom */
    flex-shrink: 0;
}

.product-seller-info {
    font-size: 11px;
    color: #666;
    margin-top: auto;
    /* Push to the bottom */
    display: flex;
    flex-shrink: 0;
    /* Ensure it doesn't shrink */
    justify-content: space-between;
    /* Added to space out elements */
    width: 100%;
    margin: 0 -10px;
    /* Added to make it flush with card edges */
    padding: 0 10px;
    /* Re-add padding for content inside */
}

.product-seller-info i {
    margin-right: 5px;
    font-size: 10px;
    color: #888;
}

.product-seller-info .seller-name-display,
.product-seller-info .product-location-display {
    display: flex;
    align-items: center;
    white-space: nowrap;
    /* Added for truncation */
    overflow: hidden;
    /* Added for truncation */
    text-overflow: ellipsis;
    /* Added for truncation */
}

.product-card .product-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    height: 100%;
    /* Ensure it takes full available height */
    text-align: left;
    width: 100%;
    overflow: hidden;
    padding: 0;
    justify-content: space-between;
    /* Distribute content evenly vertically */
}


/* Featured Products - similar adjustments */

.products.featured {
    /* Removed background-color and padding to match .products */
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    /* Changed to display 5 products per row */
    gap: 15px;
    /* Adjusted gap for more products */
    margin-top: 2rem;
    justify-items: center;
    /* Centered items within their grid cells */
}

.featured-product-card {
    background-color: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #eee;
    padding: 10px;
    position: relative;
    display: flex;
    flex-direction: column;
    max-width: 200px;
    /* Adjusted width for 5 column layout */
    width: 100%;
    box-sizing: border-box;
    min-height: 300px;
    /* Increased min-height for consistent card size */
}

.featured-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    /* Removed border-color */
}

.featured-badge {
    position: absolute;
    top: 8px;
    /* Adjusted top position */
    right: 8px;
    /* Adjusted right position */
    background: linear-gradient(45deg, #4caf50, #8bc34a);
    color: #fff;
    padding: 5px 9px;
    /* Slightly smaller padding */
    border-radius: 16px;
    /* Slightly more rounded */
    font-size: 0.75rem;
    /* Slightly smaller font size */
    font-weight: bold;
    z-index: 2;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.featured-badge i {
    margin-right: 3px;
    /* Adjusted margin */
    color: #fff;
}

.featured-product-img {
    width: 100%;
    height: 200px;
    /* Changed height to 200px for 2/3 of card height */
    object-fit: cover;
    /* Ensure image covers the area */
    border-radius: 8px;
    margin-bottom: 8px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    /* Prevent image from shrinking */
}

.featured-product-card:hover .featured-product-img {
    transform: scale(1.05);
}

.featured-product-info {
    padding: 0;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    height: 100%;
    /* Ensure it takes full available height */
    text-align: left;
    width: 100%;
    overflow: hidden;
    justify-content: space-between;
    /* Distribute content evenly vertically */
}

.featured-product-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 0;
    /* Ensures no margin-bottom */
    line-height: 1.2em;
    /* Strict line height */
    max-height: 1.2em;
    /* Ensures single line height */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    /* Ensure it behaves as a block for truncation */
    width: 100%;
    /* Ensure it takes full width for truncation */
    min-width: 0;
    /* Ensures it can shrink if needed */
    flex-shrink: 0;
}

.featured-product-price {
    font-size: 13px;
    font-weight: 700;
    color: #e91e63;
    margin-bottom: 0;
    /* Ensures no margin-bottom */
    flex-shrink: 0;
}

.featured-product-posted-date {
    font-size: 12px;
    color: #666;
    margin-bottom: 0;
    /* Ensures no margin-bottom */
    flex-shrink: 0;
}

.featured-product-seller-info {
    font-size: 11px;
    color: #666;
    margin-top: auto;
    /* Push to the bottom */
    display: flex;
    flex-shrink: 0;
    /* Ensure it doesn't shrink */
    justify-content: space-between;
    /* Added to space out elements */
    width: 100%;
    margin: 0 -10px;
    /* Added to make it flush with card edges */
    padding: 0 10px;
    /* Re-add padding for content inside */
}

.featured-product-seller-info i {
    margin-right: 4px;
    font-size: 9px;
    color: #888;
}

.featured-product-seller-info .seller-name-display,
.featured-product-seller-info .product-location-display {
    display: flex;
    align-items: center;
    white-space: nowrap;
    /* Added for truncation */
    overflow: hidden;
    /* Added for truncation */
    text-overflow: ellipsis;
    /* Added for truncation */
}

.featured-product-location {
    font-size: 11px;
    color: #666;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
}

.featured-product-location i {
    margin-right: 4px;
    font-size: 10px;
    color: #888;
}

.featured-product-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: auto;
    flex-shrink: 0;
    /* Ensure this block doesn't shrink */
}


/* Responsive adjustments - copy existing and modify */

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
    }
    .featured-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        /* Adjusted to match regular products grid */
        gap: 20px;
    }
    .product-img,
    .featured-product-img {
        height: 80px;
        /* Adjusted height on medium screens */
    }
    .product-name,
    .featured-product-name {
        font-size: 14px;
    }
    .product-price,
    .featured-product-price {
        font-size: 13px;
    }
    .product-posted-date,
    .product-seller-info,
    .featured-product-posted-date,
    .featured-product-seller-info {
        font-size: 10px;
        /* Adjusted font size for better readability on smaller screens */
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .featured-grid {
        grid-template-columns: 1fr;
        /* 1 product per row on small screens */
        gap: 20px;
    }
    .product-img,
    .featured-product-img {
        height: 60px;
        /* Adjusted height on small screens */
    }
    .product-name,
    .featured-product-name {
        font-size: 12px;
    }
    .product-price,
    .featured-product-price {
        font-size: 11px;
    }
    .product-posted-date,
    .product-seller-info,
    .featured-product-posted-date,
    .featured-product-seller-info {
        font-size: 9px;
        /* Adjusted font size for very small screens */
    }
}