/* ========================================
   PAGINADOR NOVALTIA
   ======================================== */

/* Contenedor principal del paginador */
.pagination-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    padding: 2.5rem 1rem 3rem;
    margin: 2rem auto;
    max-width: 1200px;
}

/* Navegación de paginación */
.pagination-wrap nav[role="navigation"] {
    width: 100%;
}

/* Lista de páginas */
.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Items individuales de página */
.page-item {
    margin: 0;
    text-align: center;
}

/* Enlaces y spans de página (base) */
.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #333333;
    background: #ffffff;
    border: 1.5px solid #d0d0d0;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.25s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* Efecto hover con gradiente Novaltia */
.page-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-primary);
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: -1;
}

.page-link span {
    position: relative;
    z-index: 1;
}

/* Hover en enlaces activos */
.page-item:not(.disabled):not(.active) .page-link:hover {
    color: #ffffff;
    border-color: var(--color-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(109, 24, 115, 0.25);
}

.page-item:not(.disabled):not(.active) .page-link:hover::before {
    opacity: 1;
}

/* Página activa (actual) */
.page-item.active .page-link {
    color: #ffffff;
    background: var(--color-primary);
    border-color: var(--color-primary);
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(109, 24, 115, 0.3);
    cursor: default;
}

/* Página deshabilitada */
.page-item.disabled .page-link {
    color: #999999;
    background: #f5f5f5;
    border-color: #e0e0e0;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Botones de navegación (primera, anterior, siguiente, última) */
.page-item:first-child .page-link,
.page-item:last-child .page-link,
.page-item:nth-child(2) .page-link,
.page-item:nth-last-child(2) .page-link {
    font-size: 1.1rem;
    min-width: 44px;
}

/* Estados de focus para accesibilidad */
.page-link:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    z-index: 2;
}

.page-link:focus:not(:focus-visible) {
    outline: none;
}

/* Contador de páginas */
.pagination-wrap .counter {
    margin: 0;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #666666;
    /*! background: #f8f8f8; */
    /*! border-radius: 20px; */
    /*! border: 1px solid #e8e8e8; */
    position: relative;
}

/* Decoración sutil del contador */
.pagination-wrap .counter::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--color-primary) 30%, 
        var(--color-secondary) 70%, 
        transparent 100%
    );
    opacity: 0.4;
    border-radius: 20px 20px 0 0;
}

/* RESPONSIVE DESIGN */

/* Tablets */
@media (max-width: 768px) {
    .pagination-wrap {
        padding: 2rem 1rem;
        gap: 1rem;
    }
    
    .pagination {
        gap: 0.4rem;
    }
    
    .page-link {
        min-width: 38px;
        height: 38px;
        padding: 0.4rem 0.65rem;
        font-size: 0.875rem;
    }
    
    /* Ocultar números intermedios en móviles, mantener solo algunos */
    .page-item:not(.active):not(:first-child):not(:last-child):not(:nth-child(2)):not(:nth-last-child(2)):nth-child(n+6):nth-last-child(n+6) {
        display: none;
    }
}

/* Móviles pequeños */
@media (max-width: 480px) {
    .pagination-wrap {
        padding: 1.5rem 0.75rem;
    }
    
    .pagination {
        gap: 0.35rem;
    }
    
    .page-link {
        min-width: 36px;
        height: 36px;
        padding: 0.35rem 0.55rem;
        font-size: 0.8125rem;
    }
    
    .pagination-wrap .counter {
        font-size: 0.8125rem;
        padding: 0.65rem 1.25rem;
    }
    
    /* En móviles muy pequeños, mostrar solo botones de navegación, página actual y 2 adyacentes */
    .page-item:not(.active):not(:first-child):not(:last-child):not(:nth-child(2)):not(:nth-last-child(2)):nth-child(n+4):nth-last-child(n+4) {
        display: none;
    }
}

/* Animación sutil al cargar */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pagination-wrap {
    animation: fadeInUp 0.4s ease-out;
}

/* Mejora de accesibilidad para lectores de pantalla */
.page-link[aria-current="page"]::after {
    content: ' (página actual)';
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Mejora visual: puntos suspensivos cuando hay muchas páginas */
.page-item.dots {
    pointer-events: none;
}

.page-item.dots .page-link {
    background: transparent;
    border: none;
    color: #999;
    cursor: default;
}

.page-item.dots .page-link:hover {
    transform: none;
    box-shadow: none;
}
