/**
 * Category Carousels - Carruseles de categorías dinámicas
 * Estático (sin auto-scroll), arrastrable en PC y móvil
 */

/* Contenedor principal de todas las categorías */
#categoriesCarousels {
    padding: 1rem 0;
}

/* Sección individual de categoría */
.category-section {
    padding: 1rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.category-section:first-child {
    border-top: none;
}

/* Header de categoría */
.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    margin-bottom: 0.75rem;
}

.category-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
}

.category-count {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
}

/* Wrapper del carrusel con flechas */
.category-carousel-wrapper {
    position: relative;
    overflow: hidden;
}

/* Track del carrusel - SIN animación automática */
.category-track {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    cursor: grab;
    user-select: none;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    /* Mejoras para touch móvil */
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;
    touch-action: pan-x pan-y;
}

.category-track::-webkit-scrollbar {
    display: none;
}

.category-track:active {
    cursor: grabbing;
}

/* En touch devices, quitar cursor grab */
@media (hover: none) and (pointer: coarse) {
    .category-track {
        cursor: default;
    }
    .category-track:active {
        cursor: default;
    }
}

/* Item de canción en el carrusel */
.category-song-item {
    flex-shrink: 0;
    width: 120px;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    scroll-snap-align: start;
}

.category-song-item:hover {
    transform: scale(1.05);
}

.category-song-item:active {
    transform: scale(0.98);
    opacity: 0.8;
}

/* Cover de la canción */
.category-song-cover {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    position: relative;
}

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

.category-song-item:hover .category-song-cover img {
    transform: scale(1.1);
}

/* Overlay de play en hover */
.category-song-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-song-item:hover .category-song-cover::after {
    opacity: 1;
}

/* Icono de play */
.category-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 40px;
    height: 40px;
    background: rgba(99, 102, 241, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 2;
}

.category-song-item:hover .category-play-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.category-play-icon svg {
    width: 20px;
    height: 20px;
    color: white;
    margin-left: 2px;
}

/* Info de la canción */
.category-song-info {
    padding: 0.5rem 0.25rem;
}

.category-song-title {
    font-size: 0.8125rem;
    font-weight: 500;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-song-artist {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.125rem;
}

/* Flechas de navegación */
.category-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: rgba(26, 26, 46, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.7);
}

.category-carousel-wrapper:hover .category-arrow {
    opacity: 1;
}

.category-arrow:hover {
    background: rgba(99, 102, 241, 0.8);
    border-color: rgba(99, 102, 241, 0.5);
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.category-arrow-left {
    left: 8px;
}

.category-arrow-right {
    right: 8px;
}

.category-arrow svg {
    width: 20px;
    height: 20px;
}

/* Estado de cargando */
.category-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
}

.category-loading .spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(99, 102, 241, 0.3);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.75rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Estado vacío */
.category-empty {
    text-align: center;
    padding: 2rem;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.875rem;
}

/* Canción actualmente reproduciendo */
.category-song-item.playing .category-song-cover {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.8);
}

.category-song-item.playing .category-song-title {
    color: #6366f1;
}

/* Responsive */
@media (max-width: 640px) {
    .category-song-item {
        width: 100px;
    }

    .category-song-cover {
        width: 100px;
        height: 100px;
    }

    .category-song-title {
        font-size: 0.75rem;
    }

    .category-song-artist {
        font-size: 0.6875rem;
    }

    .category-arrow {
        width: 32px;
        height: 32px;
    }

    .category-arrow svg {
        width: 16px;
        height: 16px;
    }

    /* En móvil, mostrar flechas siempre (más tenues) */
    .category-arrow {
        opacity: 0.5;
    }

    .category-carousel-wrapper:hover .category-arrow {
        opacity: 0.8;
    }
}

/* Tablets */
@media (min-width: 641px) and (max-width: 1024px) {
    .category-song-item {
        width: 110px;
    }

    .category-song-cover {
        width: 110px;
        height: 110px;
    }
}

/* Pantallas grandes - items más grandes */
@media (min-width: 1280px) {
    .category-song-item {
        width: 140px;
    }

    .category-song-cover {
        width: 140px;
        height: 140px;
    }

    .category-track {
        gap: 1rem;
    }
}
