/* =========================================================================
   PAGINATION - Page Navigation Styles
   ========================================================================= */

/**
 * Pagination styles for navigating through paged content.
 * Built on Bootstrap pagination with BusOva theming.
 */

/* ---------------------------------------------------------------------
   Base Pagination Container
   --------------------------------------------------------------------- */

.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    gap: 0.25rem;
}

/* ---------------------------------------------------------------------
   Page Item
   --------------------------------------------------------------------- */

.page-item {
    /* No specific styles needed, acts as container */
}

.page-item:first-child .page-link {
    border-top-left-radius: 0.45rem;
    border-bottom-left-radius: 0.45rem;
}

.page-item:last-child .page-link {
    border-top-right-radius: 0.45rem;
    border-bottom-right-radius: 0.45rem;
}

/* ---------------------------------------------------------------------
   Page Link
   --------------------------------------------------------------------- */

.page-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
    text-decoration: none;
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    transition:
        color 0.15s ease,
        background-color 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.page-link:hover {
    z-index: 2;
    color: var(--accent-hover);
    background-color: var(--bg-card-soft);
    border-color: var(--border-subtle);
    text-decoration: none;
}

.page-link:focus {
    z-index: 3;
    outline: 0;
    box-shadow: 0 0 0 0.2rem var(--accent-soft);
}

/* Icon inside page link */
.page-link i,
.page-link svg {
    font-size: 0.75rem;
}

/* ---------------------------------------------------------------------
   Active State
   --------------------------------------------------------------------- */

.page-item.active .page-link {
    z-index: 3;
    color: #fff;
    background-color: var(--accent);
    border-color: var(--accent);
}

.page-item.active .page-link:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* ---------------------------------------------------------------------
   Disabled State
   --------------------------------------------------------------------- */

.page-item.disabled .page-link {
    color: var(--text-muted);
    pointer-events: none;
    background-color: var(--bg-card-soft);
    border-color: var(--border-subtle);
    opacity: 0.65;
}

/* ---------------------------------------------------------------------
   Pagination Sizes
   --------------------------------------------------------------------- */

/* Small */
.pagination-sm .page-link {
    min-width: 1.875rem;
    padding: 0.3rem 0.55rem;
    font-size: 0.8rem;
}

.pagination-sm .page-item:first-child .page-link {
    border-top-left-radius: 0.35rem;
    border-bottom-left-radius: 0.35rem;
}

.pagination-sm .page-item:last-child .page-link {
    border-top-right-radius: 0.35rem;
    border-bottom-right-radius: 0.35rem;
}

/* Large */
.pagination-lg .page-link {
    min-width: 2.75rem;
    padding: 0.6rem 1rem;
    font-size: 1rem;
}

.pagination-lg .page-item:first-child .page-link {
    border-top-left-radius: 0.5rem;
    border-bottom-left-radius: 0.5rem;
}

.pagination-lg .page-item:last-child .page-link {
    border-top-right-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}

/* ---------------------------------------------------------------------
   Pagination Variants
   --------------------------------------------------------------------- */

/* Rounded/Pill style */
.pagination-rounded .page-link {
    border-radius: 50%;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0;
}

.pagination-rounded .page-item:first-child .page-link,
.pagination-rounded .page-item:last-child .page-link {
    border-radius: 50%;
}

/* Borderless */
.pagination-borderless .page-link {
    border: none;
    background-color: transparent;
}

.pagination-borderless .page-link:hover {
    background-color: var(--bg-card-soft);
}

.pagination-borderless .page-item.active .page-link {
    background-color: var(--accent);
}

/* ---------------------------------------------------------------------
   Pagination with Ellipsis
   --------------------------------------------------------------------- */

.page-item.ellipsis .page-link {
    pointer-events: none;
    background-color: transparent;
    border-color: transparent;
}

/* ---------------------------------------------------------------------
   Pagination Summary (e.g., "Page 1 of 10")
   --------------------------------------------------------------------- */

.pagination-summary {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-right: 1rem;
}

/* ---------------------------------------------------------------------
   Pagination Wrapper (for centering/alignment)
   --------------------------------------------------------------------- */

.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
}

.pagination-wrapper.justify-start {
    justify-content: flex-start;
}

.pagination-wrapper.justify-end {
    justify-content: flex-end;
}

.pagination-wrapper.justify-between {
    justify-content: space-between;
}

/* ---------------------------------------------------------------------
   Items Per Page Selector
   --------------------------------------------------------------------- */

.pagination-per-page {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.pagination-per-page select {
    width: auto;
    padding: 0.3rem 1.75rem 0.3rem 0.5rem;
    font-size: 0.875rem;
}

/* ---------------------------------------------------------------------
   Dark Theme Adjustments
   --------------------------------------------------------------------- */

body.theme-dark .page-link {
    background-color: #161b2c;
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

body.theme-dark .page-link:hover {
    background-color: #1f2436;
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--accent);
}

body.theme-dark .page-item.active .page-link {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

body.theme-dark .page-item.active .page-link:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
}

body.theme-dark .page-item.disabled .page-link {
    background-color: #0f1320;
    border-color: rgba(255, 255, 255, 0.05);
    color: #6b7280;
}

body.theme-dark .pagination-borderless .page-link {
    background-color: transparent;
}

body.theme-dark .pagination-borderless .page-link:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .pagination-summary,
body.theme-dark .pagination-per-page {
    color: var(--text-muted);
}

/* ---------------------------------------------------------------------
   Responsive Adjustments
   --------------------------------------------------------------------- */

@media (max-width: 576px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }

    .page-link {
        min-width: 2rem;
        padding: 0.375rem 0.5rem;
        font-size: 0.8rem;
    }

    /* Hide some page numbers on mobile, show only essentials */
    .pagination-mobile-minimal .page-item:not(:first-child):not(:last-child):not(.active):not(.ellipsis) {
        display: none;
    }

    .pagination-wrapper {
        flex-direction: column;
        gap: 0.75rem;
    }

    .pagination-summary {
        margin-right: 0;
        order: 1;
    }
}

/* =========================================================================
   DATATABLES PAGINATION FIX - Consistent styling across themes
   ========================================================================= */

/* DataTables Pagination Wrapper - Remove any extra padding/borders */
.dataTables_wrapper .dataTables_paginate {
    padding: 0.5rem 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Pagination container - ensure no extra styling */
.dataTables_wrapper .dataTables_paginate .pagination {
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    gap: 0.25rem !important;
}

/* Page items - remove any borders/backgrounds */
.dataTables_wrapper .dataTables_paginate .pagination .page-item {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* -------------------------------------------------------------------------
   LIGHT THEME - Black text for Previous/Next
   ------------------------------------------------------------------------- */
.dataTables_wrapper .dataTables_paginate .pagination .paginate_button .page-link,
.dataTables_wrapper .dataTables_paginate .pagination .page-item .page-link,
.dataTables_paginate .pagination .page-link {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
    color: #000000 !important;
    padding: 0.375rem 0.5rem !important;
    font-size: 0.875rem !important;
    line-height: 1.5 !important;
}

/* Light theme - Active state */
.dataTables_wrapper .dataTables_paginate .pagination .paginate_button.active .page-link,
.dataTables_wrapper .dataTables_paginate .pagination .page-item.active .page-link {
    background: #0d6efd !important;
    background-color: #0d6efd !important;
    color: #fff !important;
    border: none !important;
    border-radius: 4px !important;
    box-shadow: none !important;
}

/* Light theme - Hover state */
.dataTables_wrapper .dataTables_paginate .pagination .paginate_button:not(.disabled) .page-link:hover,
.dataTables_wrapper .dataTables_paginate .pagination .page-item:not(.disabled) .page-link:hover {
    background: rgba(0, 0, 0, 0.08) !important;
    background-color: rgba(0, 0, 0, 0.08) !important;
    color: #000000 !important;
    border: none !important;
    border-radius: 4px !important;
    box-shadow: none !important;
}

/* Light theme - Disabled state */
.dataTables_wrapper .dataTables_paginate .pagination .paginate_button.disabled .page-link,
.dataTables_wrapper .dataTables_paginate .pagination .page-item.disabled .page-link {
    color: #6c757d !important;
    cursor: not-allowed !important;
    opacity: 0.65 !important;
    border: none !important;
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

/* -------------------------------------------------------------------------
   DARK THEME - White text for Previous/Next
   ------------------------------------------------------------------------- */
.theme-dark .dataTables_wrapper .dataTables_paginate,
body.theme-dark .dataTables_wrapper .dataTables_paginate,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.theme-dark .dataTables_wrapper .dataTables_paginate .pagination,
body.theme-dark .dataTables_wrapper .dataTables_paginate .pagination,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .pagination {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.theme-dark .dataTables_wrapper .dataTables_paginate .pagination .page-item,
body.theme-dark .dataTables_wrapper .dataTables_paginate .pagination .page-item,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .pagination .page-item {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.theme-dark .dataTables_wrapper .dataTables_paginate .pagination .paginate_button .page-link,
.theme-dark .dataTables_wrapper .dataTables_paginate .pagination .page-item .page-link,
.theme-dark .dataTables_paginate .pagination .page-link,
body.theme-dark .dataTables_wrapper .dataTables_paginate .pagination .paginate_button .page-link,
body.theme-dark .dataTables_wrapper .dataTables_paginate .pagination .page-item .page-link,
body.theme-dark .dataTables_paginate .pagination .page-link,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .pagination .page-link {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
    color: #ffffff !important;
    padding: 0.375rem 0.5rem !important;
    font-size: 0.875rem !important;
    line-height: 1.5 !important;
}

/* Dark theme - Active state */
.theme-dark .dataTables_wrapper .dataTables_paginate .pagination .paginate_button.active .page-link,
.theme-dark .dataTables_wrapper .dataTables_paginate .pagination .page-item.active .page-link,
body.theme-dark .dataTables_wrapper .dataTables_paginate .pagination .paginate_button.active .page-link,
body.theme-dark .dataTables_wrapper .dataTables_paginate .pagination .page-item.active .page-link,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .pagination .page-item.active .page-link {
    background: #0d6efd !important;
    background-color: #0d6efd !important;
    color: #fff !important;
    border: none !important;
    border-radius: 4px !important;
    box-shadow: none !important;
}

/* Dark theme - Hover state */
.theme-dark .dataTables_wrapper .dataTables_paginate .pagination .paginate_button:not(.disabled) .page-link:hover,
.theme-dark .dataTables_wrapper .dataTables_paginate .pagination .page-item:not(.disabled) .page-link:hover,
body.theme-dark .dataTables_wrapper .dataTables_paginate .pagination .paginate_button:not(.disabled) .page-link:hover,
body.theme-dark .dataTables_wrapper .dataTables_paginate .pagination .page-item:not(.disabled) .page-link:hover,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .pagination .page-item:not(.disabled) .page-link:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 4px !important;
    box-shadow: none !important;
}

/* Dark theme - Disabled state */
.theme-dark .dataTables_wrapper .dataTables_paginate .pagination .paginate_button.disabled .page-link,
.theme-dark .dataTables_wrapper .dataTables_paginate .pagination .page-item.disabled .page-link,
body.theme-dark .dataTables_wrapper .dataTables_paginate .pagination .paginate_button.disabled .page-link,
body.theme-dark .dataTables_wrapper .dataTables_paginate .pagination .page-item.disabled .page-link,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .pagination .page-item.disabled .page-link {
    color: #9ca3af !important;
    cursor: not-allowed !important;
    opacity: 0.5 !important;
    border: none !important;
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
}
