/* Admin Panel Layout Fix - Remove Empty Scrollable Area */

/* Ensure proper page layout with sticky footer */
html {
    height: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* When admin panel is active, ensure proper layout */
body.admin-active {
    overflow-x: hidden;
}

/* Main content wrapper should grow to push footer down */
#detailMainWrapper {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

/* Admin panel container should not create extra space */
#admin-panel-container {
    min-height: auto !important;
    height: 100vh !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    background: white !important;
    position: relative !important;
    z-index: 10 !important;
    flex: 1 0 auto;
    overflow: hidden !important;
}

/* Ensure admin container is above other content */
#admin-panel-container .container-fluid {
    position: relative;
    z-index: 10;
    height: 100%;
}

/* Footer should stick to bottom and have no extra space */
footer {
    margin-top: 0 !important;
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
    position: relative;
    z-index: 5;
    flex-shrink: 0;
    width: 100%;
}

/* When admin mode is active, ensure footer stays at bottom */
body.admin-mode {
    --admin-footer-space: 88px;
    height: 100vh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
}

body.admin-mode footer {
    display: block !important;
    margin-top: 0 !important;
}

/* Fix navbar z-index to stay on top */
.navbar {
    z-index: 1050 !important;
    flex-shrink: 0;
}

/* Hide sections when admin is active */
body.admin-mode #home,
body.admin-mode #features,
body.admin-mode #about,
body.admin-mode #services,
body.admin-mode #demo,
body.admin-mode #download,
body.admin-mode .counterbg,
body.admin-mode .about-section-bg {
    display: none !important;
}

/* Loading spinner container should not affect footer position */
.loading-spinner {
    min-height: 200px;
}

body.admin-mode .admin-panel-inline {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.admin-mode #admin-panel-container {
    height: calc(100vh - var(--admin-footer-space)) !important;
}

body.admin-mode .tab-content {
    flex: 1 1 auto;
    overflow: hidden !important;
    padding-bottom: 0 !important;
}

body.admin-mode .tab-content > .tab-pane {
    height: 100%;
}

body.admin-mode .tab-content > .tab-pane.active,
body.admin-mode .tab-content > .active.show {
    display: flex !important;
    flex-direction: column;
}

body.admin-mode #pending .table-container,
body.admin-mode #approved .table-container,
body.admin-mode #rejected .table-container,
body.admin-mode #feedback .table-container {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
}

/* Feedback Button Styling */
.btn-feedback {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    border-radius: 2px !important;
}

.btn-feedback:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
}

.btn-feedback.active {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%) !important;
}

/* Feedback Details Modal Styling */
.feedback-details {
    padding: 10px 0;
}

.feedback-details .detail-row {
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
}

.feedback-details .detail-row:last-child {
    border-bottom: none;
}

.feedback-details .detail-row strong {
    display: inline-block;
    min-width: 150px;
    color: #495057;
    font-weight: 600;
}

.feedback-details .concern-text {
    margin-top: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-left: 4px solid #10b981;
    border-radius: 4px;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.6;
}

/* Badge Styling for Feedback Table */
.badge {
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
}

.badge-primary {
    background-color: #007bff;
    color: white;
}

.badge-danger {
    background-color: #dc3545;
    color: white;
}

.badge-success {
    background-color: #28a745;
    color: white;
}

.badge-warning {
    background-color: #ffc107;
    color: #212529;
}

.badge-info {
    background-color: #17a2b8;
    color: white;
}

.badge-secondary {
    background-color: #6c757d;
    color: white;
}

/* Feedback Table Action Buttons - Match Other Tables */
#feedbackTable .btn-sm {
    padding: 3px 8px !important;
    margin: 1px !important;
    font-size: 10px !important;
    min-width: 70px !important;
    height: 26px !important;
    border-radius: 4px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
}

#feedbackTable .btn-sm .material-icons {
    font-size: 13px !important;
    margin-right: 2px !important;
}

#feedbackTable .btn-reply {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    color: white !important;
    border: none !important;
}

#feedbackTable .btn-reply:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%) !important;
    color: white !important;
}

.feedback-reply-readonly,
.feedback-reply-message {
    resize: none !important;
}

.feedback-reply-modal .form-control {
    background: #ffffff !important;
    color: #243b53 !important;
    border: 2px solid #d7e1ec !important;
    border-radius: 10px !important;
    padding: 11px 14px !important;
}

.feedback-reply-modal .modal-dialog {
    max-width: 860px !important;
    margin: 1rem auto !important;
}

.feedback-reply-modal .modal-content {
    max-height: calc(100vh - 2rem) !important;
    border: none !important;
    border-radius: 14px !important;
    overflow: hidden !important;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18) !important;
}

.feedback-reply-modal .modal-header {
    background: linear-gradient(135deg, #0d6efd 0%, #138496 100%) !important;
    color: #ffffff !important;
    border-bottom: none !important;
    padding: 18px 22px !important;
}

.feedback-reply-modal .modal-title {
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 1.15rem !important;
}

.feedback-reply-modal .modal-body {
    overflow: hidden !important;
    padding: 20px !important;
    background: #f8fbff !important;
}

.feedback-reply-modal .modal-footer {
    background: #f8fbff !important;
    border-top: none !important;
    padding: 0 20px 20px !important;
}

.feedback-reply-modal .row.g-3 {
    --bs-gutter-y: 0.85rem !important;
}

.feedback-reply-modal .form-control:focus {
    background: #ffffff !important;
    color: #243b53 !important;
    border-color: #1f6feb !important;
    box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.12) !important;
}

.feedback-reply-modal .form-control[readonly] {
    background: #ffffff !important;
    color: #243b53 !important;
    opacity: 1 !important;
}

.feedback-reply-modal .form-label {
    color: #23395b !important;
    font-weight: 700 !important;
    margin-bottom: 5px !important;
    font-size: 0.96rem !important;
}

.feedback-reply-modal .form-label .material-icons {
    font-size: 18px !important;
    color: #0d6efd !important;
}

.feedback-reply-modal .form-control[readonly],
.feedback-reply-modal .feedback-reply-message {
    min-height: 48px !important;
}

.feedback-reply-modal .feedback-reply-readonly {
    min-height: 92px !important;
}

.feedback-reply-modal .feedback-reply-message {
    min-height: 110px !important;
}

.feedback-reply-modal .btn-secondary {
    background: #5b6470 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 10px !important;
    padding: 12px 22px !important;
    font-weight: 600 !important;
    box-shadow: 0 8px 20px rgba(91, 100, 112, 0.2) !important;
}

.feedback-reply-modal .btn-secondary:hover {
    background: #4b5563 !important;
    color: #ffffff !important;
}

.feedback-reply-modal .btn-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #059669 100%) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 10px !important;
    padding: 12px 24px !important;
    font-weight: 700 !important;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35) !important;
}

.feedback-reply-modal .btn-primary:hover,
.feedback-reply-modal .btn-primary:focus {
    background: linear-gradient(135deg, #0b5ed7 0%, #047857 100%) !important;
    color: #ffffff !important;
}

.feedback-reply-modal .btn-primary .material-icons {
    font-size: 18px !important;
    margin-right: 4px !important;
}

@media (max-width: 768px) {
    .feedback-reply-modal .modal-dialog {
        margin: 0.5rem !important;
    }

    .feedback-reply-modal .modal-content {
        max-height: calc(100vh - 1rem) !important;
    }

    .feedback-reply-modal .modal-body {
        padding: 16px !important;
    }
}

/* Feedback table action column */
#feedbackTable tbody td:last-child {
    white-space: nowrap !important;
    padding: 6px 4px !important;
}

/* Ensure modal close button is clickable */
.modal-header .btn-close,
.modal-header-custom .btn-close {
    position: relative;
    z-index: 1060 !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    opacity: 1 !important;
    filter: brightness(0) invert(1) !important; /* Make it white on colored headers */
}

/* Ensure modal header doesn't block clicks */
.modal-header,
.modal-header-custom {
    position: relative;
    z-index: 1055 !important;
}

/* Make sure modal content is above backdrop */
.modal-dialog {
    z-index: 1060 !important;
    position: relative !important;
    margin: 1.75rem auto !important;
}

.modal-content {
    position: relative;
    z-index: 1061 !important;
    background-color: #fff !important;
}

/* Make sure modal is above everything */
.modal {
    z-index: 1060 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    outline: 0 !important;
}

.modal-backdrop {
    z-index: 1050 !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
}

/* Ensure modal backdrop doesn't block modal content */
.modal.show {
    z-index: 1060 !important;
    display: block !important;
}

.modal.show .modal-dialog {
    z-index: 1061 !important;
    transform: none !important;
}


/* Force modal to be above backdrop - Critical Fix */
.modal.fade.show {
    z-index: 1060 !important;
    opacity: 1 !important;
}

.modal.fade.show .modal-dialog {
    z-index: 1061 !important;
    position: relative;
    transform: none !important;
}

.modal.fade.show .modal-content {
    z-index: 1062 !important;
    position: relative;
    background-color: #fff !important;
}

.modal.fade.show .modal-header {
    z-index: 1063 !important;
    position: relative;
}

.modal.fade.show .btn-close {
    z-index: 1065 !important;
    position: relative;
    pointer-events: auto !important;
}

/* Ensure backdrop stays below modal */
.modal-backdrop.fade.show {
    z-index: 1050 !important;
    opacity: 0.5 !important;
}

/* Additional specificity for viewModal */
#viewModal {
    z-index: 1060 !important;
}

#viewModal .modal-dialog {
    z-index: 1061 !important;
    position: relative !important;
}

#viewModal .modal-content {
    z-index: 1062 !important;
    background-color: #fff !important;
}

#viewModal .modal-header {
    z-index: 1063 !important;
}

#viewModal .btn-close {
    z-index: 1065 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    filter: brightness(0) invert(1) !important;
    opacity: 1 !important;
    background: transparent !important;
}

#viewModal .modal-header .btn-close {
    filter: brightness(0) invert(1) !important;
    opacity: 1 !important;
}

/* Ensure modal is visible and centered */
.modal.show .modal-dialog {
    display: flex !important;
    align-items: center !important;
    min-height: calc(100% - 3.5rem) !important;
}


/* ========================================
   GLOBAL DATATABLE ALIGNMENT FIX
   ======================================== */

/* Fix all DataTables - Force proper alignment */
.dataTables_wrapper {
    width: 100% !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

.dataTables_wrapper table.dataTable {
    width: 1150px !important;
    min-width: 1150px !important;
    border-collapse: collapse !important;
    margin: 0 !important;
    table-layout: fixed !important;
}

.dataTables_wrapper table.dataTable thead th,
.dataTables_wrapper table.dataTable tbody td {
    box-sizing: border-box !important;
    padding: 10px 8px !important;
    text-align: center !important;
    vertical-align: middle !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Allow text wrapping for specific columns */
.dataTables_wrapper table.dataTable thead th,
.dataTables_wrapper table.dataTable tbody td {
    white-space: normal !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
    line-height: 1.4 !important;
}

/* Specific column width enforcement */
.dataTables_wrapper table.dataTable thead th:nth-child(1),
.dataTables_wrapper table.dataTable tbody td:nth-child(1) {
    width: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
}

.dataTables_wrapper table.dataTable thead th:nth-child(2),
.dataTables_wrapper table.dataTable tbody td:nth-child(2) {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
}

.dataTables_wrapper table.dataTable thead th:nth-child(3),
.dataTables_wrapper table.dataTable tbody td:nth-child(3) {
    width: 180px !important;
    min-width: 180px !important;
    max-width: 180px !important;
}

.dataTables_wrapper table.dataTable thead th:nth-child(4),
.dataTables_wrapper table.dataTable tbody td:nth-child(4) {
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
}

.dataTables_wrapper table.dataTable thead th:nth-child(5),
.dataTables_wrapper table.dataTable tbody td:nth-child(5) {
    width: 130px !important;
    min-width: 130px !important;
    max-width: 130px !important;
}

.dataTables_wrapper table.dataTable thead th:nth-child(6),
.dataTables_wrapper table.dataTable tbody td:nth-child(6) {
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
}

.dataTables_wrapper table.dataTable thead th:nth-child(7),
.dataTables_wrapper table.dataTable tbody td:nth-child(7) {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
}

.dataTables_wrapper table.dataTable thead th:nth-child(8),
.dataTables_wrapper table.dataTable tbody td:nth-child(8) {
    width: 90px !important;
    min-width: 90px !important;
    max-width: 90px !important;
}

.dataTables_wrapper table.dataTable thead th:nth-child(9),
.dataTables_wrapper table.dataTable tbody td:nth-child(9) {
    width: 340px !important;
    min-width: 340px !important;
    max-width: 340px !important;
}

/* Ensure scroll containers are properly sized */
.dataTables_wrapper .dataTables_scroll {
    width: 100% !important;
    overflow: visible !important;
}

.dataTables_wrapper .dataTables_scrollHead {
    width: 100% !important;
    overflow: visible !important;
    border-bottom: 1px solid #dee2e6 !important;
}

.dataTables_wrapper .dataTables_scrollBody {
    width: 100% !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
}

.dataTables_wrapper .dataTables_scrollHead table,
.dataTables_wrapper .dataTables_scrollBody table {
    width: 1290px !important;
    min-width: 1290px !important;
    margin: 0 !important;
    table-layout: fixed !important;
}

.dataTables_wrapper .dataTables_scrollHeadInner {
    width: 100% !important;
    min-width: 1290px !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
}

.dataTables_wrapper .dataTables_scrollHeadInner table {
    width: 1290px !important;
    min-width: 1290px !important;
    margin: 0 !important;
    table-layout: fixed !important;
}

/* Hide the duplicate header in scroll body */
.dataTables_wrapper .dataTables_scrollBody thead {
    display: none !important;
}

/* Fix for sticky headers on all tables */
.dataTables_wrapper table.dataTable thead th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border-bottom: 2px solid #0891b2 !important;
    font-weight: 700 !important;
    position: relative !important;
}


/* Feedback Table Proper Sizing */
#feedbackTable {
    width: 100% !important;
    table-layout: auto !important;
    border-collapse: separate !important;
}

#feedbackTable thead th,
#feedbackTable tbody td {
    padding: 12px 8px !important;
    vertical-align: middle !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    text-align: center !important;
    box-sizing: border-box !important;
}

#feedbackTable thead th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border-bottom: 2px solid #0891b2 !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
}

#pendingRequestsTable,
#approvedRequestsTable,
#rejectedRequestsTable {
    width: 100% !important;
    table-layout: auto !important;
    border-collapse: separate !important;
}

#pendingRequestsTable thead th,
#pendingRequestsTable tbody td,
#approvedRequestsTable thead th,
#approvedRequestsTable tbody td,
#rejectedRequestsTable thead th,
#rejectedRequestsTable tbody td {
    padding: 12px 10px !important;
    vertical-align: middle !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: anywhere !important;
    text-align: center !important;
    box-sizing: border-box !important;
}

#pendingRequestsTable thead th,
#approvedRequestsTable thead th,
#rejectedRequestsTable thead th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border-bottom: 2px solid #0891b2 !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
}

#pendingRequestsTable tbody td:nth-child(9),
#approvedRequestsTable tbody td:nth-child(9),
#rejectedRequestsTable tbody td:nth-child(9) {
    white-space: nowrap !important;
    padding: 8px 6px !important;
    width: 340px !important;
    min-width: 340px !important;
    max-width: 340px !important;
}

#pendingRequestsTable tbody td:nth-child(9) .action-buttons-container,
#approvedRequestsTable tbody td:nth-child(9) .action-buttons-container,
#rejectedRequestsTable tbody td:nth-child(9) .action-buttons-container {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 4px !important;
    width: 100% !important;
}

#feedbackTable tbody td:nth-child(9) {
    overflow-wrap: anywhere !important;
}

/* Ensure table container has proper scrolling */
.table-container {
    width: 100% !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    max-height: none !important;
    padding: 10px 10px 0 !important;
    position: relative !important;
    margin-bottom: 0 !important;
}

/* Specific for feedback table container */
#feedback .table-container {
    width: 100% !important;
    overflow: visible !important;
    max-height: none !important;
    padding: 10px 10px 0 !important;
    position: relative !important;
    margin-bottom: 0 !important;
}

/* DataTables wrapper should not compress */
#feedbackTable_wrapper {
    width: 100% !important;
    position: relative !important;
    margin-bottom: 0 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    row-gap: 0 !important;
}

/* Use DataTables scroll body so controls stay fixed and empty space collapses */
#feedbackTable_wrapper .dataTables_scroll {
    width: 100% !important;
    overflow: hidden !important;
}

#feedbackTable_wrapper .dataTables_scrollHead {
    overflow: hidden !important;
    position: relative !important;
    margin-bottom: 0 !important;
}

#feedbackTable_wrapper .dataTables_scrollBody {
    overflow: auto !important;
    overflow-x: hidden !important;
    position: relative !important;
    max-height: calc(100vh - 500px) !important;
    min-height: 0 !important;
    border-bottom: none !important;
}

#feedbackTable_wrapper .dataTables_scrollHeadInner,
#feedbackTable_wrapper .dataTables_scrollHeadInner table {
    width: 100% !important;
}

#feedbackTable_wrapper .dataTables_scrollHead table,
#feedbackTable_wrapper .dataTables_scrollBody table {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

#feedbackTable_wrapper .dataTables_scrollBody table {
    border-bottom: none !important;
}

#feedbackTable_wrapper .dataTables_scrollBody thead th,
#feedbackTable_wrapper .dataTables_scrollBody thead td {
    height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    border-top: 0 !important;
    border-bottom: 0 !important;
    background: transparent !important;
    line-height: 0 !important;
    font-size: 0 !important;
}

#feedbackTable_wrapper .dataTables_scrollBody thead .dataTables_sizing {
    height: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
}

#feedbackTable_wrapper .dataTables_empty {
    padding: 24px 12px !important;
    text-align: center !important;
    white-space: normal !important;
}

#feedbackTable_wrapper .dataTables_scrollBody:has(.dataTables_empty) {
    height: auto !important;
}

/* Ensure proper spacing for DataTables controls */
#feedbackTable_wrapper .dataTables_length,
#feedbackTable_wrapper .dataTables_filter {
    padding: 8px 0 !important;
    margin-bottom: 10px !important;
}

#feedbackTable_wrapper .dataTables_info,
#feedbackTable_wrapper .dataTables_paginate {
    padding: 8px 0 !important;
    margin-top: 10px !important;
    margin-bottom: 0 !important;
}

#pendingRequestsTable_wrapper,
#approvedRequestsTable_wrapper,
#rejectedRequestsTable_wrapper {
    width: 100% !important;
    position: relative !important;
    margin-bottom: 0 !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

#pendingRequestsTable_wrapper .dataTables_scroll,
#approvedRequestsTable_wrapper .dataTables_scroll,
#rejectedRequestsTable_wrapper .dataTables_scroll {
    width: 100% !important;
    overflow: hidden !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

#pendingRequestsTable_wrapper .dataTables_scrollHead,
#approvedRequestsTable_wrapper .dataTables_scrollHead,
#rejectedRequestsTable_wrapper .dataTables_scrollHead {
    overflow: hidden !important;
    position: relative !important;
    margin-bottom: 0 !important;
}

#pendingRequestsTable_wrapper .dataTables_scrollBody,
#approvedRequestsTable_wrapper .dataTables_scrollBody,
#rejectedRequestsTable_wrapper .dataTables_scrollBody {
    overflow: auto !important;
    overflow-x: hidden !important;
    position: relative !important;
    flex: 1 1 auto !important;
    height: 100% !important;
    max-height: none !important;
    min-height: 220px !important;
    border-bottom: none !important;
}

#pendingRequestsTable_wrapper .dataTables_scrollHeadInner,
#pendingRequestsTable_wrapper .dataTables_scrollHeadInner table,
#approvedRequestsTable_wrapper .dataTables_scrollHeadInner,
#approvedRequestsTable_wrapper .dataTables_scrollHeadInner table,
#rejectedRequestsTable_wrapper .dataTables_scrollHeadInner,
#rejectedRequestsTable_wrapper .dataTables_scrollHeadInner table {
    width: 100% !important;
}

#pendingRequestsTable_wrapper .dataTables_scrollHead table,
#pendingRequestsTable_wrapper .dataTables_scrollBody table,
#approvedRequestsTable_wrapper .dataTables_scrollHead table,
#approvedRequestsTable_wrapper .dataTables_scrollBody table,
#rejectedRequestsTable_wrapper .dataTables_scrollHead table,
#rejectedRequestsTable_wrapper .dataTables_scrollBody table {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

#pendingRequestsTable_wrapper .dataTables_scrollBody table,
#approvedRequestsTable_wrapper .dataTables_scrollBody table,
#rejectedRequestsTable_wrapper .dataTables_scrollBody table {
    border-bottom: none !important;
}

#pendingRequestsTable_wrapper .dataTables_scrollBody thead th,
#pendingRequestsTable_wrapper .dataTables_scrollBody thead td,
#approvedRequestsTable_wrapper .dataTables_scrollBody thead th,
#approvedRequestsTable_wrapper .dataTables_scrollBody thead td,
#rejectedRequestsTable_wrapper .dataTables_scrollBody thead th,
#rejectedRequestsTable_wrapper .dataTables_scrollBody thead td {
    height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    border-top: 0 !important;
    border-bottom: 0 !important;
    background: transparent !important;
    line-height: 0 !important;
    font-size: 0 !important;
}

#pendingRequestsTable_wrapper .dataTables_scrollBody thead .dataTables_sizing,
#approvedRequestsTable_wrapper .dataTables_scrollBody thead .dataTables_sizing,
#rejectedRequestsTable_wrapper .dataTables_scrollBody thead .dataTables_sizing {
    height: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
}

#pendingRequestsTable_wrapper .dataTables_empty,
#approvedRequestsTable_wrapper .dataTables_empty,
#rejectedRequestsTable_wrapper .dataTables_empty {
    padding: 24px 12px !important;
    text-align: center !important;
    white-space: normal !important;
}

#pendingRequestsTable_wrapper .dataTables_length,
#pendingRequestsTable_wrapper .dataTables_filter,
#approvedRequestsTable_wrapper .dataTables_length,
#approvedRequestsTable_wrapper .dataTables_filter,
#rejectedRequestsTable_wrapper .dataTables_length,
#rejectedRequestsTable_wrapper .dataTables_filter {
    padding: 8px 0 !important;
    margin-bottom: 10px !important;
}

#pendingRequestsTable_wrapper .dataTables_info,
#pendingRequestsTable_wrapper .dataTables_paginate,
#approvedRequestsTable_wrapper .dataTables_info,
#approvedRequestsTable_wrapper .dataTables_paginate,
#rejectedRequestsTable_wrapper .dataTables_info,
#rejectedRequestsTable_wrapper .dataTables_paginate {
    padding: 8px 0 !important;
    margin-top: 10px !important;
    margin-bottom: 0 !important;
}

#feedbackTable_wrapper table th,
#feedbackTable_wrapper table td,
#pendingRequestsTable_wrapper table th,
#pendingRequestsTable_wrapper table td,
#approvedRequestsTable_wrapper table th,
#approvedRequestsTable_wrapper table td,
#rejectedRequestsTable_wrapper table th,
#rejectedRequestsTable_wrapper table td {
    text-align: center !important;
    vertical-align: middle !important;
}


/* CRITICAL FIX - Force white close button on all modals */
.modal .modal-header .btn-close,
.modal-header-custom .btn-close,
#viewModal .modal-header .btn-close,
.feedback-modal .modal-header .btn-close,
.btn-close-white,
button.btn-close,
.modal-header .btn-close-white {
    filter: brightness(0) invert(1) !important;
    opacity: 1 !important;
    background-color: transparent !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 1em !important;
    border: none !important;
    color: white !important;
    width: 1em !important;
    height: 1em !important;
    padding: 0.25em 0.25em !important;
    display: inline-block !important;
    visibility: visible !important;
}

/* Ensure it works on colored headers */
.modal-header[style*="background"] .btn-close,
.modal-header-custom .btn-close,
.modal-header-custom .btn-close-white {
    filter: brightness(0) invert(1) !important;
    opacity: 1 !important;
}

/* Extra specificity for stubborn cases */
button.btn-close.btn-close-white,
.modal .modal-header button.btn-close,
#viewModal .modal-header button.btn-close {
    filter: brightness(0) invert(1) !important;
    opacity: 1 !important;
}

/* Override Bootstrap default close button */
.btn-close:not(.btn-close-white) {
    filter: brightness(0) invert(1) !important;
}

/* Force white on all close buttons in modals with colored headers */
.modal-header-custom button[data-bs-dismiss="modal"],
.modal-header button[data-bs-dismiss="modal"] {
    filter: brightness(0) invert(1) !important;
    opacity: 1 !important;
}

/* Hover effect */
.modal-header .btn-close:hover,
.modal-header-custom .btn-close:hover {
    opacity: 0.75 !important;
}


/* ========================================
   DataTables Pagination & Controls Enhancement
   ======================================== */

/* Pagination styling improvements */
.dataTables_wrapper .dataTables_paginate {
    margin-top: 15px !important;
    padding-top: 10px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 6px 12px !important;
    margin: 0 2px !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 4px !important;
    background: white !important;
    color: #495057 !important;
    font-weight: 500 !important;
    transition: all 0.2s !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f8f9fa !important;
    border-color: #0891b2 !important;
    color: #0891b2 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%) !important;
    border-color: #0891b2 !important;
    color: white !important;
    font-weight: 600 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: linear-gradient(135deg, #0e7490 0%, #155e75 100%) !important;
    color: white !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background: white !important;
    border-color: #dee2e6 !important;
    color: #495057 !important;
}

/* Length menu (Show entries dropdown) styling */
.dataTables_wrapper .dataTables_length select {
    padding: 6px 30px 6px 10px !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 4px !important;
    background: white !important;
    color: #495057 !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
}

.dataTables_wrapper .dataTables_length select:focus {
    outline: none !important;
    border-color: #0891b2 !important;
    box-shadow: 0 0 0 2px rgba(8, 145, 178, 0.1) !important;
}

.dataTables_wrapper .dataTables_length select:hover {
    border-color: #0891b2 !important;
}

/* Info text styling */
.dataTables_wrapper .dataTables_info {
    padding-top: 15px !important;
    color: #6c757d !important;
    font-weight: 500 !important;
}

/* Search box styling */
.dataTables_wrapper .dataTables_filter input {
    padding: 6px 12px !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 4px !important;
    margin-left: 8px !important;
    transition: all 0.2s !important;
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none !important;
    border-color: #0891b2 !important;
    box-shadow: 0 0 0 2px rgba(8, 145, 178, 0.1) !important;
}

/* ========================================
   Fresh Request Table Layout Override
   ======================================== */

body.admin-mode {
    height: 100vh !important;
    min-height: 100vh !important;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
}

body.admin-mode #admin-panel-container {
    height: calc(100vh - var(--admin-footer-space)) !important;
    min-height: calc(100vh - var(--admin-footer-space)) !important;
    overflow: hidden !important;
}

body.admin-mode .admin-panel-inline {
    height: 100% !important;
    min-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

body.admin-mode .tab-content {
    flex: 1 1 auto !important;
    overflow: hidden !important;
}

body.admin-mode .tab-content > .tab-pane,
body.admin-mode .tab-content > .tab-pane.fade {
    height: 100% !important;
    min-height: 0 !important;
}

body.admin-mode .tab-content > .tab-pane.active,
body.admin-mode .tab-content > .active.show {
    display: flex !important;
    flex-direction: column !important;
}

body.admin-mode #pending .request-table-container,
body.admin-mode #approved .request-table-container,
body.admin-mode #rejected .request-table-container,
body.admin-mode #feedback .request-table-container {
    display: flex !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    overflow: hidden !important;
    padding: 16px 18px 8px !important;
    min-height: 0 !important;
}

.request-table-shell {
    width: 100% !important;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
    border: 1px solid #e6edf3 !important;
    border-radius: 16px !important;
    background: #ffffff !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06) !important;
    padding: 12px 10px 6px !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
}

.feedback-table-shell {
    padding-bottom: 10px !important;
}

#pendingRequestsTable_wrapper,
#approvedRequestsTable_wrapper,
#rejectedRequestsTable_wrapper {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    margin: 0 !important;
    min-height: 0 !important;
}

#pendingRequestsTable_wrapper .dataTables_scroll,
#approvedRequestsTable_wrapper .dataTables_scroll,
#rejectedRequestsTable_wrapper .dataTables_scroll {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    min-height: 0 !important;
    border: 0 !important;
}

#pendingRequestsTable_wrapper .dataTables_scrollHead,
#approvedRequestsTable_wrapper .dataTables_scrollHead,
#rejectedRequestsTable_wrapper .dataTables_scrollHead {
    display: block !important;
    width: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: hidden !important;
    border: 0 !important;
}

#pendingRequestsTable_wrapper .dataTables_scrollBody,
#approvedRequestsTable_wrapper .dataTables_scrollBody,
#rejectedRequestsTable_wrapper .dataTables_scrollBody {
    display: block !important;
    width: 100% !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    border: 0 !important;
}

#pendingRequestsTable_wrapper .dataTables_length,
#approvedRequestsTable_wrapper .dataTables_length,
#rejectedRequestsTable_wrapper .dataTables_length,
#pendingRequestsTable_wrapper .dataTables_filter,
#approvedRequestsTable_wrapper .dataTables_filter,
#rejectedRequestsTable_wrapper .dataTables_filter {
    float: none !important;
    padding: 0 0 14px !important;
    margin: 0 !important;
    min-height: 32px !important;
    display: flex !important;
    align-items: flex-start !important;
}

#pendingRequestsTable_wrapper .dataTables_length,
#approvedRequestsTable_wrapper .dataTables_length,
#rejectedRequestsTable_wrapper .dataTables_length {
    justify-content: flex-start !important;
}

#pendingRequestsTable_wrapper .dataTables_filter,
#approvedRequestsTable_wrapper .dataTables_filter,
#rejectedRequestsTable_wrapper .dataTables_filter {
    justify-content: flex-end !important;
    text-align: right !important;
}

#pendingRequestsTable_wrapper .dataTables_length label,
#approvedRequestsTable_wrapper .dataTables_length label,
#rejectedRequestsTable_wrapper .dataTables_length label,
#pendingRequestsTable_wrapper .dataTables_filter label,
#approvedRequestsTable_wrapper .dataTables_filter label,
#rejectedRequestsTable_wrapper .dataTables_filter label {
    margin: 0 !important;
    display: flex !important;
    align-items: flex-start !important;
    line-height: 32px !important;
}

#pendingRequestsTable_wrapper .dataTables_filter input,
#approvedRequestsTable_wrapper .dataTables_filter input,
#rejectedRequestsTable_wrapper .dataTables_filter input,
#pendingRequestsTable_wrapper .dataTables_length select,
#approvedRequestsTable_wrapper .dataTables_length select,
#rejectedRequestsTable_wrapper .dataTables_length select {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

#feedbackTable_wrapper .dataTables_length,
#feedbackTable_wrapper .dataTables_filter {
    float: none !important;
    padding: 0 0 14px !important;
    margin: 0 !important;
    min-height: 32px !important;
    display: flex !important;
    align-items: flex-start !important;
    width: 50% !important;
    flex: 0 0 50% !important;
}

#feedbackTable_wrapper .dataTables_length {
    justify-content: flex-start !important;
}

#feedbackTable_wrapper .dataTables_filter {
    justify-content: flex-end !important;
    text-align: right !important;
}

#feedbackTable_wrapper .dataTables_scroll,
#feedbackTable_wrapper .dataTables_info,
#feedbackTable_wrapper .dataTables_paginate {
    width: 100% !important;
    flex: 0 0 100% !important;
}

#feedbackTable_wrapper .dataTables_info,
#feedbackTable_wrapper .dataTables_paginate {
    width: 50% !important;
    flex: 0 0 50% !important;
    padding-top: 14px !important;
}

#feedbackTable_wrapper .dataTables_info {
    text-align: left !important;
}

#feedbackTable_wrapper .dataTables_paginate {
    text-align: right !important;
}

#feedbackTable_wrapper .dataTables_length label,
#feedbackTable_wrapper .dataTables_filter label {
    margin: 0 !important;
    display: flex !important;
    align-items: flex-start !important;
    line-height: 32px !important;
}

#feedbackTable_wrapper .dataTables_filter input,
#feedbackTable_wrapper .dataTables_length select {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

@media (max-width: 768px) {
    #feedbackTable_wrapper .dataTables_length,
    #feedbackTable_wrapper .dataTables_filter {
        width: 100% !important;
        flex: 0 0 100% !important;
    }

    #feedbackTable_wrapper .dataTables_filter {
        justify-content: flex-start !important;
        text-align: left !important;
    }

    #feedbackTable_wrapper .dataTables_info,
    #feedbackTable_wrapper .dataTables_paginate {
        width: 100% !important;
        flex: 0 0 100% !important;
        text-align: left !important;
    }
}

#pendingRequestsTable_wrapper .dataTables_info,
#approvedRequestsTable_wrapper .dataTables_info,
#rejectedRequestsTable_wrapper .dataTables_info,
#pendingRequestsTable_wrapper .dataTables_paginate,
#approvedRequestsTable_wrapper .dataTables_paginate,
#rejectedRequestsTable_wrapper .dataTables_paginate {
    padding: 14px 0 0 !important;
    margin: 0 !important;
}

#pendingRequestsTable,
#approvedRequestsTable,
#rejectedRequestsTable {
    width: 100% !important;
    min-width: 1290px !important;
    margin: 0 !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    table-layout: fixed !important;
}

#pendingRequestsTable thead th,
#approvedRequestsTable thead th,
#rejectedRequestsTable thead th {
    position: static !important;
    background: #f7fafc !important;
    border-bottom: 1px solid #dbe4ee !important;
    color: #0f172a !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    padding: 14px 10px !important;
    white-space: nowrap !important;
}

#pendingRequestsTable tbody td,
#approvedRequestsTable tbody td,
#rejectedRequestsTable tbody td {
    padding: 12px 10px !important;
    border-bottom: 1px solid #edf2f7 !important;
    background: #ffffff !important;
    color: #334155 !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
    text-align: center !important;
    vertical-align: middle !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
}

#pendingRequestsTable tbody tr:nth-child(even) td,
#approvedRequestsTable tbody tr:nth-child(even) td,
#rejectedRequestsTable tbody tr:nth-child(even) td {
    background: #f8fbfd !important;
}

#pendingRequestsTable tbody td:nth-child(9),
#approvedRequestsTable tbody td:nth-child(9),
#rejectedRequestsTable tbody td:nth-child(9) {
    min-width: 320px !important;
    white-space: nowrap !important;
}

#pendingRequestsTable_wrapper .action-buttons-container,
#approvedRequestsTable_wrapper .action-buttons-container,
#rejectedRequestsTable_wrapper .action-buttons-container {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 4px !important;
    width: 100% !important;
    min-width: 0 !important;
}

#pendingRequestsTable_wrapper .action-btn,
#approvedRequestsTable_wrapper .action-btn,
#rejectedRequestsTable_wrapper .action-btn {
    margin: 0 !important;
    min-width: 66px !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    flex: 0 0 auto !important;
}

/* Keep approved table controls in one top row only */
#pendingRequestsTable_wrapper,
#approvedRequestsTable_wrapper {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
}

#pendingRequestsTable_wrapper .dataTables_length,
#pendingRequestsTable_wrapper .dataTables_filter,
#approvedRequestsTable_wrapper .dataTables_length,
#approvedRequestsTable_wrapper .dataTables_filter {
    width: 50% !important;
    flex: 0 0 50% !important;
}

#pendingRequestsTable_wrapper .dataTables_scroll,
#pendingRequestsTable_wrapper .dataTables_info,
#pendingRequestsTable_wrapper .dataTables_paginate,
#approvedRequestsTable_wrapper .dataTables_scroll,
#approvedRequestsTable_wrapper .dataTables_info,
#approvedRequestsTable_wrapper .dataTables_paginate {
    width: 100% !important;
    flex: 0 0 100% !important;
}

#pendingRequestsTable_wrapper .dataTables_info,
#pendingRequestsTable_wrapper .dataTables_paginate,
#approvedRequestsTable_wrapper .dataTables_info,
#approvedRequestsTable_wrapper .dataTables_paginate,
#rejectedRequestsTable_wrapper .dataTables_info,
#rejectedRequestsTable_wrapper .dataTables_paginate {
    width: 50% !important;
    flex: 0 0 50% !important;
    padding-top: 14px !important;
}

#pendingRequestsTable_wrapper .dataTables_info,
#approvedRequestsTable_wrapper .dataTables_info,
#rejectedRequestsTable_wrapper .dataTables_info {
    text-align: left !important;
}

#pendingRequestsTable_wrapper .dataTables_paginate,
#approvedRequestsTable_wrapper .dataTables_paginate,
#rejectedRequestsTable_wrapper .dataTables_paginate {
    text-align: right !important;
}

@media (max-width: 768px) {
    #pendingRequestsTable_wrapper .dataTables_length,
    #pendingRequestsTable_wrapper .dataTables_filter,
    #approvedRequestsTable_wrapper .dataTables_length,
    #approvedRequestsTable_wrapper .dataTables_filter {
        width: 100% !important;
        flex: 0 0 100% !important;
    }

    #pendingRequestsTable_wrapper .dataTables_filter,
    #approvedRequestsTable_wrapper .dataTables_filter {
        justify-content: flex-start !important;
        text-align: left !important;
    }

    #pendingRequestsTable_wrapper .dataTables_info,
    #pendingRequestsTable_wrapper .dataTables_paginate,
    #approvedRequestsTable_wrapper .dataTables_info,
    #approvedRequestsTable_wrapper .dataTables_paginate,
    #rejectedRequestsTable_wrapper .dataTables_info,
    #rejectedRequestsTable_wrapper .dataTables_paginate {
        width: 100% !important;
        flex: 0 0 100% !important;
        text-align: left !important;
    }
}

/* Keep rejected table controls in one top row only */
#rejectedRequestsTable_wrapper {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
}

#rejectedRequestsTable_wrapper .dataTables_length,
#rejectedRequestsTable_wrapper .dataTables_filter {
    width: 50% !important;
    flex: 0 0 50% !important;
}

#rejectedRequestsTable_wrapper .dataTables_scroll {
    width: 100% !important;
    flex: 0 0 100% !important;
}

/* Keep the feedback view modal bright and readable */
body.modal-open #viewModal,
body.modal-open #viewModal.modal,
body.modal-open #viewModal.modal.show,
body.modal-open #viewModal.modal.fade.show {
    background: transparent !important;
    background-color: transparent !important;
}

body.modal-open #viewModal.show ~ .modal-backdrop.show,
body.modal-open #viewModal.show ~ .modal-backdrop.fade.show {
    background-color: #17384d !important;
    opacity: 0.12 !important;
}

#viewModal.show .modal-content {
    background-color: #ffffff !important;
    box-shadow: 0 24px 60px rgba(8, 37, 61, 0.18) !important;
}
