/* تصميم محسن لـ Pagination في التقارير */

/* Container للـ pagination */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem 0;
    padding: 1rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Pagination Nav */
.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    border-radius: 12px;
    margin: 0;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    overflow: hidden;
}

/* Pagination Items */
.pagination .page-item {
    margin: 0;
}

.pagination .page-item:first-child .page-link {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    border-left: 2px solid #007bff;
}

.pagination .page-item:last-child .page-link {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    border-right: 2px solid #007bff;
}

/* Pagination Links */
.pagination .page-link {
    position: relative;
    display: block;
    padding: 12px 16px;
    margin: 0;
    line-height: 1.25;
    color: #495057;
    text-decoration: none;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-right: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    min-width: 48px;
    text-align: center;
}

.pagination .page-item:last-child .page-link {
    border-right: 1px solid #dee2e6;
}

/* Hover Effect */
.pagination .page-link:hover {
    z-index: 2;
    color: #0056b3;
    text-decoration: none;
    background-color: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,123,255,0.25);
}

/* Active Page */
.pagination .page-item.active .page-link {
    z-index: 3;
    color: #fff;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border-color: #007bff;
    font-weight: 700;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,123,255,0.4);
}

/* Disabled State */
.pagination .page-item.disabled .page-link {
    color: #6c757d;
    pointer-events: none;
    cursor: auto;
    background-color: #fff;
    border-color: #dee2e6;
    opacity: 0.6;
}

/* Pagination Dots */
.pagination .page-item.disabled .page-link {
    font-weight: 900;
    font-size: 16px;
    color: #adb5bd;
    padding: 12px 8px;
    letter-spacing: 2px;
}

/* First and Last Page Emphasis */
.pagination .page-item:first-of-type .page-link,
.pagination .page-item:last-of-type .page-link {
    font-weight: 700;
}

/* Enhanced pagination for Arabic */
.pagination .page-link {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: ltr; /* Keep numbers LTR */
}

/* Previous/Next Arrows */
.pagination .page-link[aria-label="Previous"],
.pagination .page-link[aria-label="Next"] {
    font-size: 16px;
    font-weight: 700;
    padding: 12px 20px;
}

.pagination .page-link[aria-label="Previous"]:before {
    content: "« ";
    font-weight: 900;
}

.pagination .page-link[aria-label="Next"]:after {
    content: " »";
    font-weight: 900;
}

/* العربية - تعديل اتجاه الأسهم */
[dir="rtl"] .pagination .page-link[aria-label="Previous"]:before {
    content: " »";
}

[dir="rtl"] .pagination .page-link[aria-label="Next"]:after {
    content: "« ";
}

/* معلومات إضافية */
.pagination-info {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 14px;
    margin-top: 1rem;
    font-weight: 500;
}

.pagination-info .badge {
    margin: 0 8px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
    border-radius: 20px;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .pagination-container {
        margin: 1rem 0;
        padding: 0.5rem;
    }
    
    .pagination .page-link {
        padding: 8px 10px;
        font-size: 12px;
        min-width: 32px;
    }
    
    .pagination .page-link[aria-label="Previous"],
    .pagination .page-link[aria-label="Next"] {
        padding: 8px 14px;
    }
    
    /* On mobile, show only: prev, first, current, last, next */
    .pagination .page-item:not(.disabled):not(.active):not(:first-child):not(:last-child) {
        display: none;
    }
    
    /* Always show these on mobile */
    .pagination .page-item.active,
    .pagination .page-item.disabled,
    .pagination .page-item:first-child,
    .pagination .page-item:last-child {
        display: block;
    }
    
    /* Show first and last page numbers on mobile */
    .pagination .page-item:nth-child(2),
    .pagination .page-item:nth-last-child(2) {
        display: block;
    }
}

@media (max-width: 480px) {
    .pagination .page-link {
        padding: 6px 8px;
        font-size: 11px;
        min-width: 30px;
    }
    
    .pagination-info {
        font-size: 12px;
        flex-direction: column;
        gap: 5px;
    }
}

/* Loading Animation */
.pagination-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.pagination-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Enhanced Pagination Text (Arabic Support) */
.pagination-text {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
    text-align: center;
}
