/* Contenedor Grilla */
.custom-loop-grid-wrapper {
    display: grid;
    grid-template-columns: repeat(var(--columns, 3), minmax(0, 1fr));
    gap: var(--gap, 20px);
    width: 100%;
    margin-bottom: 20px;
}

@media (max-width: 1024px) {
    .custom-loop-grid-wrapper {
        grid-template-columns: repeat(var(--columns-tablet, 2), minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .custom-loop-grid-wrapper {
        grid-template-columns: repeat(var(--columns-mobile, 1), minmax(0, 1fr));
    }
}

.custom-loop-item {
    position: relative;
    box-sizing: border-box;
    width: 100%;
}

/* Swiper Carousel */
.custom-loop-carousel-wrapper.swiper {
    position: relative;
    overflow: hidden;
    width: 100%;
    padding-bottom: 10px;
}

/* Navegación Swiper (Flechas Personalizadas) */
.custom-loop-carousel-wrapper .swiper-button-prev,
.custom-loop-carousel-wrapper .swiper-button-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    color: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-loop-carousel-wrapper .swiper-button-prev:hover,
.custom-loop-carousel-wrapper .swiper-button-next:hover {
    background-color: #f8fafc;
    color: #0f172a;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}

.custom-loop-carousel-wrapper .swiper-button-prev {
    left: 10px;
}

.custom-loop-carousel-wrapper .swiper-button-next {
    right: 10px;
}

.custom-loop-carousel-wrapper .swiper-button-disabled {
    opacity: 0.3;
    cursor: not-allowed;
    box-shadow: none !important;
}

.custom-loop-carousel-wrapper .swiper-button-prev::after,
.custom-loop-carousel-wrapper .swiper-button-next::after {
    display: none !important; /* Desactiva la fuente icónica por defecto de Swiper */
}

.custom-loop-carousel-wrapper .swiper-button-prev svg,
.custom-loop-carousel-wrapper .swiper-button-next svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2.5px;
    transition: transform 0.25s ease;
}

.custom-loop-carousel-wrapper .swiper-button-prev:hover svg {
    transform: translateX(-2px);
}

.custom-loop-carousel-wrapper .swiper-button-next:hover svg {
    transform: translateX(2px);
}

/* Paginación Swiper (Puntos) */
.custom-loop-carousel-wrapper .swiper-pagination {
    position: relative;
    margin-top: 25px;
    bottom: 0 !important;
    text-align: center;
    width: 100%;
}

.custom-loop-carousel-wrapper .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background-color: #cbd5e1;
    opacity: 1;
    margin: 0 5px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
}

.custom-loop-carousel-wrapper .swiper-pagination-bullet-active {
    width: 24px !important;
    border-radius: 4px !important;
    background-color: #1e293b;
}

/* Contenedor de Paginación */
.custom-loop-pagination-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 30px;
    margin-bottom: 20px;
}

/* Botón Ver más */
.custom-loop-load-more-btn {
    border: none;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.custom-loop-load-more-btn.is-loading {
    cursor: not-allowed;
    opacity: 0.8;
}

/* Paginación Estándar Nav Links */
.custom-loop-nav-pagination {
    display: flex;
    gap: 8px;
    align-items: center;
}

.custom-loop-nav-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.custom-loop-nav-pagination .page-numbers:hover {
    border-color: #94a3b8;
    color: #0f172a;
}

.custom-loop-nav-pagination .page-numbers.current {
    background-color: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
}

.custom-loop-nav-pagination .page-numbers svg {
    width: 16px;
    height: 16px;
    display: block;
}

/* Spinner e Infinite Scroll */
.custom-loop-infinite-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 20px 0;
}

.custom-loop-spinner {
    width: 32px;
    height: 32px;
    border: 3.5px solid #f1f5f9;
    border-top: 3.5px solid #0f172a;
    border-radius: 50%;
    animation: customLoopSpin 0.75s linear infinite;
}

@keyframes customLoopSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Responsive Navigation Visibility Overrides
   ========================================================================== */
@media (min-width: 1025px) {
    .custom-loop-container.hide-arrows-desktop .swiper-button-prev,
    .custom-loop-container.hide-arrows-desktop .swiper-button-next {
        display: none !important;
    }
    .custom-loop-container.hide-dots-desktop .swiper-pagination {
        display: none !important;
    }
}

@media (max-width: 1024px) and (min-width: 768px) {
    .custom-loop-container.hide-arrows-tablet .swiper-button-prev,
    .custom-loop-container.hide-arrows-tablet .swiper-button-next {
        display: none !important;
    }
    .custom-loop-container.hide-dots-tablet .swiper-pagination {
        display: none !important;
    }
}

@media (max-width: 767px) {
    .custom-loop-container.hide-arrows-mobile .swiper-button-prev,
    .custom-loop-container.hide-arrows-mobile .swiper-button-next {
        display: none !important;
    }
    .custom-loop-container.hide-dots-mobile .swiper-pagination {
        display: none !important;
    }
}

/* ==========================================================================
   Carousel Pagination Position (Inside / Outside)
   ========================================================================== */
/* Outside position (Default) */
.custom-loop-dots-position-outside .swiper-pagination {
    position: relative !important;
    margin-top: 25px !important;
    bottom: auto !important;
}

/* Inside position */
.custom-loop-dots-position-inside .swiper-pagination {
    position: absolute !important;
    bottom: 15px !important;
    margin-top: 0 !important;
    z-index: 10;
}

/* ==========================================================================
   Clickable Box Link Wrapper
   ========================================================================== */
.ecs-link-wrapper {
    cursor: pointer;
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

/* ==========================================================================
   Transition Loading State for AJAX standard pagination
   ========================================================================== */
.custom-loop-container {
    transition: opacity 0.35s ease;
}
.custom-loop-container.custom-loop-loading {
    opacity: 0.55;
    pointer-events: none;
}

/* ==========================================================================
   Corregir conflicto de Elementor 'Ocultar título de página' que oculta los títulos del loop
   ========================================================================== */
.custom-loop-item .elementor-page-title {
    display: block !important;
}

/* ==========================================================================
   Grilla a Carrusel Responsivo (Grilla en Escritorio, Carrusel en Tablet/Móvil)
   ========================================================================== */
@media (min-width: 1025px) {
    .custom-loop-grid-to-carousel.swiper {
        overflow: visible !important;
    }
    .custom-loop-grid-to-carousel .swiper-wrapper {
        display: grid !important;
        grid-template-columns: repeat(var(--columns, 3), minmax(0, 1fr)) !important;
        gap: var(--gap, 20px) !important;
        width: 100% !important;
        transform: none !important;
        flex-wrap: wrap !important;
    }
    .custom-loop-grid-to-carousel .swiper-slide {
        width: 100% !important;
        height: auto !important;
        margin-right: 0 !important;
    }
    .custom-loop-grid-to-carousel .swiper-button-prev,
    .custom-loop-grid-to-carousel .swiper-button-next,
    .custom-loop-grid-to-carousel .swiper-pagination {
        display: none !important;
    }
}

