/* Category Carousel Container */
.category-carousel {
    position: relative;
    overflow: hidden;
    padding: 20px 0;
}

.category-carousel-inner {
    display: flex;
    width: max-content;
}

/* Enable animation only if more than visible items */
.category-carousel-inner.animate {
    animation: slideCategories 20s linear infinite;
}

/* Category Item */
.category-item {
    flex: 0 0 auto;
    padding: 0 15px;
    width: 300px; /* Base width for large screens */
}

.category-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    height: 100%;
}

.category-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.img-container {
    height: 200px;
    overflow: hidden;
    position: relative;
}

.category-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.category-card:hover .category-img {
    transform: scale(1.1);
}

.category-content {
    padding: 1.5rem;
    text-align: center;
}

.category-title {
    color: #2c3e50;
    font-weight: 600;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.category-count {
    color: #6c757d;
    font-size: 0.9rem;
    margin: 0;
}

/* Animation Keyframes */
@keyframes slideCategories {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* Pause animation on hover */
.category-carousel:hover .category-carousel-inner.animate {
    animation-play-state: paused;
}

/* Large screens (Desktop) - 3 categories visible */
@media (min-width: 992px) {
    .category-item {
        width: calc(100vw / 3.5); /* Show 3 full + partial 4th */
        max-width: 350px;
        min-width: 280px;
    }
}

/* Medium screens (Tablet) - 2 categories visible */
@media (min-width: 768px) and (max-width: 991px) {
    .category-item {
        width: calc(100vw / 2.2); /* Show 2 full + partial 3rd */
        max-width: 300px;
        min-width: 250px;
    }
    
    .category-carousel-inner.animate {
        animation-duration: 15s;
    }
}

/* Small screens (Mobile) - 1 category visible */
@media (max-width: 767px) {
    .category-item {
        width: calc(100vw - 60px); /* Almost full width with margins */
        max-width: 280px;
        min-width: 240px;
    }
    
    .category-carousel-inner.animate {
        animation-duration: 12s;
    }
    
    .section-title h2 {
        font-size: 1.5rem;
    }
    
    .img-container {
        height: 180px;
    }
    
    .category-content {
        padding: 1rem;
    }
}

/* Ultra small screens */
@media (max-width: 480px) {
    .category-item {
        width: calc(100vw - 40px);
        padding: 0 10px;
    }
}

/* Animation speed control based on number of items */
.category-carousel-inner.fast {
    animation-duration: 15s;
}

.category-carousel-inner.medium {
    animation-duration: 20s;
}

.category-carousel-inner.slow {
    animation-duration: 25s;
}

/* Static layout for few categories */
.category-carousel-inner.static {
    justify-content: center;
    animation: none !important;
}

@media (min-width: 992px) {
    .category-carousel-inner.static .category-item {
        width: 350px;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .category-carousel-inner.static .category-item {
        width: 300px;
    }
}

@media (max-width: 767px) {
    .category-carousel-inner.static .category-item {
        width: calc(100vw - 60px);
        max-width: 280px;
    }
}