/* =====================================================
   PAGINATION STYLE - Modern UX for Desktop & Mobile
   ===================================================== */

/* Container - compatible avec Bootstrap */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    margin: 20px 0;
}

/* Override Bootstrap pagination */
.pagination {
    display: flex !important;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 0 !important;
}

/* All page items */
.pagination .page-item {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Base button style - ALL DEVICES */
.pagination .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 10px 16px;
    font-size: 15px;
    font-weight: 600;
    color: #475569;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Hover for regular pages */
.pagination .page-link:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #014fa3;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Active page */
.pagination .page-item.active .page-link {
    background: #014fa3;
    color: #fff;
    border-color: #014fa3;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(1, 79, 163, 0.3);
}

/* Active page hover */
.pagination .page-item.active .page-link:hover {
    background: #014fa3;
    color: #fff;
    transform: none;
}

/* Prev/Next buttons - ALL DEVICES */
.pagination .page-item:first-child .page-link,
.pagination .page-item:last-child .page-link {
    min-width: 50px;
    font-weight: 700;
    color: #014fa3;
    border-color: #014fa3;
}

.pagination .page-item:first-child .page-link:hover,
.pagination .page-item:last-child .page-link:hover {
    background: #014fa3;
    color: #fff;
}

/* Disabled state */
.pagination .page-item.disabled .page-link {
    color: #cbd5e1;
    background: #f8fafc;
    border-color: #e2e8f0;
    cursor: not-allowed;
    pointer-events: none;
}

/* Hide First/Last buttons (<< >>) */
.pagination .page-item:first-child:not(:nth-child(2)),
.pagination .page-item:last-child:not(:nth-last-child(2)) {
    display: none;
}

/* Smartphone: Show only 2 page numbers + prev/next */
@media (max-width: 576px) {
    .pagination {
        gap: 8px;
    }
    
    .pagination .page-link {
        min-width: 48px;
        min-height: 48px;
        padding: 12px 16px;
        font-size: 16px;
        font-weight: 600;
    }
    
    /* Hide the last numeric page item to show only 2 numbers */
    .pagination .page-item:nth-last-child(3):not(.active):not(:first-child):not(:last-child) {
        display: none;
    }
    
    /* Show ellipsis if needed */
    .pagination .page-item:nth-last-child(4):not(.active):not(:first-child):not(:last-child) {
        display: none;
    }
}

/* Tablet */
@media (min-width: 577px) and (max-width: 991px) {
    .pagination .page-link {
        min-width: 42px;
        min-height: 42px;
        padding: 9px 14px;
        font-size: 14px;
    }
}

/* Desktop - Larger touch targets */
@media (min-width: 992px) {
    .pagination .page-link {
        min-width: 46px;
        min-height: 46px;
        padding: 11px 18px;
        font-size: 15px;
    }
    
    .pagination {
        gap: 10px;
    }
}

/* Accessibility - Focus state */
.pagination .page-link:focus {
    outline: 2px solid #014fa3;
    outline-offset: 2px;
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .pagination .page-link {
        background: #1e293b;
        border-color: #334155;
        color: #e2e8f0;
    }
    
    .pagination .page-link:hover {
        background: #334155;
        border-color: #475569;
        color: #fff;
    }
    
    .pagination .page-item.active .page-link {
        background: #014fa3;
        border-color: #014fa3;
        color: #fff;
    }
    
    .pagination .page-item.disabled .page-link {
        background: #1e293b;
        border-color: #334155;
        color: #64748b;
    }
}
