/**
 * Custom Pagination Component Styles
 * Responsive pagination with info display
 */

/* Wrapper */
.custom-pagination-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
    padding: 1rem 0;
}

/* Info Section */
.pagination-info {
    text-align: center;
}

.pagination-info-text {
    color: #666;
    font-size: 0.95rem;
}

.pagination-info-text strong {
    color: #333;
    font-weight: 600;
}

/* Pagination Nav */
.custom-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
}

.custom-pagination .pagination {
    display: flex;
    gap: 0.25rem;
    padding: 0;
    margin: 0;
    list-style: none;
    flex-wrap: wrap;
    justify-content: center;
}

.custom-pagination .page-item {
    display: inline-flex;
}

.custom-pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 0.5rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.custom-pagination .page-link:hover,
.custom-pagination .page-link:focus {
    color: var(--primary-color, #4e732c);
    background: #f8f9fa;
    border-color: var(--primary-color, #4e732c);
    outline: none;
}

/* Active State */
.custom-pagination .page-item.active .page-link {
    background: var(--primary-color, #4e732c);
    color: #fff;
    border-color: var(--primary-color, #4e732c);
    cursor: default;
    font-weight: 600;
}

.custom-pagination .page-item.active .page-link:hover {
    background: var(--primary-color, #4e732c);
    color: #fff;
}

/* Disabled State */
.custom-pagination .page-item.disabled .page-link {
    color: #aaa;
    background: #f5f5f5;
    border-color: #e0e0e0;
    cursor: not-allowed;
    pointer-events: none;
}

/* Ellipsis */
.custom-pagination .page-ellipsis {
    border: none;
    background: transparent;
    cursor: default;
    min-width: 30px;
}

.custom-pagination .page-ellipsis:hover {
    background: transparent;
    border: none;
}

/* Icons */
.custom-pagination .page-link i {
    font-size: 1rem;
    line-height: 1;
    vertical-align: middle;
}

.custom-pagination .page-link i.bi {
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 576px) {
    .custom-pagination-wrapper {
        gap: 0.75rem;
        padding: 0.75rem 0;
    }
    
    .pagination-info-text {
        font-size: 0.85rem;
    }
    
    .custom-pagination .pagination {
        gap: 0.15rem;
    }
    
    .custom-pagination .page-link {
        min-width: 36px;
        height: 36px;
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
        border-radius: 0.375rem;
    }
    
    .custom-pagination .page-link i {
        font-size: 0.95rem;
    }
    
    .custom-pagination .page-link i.bi {
        font-size: 1rem;
    }
}

/* Admin Panel - Dark variant */
.custom-pagination-wrapper.pagination-admin {
    background: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1rem;
}

.custom-pagination-wrapper.pagination-admin .pagination-info-text {
    color: #555;
}

.custom-pagination-wrapper.pagination-admin .page-link {
    background: #fff;
    border-color: #dee2e6;
}

.custom-pagination-wrapper.pagination-admin .page-link:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #495057;
}

.custom-pagination-wrapper.pagination-admin .page-item.active .page-link {
    background: #696cff;
    border-color: #696cff;
}

/* Centered variant */
.custom-pagination-wrapper.pagination-centered {
    text-align: center;
}

/* Separated layout (info left, pagination right) */
.custom-pagination-wrapper.pagination-separated {
    flex-direction: row;
    justify-content: space-between;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .custom-pagination-wrapper.pagination-separated {
        flex-direction: column;
        gap: 1rem;
    }
}

/* ==========================================
   AJAX Loading States
   ========================================== */

/* Container loading state */
.pagination-loading {
    position: relative;
    pointer-events: none;
}

.pagination-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 10;
}

/* Pagination wrapper loading state */
.custom-pagination-wrapper.pagination-loading {
    opacity: 0.6;
}

.custom-pagination-wrapper.pagination-loading .page-link {
    pointer-events: none;
    cursor: wait;
}

/* Loader overlay */
.pagination-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* Spinner */
.pagination-loader .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e0e0e0;
    border-top-color: var(--primary-color, #4e732c);
    border-radius: 50%;
    animation: pagination-spin 0.8s linear infinite;
}

@keyframes pagination-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Alternative: Dots loader */
.pagination-loader-dots {
    display: flex;
    gap: 0.5rem;
}

.pagination-loader-dots span {
    width: 10px;
    height: 10px;
    background: var(--primary-color, #4e732c);
    border-radius: 50%;
    animation: pagination-bounce 0.6s ease-in-out infinite alternate;
}

.pagination-loader-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.pagination-loader-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pagination-bounce {
    to {
        opacity: 0.3;
        transform: scale(0.8);
    }
}

/* Skeleton loading for pagination */
.pagination-skeleton {
    display: flex;
    gap: 0.25rem;
    justify-content: center;
}

.pagination-skeleton .skeleton-item {
    width: 40px;
    height: 40px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: pagination-skeleton-pulse 1.5s ease-in-out infinite;
    border-radius: 0.5rem;
}

@keyframes pagination-skeleton-pulse {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Fade transition for content */
.pagination-content-transition {
    transition: opacity 0.3s ease;
}

.pagination-content-transition.loading {
    opacity: 0.5;
}
