.aelab-rel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.aelab-rel-header .aelab-rel-nav { position: static; top: auto !important; right: auto !important; margin: 0 0 0 auto; }
.aelab-rel-nav {
    position: absolute;
    top: -72px; /* pull higher to align with theme spacing */
    right: 12px;
    display: flex;
    gap: 12px;
    opacity: 0; /* Initially hidden until positioned by JS */
    transition: opacity 0.3s ease;
}

.aelab-rel-nav.positioned {
    opacity: 1;
}

.aelab-rel-nav .aelab-rel-btn { position: static; right: auto; top: auto; background: transparent; border-color: #d1d5db; color: #111; }
/* Related Products Carousel Styles */
.aelab-carousel-container {
    width: 100%;
    overflow: hidden;
    position: relative;
    max-width: 100%;
}

.aelab-carousel-wrapper {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0 10px;
    width: 100%;
}

/* Hide scrollbars */
.aelab-carousel-wrapper::-webkit-scrollbar {
    display: none !important;
}

.aelab-carousel-wrapper {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

/* Product card styles */
.aelab-product-card {
    flex: 0 0 auto;
    width: 250px;
    min-width: 250px;
    max-width: 250px;
    background: none;
    border-radius: 16px;
    border: 1.5px solid #e5e5e5;
    box-shadow: 0 2px 8px #f3f3f3;
    padding: 24px 12px 18px 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 260px;
    transition: box-shadow 0.2s;
}

.aelab-product-card:hover {
    box-shadow: 0 4px 16px #e0e0e0;
}

.aelab-product-thumb {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    width: 100%;
    height: 120px;
    overflow: hidden;
}

.aelab-product-thumb img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    background: none !important;
    box-shadow: none !important;
}

.aelab-product-title {
    font-size: 1rem;
    font-weight: normal;
    margin: 0;
    margin-top: 10px;
    color: #222;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.4;
    word-break: break-word;
}

.aelab-product-link {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
    height: 100%;
}

/* Prevent body horizontal scroll */
body {
    overflow-x: hidden !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .aelab-product-card {
        width: 200px;
        min-width: 200px;
        max-width: 200px;
        padding: 16px 8px 12px 8px;
        min-height: 220px;
    }
    
    .aelab-product-thumb {
        min-height: 100px;
        height: 100px;
    }
    
    .aelab-product-title {
        font-size: 0.9rem;
        min-height: 35px;
    }

    /* Force nav alignment relative to title on mobile */
    .aelab-rel-nav.positioned {
        top: -7px !important;
    }
} 

/* Swiper pagination for related products: keep inside container but lower */
/* Navigation arrows (replace dots) */
.aelab-related-swiper {
    position: relative;
}

.aelab-related-swiper .aelab-rel-btn {
    position: absolute;
    top: -38px; /* align horizontally with the section title */
    transform: none;
    right: 18px;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: transparent;
    box-shadow: 0 2px 6px rgba(0,0,0,.06);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

.aelab-related-swiper .aelab-rel-btn.prev {
    right: 50px; /* space between buttons */
}

.aelab-related-swiper .aelab-rel-btn:hover {
    background: #d1d5db;
}

.aelab-rel-icon {
    font-size: 16px;
    line-height: 1;
}

.aelab-related-swiper .swiper-pagination-bullets .swiper-pagination-bullet {
    margin: 0 4px !important;
}