/* --- Default Styling for Custom Product Grid --- */

.custom-product-grid-wrapper {
    display: grid;
    grid-gap: 15px; /* Overridden by Elementor controls */
}

.custom-product-card {
    border: 1px solid #eee;
    background: #fff;
    text-align: center; /* Center all text content */
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    position: relative; /* Crucial for the hover button */
}

.product-image-wrapper {
    position: relative;
    background: #f9f9f9; 
}

.product-image-wrapper img {
    width: 100%;
    height: auto;
    object-fit: cover;
    aspect-ratio: 1 / 1;
}

.custom-product-badge {
    /* This is no longer on the image */
    display: inline-block;
    background-color: #d9534f; /* Red from image */
    color: #fff;
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 5px;
    margin-left: 8px; /* Space from regular price */
    vertical-align: middle;
}

.custom-product-wishlist {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 22px;
    color: #333; 
    cursor: pointer;
    background: #ffffff; /* Solid white background */
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15); /* New shadow */
}

.custom-product-wishlist .fa-heart {
    font-weight: 400; 
}

.product-content-wrapper {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.custom-product-brand {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #111; /* Darker text */
    text-transform: uppercase; /* All caps */
    margin-bottom: 5px;
}

.custom-product-title {
    font-size: 16px;
    font-weight: 500; /* Lighter than brand */
    margin: 0 0 10px 0;
    line-height: 1.3;
    min-height: 42px; 
}

.custom-product-title a {
    text-decoration: none;
    color: #111;
}

.custom-product-title a:hover {
    color: #c90000;
}

.custom-product-price {
    margin-bottom: 8px;
}

.custom-product-price .sale-price {
    font-size: 22px;
    font-weight: 700;
    color: #c90000; /* Red */
    margin-right: 0; /* Centered, no margin needed */
    display: block; /* Takes its own line */
}

.regular-price-wrapper {
    margin-top: 5px; /* Space from sale price */
}

.custom-product-price .regular-price {
    font-size: 16px;
    color: #777;
    text-decoration: line-through;
    display: inline-block;
    vertical-align: middle;
}

.custom-product-financing {
    display: block;
    font-size: 13px;
    color: #666;
    margin-top: 8px; /* Space from price */
}

/* --- Add to Cart Button Styles --- */
.custom-product-add-to-cart {
    margin-top: 15px; /* This is the default for MOBILE */
}

.custom-product-card .add_to_cart_button,
.custom-product-card .product_type_variable,
.custom-product-card .product_type_grouped {
    display: inline-block;
    background-color: #1e85be; 
    color: #ffffff !important;
    border-radius: 5px;
    padding: 10px 15px;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 14px;
    transition: background-color 0.3s ease;
    border: none;
    line-height: 1.2;
    width: 100%; /* Make button full width in its container */
    box-sizing: border-box;
}

.custom-product-card .add_to_cart_button:hover,
.custom-product-card .product_type_variable:hover,
.custom-product-card .product_type_grouped:hover {
    background-color: #15608a; 
    color: #ffffff !important;
}

.custom-product-card .added_to_cart {
    display: none !important;
}

.custom-product-card .ajax_add_to_cart.loading {
    opacity: 0.5;
    padding-right: 30px; 
}


/* --- DESKTOP HOVER & MOBILE VISIBLE LOGIC --- */
/* (min-width: 768px) is a standard tablet/desktop breakpoint */

@media (min-width: 768px) {
    
    /* 1. Add padding to the bottom of the content wrapper */
    /* This makes space for the absolute-positioned button */
    .product-content-wrapper {
        padding-bottom: 70px; /* Adjust as needed */
    }

    /* 2. Hide the 'Add to Cart' button by default on desktop */
    .custom-product-card .custom-product-add-to-cart { /* Made selector more specific */
        position: absolute;
        left: 15px;  /* Match content padding */
        right: 15px; /* Match content padding */
        bottom: 15px; /* Position at the bottom of the card */
        margin-top: 0;
        opacity: 0; /* Hidden */
        visibility: hidden; /* Added for robust hiding */
        transform: translateY(10px); /* Start slightly down */
        transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    }

    /* 3. Show the button when the card is hovered */
    .custom-product-card:hover .custom-product-add-to-cart {
        opacity: 1; /* Visible */
        visibility: visible; /* Make it visible again */
        transform: translateY(0); /* Move to final position */
    }
}

