/**
 * Categories Carousel CSS
 *
 * Estilos para el carrusel de categorías que muestra 3 elementos simultáneamente
 */

.categories-carousel-wrapper {
    position: relative;
    padding: 0 60px; /* Space for navigation arrows */
}

.categories-carousel {
    overflow: hidden;
    width: 100%;
}

.categories-track {
    display: flex;
    gap: 2rem;
    transition: transform 0.5s ease-in-out;
}

.category-carousel-item {
    flex: 0 0 calc(25% - 1.5rem); /* 4 items visible, accounting for gap */
    min-width: 0; /* Important for flex children */
}

.category-carousel-item .category-card {
    display: block;
    background: #ffffff;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid #e5e7eb;
    height: 100%;
}

/* Category Image (if set) */
.category-image {
    position: relative;
    width: 100%;
    height: 150px;
    overflow: hidden;
}

.category-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Rollover effect for category images */
.category-img-default {
    position: relative;
    z-index: 2;
    opacity: 1;
    transition: opacity 0.4s ease-in-out;
}

.category-img-hover {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

.category-carousel-item .category-card:hover .category-img-default {
    opacity: 0;
}

.category-carousel-item .category-card:hover .category-img-hover {
    opacity: 1;
}

.category-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.4));
    z-index: 3;
    pointer-events: none;
}

/* Category Icon (fallback if no image) */
.category-carousel-item .category-icon {
    width: 100px;
    height: 100px;
    margin: 1.5rem auto 1rem;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-carousel-item .category-icon i {
    font-size: 2.5rem;
    color: #ffffff;
}

/* Category Content */
.category-content {
    padding: 1rem 1.25rem;
    text-align: center;
}

.category-carousel-item .category-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.category-carousel-item .category-description {
    color: #6b7280;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.4;
}

.category-carousel-item .category-stats {
    margin-bottom: 0;
}

.category-carousel-item .stat-badge {
    background: #eff6ff;
    color: #1e40af;
    padding: 0.375rem 0.875rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 2px solid #dbeafe;
    display: inline-block;
}

/* Navigation Arrows */
.categories-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: #ffffff;
    border: 2px solid #1e40af;
    color: #1e40af;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.categories-nav:hover {
    background: #1e40af;
    color: #ffffff;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

.categories-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.categories-prev {
    left: 0;
}

.categories-next {
    right: 0;
}

.categories-nav i {
    font-size: 1.5rem;
}

/* Responsive Design */
@media (max-width: 991.98px) {
    .categories-carousel-wrapper {
        padding: 0 50px;
    }

    .category-carousel-item {
        flex: 0 0 calc(50% - 1rem); /* 2 items visible on tablets */
    }

    .categories-nav {
        width: 45px;
        height: 45px;
    }

    .categories-nav i {
        font-size: 1.25rem;
    }
}

@media (max-width: 767.98px) {
    .categories-carousel-wrapper {
        padding: 0;
    }

    .category-carousel-item {
        flex: 0 0 100%; /* 1 item visible on mobile */
    }

    /* Ocultar flechas en mobile */
    .categories-nav {
        display: none;
    }

    .category-image {
        height: 130px;
    }

    .category-carousel-item .category-icon {
        width: 80px;
        height: 80px;
        margin: 1.25rem auto 0.875rem;
    }

    .category-carousel-item .category-icon i {
        font-size: 2rem;
    }

    .category-content {
        padding: 0.875rem 1rem;
    }

    .category-carousel-item .category-title {
        font-size: 1rem;
    }

    .category-carousel-item .category-description {
        font-size: 0.85rem;
    }
}

@media (max-width: 575.98px) {
    .categories-carousel-wrapper {
        padding: 0;
    }

    .category-image {
        height: 110px;
    }

    .category-carousel-item .category-icon {
        width: 70px;
        height: 70px;
        margin: 1rem auto 0.75rem;
    }

    .category-carousel-item .category-icon i {
        font-size: 1.75rem;
    }
}

/* Touch/Swipe Support Styles */
.categories-carousel.swiping {
    cursor: grabbing;
}

.categories-carousel.swiping .categories-track {
    transition: none; /* Disable transition during swipe */
}

/* Animation for initial load */
@keyframes slideInCategory {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-carousel-item {
    animation: slideInCategory 0.6s ease-out;
    animation-fill-mode: both;
}

.category-carousel-item:nth-child(1) {
    animation-delay: 0.1s;
}

.category-carousel-item:nth-child(2) {
    animation-delay: 0.2s;
}

.category-carousel-item:nth-child(3) {
    animation-delay: 0.3s;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .categories-track {
        transition: none;
    }

    .category-carousel-item {
        animation: none;
    }

    .category-carousel-item .category-card,
    .category-carousel-item .category-icon,
    .category-image img {
        transition: none;
    }
}
