/* assets/css/product-card.css */

.product-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease; /* Consolidated transition */
}

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

.product-img-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1; /* Ensures the image area is always square */
    overflow: hidden;
}

.product-img.front, .product-img.back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.product-img.back {
    opacity: 0;
    visibility: hidden;
}

.product-card.has-back:hover .product-img.front {
    opacity: 0;
    visibility: hidden;
}

.product-card.has-back:hover .product-img.back {
    opacity: 1;
    visibility: visible;
}

.product-info {
    padding: 1rem 1.25rem;
    text-align: left; /* Left-align for better readability */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    color: var(--dark);
}

.product-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--dark);
    line-height: 1.4;
    /* --- FIX: Consistent Height for Titles --- */
    height: 2.8em; /* 2 lines (1.4 line-height * 2) */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit to 2 lines */
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    /* --- End Fix --- */
}

/* Make the whole card clickable by stretching the inner link */
.product-card a::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
    margin-top: auto; /* Pushes the price to the bottom if there's extra space */
    padding-top: 0.5rem; /* Adds space above the price */
}

.quick-view-btn {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--light-gray);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    opacity: 0;
    z-index: 2;
    transition: opacity 0.3s, transform 0.3s;
    white-space: nowrap;
}

.product-card:hover .quick-view-btn {
    opacity: 1;
    transform: translate(-50%, -5px);
}