/* General styles for the container and items */
.custom-testimonial-grid, .custom-testimonial-carousel-container {
    width: 100%; /* Allow full width */
    margin: 0; /* Remove centering margin */
    padding: 20px;
}
.testimonial-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease-in-out;
    height: 450px; /* Increased height for review design */
}
.testimonial-item:hover {
    transform: translateY(-5px);
}
.testimonial-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease-in-out;
}
.testimonial-item:hover img {
    transform: scale(1.05);
}
.testimonial-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 250px;
}

/* Overlay styles */
.testimonial-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.5) 40%, rgba(0,0,0,0) 100%);
    color: white;
    padding: 15px;
    padding-top: 50px;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}
.testimonial-item:hover .testimonial-overlay {
    opacity: 1;
}
.testimonial-name {
      color: #fff;
    margin: 0;
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}
.testimonial-rating .star {
    color: #ddd;
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}
.testimonial-rating .star.filled {
    color: #ffc107;
}
.view-more {
    display: inline-block;
    margin-top: 5px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}
.view-more::after {
    content: '\2192';
    margin-left: 5px;
}

/* Grid layout */
.custom-testimonial-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(var(--columns), minmax(0, 1fr));
}

/* Carousel layout */
.custom-testimonial-carousel-container {
    position: relative;
    overflow: hidden;
    padding-bottom: 40px; /* Space for pagination dots */
}
.custom-testimonial-carousel {
    display: flex;
    transition: transform 0.5s ease-in-out;
    gap: 20px;
}
.custom-testimonial-carousel .testimonial-item {
    flex-shrink: 0;
    flex-grow: 0;
    flex-basis: calc( (100% - 20px * (var(--per-view) - 1)) / var(--per-view));
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
    font-size: 1.5rem;
    border-radius: 50%;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}
.prev-btn { left: 10px; }
.next-btn { right: 10px; }

/* Pagination dots */
.carousel-pagination {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}
.pagination-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.pagination-dot.active {
    background-color: rgba(0, 0, 0, 0.7);
}


/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
    padding: 20px;
}
.modal-content {
    background-color: #fefefe;
    width: 90%;
    max-width: 900px;
    padding: 20px;
    border-radius: 10px;
    position: absolute;
    animation-name: animatetop;
    animation-duration: 0.4s;
    display: flex;
    max-height: 90vh;
    height: auto;
    flex-direction: column;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.close-btn {
    position: absolute;
    top: 10px;
    right: 20px;
    z-index: 1001;
    color: #aaa;
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.close-btn:hover, .close-btn:focus {
    color: black;
}
.modal-body {
    display: flex;
    gap: 20px;
    flex-wrap: nowrap;
    width: 100%;
    height: auto;
    overflow-y: auto;
    flex-direction: column;
}
.modal-image {
    flex-shrink: 0;
    height: auto;
    max-height: 300px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.modal-image img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
    object-position: top;
}
.modal-details {
    overflow-y: auto;
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.modal-reviewer-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}
#modal-verified-buyer-badge {
    font-size: 0.8rem;
    color: #4CAF50;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
}
#modal-verified-buyer-badge.hide {
    display: none;
}
#modal-verified-buyer-badge::before {
    content: '✔';
    font-size: 1.2em;
}
#modal-reviewer-name {
    font-size: 1.8rem;
    font-weight: bold;
    margin: 0;
}
#modal-verified-buyer-badge {
    font-size: 0.8rem;
    color: #4CAF50;
    font-weight: bold;
    display: none; /* Changed from visibility: hidden to display: none */
    align-items: center;
    gap: 5px;
}
#modal-verified-buyer-badge::before {
    content: '✔';
    font-size: 1.2em;
}
#modal-review-text {
    font-size: 1rem;
}
#modal-product-details {
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 20px;
    display: none;
}
.product-info-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}
#modal-product-image {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 5px;
}
.product-text {
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
}
#modal-product-name {
    font-size: 1rem;
    font-weight: bold;
}
#modal-product-price {
    color: #888;
}

/* Animation */
@keyframes animatetop {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Media queries for responsiveness */
@media (min-width: 1025px) {
    .modal-content {
        display: grid;
        grid-template-columns: 1fr 2fr;
        gap: 20px;
        max-height: 90vh;
        height: auto;
        flex-direction: row;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
    .modal-body {
        display: contents;
    }
    .modal-image {
        max-height: none;
        height: 100%;
    }
    .modal-image img {
        max-height: none;
        height: 100%;
        object-position: top;
    }
    .close-btn {
        position: absolute;
        top: 10px;
        right: 20px;
        background: none;
        color: #aaa;
    }
    .modal-details {
        overflow-y: auto;
        height: 100%;
    }
    #modal-review-text {
        flex-grow: 1;
    }
}
@media (max-width: 1024px) {
    .modal-content {
        flex-direction: column;
        height: auto;
        max-height: 90vh;
        overflow: auto;
    }
    .modal-body {
        flex-direction: column;
        overflow-y: auto;
    }
    .modal-image {
        height: auto;
        max-height: 300px;
    }
    .modal-image img {
        height: auto;
        max-height: 300px;
        object-position: top;
    }
    .close-btn {
        position: fixed;
        top: 10px;
        right: 10px;
        background-color: rgba(0, 0, 0, 0.5);
        border-radius: 50%;
        width: 30px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1001;
        color: #fff;
    }
    .custom-testimonial-carousel .testimonial-item {
        flex-basis: 100%;
    }
}
@media (max-width: 768px) {
    .custom-testimonial-grid {
        grid-template-columns: 1fr;
    }
    .carousel-pagination {
        display: flex;
    }
    .carousel-btn {
        display: none;
    }
    .modal-content {
        flex-direction: column;
    }
    .modal-body {
        flex-direction: column;
    }
}