/**
 * HL Related Products Grid Styles
 * Custom grid layout - Desktop 4 columns max, Mobile 2 columns
 */

.hl-related-products-grid {
    margin-bottom: 2rem;
}

/* Grid wrapper with flexbox layout */
.hl-related-products-grid .hl-grid-wrapper {
    display: flex;
    flex-wrap: wrap;
    margin: -0.5rem; /* Negative margin for spacing compensation */
}

/* Grid item - 4 columns on desktop */
.hl-related-products-grid .hl-grid-item {
    width: calc(25% - 1rem); /* 4 columns */
    margin: 0.5rem;
    display: flex;
    flex-direction: column;
}

.hl-related-products-grid .product-card-wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Section header styling */
.hl-section-header {
    text-align: left;
    margin-bottom: 2rem;
    position: relative;
}

.hl-section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
    position: relative;
    display: block;
}

/* Product section padding */
.product-section {
    padding-top: 20px;
}

/* Responsive: 2 columns on mobile */
@media screen and (max-width: 640px) {
    .hl-section-title {
        font-size: 1.2rem;
    }

    .hl-section-header {
        margin-bottom: 1.5rem;
    }

    .hl-related-products-grid .hl-grid-wrapper {
        margin: -0.25rem;
    }

    .hl-related-products-grid .hl-grid-item {
        width: calc(50% - 0.5rem); /* 2 columns on mobile */
        margin: 0.25rem;
    }

    .hl-related-products-grid {
        margin-bottom: 1.5rem;
    }
}

/* Column spacing adjustments */
.hl-related-products-grid.has-0-gap .hl-grid-wrapper {
    margin: 0;
}

.hl-related-products-grid.has-0-gap .hl-grid-item {
    margin: 0;
    width: 25%;
}

.hl-related-products-grid.has-small-gap .hl-grid-wrapper {
    margin: -0.5rem;
}

.hl-related-products-grid.has-small-gap .hl-grid-item {
    margin: 0.5rem;
}

.hl-related-products-grid.has-medium-gap .hl-grid-wrapper {
    margin: -1rem;
}

.hl-related-products-grid.has-medium-gap .hl-grid-item {
    margin: 1rem;
}

.hl-related-products-grid.has-large-gap .hl-grid-wrapper {
    margin: -1.5rem;
}

.hl-related-products-grid.has-large-gap .hl-grid-item {
    margin: 1.5rem;
}

.hl-related-products-grid.has-collapse .hl-grid-wrapper {
    margin: 0;
}

.hl-related-products-grid.has-collapse .hl-grid-item {
    margin: 0;
    width: 25%;
}

/* Responsive column spacing */
@media screen and (max-width: 640px) {
    .hl-related-products-grid.has-0-gap .hl-grid-item {
        width: 50%;
    }

    .hl-related-products-grid.has-small-gap .hl-grid-wrapper {
        margin: -0.25rem;
    }

    .hl-related-products-grid.has-small-gap .hl-grid-item {
        margin: 0.25rem;
        width: calc(50% - 0.5rem);
    }

    .hl-related-products-grid.has-medium-gap .hl-grid-wrapper {
        margin: -0.5rem;
    }

    .hl-related-products-grid.has-medium-gap .hl-grid-item {
        margin: 0.5rem;
        width: calc(50% - 1rem);
    }

    .hl-related-products-grid.has-large-gap .hl-grid-wrapper {
        margin: -0.75rem;
    }

    .hl-related-products-grid.has-large-gap .hl-grid-item {
        margin: 0.75rem;
        width: calc(50% - 1.5rem);
    }

    .hl-related-products-grid.has-collapse .hl-grid-item {
        width: 50%;
    }
}

/* Product card styling */
.hl-related-products-grid .product {
    height: 100%;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

.hl-related-products-grid .product .box-image {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.hl-related-products-grid .product .box-image img {
    width: 100%;
    height: auto;
    transition: transform 0.3s ease;
    display: block;
}

.hl-related-products-grid .product:hover .box-image img {
    transform: scale(1.05);
}

.hl-related-products-grid .product .box-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
}

.hl-related-products-grid .product:hover .box-text {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.hl-related-products-grid .product .woocommerce-loop-product__title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 0.5rem 0;
    color: #333;
    text-decoration: none;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.hl-related-products-grid .product .price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #e74c3c;
    margin: 0 0 1rem 0;
}

/* Category tag styling */
.hl-related-products-grid .product .category-link {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    display: block;
}

/* Rating stars styling */
.hl-related-products-grid .product .star-rating {
    margin-bottom: 0.5rem;
}

/* Add to cart button styling */
.hl-related-products-grid .product .add_to_cart_button,
.hl-related-products-grid .product .product_type_simple,
.hl-related-products-grid .product .product_type_variable,
.hl-related-products-grid .product .product_type_external {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    margin-top: auto;
}

.hl-related-products-grid .product .add_to_cart_button:hover,
.hl-related-products-grid .product .product_type_simple:hover,
.hl-related-products-grid .product .product_type_variable:hover,
.hl-related-products-grid .product .product_type_external:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Sale badge */
.hl-related-products-grid .product .onsale {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: #e74c3c;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 2;
}