/*=========================================================
|| Hide DataTables Length Menu and Processing + Table Fixes
==========================================================*/

/* Hide the length menu completely */
.dataTables_length {
    display: none !important;
}

.dataTables_wrapper .dataTables_length {
    display: none !important;
}

.dataTables_wrapper .dataTables_length label {
    display: none !important;
}

.dataTables_wrapper .dataTables_length select {
    display: none !important;
}

/* HIDE PROCESSING (LOADING) INDICATOR */
.dataTables_processing {
    display: none !important;
}

.dataTables_wrapper .dataTables_processing {
    display: none !important;
}

/* Hide any processing with ID */
#geniustable_processing {
    display: none !important;
}

/* Ensure filter takes full width when length is hidden */
.dataTables_wrapper .dataTables_filter {
    width: 100% !important;
    text-align: right !important;
}

/* Adjust layout without length menu */
.dataTables_wrapper .row .col-sm-6:first-child {
    display: none !important;
}

.dataTables_wrapper .row .col-sm-6:last-child {
    width: 100% !important;
    max-width: 100% !important;
}

/* TABLE CONTAINER - CLEAN */
.dataTables_wrapper {
    padding: 10px !important;
    
    
}

/* SIMPLE TABLE STYLING */
.dataTables_wrapper table {
    width: 100% !important;
    border-collapse: collapse !important;
}

/* TABLE HEADERS - CENTERED */
.dataTables_wrapper table thead th {
    text-align: center !important;
    vertical-align: middle !important;
    padding: 10px 5px !important;
    font-weight: 600 !important;
}

/* TABLE DATA - CENTERED */
.dataTables_wrapper table tbody td {
    text-align: center !important;
    vertical-align: middle !important;
    padding: 8px 5px !important;
}

/* 🎯 SIMPLE UNIFIED TABLE DESIGN */

/* Force ALL tables to have the unified design */
table thead {
    overflow: auto hidden !important;
    display: block !important;
}

table tbody {
    overflow: auto hidden !important;
    display: block !important;
}

/* Ensure table rows work properly */
table thead tr,
table tbody tr {
    display: table !important;
    width: 100% !important;
}

/* Ensure table cells work properly */
table thead th,
table tbody td {
    display: table-cell !important;
}

/* Simple scrollbar for tbody */
table tbody::-webkit-scrollbar {
    height: 12px !important;
}

table tbody::-webkit-scrollbar-thumb {
    background: #888 !important;
    border-radius: 6px !important;
}

table tbody::-webkit-scrollbar-track {
    background: #f1f1f1 !important;
}

/* 🔍 SEARCH & BUTTONS LAYOUT - FULL WIDTH SEARCH + BUTTONS ON TOP */
.dataTables_wrapper .row.btn-area {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 15px !important;
    margin-bottom: 5px !important;
    padding: 15px 0 !important;
}

/* Buttons section - Always on top, extreme positioning */
.dataTables_wrapper .row.btn-area .table-contents {
    order: 1 !important;
    align-self: flex-start !important; /* أقصى الشمال في LTR */
    margin: 0 !important;
}

/* Search section - Full width below buttons */
.dataTables_filter {
    order: 2 !important;
    width: 100% !important;
    margin: 0 !important;
}

.dataTables_filter label {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    margin: 0 !important;
    font-weight: 500 !important;
    width: 100% !important;
}

.dataTables_filter input[type="search"] {
    border-radius: 6px !important;
    padding: 8px 12px !important;
    border: 1px solid #ddd !important;
    flex: 1 !important;
    font-size: 14px !important;
}

.dataTables_filter input[type="search"]:focus {
    border-color: #007bff !important;
    outline: none !important;
}

/* Hide length menu completely */
.dataTables_length {
    display: none !important;
}

/* RTL Support - Extreme positioning */
html[dir="rtl"] .dataTables_wrapper .row.btn-area .table-contents {
    align-self: flex-end !important; /* أقصى اليمين في RTL */
}

/* Additional RTL support for Arabic */
body.rtl .dataTables_wrapper .row.btn-area .table-contents,
[lang="ar"] .dataTables_wrapper .row.btn-area .table-contents,
.rtl .dataTables_wrapper .row.btn-area .table-contents {
    align-self: flex-end !important; /* أقصى اليمين في العربي */
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .dataTables_wrapper .row.btn-area {
        padding: 2px 0 !important;
        gap: 10px !important;
    }
    
    .dataTables_filter input[type="search"] {
        padding: 8px 12px !important;
        font-size: 13px !important;
    }
    
    .dataTables_filter label {
        gap: 8px !important;
    }
}

/* Button styling and extreme positioning */
.table-contents {
    display: flex !important;
    justify-content: flex-start !important; /* أقصى الشمال */
    width: auto !important;
}

.table-contents .add-btn {
    background: #007bff !important;
    color: white !important;
    padding: 8px 16px !important;
    border-radius: 4px !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-weight: 500 !important;
    border: none !important;
}

.table-contents .add-btn:hover {
    background: #0056b3 !important;
    color: white !important;
    text-decoration: none !important;
}

/* RTL Button positioning */
html[dir="rtl"] .table-contents,
body.rtl .table-contents,
[lang="ar"] .table-contents,
.rtl .table-contents {
    justify-content: flex-end !important; /* أقصى اليمين في العربي */
}

/* Force extreme positioning on mobile too */
@media (max-width: 768px) {
    .table-contents {
        justify-content: flex-start !important; /* أقصى الشمال على الموبايل */
    }
    
    html[dir="rtl"] .table-contents,
    body.rtl .table-contents,
    [lang="ar"] .table-contents,
    .rtl .table-contents {
        justify-content: flex-end !important; /* أقصى اليمين في العربي على الموبايل */
    }
}



/* BASIC TABLE CENTERING */
.dataTables_wrapper table th,
.dataTables_wrapper table td {
    text-align: center !important;
    vertical-align: middle !important;
}

/* FALLBACK FOR NORMAL TABLES */
.table-responsive {
    overflow-x: auto !important;
    overflow-y: visible !important;
}

/* FORCE ALL TABLES TO BE RESPONSIVE */
table {
    width: 100% !important;
    min-width: 600px !important; /* Force horizontal scroll when needed */
}

/* ENSURE ALL TABLE CONTAINERS ARE SCROLLABLE */
.mr-table,
.table-responsive,
div:has(> table) {
    overflow-x: auto !important;
    overflow-y: visible !important;
    width: 100% !important;
}

/* MOBILE RESPONSIVE FOR ALL TABLES */
@media (max-width: 768px) {
    table {
        min-width: 800px !important; /* Force scroll on mobile */
    }
    
    .mr-table,
    .table-responsive,
    div:has(> table) {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* NO MORE BORDER RADIUS - CLEAN LOOK */
