/* =============================================================================
   bestsellers-carousel.css — Carousel de Más Vendidos
   Rodio Divi Child Theme · Prefijo: rod-bs-

   Replica el estilo visual de dwe-carousel-feed-style.css con clases propias.
   Mobile-first: muestra 2 slides en mobile, 3 en tablet, 5 en desktop.
   ============================================================================= */

/* ── Variables ─────────────────────────────────────────────────────────────── */
.rod-bs-carousel {
    --bs-primary:        #00B3A6;
    --bs-primary-hover:  #009688;
    --bs-sale:           #dc2626;
    --bs-bg:             #f9fafb;
    --bs-white:          #ffffff;
    --bs-border:         #e5e7eb;
    --bs-border-light:   #f3f4f6;
    --bs-text:           #111827;
    --bs-text-secondary: #6b7280;
    --bs-radius:         0.5rem;
    --bs-transition:     150ms ease;
    --bs-shadow-md:      0 4px 12px rgba(0, 0, 0, 0.06);
    --bs-gap:            20px;
}

/* ── Scoped reset ──────────────────────────────────────────────────────────── */
.rod-bs-carousel *,
.rod-bs-carousel *::before,
.rod-bs-carousel *::after { box-sizing: border-box; }

/* ── Spinner para estado "Agregando..." ─────────────────────────────────────── */
@keyframes rod-bs-spin {
    to { transform: rotate(360deg); }
}

/* =============================================================================
   HEADER (título + botones de navegación)
   ============================================================================= */

.rod-bs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.rod-bs-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--bs-text);
    margin: 0;
    padding: 0;
    line-height: 1.2;
}

/* ── Botones prev / next ─────────────────────────────────────────────────── */

.rod-bs-nav {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.rod-bs-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: 1px solid var(--bs-border);
    background: var(--bs-white);
    color: var(--bs-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition:
        background var(--bs-transition),
        border-color var(--bs-transition),
        color var(--bs-transition);
}

.rod-bs-btn svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.rod-bs-btn:hover {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
}

.rod-bs-btn:disabled,
.rod-bs-btn[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* =============================================================================
   VIEWPORT + TRACK
   ============================================================================= */

.rod-bs-viewport {
    overflow: hidden;
    /* Deja el scroll vertical de la página al navegador; el swipe horizontal
       lo maneja bestsellers-carousel.js (evita el delay de "¿es scroll o
       swipe?" en móvil). */
    touch-action: pan-y;
}

.rod-bs-track {
    display: flex;
    gap: var(--bs-gap);
    transition: transform 0.35s ease;
    will-change: transform;
    align-items: stretch;
}

/* Ancho de cada slide calculado por JS al init y al resize.
   Valores por defecto en CSS como respaldo visible. */
.rod-bs-slide {
    flex: 0 0 auto;
    min-width: 0;
}

/* =============================================================================
   CARD
   ============================================================================= */

.rod-bs-card {
    background: var(--bs-white);
    border: 1px solid #f3f4f6;
    border-radius: 0.75rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    cursor: pointer;
    transition:
        border-color var(--bs-transition),
        box-shadow var(--bs-transition);
}

.rod-bs-card:hover {
    border-color: #99f6e4;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.10), 0 2px 4px -2px rgba(0, 0, 0, 0.10);
}

/* ── Thumbnail ─────────────────────────────────────────────────────────────── */

/* aspect-ratio (no height fija) para que la miniatura escale junto con el
   ancho de la tarjeta, que bestsellers-carousel.js recalcula por JS en cada
   breakpoint — con height fija la proporción se descuadraba y la imagen se
   veía sobredimensionada en tablet/celular. */
.rod-bs-card__thumb-wrap {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--bs-bg);
    overflow: hidden;
    flex-shrink: 0;
}

.rod-bs-card__thumb {
    height: 100%;
    line-height: 0;
}

.rod-bs-card__thumb a {
    display: block;
    height: 100%;
}

.rod-bs-card__thumb img {
    width: 100% !important;
    height: 100% !important;
    /* contain (no cover): el producto completo, centrado y sin recorte,
       igual que en feed-productos / ofertas. */
    object-fit: contain;
    object-position: center;
    transition: transform 0.35s ease;
}

.rod-bs-card:hover .rod-bs-card__thumb img {
    transform: scale(1.05);
}


/* ── Badges overlay (tipo + descuento) ───────────────────────────────────────── */

.rod-bs-card__badges {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 2;
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

/* Badge de tipo: “Más vendido” (naranja), “En oferta” (rosa) */
.rod-bs-card__type-badge {
    display: inline-block;
    padding: 0.2rem 0.45rem;
    border-radius: 0.25rem;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    background: #fff7ed;
    color: #ea580c;
    pointer-events: none;
}

.rod-bs-card__type-badge--oferta {
    background: #fff1f2;
    color: #e11d48;
}

/* Badge de descuento: -X% (rojo) */
.rod-bs-card__badge {
    display: inline-block;
    padding: 0.2rem 0.45rem;
    border-radius: 0.25rem;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    background: #ef4444;
    color: #fff;
    pointer-events: none;
}

/* ── Botón wishlist (DWE nativo) ────────────────────────────────────────────── */

.rod-bs-card__wishlist {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 2;
}

/* ── Contenido de la card ───────────────────────────────────────────────────── */

.rod-bs-card__content {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Marca (brand) */
.rod-bs-card__brand {
    margin: 0 0 0.125rem;
    padding: 0;
    font-size: 0.7rem;
    color: #9ca3af;
    font-weight: 400;
    line-height: 1.3;
}

/* Título */
.rod-bs-card__title {
    margin: 0 0 0.5rem;
    padding: 0;
}

.rod-bs-card__title,
.rod-bs-card__title a {
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    color: #1f2937;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.38rem;
    text-transform: none !important;
    letter-spacing: 0 !important;
}

.rod-bs-card__title a {
    text-decoration: none;
    display: -webkit-box;
}

.rod-bs-card__title a:hover {
    color: var(--bs-primary);
}

/* Rating (estrellas + conteo) */
.rod-bs-card__rating {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.375rem;
}

.rod-bs-card__star {
    width: 0.7rem;
    height: 0.7rem;
    flex-shrink: 0;
}

.rod-bs-card__rating-score {
    font-size: 0.72rem;
    font-weight: 600;
    color: #374151;
}

.rod-bs-card__rating-count {
    font-size: 0.7rem;
    color: #9ca3af;
}

/* ── Precio ─────────────────────────────────────────────────────────────────── */

.rod-bs-card__price {
    margin-top: auto;
    margin-bottom: 0.25rem;
}

.rod-bs-card__price del,
.rod-bs-card__price del .woocommerce-Price-amount {
    font-size: 0.72rem;
    font-weight: 400;
    color: #9ca3af;
    display: block;
    line-height: 1.3;
}

.rod-bs-card__price ins,
.rod-bs-card__price ins .woocommerce-Price-amount {
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 700;
    color: #00A99D;
    display: block;
    line-height: 1.2;
}

.rod-bs-card__price .woocommerce-Price-amount {
    color: #00A99D;
    font-size: 1.05rem;
    font-weight: 700;
}

/* =============================================================================
   FOOTER DE CARD (botón de acción)
   ============================================================================= */

.rod-bs-card__footer {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.625rem;
}

/* ── Botón Agregar al carrito ───────────────────────────────────────────────── */

.rod-bs-add-to-cart {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.45rem 0.7rem;
    border-radius: var(--bs-radius);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid #ccfbf1;
    background: #ffffff;
    color: #00A99D;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1;
    min-height: 2rem;
}

.rod-bs-add-to-cart:hover:not(:disabled) {
    background: #f0fdfa;
    border-color: #5eead4;
}

.rod-bs-add-to-cart:active {
    transform: scale(0.97);
}

.rod-bs-add-to-cart:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ── Ver opciones / Ver producto ────────────────────────────────────────────── */

.rod-bs-card__link {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.4rem 0.7rem;
    border-radius: var(--bs-radius);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--bs-border);
    background: var(--bs-white);
    color: var(--bs-text);
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s;
    min-height: 2rem;
    white-space: nowrap;
}

.rod-bs-card__link:hover {
    border-color: var(--bs-primary);
    color: var(--bs-primary);
}

/* =============================================================================
   RESPONSIVE — breakpoints alineados con Divi (tablet: max-width 980px,
   phone: max-width 767px). El número de slides visibles lo controla
   bestsellers-carousel.js (getSlidesPerView); aquí solo se ajusta densidad
   visual (gap, alturas, tipografía) para que las tarjetas no se vean apretadas.
   ============================================================================= */

@media (max-width: 980px) {
    .rod-bs-carousel {
        --bs-gap: 14px;
    }

    .rod-bs-title {
        font-size: 1.1rem;
    }

    .rod-bs-card__content {
        padding: 0.6rem;
    }

    .rod-bs-card__footer {
        flex-wrap: wrap;
    }
}

@media (max-width: 767px) {
    .rod-bs-carousel {
        --bs-gap: 10px;
    }

    .rod-bs-header {
        margin-bottom: 0.75rem;
    }

    .rod-bs-title {
        font-size: 1rem;
    }

    .rod-bs-btn {
        width: 1.75rem;
        height: 1.75rem;
    }

    .rod-bs-card__content {
        padding: 0.5rem;
    }

    .rod-bs-card__title,
    .rod-bs-card__title a {
        font-size: 0.78rem !important;
        height: 2.2rem;
    }

    .rod-bs-card__price ins,
    .rod-bs-card__price ins .woocommerce-Price-amount,
    .rod-bs-card__price .woocommerce-Price-amount {
        font-size: 0.9rem;
    }

    .rod-bs-add-to-cart,
    .rod-bs-card__link {
        font-size: 0.68rem;
        padding: 0.4rem 0.5rem;
    }
}
