/*--------------------------------
PRODUCT TILES FRONTEND
---------------------------------*/
.pgb-product-tiles-container {
    max-width: 1330px;
    margin: 0 auto;
    display: block;
}

.pgb-product-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px; 
    align-items: stretch; /* Forces all columns in a row to be equal height */
}

.pgb-product-tiles hr {
    display: none !important; 
}

/* --- THE CARD WRAPPER (Start of Flex Chain) --- */
.pgb-product-tile-item-wrap {
    background: #ffffff; 
    border: 4px solid #e6e6e6; 
    border-radius: 4px;
    padding: 25px;
    text-align: left; 
    height: 100%; 
    
    /* Flex settings */
    display: flex;
    flex-direction: column;
    
    -webkit-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;     
}

.pgb-product-tile-item-wrap:hover {
    border-color: #d0d0d0; 
    transform: translateY(-3px) !important; 
    box-shadow: 0 10px 20px rgba(0,0,0,0.05); 
}

/* --- INTERMEDIATE WRAPPER (Continue Flex Chain) --- */
/* If this div exists in the HTML, it must also flex to pass the height down */
.pgb-product-tile {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    width: 100%;
}

/* --- IMAGE --- */
.pgb-product-image {
    text-align: center; 
    margin-bottom: 20px;
    padding: 0;
}

.pgb-product-image img {
    max-width: 100% !important;
    height: auto !important;
}

/* --- INNER CONTENT (Continue Flex Chain) --- */
.pgb-tile-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Absorbs all remaining height */
    width: 100%;
}

/* --- BADGE --- */
.pgb-ribbon {
    position: static !important;
    display: inline-block !important;
    background-color: #edf5e6 !important; 
    color: #111 !important;
    padding: 6px 12px !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    margin-bottom: 15px !important;
    align-self: flex-start !important;
    
    clip-path: none !important;
    border-image: none !important;
    transform: none !important;
    width: auto !important;
    height: auto !important;
    line-height: 1 !important;
}

.pgb-ribbon:after {
    display: none !important; 
}

.ribbon-title {
    width: auto !important;
    display: inline !important;
    margin: 0 !important;
    font-size: inherit !important;
}

/* --- TITLE --- */
.pgb-tile-inner .tile-title {
    margin: 0 0 10px 0 !important;
}

#content .pgb-product-tile .tile-title a,
.pgb-tile-inner .tile-title a {
    font-size: 28px !important;    
    font-weight: 900 !important;
    color: #000000 !important;
    text-transform: capitalize !important; 
    text-decoration: none !important;
    line-height: 1.2;
    margin: 0 !important;
}

.pgb-product-tiles .tile-title a:hover {
    color: #39b54a !important; 
}

/* --- DESCRIPTION --- */
.pgb-product-description {
    color: #222222; 
    font-size: 16px;
    font-weight: normal; 
    line-height: 1.4;
    margin: 0 0 20px 0 !important;
}

/* --- PRICE --- */
#content .pgb-product-price .wc-measurement-price-calculator-price, 
#content .pgb-product-price .amount, 
.pgb-product-price {
    font-size: 26px !important;
    font-weight: 900 !important;
    color: #39b54a !important; 
    margin: 0 0 20px 0 !important;
}

/* --- BUTTON WRAPPER (End of Flex Chain - Force to Bottom) --- */
.pgb-tile-btn-wrap {
    margin-top: auto !important; /* Pushes the button wrapper to the absolute bottom */
    margin-bottom: 0 !important;
    padding-top: 15px; /* Adds breathing room if text gets close */
}

/* Targeting the button directly just in case it is not inside .pgb-tile-btn-wrap */
#content .tile-product-link,
.tile-product-link,
a.tile-product-link {
    display: inline-block;
    background: #ffffff !important; 
    color: #000000 !important;
    border: 2px solid #000000 !important; 
    padding: 8px 20px !important;
    text-decoration: none !important;
    border-radius: 4px !important; 
    font-weight: 700 !important;
    font-size: 15px !important;
    text-transform: none !important; 
    transition: all 0.2s ease-in-out !important;
    max-width: none;
    margin-top: auto !important; /* Forces link to bottom if it's the direct child */
    margin-bottom: 0 !important;
}

#content .tile-product-link:hover,
.tile-product-link:hover {
    background: #000000 !important;
    color: #ffffff !important;
}

/* --- RESPONSIVE --- */
@media screen and (max-width: 1028px) {
    #content .pgb-product-tiles {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
        gap: 30px;
    } 
}

@media screen and (max-width: 767px){
    .pgb-product-tile-item-wrap {
        padding: 20px;
    }

    .pgb-tile-inner {
        height: auto;
    }

    #content .pgb-product-tiles .tile-title a,
    .pgb-tile-inner .tile-title a {
        font-size: 24px !important;
    }

    .pgb-product-description {
        font-size: 15px;
    }

    #content .pgb-product-price .wc-measurement-price-calculator-price, 
    #content .pgb-product-price .amount, 
    .pgb-product-price {
        font-size: 22px !important;
    }    
}