/**
 * CSS para Carruseles de Productos — TP3D
 */

/* ========================================
   CONTENEDOR PRINCIPAL
========================================= */

.pc-carousel-wrapper {
    margin: 20px 0;
    position: relative;
    clear: both;
    animation: pcFadeInUp 0.5s ease-out;
}

.pc-carousel-header {
    margin-bottom: 20px;
    text-align: center;
    padding: 0 4px;
}

.pc-carousel-title {
    font-size: 22px;
    font-weight: 700;
    color: #1d1d1f;
    margin: 0;
    letter-spacing: -0.3px;
    text-decoration: none !important;
}

.pc-carousel-container {
    position: relative;
    z-index: 1;
}

.pc-carousel-viewport {
    overflow: hidden;
    position: relative;
}

.pc-carousel-track {
    display: flex;
    transition: margin-left 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.pc-carousel-item {
    flex: 0 0 auto;
    padding: 0 8px;
    box-sizing: border-box;
    display: flex;
    align-items: stretch;
    width: 25%; /* 4 items por defecto (desktop) */
}

@media (max-width: 992px) {
    .pc-carousel-item { width: 33.333%; } /* 3 items */
}

@media (max-width: 768px) {
    /* Tarjetas más anchas en celular: se ve 1 entera y se asoma la siguiente,
       así la foto y las píldoras entran cómodas (antes eran 2 al 50%). */
    .pc-carousel-item { width: 62%; }
}

/* ========================================
   CARD DE PRODUCTO
========================================= */

.pc-product-miniature {
    background: #fff;
    border: 1px solid #ebebeb;
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: box-shadow 0.2s ease;
    margin: 4px 0 8px;
}

.pc-product-miniature:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
    z-index: 2;
}

/* Overlay invisible que hace toda la card clickeable */
.pc-card-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    text-indent: -9999px;
}

/* ========================================
   IMAGEN
========================================= */

.pc-thumbnail-container {
    position: relative;
    overflow: hidden;
    background: #fff;
    flex: 0 0 auto;
    aspect-ratio: 1 / 1;
    width: 100%;
    border-radius: 8px 8px 0 0;
}

.pc-product-thumbnail {
    display: block;
    height: 100%;
    text-decoration: none;
}

.pc-product-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
    max-width: none !important;
    padding: 0 !important;
}

/* Limitar stickers/botones del tema hook para que no se agranden */
.pc-thumbnail-container img:not(.pc-product-image) {
    max-width: 80px !important;
    max-height: 80px !important;
    width: auto !important;
    height: auto !important;
    object-fit: initial !important;
    padding: 0 !important;
}

/* ========================================
   STICKERS / FLAGS
========================================= */

/* Los stickers del tema (displayProductListFunctionalButtons) quedan por encima del overlay */
.pc-thumbnail-container .product-flags,
.pc-thumbnail-container [class*="flag"],
.pc-thumbnail-container .product-flag {
    z-index: 10;
    position: absolute;
}

/* Stickers imagen/texto del módulo propio (sticker-fix) */
.pc-flag-text {
    background: #e74c3c;
    color: #fff;
    font-weight: 700;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
}

.pc-flag-image {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    pointer-events: none;
}

.pc-sticker-image {
    display: block;
    max-width: 60px;
    max-height: 60px;
    width: auto;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

@media (max-width: 480px) {
    .pc-carousel-item { width: 82%; }
}

@media (max-width: 768px) {
    .pc-sticker-image { max-width: 44px; max-height: 44px; }
    .pc-flag-text { font-size: 9px; padding: 4px 7px; }
    .pc-thumbnail-container img:not(.pc-product-image) {
        max-width: 52px !important;
        max-height: 52px !important;
    }
}

/* ========================================
   DESCRIPCIÓN: NOMBRE + PRECIO
========================================= */

.pc-product-miniature .pc-product-description {
    padding: 8px 10px 10px;
    flex: 0 0 auto;
    display: block;
    text-align: left;
}

.pc-product-miniature .pc-product-title {
    font-size: 14px !important;
    font-weight: 400 !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.3 !important;
    color: #333 !important;
    text-align: left !important;
    /* Reservar siempre 2 líneas para igualar altura entre cards */
    min-height: 2.6em !important;
    max-height: 2.6em !important;
    overflow: hidden !important;
    display: block !important;
}

.pc-product-miniature .pc-product-title a {
    color: inherit;
    text-decoration: none;
}

.pc-product-miniature .pc-product-price {
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
    margin: 6px 0 0 0 !important;
    padding: 0 !important;
    text-align: left !important;
    width: 100% !important;
}

.pc-price-regular {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
}

/* Fila: precio grande + % OFF */
.pc-price-current-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}

.pc-price {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    line-height: 1;
}

/* Texto verde "X% OFF" — estilo ML */
.pc-discount-off {
    font-size: 14px;
    font-weight: 500;
    color: #00a650;
}

/* Cuotas */
.pc-installments {
    display: block;
    font-family: 'Proxima Nova', -apple-system, 'Helvetica Neue', helvetica, roboto, arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #00a650;
    line-height: 1.1;
    margin-top: 7px;
}

/* Precio con transferencia */
.pc-transfer-price {
    display: block;
    font-family: 'Proxima Nova', -apple-system, 'Helvetica Neue', helvetica, roboto, arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #0277bd;
    line-height: 1.1;
    text-align: left;
    margin-top: 8px;
    margin-bottom: 7px;
}

/* ========================================
   FLECHAS DE NAVEGACIÓN
========================================= */

.pc-carousel-navigation {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pc-nav-btn {
    position: relative;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.95);
    border: 1px solid #d0d0d0;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    backdrop-filter: blur(8px);
    flex-shrink: 0;
}

.pc-nav-btn:hover {
    background: #007aff;
    border-color: #007aff;
    box-shadow: 0 4px 16px rgba(0,122,255,0.35);
    transform: scale(1.08);
}

.pc-nav-btn:hover::before {
    border-color: #fff;
}

/* Al hacer click o tocarla no tiene que quedar el recuadro negro del navegador.
   Se saca solo para el mouse y el dedo: con el teclado (Tab) el foco se sigue viendo,
   que es lo que necesita quien navega sin mouse. */
.pc-nav-btn {
    -webkit-tap-highlight-color: transparent;
}

.pc-nav-btn:focus,
.pc-nav-btn:focus:not(:focus-visible) {
    outline: none;
}

.pc-nav-btn:focus-visible {
    outline: 2px solid #007aff;
    outline-offset: 2px;
}

.pc-nav-btn::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border-top: 2px solid #333;
    border-right: 2px solid #333;
    transition: border-color 0.2s;
}

.pc-nav-prev {
    left: -22px;
    margin-left: 10px;
}

.pc-nav-prev::before {
    transform: rotate(225deg);
    margin-left: 2px;
}

.pc-nav-next {
    right: -22px;
    margin-right: 10px;
}

.pc-nav-next::before {
    transform: rotate(45deg);
    margin-right: 2px;
}

@media (max-width: 768px) {
    .pc-nav-btn {
        width: 36px;
        height: 36px;
    }
    .pc-nav-btn::before {
        width: 8px;
        height: 8px;
    }
    .pc-nav-prev { left: -18px; margin-left: 6px; }
    .pc-nav-next { right: -18px; margin-right: 6px; }
}

/* ========================================
   INICIALIZACIÓN (ocultar hasta que el JS esté listo)
========================================= */

.pc-carousel-container:not(.pc-initialized) {
    opacity: 0;
    animation: pcForceVisible 0s 2s forwards;
}

@keyframes pcForceVisible {
    to { opacity: 1; }
}

.pc-carousel-container.pc-initialized {
    opacity: 1;
    transition: opacity 0.3s ease;
    animation: none;
}

/* ========================================
   ANIMACIÓN DE ENTRADA
========================================= */

@keyframes pcFadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pc-carousel-track.transitioning {
    transition: margin-left 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ========================================
   RESET / COMPATIBILIDAD CON TEMAS
========================================= */

.pc-carousel-wrapper * {
    box-sizing: border-box;
}

.pc-carousel-wrapper a {
    text-decoration: none;
}

.pc-carousel-wrapper img {
    max-width: 100%;
}

/* ── Botón Vista rápida ── */
.pc-carousel-wrapper .highlighted-informations {
    overflow: visible !important;
}

@media (max-width: 768px) {
    .highlighted-informations {
        display: none !important;
    }
}

/* ── TP3D (sept 2026): en celular el carrusel se sale del margen del theme ──
   #content-wrapper agrega 15px de relleno a cada lado y la tarjeta quedaba angosta.
   Se recuperan 8 de esos 15 por lado: gana ancho sin quedar pegada al borde de la pantalla.
   El body ya tiene overflow-x oculto en celular, así que no aparece scroll lateral. */
@media (max-width: 768px) {
    .pc-carousel-wrapper {
        margin-left: -8px !important;
        margin-right: -8px !important;
    }
    .pc-carousel-item {
        /* Casi pegadas: cada px que se saca de acá se lo gana la tarjeta, y con tarjetas
           más anchas las píldoras entran de a varias por renglón. */
        padding-left: 2px !important;
        padding-right: 2px !important;
    }
    /* Las flechas se corrían 18px hacia afuera del carrusel; con la salida de margen
       quedaban fuera de la pantalla y el navegador las cortaba. Se traen adentro,
       un poco más juntas y despegadas del borde. */
    /* Contra el borde de la pantalla, para tapar lo menos posible de la tarjeta */
    .pc-nav-prev {
        left: 2px !important;
        margin-left: 0 !important;
    }
    .pc-nav-next {
        right: 2px !important;
        margin-right: 0 !important;
    }

    /* Círculo gris claro, chico y plano. El fondo casi transparente de antes se perdía
       sobre la tarjeta blanca: quedaba una puntita suelta encima del texto. */
    .pc-nav-btn,
    .pc-nav-btn:hover,
    .pc-nav-btn:active,
    .pc-nav-btn:focus {
        width: 34px !important;
        height: 34px !important;
        background: rgba(228, 228, 233, 0.92) !important;
        border: 0 !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        outline: none !important;
        opacity: 0.9;
        transform: none !important;
    }

    .pc-nav-btn::before,
    .pc-nav-btn:hover::before {
        width: 7px;
        height: 7px;
        border-width: 2px;
        border-color: #3a3a3c !important;
    }
}

/* ── TP3D (sept 2026): en celular el carrusel se mueve con el dedo ──
   Lo agrega el JS con la clase .pc-touch. El desplazamiento pasa a ser el scroll del
   navegador: arrastre con inercia, la tarjeta queda calzada al soltar (scroll-snap) y
   no se mueve solo. La barra de scroll se oculta: se navega con el dedo. */
@media (max-width: 768px) {
    /* Sin `.pc-touch`: vale aunque el JS no haya corrido o haya quedado una versión vieja
       cacheada por CCC. En celular el track NO se mueve nunca, se mueve el scroll. */
    .pc-carousel-viewport {
        /* !important porque sticker-fix.css fuerza overflow:hidden en el viewport */
        overflow-x: auto !important;
        overflow-y: hidden !important;
        /* Sin imán: el cliente arrastra a donde quiere y frena donde quiere.
           Con snap el carrusel además se reacomodaba solo al cargar las fotos. */
        scroll-snap-type: none;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        touch-action: pan-x pan-y;       /* que ningún theme bloquee el arrastre */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .pc-carousel-viewport::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }

    /* El track queda quieto pase lo que pase: ni margen, ni transform, ni animación.
       Así el carrusel no puede "pasar de a bloques" ni moverse solo aunque el JS viejo
       le siga pidiendo que avance: no tiene efecto visible. */
    .pc-carousel-track,
    .pc-carousel-track.transitioning {
        margin-left: 0 !important;
        transform: none !important;
        transition: none !important;
        animation: none !important;
        flex-wrap: nowrap !important;    /* todo en una fila: es lo que se scrollea */
    }

    .pc-carousel-item {
        scroll-snap-align: none;
        visibility: visible !important;
    }
}

/* ── TP3D (sept 2026): todas las fotos del mismo tamaño ──
   El bloque de la foto lleva también la clase `thumbnail-container` del theme, que le
   pisaba el `aspect-ratio`: cada tarjeta tomaba el alto natural de SU imagen y las
   tarjetas quedaban descuadradas entre sí. Acá el cuadrado se fuerza con el truco del
   relleno (no depende de `aspect-ratio`) y se saca del flujo todo lo que haya adentro,
   así ningún sticker ni etiqueta puede estirar la caja. */
.pc-thumbnail-container {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 !important;
    overflow: hidden;
}

.pc-thumbnail-container::before {
    content: "";
    display: block;
    padding-top: 100%;            /* cuadrado exacto, siempre */
}

.pc-thumbnail-container > * {
    position: absolute;           /* nada de adentro puede estirar la caja */
}

.pc-thumbnail-container .pc-product-thumbnail {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: auto;
}

/* La foto llena el cuadrado sin deformarse: se escala manteniendo su proporción y, si
   le sobra de un lado, se recorta. Nunca queda espacio vacío ni la imagen estirada.
   La fuente es `large_default` (la grande de PrestaShop), así que no pierde nitidez. */
.pc-thumbnail-container .pc-product-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
    padding: 0 !important;
}
