/* ========================================
   SHOP PAGE PRODUCT CARDS - SCOPED STYLING
   Apply ONLY to shop.php product grid
   ======================================== */

/* 1. CARD CONTAINER - CONSISTENT HEIGHTS */
#productGrid .product-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #eee;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    /* Reset conflicting styles from style.css */
    min-width: unset !important;
    max-width: unset !important;
    width: 100%;
}

#productGrid .product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

/* 2. IMAGE CONTAINER FIX - NEVER STRETCH */
#productGrid .product-card .image-wrapper {
    height: 250px;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    position: relative;
    overflow: hidden;
}

#productGrid .product-card .image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover !important;
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1), opacity 0.4s ease;
}

#productGrid .product-card .image-wrapper img.primary-img {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    opacity: 1;
}

#productGrid .product-card .image-wrapper img.hover-img {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    opacity: 0;
}

/* Hover Zoom & Show Second Image */
#productGrid .product-card:hover .image-wrapper img {
    transform: scale(1.08);
}

#productGrid .product-card:hover .image-wrapper img.hover-img {
    opacity: 1;
}

#productGrid .product-card:hover .image-wrapper img.primary-img {
    opacity: 0;
}

/* 3. PRODUCT CONTENT AREA - VERTICAL ALIGNMENT */
#productGrid .product-card .card-body {
    padding: 14px;
    flex-grow: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
}

/* Category */
#productGrid .product-card .card-category {
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

/* Product Title - Fixed Min Height */
#productGrid .product-card .card-title {
    font-weight: 600;
    font-size: 15px;
    min-height: 40px;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    display: flex;
    align-items: center;
    justify-content: center;
}

#productGrid .product-card .card-title a {
    color: #111;
    text-decoration: none;
    transition: color 0.2s;
}

#productGrid .product-card .card-title a:hover {
    color: #555;
}

/* 4. PRICE ALIGNMENT FIX - INLINE DISPLAY */
#productGrid .product-card .price {
    display: flex;
    justify-content: center;
    gap: 8px;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

#productGrid .product-card .price .sale-price,
#productGrid .product-card .price .current-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111;
}

#productGrid .product-card .price .sale-price {
    color: #e53935;
}

#productGrid .product-card .price .old-price {
    text-decoration: line-through;
    color: #aaa;
    font-size: 13px;
    font-weight: 400;
}

/* 5. ADD TO CART BUTTON FIX - STAYS AT BOTTOM */
#productGrid .product-card .card-body .btn {
    margin-top: auto;
}

/* Desktop Overlay Button - FIXED, NO BLINKING */
#productGrid .product-card .add-to-cart-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
    z-index: 10;
    border-radius: 0;
    background: #000;
    color: #fff;
    font-weight: 600;
    text-transform: uppercase;
    padding: 12px 0;
}

#productGrid .product-card:hover .add-to-cart-overlay {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 6. BADGES */
#productGrid .product-card .badge {
    z-index: 5;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* 7. WISHLIST BUTTON */
#productGrid .product-card .add-to-wishlist {
    z-index: 5;
    background: rgba(255,255,255,0.9);
    border: none;
    transition: all 0.2s;
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#productGrid .product-card .add-to-wishlist:hover {
    background: #ff4757;
    color: white;
}

/* 8. EMPTY/UNAVAILABLE IMAGE FIX */
#productGrid .product-card .image-wrapper img[src=""],
#productGrid .product-card .image-wrapper img:not([src]) {
    opacity: 0.5;
}

/* ========================================
   RESPONSIVE GRID ADJUSTMENTS
   ======================================== */

/* Mobile: 2 columns */
@media (max-width: 575.98px) {
    #productGrid .product-card .image-wrapper {
        height: 160px;
        min-height: 160px;
    }
    
    #productGrid .product-card .card-title {
        font-size: 13px;
        min-height: 32px;
    }
    
    #productGrid .product-card .card-body {
        padding: 10px;
    }
    
    #productGrid .product-card .price {
        font-size: 14px;
    }
}

/* Tablet: 3 columns */
@media (min-width: 576px) and (max-width: 991.98px) {
    #productGrid .product-card .image-wrapper {
        height: 180px;
        min-height: 180px;
    }
}

/* Desktop: 4 columns */
@media (min-width: 992px) {
    #productGrid .product-card .image-wrapper {
        height: 220px;
        min-height: 220px;
    }
}
