/* Reviews Section Styling */
.reviews-section {
    background-color: #f9f9fa;
    padding: 60px 0;
    overflow: hidden;
    position: relative;
    min-height: 400px; /* Ensure there's enough space for the reviews */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Horizontal scrolling container */
.reviews-container {
    width: 100%;
    max-width: 100%;
    margin-bottom: 50px;
    position: relative;
    padding: 20px 0;
    overflow: hidden;
    overscroll-behavior-x: none; /* Prevent scroll chaining */
}

/* Animation for the horizontal scrolling */
@keyframes scrollTape {
    0% {
        transform: translateX(0%); /* Start from visible position */
    }
    100% {
        transform: translateX(-50%); /* Move half width for smoother loop */
    }
}

/* Also provide webkit-specific animation for Safari */
@-webkit-keyframes scrollTape {
    0% {
        -webkit-transform: translateX(0%);
    }
    100% {
        -webkit-transform: translateX(-50%);
    }
}

/* Inner container with animation */
.reviews-scroll {
    display: flex;
    width: max-content;
    animation: scrollTape 60s linear infinite;
    -webkit-animation: scrollTape 60s linear infinite; /* Safari support */
    animation-delay: 0s; /* Start immediately */
    padding: 20px 0;
    will-change: transform; /* Optimize for animation performance */
    backface-visibility: hidden; /* Reduce flickering */
    -webkit-backface-visibility: hidden;
    transform: translate3d(0, 0, 0); /* Force GPU acceleration */
    -webkit-transform: translate3d(0, 0, 0);
}

/* Pause animation on hover */
.reviews-scroll:hover {
    animation-play-state: paused;
    -webkit-animation-play-state: paused;
}

/* Review card styling */
.review-card {
    background-color: white;
    border-radius: 3px;
    overflow: hidden;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    border: 10px solid white;
    position: relative;
    margin: 0 30px;
    transform: rotate(var(--rotate, -2deg));
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    min-width: 450px;
    max-width: 550px;
}

/* Alternate rotation for cards */
.review-card:nth-child(even) {
    --rotate: 2deg;
}

.review-card:hover {
    transform: rotate(0) scale(1.05);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

/* Enhanced Tape effect */
.review-card::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 35px;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px dashed rgba(0, 0, 0, 0.15);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.review-image-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
    position: relative;
    overflow: hidden;
    height: auto;
}

.review-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.5s ease;
    transform-origin: center;
    object-fit: contain; /* Ensure the image is fully visible */
    max-height: none;
}

.review-card:hover .review-image {
    transform: scale(1.03);
}

/* No controls needed since animation is automatic */

.reviews-button {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    width: 100%;
}

.reviews-button .btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 15px 35px;
    font-size: 1.1rem;
    box-shadow: 0 8px 20px rgba(42, 82, 152, 0.2);
    border-radius: 50px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.reviews-button .btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(42, 82, 152, 0.3);
}

.reviews-button .btn i {
    font-size: 1.3rem;
    transition: transform 0.3s ease;
}

.reviews-button .btn:hover i {
    transform: rotate(15deg);
}

/* Additional styling for ensuring review cards are clearly visible */
.reviews-container {
    margin-top: 30px;
    padding: 30px 0;
}

/* Image error handling */
.image-error {
    min-height: 200px;
    background-color: #f1f1f1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.image-error::after {
    content: 'Image could not be loaded';
    font-size: 14px;
    color: #888;
}

.image-container-error {
    background-color: #f1f1f1;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-error-placeholder {
    min-height: 200px;
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #6c757d;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

/* Additional style to ensure compatibility across browsers */
@supports not (animation-play-state: paused) {
    .reviews-scroll {
        transition: transform 0.5s ease;
    }
}

/* Responsive adjustments */
/* Comprehensive responsive breakpoints for reviews */
@media screen and (max-width: 1440px) {
    @keyframes scrollTape {
        0% {
            transform: translateX(0%);
        }
        100% {
            transform: translateX(-100%);
        }
    }
    
    .review-card {
        min-width: 430px;
        max-width: 520px;
    }
}

@media screen and (max-width: 1200px) {
    .review-card {
        min-width: 380px;
        max-width: 450px;
    }
    
    .reviews-scroll {
        animation-duration: 70s; /* Slower on smaller screens */
    }
}

@media screen and (max-width: 992px) {
    .review-card {
        min-width: 340px;
        max-width: 400px;
        padding: 12px;
        margin: 0 15px;
    }
}

@media screen and (max-width: 768px) {
    .review-card {
        min-width: 280px;
        max-width: 340px;
        --rotate: -3deg;
        padding: 10px;
        margin: 0 15px;
    }
    
    .review-card:nth-child(even) {
        --rotate: 3deg;
    }
    
    .review-card::before {
        width: 100px;
    }
    
    .reviews-scroll {
        animation-duration: 80s; /* Even slower on mobile for better reading */
    }
}

@media screen and (max-width: 576px) {
    .review-card {
        min-width: 240px;
        max-width: 300px;
        padding: 8px;
        margin: 0 12px;
        border-width: 8px;
    }
    
    .review-card::before {
        width: 80px;
        height: 25px;
    }
    
    .reviews-container {
        padding: 15px 0;
    }
}

@media screen and (max-width: 480px) {
    .review-card {
        min-width: 220px;
        max-width: 270px;
    }
    
    .reviews-button .btn {
        padding: 10px 20px;
        font-size: 0.95rem;
    }
}

/* Orientation specific adjustments */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .reviews-container {
        padding: 10px 0;
    }
    
    .review-card {
        min-width: 240px;
        max-width: 280px;
        margin: 0 15px;
        transform: rotate(0); /* Less rotation in landscape */
    }
    
    .review-card:hover {
        transform: scale(1.03); /* Subtle scale on landscape mode */
    }
}
