/*
 * csoft_instagramfeeds front-end module version 1.3.4 for Prestashop 1.6, 1.7
 * Support contact : prestashop@comonsoft.com.
 * RESPONSIVE VERSION - Fixed for mobile devices
 */

#csinstagramfeed {
    padding: 24px 0;
}

#csinstagramfeed .bx-wrapper .bx-controls-direction a {
    margin-top: 0;
    height: 40px;
    width: 40px;
    line-height: 0;
    top: calc(50% - 20px);
}

#csinstagramfeed .bx-wrapper .bx-controls-direction a:before {
    padding: 0;
    font-size: 40px;
    line-height: 42px;
}

.csinstfeed-media {
    display: block;
    position: relative;
    height: 100%;
    width: 100%;
    background-color: transparent;
    overflow: hidden;
    cursor: pointer;
    background-color: #0000003d;
}

.csinstfeed-media:before {
    content: '';
    display: block;
    padding-top: 100%;
}

.csinstfeed-media:hover .csinstfeed-src {
    transform: scale(1.2);
}

.csinstfeed-src {
    position: absolute;
    left: 0;
    top: 0;
    object-fit: cover;
    height: 100%;
    width: 100%;
    transition: transform 0.6s ease-in-out;
    user-select: none;
    -webkit-user-drag: none;
}

.csinstfeed-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    padding: min(24px, 10%);
    padding-bottom: min(20px, 10%);
    background-color: transparent;
    transition: background-color 0.2s ease-in-out, opacity 0.2s ease-in-out;
    opacity: 0;
    display: flex;
    flex-flow: column nowrap;
    justify-content: flex-end;
    user-select: none;
    color: #FFFFFF;
    container: csinstfeed-overlay / inline-size;
}

.csinstfeed-overlay:hover {
    background-color: rgba(0, 0, 0, 0.40);
    opacity: 1;
}

.csinstfeed-logo {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
}

.csinstfeed-content {
    display: flex;
    flex-flow: column nowrap;
    gap: 16px;
    font-size: 14px;
    line-height: 20px;
    font-weight: 400;
    color: #FFFFFF;
    z-index: 2;
}

.csinstfeed-kpi {
    display: flex;
    flex-flow: column nowrap;
    gap: 8px;
}

.csinstfeed-counters {
    display: flex;
    flex-flow: row nowrap;
    gap: 16px;
}

.csinstfeed-counter {
    display: flex;
    flex-flow: row nowrap;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    line-height: 20px;
    gap: 6px;
    font-weight: 600;
}

.csinstfeed-counter svg {
    width: 20px;
    height: 20px;
}

/* =====================================
    RESPONSIVE IMPROVEMENTS FOR MOBILE
    ===================================== */

/* Tablets */
@media screen and (max-width: 1024px) {
    #csinstagramfeed {
        padding: 20px 0;
    }

    .csinstfeed-content {
        font-size: 13px;
        gap: 12px;
    }

    .csinstfeed-counter {
        font-size: 11px;
        gap: 4px;
    }

    .csinstfeed-counter svg {
        width: 18px;
        height: 18px;
    }
}

/* Mobile devices */
@media screen and (max-width: 767px) {
    #csinstagramfeed {
        padding: 16px 0;
    }
    
    /* --- AÑADIDO: Forzar el carrusel a una sola columna --- */
    #csinstagramfeed .bx-viewport {
        /* Forzamos el viewport (la "ventana" del slider) a que su altura se ajuste al contenido. */
        /* El script del slider (bxSlider) a veces fija una altura y esto lo anula. */
        height: auto !important;
    }

    #csinstagramfeed .csinstfeed-slide {
        /* Forzamos CADA slide a tener el 100% del ancho del viewport */
        /* Esto hace que solo un post sea visible a la vez. */
        width: 100% !important;
        float: none !important; /* Evita que los elementos floten uno al lado del otro */
        margin-right: 0 !important; /* Quita el margen que el slider pone entre elementos */
    }
    /* --- FIN DEL AÑADIDO --- */

    /* Disable hover effects on mobile */
    .csinstfeed-media:hover .csinstfeed-src {
        transform: none;
    }

    /* Show overlay by default on mobile */
    .csinstfeed-overlay {
        opacity: 1;
        background-color: rgba(0, 0, 0, 0.30);
        padding: 12px;
        padding-bottom: 10px;
    }

    .csinstfeed-overlay:hover {
        background-color: rgba(0, 0, 0, 0.30);
    }

    .csinstfeed-logo {
        top: 0;
        left: 0;
        transform: none;
        width: 100%;
        height: 100%;
    }

    .csinstfeed-logo a {
        width: 100%;
        height: 100%;
        display: inline-block;
    }

    .csinstfeed-content {
        font-size: 12px;
        line-height: 16px;
        gap: 8px;
    }

    .csinstfeed-kpi {
        gap: 6px;
    }

    .csinstfeed-counters {
        gap: 12px;
        flex-wrap: wrap;
    }

    .csinstfeed-counter {
        font-size: 10px;
        line-height: 14px;
        gap: 3px;
        font-weight: 500;
    }

    .csinstfeed-counter svg {
        width: 14px;
        height: 14px;
    }

    /* Adjust carousel controls for mobile */
    #csinstagramfeed .bx-wrapper .bx-controls-direction a {
        height: 32px;
        width: 32px;
        top: calc(50% - 16px);
    }

    #csinstagramfeed .bx-wrapper .bx-controls-direction a:before {
        font-size: 24px;
        line-height: 32px;
    }
}

/* Small mobile devices */
@media screen and (max-width: 480px) {
    #csinstagramfeed {
        padding: 12px 0;
    }

    .csinstfeed-overlay {
        padding: 8px;
        padding-bottom: 6px;
    }

    .csinstfeed-content {
        font-size: 11px;
        line-height: 14px;
        gap: 6px;
    }

    .csinstfeed-counter {
        font-size: 9px;
        line-height: 12px;
        gap: 2px;
    }

    .csinstfeed-counter svg {
        width: 12px;
        height: 12px;
    }

    .csinstfeed-counters {
        gap: 8px;
    }

    /* Hide controls on very small screens if needed */
    #csinstagramfeed .bx-wrapper .bx-controls-direction a {
        height: 28px;
        width: 28px;
        top: calc(50% - 14px);
    }

    #csinstagramfeed .bx-wrapper .bx-controls-direction a:before {
        font-size: 20px;
        line-height: 28px;
    }
}