/* Professional Mobile Pagination Styling */

/* ============================================
   DATATABLES WRAPPER SPACING
   ============================================ */
.dataTables_wrapper {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* Spacing between table and pagination info section */
.dataTables_wrapper .dataTables_info {
    margin-top: 0.5rem !important;
    margin-bottom: 0.75rem !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Spacing for pagination controls */
.dataTables_wrapper .dataTables_paginate {
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Ensure proper spacing in the bottom section */
.dataTables_wrapper .row:last-child {
    margin-top: 1.5rem !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Spacing for the pagination/info container */
.dataTables_wrapper .d-flex.justify-content-between {
    margin-top: 1.5rem !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    gap: 1rem !important;
}

/* Table bottom margin to create space before pagination */
.dataTables_wrapper table.dataTable {
    margin-bottom: 0 !important;
}

.dataTables_wrapper .table-responsive {
    margin-bottom: 0.5rem !important;
}

/* Additional spacing for DataTables bottom row */
.dataTables_wrapper > .row:last-child {
    margin-top: 0.75rem !important;
    padding-top: 0.75rem !important;
}

/* Spacing for DataTables info and paginate in same row */
.dataTables_wrapper .row .col-sm-12.col-md-5,
.dataTables_wrapper .row .col-sm-12.col-md-7 {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* ============================================
   MAIN CONTAINER
   ============================================ */
nav[role="navigation"].flex.items-center.justify-between {
    margin: 0 !important;
    margin-top: 0.75rem !important;
    padding: 0 !important;
    width: 100% !important;
}

/* ============================================
   RESULTS TEXT SECTION
   ============================================ */
.flex-1.flex.items-center.justify-between {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    width: 100% !important;
}

.flex-1.flex.items-center.justify-between > div:first-child {
    width: 100% !important;
    text-align: center !important;
}

.flex-1.flex.items-center.justify-between > div:first-child p {
    margin: 0 !important;
    font-size: 14px !important;
    color: #6b7280 !important;
    line-height: 1.6 !important;
    font-weight: 400 !important;
}

.flex-1.flex.items-center.justify-between > div:first-child p .font-medium {
    font-weight: 600 !important;
    color: #374151 !important;
}

/* ============================================
   PAGINATION BUTTONS CONTAINER
   ============================================ */
.relative.z-0.inline-flex[class*="rtl"] {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06) !important;
    border: 1px solid #e5e7eb !important;
    background: #ffffff !important;
}

/* ============================================
   MOBILE PAGINATION (screens < 640px)
   ============================================ */
@media (max-width: 639.98px) {
    /* Stack results text and pagination vertically on mobile */
    .flex-1.flex.items-center.justify-between {
        flex-direction: column !important;
        gap: 24px !important;
        align-items: center !important;
    }

    /* Results text - centered on mobile */
    .flex-1.flex.items-center.justify-between > div:first-child {
        order: -1 !important;
        text-align: center !important;
        width: 100% !important;
    }

    .flex-1.flex.items-center.justify-between > div:first-child p {
        font-size: 13px !important;
        color: #6b7280 !important;
    }

    /* Pagination container - centered and compact on mobile */
    .flex-1.flex.items-center.justify-between > div:last-child {
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
    }

    .relative.z-0.inline-flex[class*="rtl"] {
        width: auto !important;
        max-width: 100% !important;
        justify-content: center !important;
        gap: 0 !important;
        border-radius: 8px !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
        border: 1px solid #e5e7eb !important;
    }

    /* Show page numbers on mobile */
    .relative.z-0.inline-flex[class*="rtl"] > a[aria-label^="Go to page"] {
        display: inline-flex !important;
    }

    /* Show active page number */
    .relative.z-0.inline-flex[class*="rtl"] > span[aria-current="page"] {
        display: inline-flex !important;
    }

    /* Mobile buttons - large and touch-friendly */
    .relative.z-0.inline-flex[class*="rtl"] > a,
    .relative.z-0.inline-flex[class*="rtl"] > span > span,
    .relative.z-0.inline-flex[class*="rtl"] > span[aria-current="page"] > span {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 48px !important;
        height: 48px !important;
        padding: 0 16px !important;
        font-size: 15px !important;
        font-weight: 500 !important;
        color: #374151 !important;
        background-color: #ffffff !important;
        border: none !important;
        border-right: 1px solid #e5e7eb !important;
        border-radius: 0 !important;
        text-decoration: none !important;
        transition: all 0.15s ease !important;
        box-shadow: none !important;
        margin: 0 !important;
    }

    /* Remove right border from last button */
    .relative.z-0.inline-flex[class*="rtl"] > *:last-child > span,
    .relative.z-0.inline-flex[class*="rtl"] > *:last-child {
        border-right: none !important;
    }

    /* Active page number on mobile */
    .relative.z-0.inline-flex[class*="rtl"] > span[aria-current="page"] > span {
        color: #ffffff !important;
        background-color: #2563eb !important;
        border-right: 1px solid #2563eb !important;
        font-weight: 600 !important;
    }

    /* Mobile hover state */
    .relative.z-0.inline-flex[class*="rtl"] > a:hover {
        color: #2563eb !important;
        background-color: #eff6ff !important;
        border-right: 1px solid #e5e7eb !important;
    }

    /* Mobile disabled state */
    .relative.z-0.inline-flex[class*="rtl"] > span[aria-disabled="true"] > span {
        color: #d1d5db !important;
        background-color: #f9fafb !important;
        border-right: 1px solid #e5e7eb !important;
        cursor: not-allowed !important;
        opacity: 0.7 !important;
    }

    /* SVG icons - larger on mobile */
    .relative.z-0.inline-flex[class*="rtl"] svg {
        width: 20px !important;
        height: 20px !important;
    }
}

/* ============================================
   DESKTOP PAGINATION (screens >= 640px)
   ============================================ */
@media (min-width: 640px) {
    /* Desktop layout - horizontal */
    .flex-1.flex.items-center.justify-between {
        align-items: center !important;
        justify-content: space-between !important;
        gap: 24px !important;
    }

    .flex-1.flex.items-center.justify-between > div:first-child {
        text-align: left !important;
        flex: 0 0 auto !important;
    }

    .flex-1.flex.items-center.justify-between > div:last-child {
        flex: 0 0 auto !important;
    }

    /* Desktop pagination buttons */
    .relative.z-0.inline-flex[class*="rtl"] {
        gap: 0 !important;
        border-radius: 8px !important;
    }

    /* Show all page numbers on desktop */
    .relative.z-0.inline-flex[class*="rtl"] > a[aria-label^="Go to page"] {
        display: inline-flex !important;
    }

    .relative.z-0.inline-flex[class*="rtl"] > a,
    .relative.z-0.inline-flex[class*="rtl"] > span > span,
    .relative.z-0.inline-flex[class*="rtl"] > span[aria-current="page"] > span {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 40px !important;
        height: 40px !important;
        padding: 0 12px !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        color: #374151 !important;
        background-color: #ffffff !important;
        border: none !important;
        border-right: 1px solid #d1d5db !important;
        border-radius: 0 !important;
        text-decoration: none !important;
        transition: all 0.15s ease !important;
        margin: 0 !important;
    }

    /* Remove right border from last button */
    .relative.z-0.inline-flex[class*="rtl"] > *:last-child > span,
    .relative.z-0.inline-flex[class*="rtl"] > *:last-child {
        border-right: none !important;
    }

    /* Desktop hover */
    .relative.z-0.inline-flex[class*="rtl"] > a:hover {
        color: #2563eb !important;
        background-color: #eff6ff !important;
        border-right: 1px solid #d1d5db !important;
    }

    /* Desktop active page */
    .relative.z-0.inline-flex[class*="rtl"] > span[aria-current="page"] > span {
        color: #ffffff !important;
        background-color: #2563eb !important;
        border-right: 1px solid #2563eb !important;
        font-weight: 600 !important;
    }

    /* Desktop disabled */
    .relative.z-0.inline-flex[class*="rtl"] > span[aria-disabled="true"] > span {
        color: #9ca3af !important;
        background-color: #f9fafb !important;
        border-right: 1px solid #e5e7eb !important;
        cursor: not-allowed !important;
        opacity: 0.6 !important;
    }

    /* Desktop arrow buttons */
    .relative.z-0.inline-flex[class*="rtl"] > a.rounded-l-md,
    .relative.z-0.inline-flex[class*="rtl"] > a.rounded-r-md,
    .relative.z-0.inline-flex[class*="rtl"] > span > span.rounded-l-md,
    .relative.z-0.inline-flex[class*="rtl"] > span > span.rounded-r-md {
        border-radius: 0 !important;
    }

    /* Desktop SVG icons */
    .relative.z-0.inline-flex[class*="rtl"] svg {
        width: 18px !important;
        height: 18px !important;
    }
}

/* ============================================
   GENERAL STYLES
   ============================================ */
/* Focus states for accessibility */
.relative.z-0.inline-flex[class*="rtl"] > a:focus,
.relative.z-0.inline-flex[class*="rtl"] > span[aria-current="page"] > span:focus {
    outline: 2px solid #2563eb !important;
    outline-offset: 2px !important;
    z-index: 10 !important;
}

/* Remove negative margins that cause overlap */
.relative.z-0.inline-flex[class*="rtl"] > * {
    margin-left: 0 !important;
}

/* Smooth transitions */
.relative.z-0.inline-flex[class*="rtl"] > a,
.relative.z-0.inline-flex[class*="rtl"] > span > span {
    transition: all 0.15s ease !important;
}

/* Three dots separator */
.relative.z-0.inline-flex[class*="rtl"] > span[aria-disabled="true"]:not([aria-label]) > span {
    color: #6b7280 !important;
    background-color: #ffffff !important;
    border-right: 1px solid #e5e7eb !important;
    cursor: default !important;
    font-weight: 500 !important;
}

/* Active state hover prevention */
.relative.z-0.inline-flex[class*="rtl"] > span[aria-current="page"] > span:hover {
    background-color: #2563eb !important;
    color: #ffffff !important;
}
