/* Relaciones de producto en ficha pública (carrusel mejorado) */
.pr-relaciones-section {
    width: 100%;
    max-width: none;
    margin: 0 0 30px;
    padding: 0;
}

.pr-slider {
    position: relative;
    margin-bottom: 8px;
}

.pr-slider-title {
    font-size: 16px;
    font-weight: 600;
    color: #0F1111;
    text-transform: none;
    margin: 0 0 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #1ebea5;
}

.pr-slider-viewport {
    position: relative;
}

.pr-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 2px 12px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scroll-behavior: smooth;
}

.pr-track::-webkit-scrollbar {
    height: 6px;
}

.pr-track::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.pr-track::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 4px;
}

/* Cuando hay pocos productos, centramos las tarjetas */
.pr-track.is-centered {
    justify-content: center;
}

.pr-card {
    flex: 1 0 230px;
    max-width: 320px;
    min-width: 0;
    box-sizing: border-box;
    scroll-snap-align: start;
    border: 1px solid #e7e7e7;
    border-radius: 8px;
    padding: 14px;
    background: #fff;
    text-align: center;
    transition: box-shadow .2s ease, border-color .2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pr-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    border-color: #c9c9c9;
    text-decoration: none;
}

.pr-card-img {
    max-height: 180px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    margin: 0 auto 12px;
}

.pr-card-title {
    font-size: 13px;
    line-height: 1.35;
    color: #0F1111;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 36px;
}

.pr-card-marca {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

.pr-card-price {
    font-weight: 700;
    color: #B12704;
    font-size: 16px;
    margin-top: 8px;
}

.pr-card-price:empty {
    display: none;
}

/* Flechas del carrusel */
.pr-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 50%;
    background: #fff;
    color: #333;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
    opacity: 0;
    transition: opacity .2s ease, background .2s ease;
}

.pr-slider:hover .pr-arrow,
.pr-arrow:focus {
    opacity: 1;
}

.pr-arrow:hover {
    background: #f7f7f7;
    border-color: #bbb;
}

.pr-arrow.prev {
    left: -20px;
}

.pr-arrow.next {
    right: -20px;
}

.pr-slider.has-overflow .pr-arrow {
    opacity: 1;
}

/* Ocultar flechas si no hay desbordamiento */
.pr-slider:not(.has-overflow) .pr-arrow {
    display: none;
}

/* Pantallas grandes: tarjetas un poco más amplias, siempre centradas */
@media (min-width: 1400px) {
    .pr-card {
        flex-basis: 260px;
        max-width: 340px;
    }
}

@media (min-width: 1800px) {
    .pr-card {
        flex-basis: 280px;
        max-width: 360px;
    }
}

/* Tablets y portátiles compactos: reducimos la tarjeta para que 5 quepan */
@media (min-width: 768px) and (max-width: 1199px) {
    .pr-card {
        flex-basis: 200px;
        max-width: 270px;
    }
}

@media (max-width: 767px) {
    .pr-relaciones-section {
        padding: 0;
    }

    .pr-card {
        flex: 1 0 clamp(170px, 48vw, 220px);
        max-width: 260px;
        padding: 10px;
    }

    .pr-slider-title {
        font-size: 16px;
    }

    .pr-arrow {
        width: 34px;
        height: 34px;
        font-size: 15px;
    }

    .pr-arrow.prev {
        left: -12px;
    }

    .pr-arrow.next {
        right: -12px;
    }
}
