/* 
 * DataTables Custom Theme - Urbix Style
 * Integration avec le thème Urbix pour une cohérence visuelle
 */

/* Base wrapper styling */
.dataTables_wrapper {
    font-family: var(--pe-font-sans-serif);
    font-size: 0.875rem;
    color: var(--pe-body-color);
    background: transparent !important;
}

/* Spacing for main elements */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin-bottom: 0.75rem;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.dataTables_wrapper .dataTables_length {
    margin-top: 0;
}

.dataTables_wrapper .dataTables_filter {
    margin-top: 0;
}

/* Search input styling */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #e3e6f0;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background-color: #fff;
    color: var(--pe-body-color);
    transition: all 0.2s ease;
    box-shadow: var(--pe-box-shadow-sm);
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--pe-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--pe-primary-rgb), 0.25);
    outline: none;
}

/* Length selector styling */
.dataTables_wrapper .dataTables_length select {
    border: 1px solid #e3e6f0;
    border-radius: 0.5rem;
    padding: 0.375rem 2rem 0.375rem 0.75rem;
    font-size: 0.875rem;
    background-color: #fff;
    color: var(--pe-body-color);
    transition: all 0.2s ease;
    box-shadow: var(--pe-box-shadow-sm);
}

.dataTables_wrapper .dataTables_length select:focus {
    border-color: var(--pe-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--pe-primary-rgb), 0.25);
    outline: none;
}

/* Pagination buttons styling - force override any inherited styles */
.dataTables_wrapper .dataTables_paginate .paginate_button,
.card .dataTables_wrapper .dataTables_paginate .paginate_button,
.card-body .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--pe-body-color) !important;
    text-decoration: none !important;
    background: #ffffff !important;
    box-shadow: none !important;
    transition: all 0.15s ease !important;
    font-size: 0.75rem !important;
    line-height: 1.2 !important;
    min-width: 2rem !important;
    text-align: center !important;
    display: inline-block !important;
    position: relative !important;
    z-index: 1 !important;
}

/* .dataTables_wrapper .dataTables_paginate .paginate_button:hover,
.card .dataTables_wrapper .dataTables_paginate .paginate_button:hover,
.card-body .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    /* background: var(--pe-primary) !important;
    color: white !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(var(--pe-primary-rgb), 0.25) !important; 
} */

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.card .dataTables_wrapper .dataTables_paginate .paginate_button.current,
.card-body .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--pe-primary) !important;
    color: white !important;
    box-shadow: 0 1px 4px rgba(var(--pe-primary-rgb), 0.3) !important;
    font-weight: 500 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    background: #f8f9fa !important;
    color: #6c757d !important;
    border-color: #e3e6f0 !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background: #f8f9fa !important;
    color: #6c757d !important;
    border-color: #e3e6f0 !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Override Bootstrap pagination styles specifically */
.dataTables_wrapper .dataTables_paginate .pagination {
    margin: 0 !important;
}

.dataTables_wrapper .dataTables_paginate .page-link,
.card .dataTables_wrapper .dataTables_paginate .page-link,
.card-body .dataTables_wrapper .dataTables_paginate .page-link {
    border: 1px solid #e3e6f0 !important;
    border-radius: 0.375rem !important;
    padding: 0.25rem 0.5rem !important;
    margin: 0 0.125rem !important;
    color: var(--pe-body-color) !important;
    text-decoration: none !important;
    background: #ffffff !important;
    box-shadow: none !important;
    transition: all 0.15s ease !important;
    font-size: 0.75rem !important;
    line-height: 1.2 !important;
    min-width: 2rem !important;
    text-align: center !important;
    display: inline-block !important;
    position: relative !important;
    z-index: 1 !important;
}

.dataTables_wrapper .dataTables_paginate .page-link:hover,
.card .dataTables_wrapper .dataTables_paginate .page-link:hover,
.card-body .dataTables_wrapper .dataTables_paginate .page-link:hover {
    background: var(--pe-primary) !important;
    color: white !important;
    border-color: var(--pe-primary) !important;
    /* transform: translateY(-1px) !important; */
    box-shadow: 0 2px 8px rgba(var(--pe-primary-rgb), 0.25) !important;
}

.dataTables_wrapper .dataTables_paginate .page-item.active .page-link,
.card .dataTables_wrapper .dataTables_paginate .page-item.active .page-link,
.card-body .dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
    background: var(--pe-primary) !important;
    color: white !important;
    border-color: var(--pe-primary) !important;
    box-shadow: 0 1px 4px rgba(var(--pe-primary-rgb), 0.3) !important;
    font-weight: 500 !important;
}

.dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link {
    background: #f8f9fa !important;
    color: #6c757d !important;
    border-color: #e3e6f0 !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

.dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link:hover {
    background: #f8f9fa !important;
    color: #6c757d !important;
    border-color: #e3e6f0 !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Remove all Bootstrap focus styles */
.dataTables_wrapper .dataTables_paginate .page-link:focus {
    box-shadow: 0 1px 4px rgba(var(--pe-primary-rgb), 0.4) !important;
    outline: none !important;
    z-index: auto !important;
}

/* Additional specificity for current page */
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
    background-color: var(--pe-primary) !important;
    background-image: none !important;
    border-color: var(--pe-primary) !important;
}

/* Pagination wrapper spacing - remove borders from container */
.dataTables_wrapper .dataTables_paginate {
    margin-top: 1rem;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
}

/* Remove card styling from pagination container */
div.dataTables_wrapper div.dataTables_paginate {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0.75rem 0 !important;
    margin: 0 !important;
}

/* Force override any card styling around pagination */
.card .dataTables_wrapper .dataTables_paginate,
.card-body .dataTables_wrapper .dataTables_paginate {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0.75rem 0 !important;
}

/* DataTables info styling */
div.dataTables_wrapper div.dataTables_info {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0.75rem 0 !important;
}

/* Force card-body to not interfere with pagination */
.card-body .dataTables_wrapper {
    background: transparent !important;
}

.card-body:has(.dataTables_wrapper) {
    background: #ffffff !important;
    border: 1px solid #e3e6f0 !important;
    border-radius: 0.5rem !important;
    box-shadow: var(--pe-box-shadow-sm) !important;
}

/* Labels and info styling */
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_info {
    color: var(--pe-body-color);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Table header styling */
.dataTables_wrapper table.dataTable thead th {
    background: linear-gradient(145deg, #f8f9fa, #ffffff);
    color: var(--pe-body-color);
    border-bottom: 2px solid var(--pe-primary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.dataTables_wrapper table.dataTable thead th:hover {
    background: linear-gradient(145deg, #e9ecef, #f8f9fa);
}

/* Table rows styling */
.dataTables_wrapper table.dataTable tbody tr {
    transition: all 0.2s ease;
}

.dataTables_wrapper table.dataTable tbody tr:hover {
    background: linear-gradient(145deg, #f8f9fa, #ffffff);
    transform: translateY(-1px);
    box-shadow: var(--pe-box-shadow-sm);
}

/* Responsive design */
@media (max-width: 768px) {
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: center;
        margin-bottom: 1rem;
    }
}

/* Processing indicator */
.dataTables_wrapper .dataTables_processing {
    background: var(--pe-primary);
    color: white;
    border-radius: 0.5rem;
    padding: 1rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(var(--pe-primary-rgb), 0.3);
}

/* Empty table message */
.dataTables_wrapper .dataTables_empty {
    color: var(--pe-secondary);
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

/* ========================================
   DARK MODE STYLES
   ======================================== */

[data-bs-theme="dark"] .dataTables_wrapper {
    color: var(--bs-body-color);
}

/* Search input dark mode */
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input:focus {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--pe-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--pe-primary-rgb), 0.25);
}

/* Length selector dark mode */
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length select {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length select:focus {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--pe-primary);
}

/* Pagination dark mode */
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button,
[data-bs-theme="dark"] .card .dataTables_wrapper .dataTables_paginate .paginate_button,
[data-bs-theme="dark"] .card-body .dataTables_wrapper .dataTables_paginate .paginate_button,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .page-link,
[data-bs-theme="dark"] .card .dataTables_wrapper .dataTables_paginate .page-link,
[data-bs-theme="dark"] .card-body .dataTables_wrapper .dataTables_paginate .page-link {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.disabled),
[data-bs-theme="dark"] .card .dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.disabled),
[data-bs-theme="dark"] .card-body .dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.disabled),
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .page-link:hover:not(.disabled),
[data-bs-theme="dark"] .card .dataTables_wrapper .dataTables_paginate .page-link:hover:not(.disabled),
[data-bs-theme="dark"] .card-body .dataTables_wrapper .dataTables_paginate .page-link:hover:not(.disabled),
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .page-item:not(.disabled) .page-link:hover {
    background: var(--pe-primary) !important;
    color: white !important;
    border-color: var(--pe-primary) !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current,
[data-bs-theme="dark"] .card .dataTables_wrapper .dataTables_paginate .paginate_button.current,
[data-bs-theme="dark"] .card-body .dataTables_wrapper .dataTables_paginate .paginate_button.current,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .page-item.active .page-link,
[data-bs-theme="dark"] .card .dataTables_wrapper .dataTables_paginate .page-item.active .page-link,
[data-bs-theme="dark"] .card-body .dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
    background: var(--pe-primary) !important;
    color: white !important;
    border-color: var(--pe-primary) !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background: rgba(255, 255, 255, 0.02) !important;
    color: rgba(255, 255, 255, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    cursor: not-allowed !important;
}

/* Force styles on pagination links */
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate a.paginate_button,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate span.paginate_button {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate a.paginate_button:hover:not(.disabled),
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate span.paginate_button:hover:not(.disabled) {
    background: var(--pe-primary) !important;
    color: white !important;
    border-color: var(--pe-primary) !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate a.paginate_button.current,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate span.paginate_button.current {
    background: var(--pe-primary) !important;
    color: white !important;
    border-color: var(--pe-primary) !important;
}

/* Table header dark mode */
[data-bs-theme="dark"] .dataTables_wrapper table.dataTable thead th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--bs-body-color);
    border-bottom-color: var(--pe-primary);
}

[data-bs-theme="dark"] .dataTables_wrapper table.dataTable thead th:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Table rows dark mode */
[data-bs-theme="dark"] .dataTables_wrapper table.dataTable tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Table borders dark mode */
[data-bs-theme="dark"] .dataTables_wrapper table.dataTable {
    border-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .dataTables_wrapper table.dataTable thead th,
[data-bs-theme="dark"] .dataTables_wrapper table.dataTable tbody td {
    border-color: rgba(255, 255, 255, 0.1);
}

/* Labels and info dark mode */
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length label,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter label,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_info {
    color: var(--bs-body-color);
}

/* Processing indicator dark mode */
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_processing {
    background: var(--pe-primary);
    color: white;
}

/* Card body dark mode */
[data-bs-theme="dark"] .card-body:has(.dataTables_wrapper) {
    background: transparent !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Scrollbars dark mode */
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_scrollBody {
    background: transparent !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .table-responsive {
    background: transparent !important;
}

/* Webkit scrollbars dark mode (Chrome, Safari, Edge) */
[data-bs-theme="dark"] .dataTables_wrapper ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.05);
}

[data-bs-theme="dark"] .dataTables_wrapper ::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
}

[data-bs-theme="dark"] .dataTables_wrapper ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
}

[data-bs-theme="dark"] .dataTables_wrapper ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Firefox scrollbars dark mode */
[data-bs-theme="dark"] .dataTables_wrapper * {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) rgba(255, 255, 255, 0.05);
}

/* Table responsive container dark mode */
[data-bs-theme="dark"] .table-responsive {
    background: transparent !important;
}

[data-bs-theme="dark"] .table-responsive::-webkit-scrollbar {
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.05);
}

[data-bs-theme="dark"] .table-responsive::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
}

[data-bs-theme="dark"] .table-responsive::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
}

[data-bs-theme="dark"] .table-responsive::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

