/* Enhanced carousel.css with improved continuous movement for Arabic RTL support */
.carousel-container {
    width: 100%;
    overflow: hidden;
    position: relative;
    margin: 2rem 0;
    background-color: rgba(40, 40, 40, 0.7);
    border-radius: 8px;
    padding: 1.5rem 0;
    display: block !important; /* Ensure all carousel containers are visible */
}

.carousel-track {
    display: flex;
    width: max-content;
    animation: scroll 15s linear infinite;
    will-change: transform; /* Performance optimization */
}

.carousel-track:hover {
    animation-play-state: paused;
}

.carousel-item {
    display: flex !important; /* Ensure all carousel items are visible */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    min-width: 180px;
    text-align: center;
}

.carousel-item img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin-bottom: 0;
    transition: transform 0.3s ease;
}

.carousel-item:hover img {
    transform: scale(1.1);
}

/* Animation for automatic scrolling - LTR (English) */
@keyframes scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(-50% - 180px)); /* Adjusted to ensure complete exit before entry */
    }
}

/* Animation for automatic scrolling - RTL (Arabic) */
@keyframes scroll-rtl {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(50% + 180px)); /* Adjusted to ensure complete exit before entry */
    }
}

/* Ensure RTL support for Arabic - use the RTL-specific keyframes */
[dir="rtl"] .carousel-track {
    animation-name: scroll-rtl;
}

/* Controls for manual navigation */
.carousel-controls {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.carousel-control {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 0.5rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.carousel-control:hover {
    background-color: var(--hover-color);
}

/* Specific styles for partners and clients sections */
.partners .carousel-container,
.clients .carousel-container,
.partners-page .carousel-container,
.clients-section .carousel-container,
.brands-section .carousel-container {
    animation-play-state: running !important;
    display: block !important; /* Ensure visibility */
}

.partners .carousel-track,
.clients .carousel-track,
.partners-page .carousel-track,
.clients-section .carousel-track,
.brands-section .carousel-track {
    animation: scroll 15s linear infinite;
    animation-play-state: running !important;
    display: flex !important; /* Ensure visibility */
}

/* Ensure RTL support for specific sections */
[dir="rtl"] .partners .carousel-track,
[dir="rtl"] .clients .carousel-track,
[dir="rtl"] .partners-page .carousel-track,
[dir="rtl"] .clients-section .carousel-track,
[dir="rtl"] .brands-section .carousel-track {
    animation-name: scroll-rtl;
}

/* Override any display:none that might be hiding carousels */
.brands-grid,
.partners-grid,
.clients-grid {
    display: block !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .carousel-item {
        min-width: 150px;
        padding: 1rem;
    }
    
    .carousel-item img {
        width: 80px;
        height: 80px;
    }
    
    @keyframes scroll {
        0% {
            transform: translateX(0);
        }
        100% {
            transform: translateX(calc(-50% - 150px)); /* Adjusted for mobile */
        }
    }

    @keyframes scroll-rtl {
        0% {
            transform: translateX(0);
        }
        100% {
            transform: translateX(calc(50% + 150px)); /* Adjusted for mobile */
        }
    }
}

@media (max-width: 480px) {
    .carousel-item {
        min-width: 120px;
        padding: 0.8rem;
    }
    
    .carousel-item img {
        width: 60px;
        height: 60px;
    }
    
    @keyframes scroll {
        0% {
            transform: translateX(0);
        }
        100% {
            transform: translateX(calc(-50% - 120px)); /* Adjusted for small mobile */
        }
    }

    @keyframes scroll-rtl {
        0% {
            transform: translateX(0);
        }
        100% {
            transform: translateX(calc(50% + 120px)); /* Adjusted for small mobile */
        }
    }
}
