/**
 * CC Related Products Module
 * Frontend styles for related products display
 *
 * @author Carlos Casado
 * @copyright Carlos Casado
 * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0
 */

/* Section */
.cc-relatedproducts {
    margin: 2.5rem 0;
    padding: 2rem 0;
    border-top: 1px solid #e9ecef;
}

/* Title */
.cc-relatedproducts__title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 1.5rem 0;
    color: #232323;
    text-align: center;
}

/* Carousel Wrapper */
.cc-relatedproducts__carousel-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Carousel Container */
.cc-relatedproducts__carousel {
    overflow: hidden;
    flex: 1;
    position: relative;
    padding: 10px;
    margin: -10px;
}

/* Track */
.cc-relatedproducts__track {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
    gap: 1rem;
}

/* Slide */
.cc-relatedproducts__slide {
    flex: 0 0 calc(25% - 0.75rem);
    min-width: 0;
}

/* Override Bootstrap column classes inside slides */
.cc-relatedproducts__slide .product-miniature,
.cc-relatedproducts__slide article.product-miniature {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    padding-left: 0;
    padding-right: 0;
}

/* Hide alternate product view modes - only show grid view */
.cc-relatedproducts .tvproduct-wrapper.grid-2,
.cc-relatedproducts .tvproduct-wrapper.list,
.cc-relatedproducts .tvproduct-wrapper.catelog {
    display: none !important;
}

/* Show only the grid view */
.cc-relatedproducts .tvproduct-wrapper.grid {
    display: block !important;
}

/* Fix product wrapper sizing */
.cc-relatedproducts .tvproduct-wrapper {
    width: 100%;
}

/* Ensure thumbnail container takes full width */
.cc-relatedproducts .thumbnail-container {
    width: 100%;
}

/* Fix product image sizing */
.cc-relatedproducts .tvproduct-image {
    width: 100%;
}

.cc-relatedproducts .tvproduct-image a {
    display: block;
    width: 100%;
}

.cc-relatedproducts .tvproduct-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* Fix product info box */
.cc-relatedproducts .tvproduct-info-box-wrapper {
    width: 100%;
    padding: 10px 15px;
}

/* Navigation Buttons */
.cc-relatedproducts__nav {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: #f8f9fa;
    color: #232323;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cc-relatedproducts__nav:hover {
    background: #232323;
    color: #fff;
    transform: scale(1.05);
}

.cc-relatedproducts__nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.cc-relatedproducts__nav svg {
    width: 20px;
    height: 20px;
}

/* Dots Navigation */
.cc-relatedproducts__dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.cc-relatedproducts__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #dee2e6;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
}

.cc-relatedproducts__dot:hover {
    background: #adb5bd;
}

.cc-relatedproducts__dot.active {
    background: #232323;
    transform: scale(1.2);
}

/* Grid Mode */
.cc-relatedproducts__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.cc-relatedproducts__item {
    min-width: 0;
}

/* Override Bootstrap column classes inside grid items */
.cc-relatedproducts__item .product-miniature,
.cc-relatedproducts__item article.product-miniature {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    padding-left: 0;
    padding-right: 0;
}

/* Product Card Enhancements */
.cc-relatedproducts .product-miniature {
    height: 100%;
}

.cc-relatedproducts .tvproduct-wrapper {
    position: relative;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.cc-relatedproducts .tvproduct-wrapper .tvproduct-image {
    position: relative;
    overflow: hidden;
}

/* Ensure hover buttons are visible */
.cc-relatedproducts .tvproduct-wrapper .tvproducthover-btn {
    position: absolute;
    z-index: 10;
}

/* Make info box flexible */
.cc-relatedproducts .tvproduct-info-box-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Responsive */
@media (max-width: 1199px) {
    .cc-relatedproducts__slide {
        flex: 0 0 calc(33.333% - 0.67rem);
    }

    .cc-relatedproducts__grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 991px) {
    .cc-relatedproducts__slide {
        flex: 0 0 calc(50% - 0.5rem);
    }

    .cc-relatedproducts__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .cc-relatedproducts__nav {
        width: 38px;
        height: 38px;
    }

    .cc-relatedproducts__nav svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 575px) {
    .cc-relatedproducts {
        margin: 1.5rem 0;
        padding: 1.5rem 0;
    }

    .cc-relatedproducts__title {
        font-size: 1.25rem;
    }

    .cc-relatedproducts__slide {
        flex: 0 0 calc(100% - 0rem);
    }

    .cc-relatedproducts__grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .cc-relatedproducts__nav {
        width: 34px;
        height: 34px;
    }

    .cc-relatedproducts__carousel-wrapper {
        gap: 0.25rem;
    }
}