/* Best Sellers Module CSS */

.rebit-module-best-sellers {
    padding: var(--section-padding) 0;
}

.rebit-best-sellers-header {
    text-align: center;
    margin-bottom: var(--spacing-48);
}

.rebit-best-sellers-header .rebit-section-title {
    margin-bottom: 10px;
    font-size: var(--fs-section-title);
    text-transform: uppercase;
}

.rebit-best-sellers-header .rebit-section-subtitle {
    color: var(--color-text-muted);
    font-size: var(--fs-section-subtitle);
    margin: 0;
}

/* Contenedor flexible dependiendo de la cantidad de items */
.rebit-best-sellers-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-24);
    max-width: 1000px;
    margin: 0 auto;
}

.rebit-bs-item-wrapper {
    flex: 1;
    position: relative;
    transition: transform 0.3s ease;
    max-width: 320px; /* Limitar el ancho de cada tarjeta */
    width: 100%;
}

/* Si hay 3 items, el del centro es un poco más grande */
.rebit-bs-item-wrapper.center-featured {
    transform: scale(1.08);
    z-index: 10;
}

/* Borde y sombra extra para el recomendado */
.rebit-bs-item-wrapper.center-featured .rebit-shared-product-card {
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    border: 2px solid var(--color-primary);
}

/* Etiqueta flotante RECOMENDADO */
.rebit-bs-recommended-label {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-primary);
    color: #fff;
    padding: 4px 16px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    z-index: 20;
    white-space: nowrap;
}

/* Carrusel Container */
.rebit-best-sellers-carousel-container {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
}

/* Flechas ocultas en web/desktop */
.rebit-bs-arrow {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    border: 1px solid var(--color-outline);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    z-index: 30;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    align-items: center;
    justify-content: center;
    color: var(--color-text);
}
.rebit-bs-arrow:hover {
    background: var(--color-surface-variant);
}
.rebit-bs-arrow svg {
    width: 20px;
    height: 20px;
}
.rebit-bs-prev { left: -10px; }
.rebit-bs-next { right: -10px; }

/* Responsive */
@media (max-width: 992px) {
    .rebit-best-sellers-wrapper {
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--spacing-24);
    }
    
    .rebit-bs-item-wrapper {
        flex: 0 0 calc(50% - 12px);
    }

    .rebit-bs-item-wrapper.center-featured {
        transform: scale(1);
    }
}

@media (max-width: 768px) {
    .rebit-best-sellers-header {
        margin-bottom: var(--spacing-32);
    }
    .rebit-module-best-sellers {
        padding: var(--section-padding) 0;
    }
    
    /* Habilitar slider horizontal (scroll snap) en móvil */
    .rebit-best-sellers-wrapper {
        display: flex;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important; /* Fix para scroll hacia la izquierda */
        align-items: stretch;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        gap: 15px;
        padding-top: 20px; /* Evitar que se corte el label RECOMENDADO */
        padding-bottom: 20px; /* Espacio para scrollbar si aparece */
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
        margin-left: -20px; /* Expandir contenedor fuera del padding general */
        margin-right: -20px;
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .rebit-best-sellers-wrapper::-webkit-scrollbar {
        display: none;
    }
    
    .rebit-bs-item-wrapper {
        flex: 0 0 280px !important; /* Más pequeño en móvil para revelar las otras cards */
        scroll-snap-align: center;
        max-width: 280px;
    }
    
    /* Mostrar flechas solo en móvil */
    .rebit-bs-arrow {
        display: flex;
    }
}

