/* ── Outer wrapper (your .table-wrapper div) ── */
.table-wrapper {
    background: #ffffff;
    border-radius: 18px;
    padding: 10px;
    box-shadow: 0 2px 16px rgba(60, 60, 120, 0.08);
    overflow: hidden;
}

/* DataTables generates div.dataTables_wrapper INSIDE .table-wrapper */
.table-wrapper .dataTables_wrapper {
    padding: 0;

}

/* ── Top bar: search + length ── */
.table-wrapper .dt-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 20px 14px;
    background: #ffffff;
    border-bottom: 1.5px solid #f0f0f8;
}

/* Length dropdown label */
.table-wrapper .dataTables_length label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: #666;
    margin: 0;
    white-space: nowrap;
}

.table-wrapper .dataTables_length select {
    appearance: none;
    -webkit-appearance: none;
    padding: 6px 28px 6px 10px;
    border: 1.5px solid #e0dff5;
    border-radius: 8px;
    background-color: #ffffff;

    font-size: 13.5px;
    color: #1a1a2e;
    cursor: pointer;
    outline: none;
    font-family: inherit;
    transition: border-color 0.18s;
}

.table-wrapper .dataTables_length select:focus {
    border-color: var(--accent, #4b3ec8);
    box-shadow: 0 0 0 3px rgba(75, 62, 200, 0.10);
}

/* Search label + input */
.table-wrapper .dataTables_filter label {

    align-items: center;

}

table.dataTable thead>tr>th.sorting_asc:before,
table.dataTable thead>tr>th.sorting_asc:before {
    content: "";
}

.table-wrapper .dataTables_filter input[type="search"] {
    border: 1.5px solid #e0dff5 !important;
    border-radius: 10px !important;
    padding: 8px 14px 8px 36px !important;
    font-size: 13.5px !important;
    color: #1a1a2e !important;
    outline: none !important;
    font-family: inherit !important;
    background-color: #ffffff !important;

    width: 220px !important;
    margin-left: 25 !important;
    box-shadow: none !important;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.table-wrapper .dataTables_filter input[type="search"]:focus {
    border-color: var(--accent, #4b3ec8) !important;
    box-shadow: 0 0 0 3px rgba(75, 62, 200, 0.10) !important;
}

.table-wrapper .dataTables_filter input[type="search"]::placeholder {
    color: #bbb;
}

/* ══ TABLE CORE ══
   These must beat DataTables' inline style="border-collapse:collapse"
   We use the wrapper class for higher specificity                        */
.table-wrapper table.patient-table,
.table-wrapper table.dataTable {
    width: 100% !important;
    border-collapse: separate !important;
    /* CRITICAL — enables border-radius on td */
    border-spacing: 0 10px !important;
    /* 10px gap between card rows */
    padding: 4px 16px 4px !important;
    /* background: #f3f4f8 !important; */
    /* page bg — rows float above this */
    margin: 0 !important;
}

/* ══ THEAD ══ */
.table-wrapper table.patient-table thead,
.table-wrapper table.dataTable thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.table-wrapper table.patient-table thead tr,
.table-wrapper table.dataTable thead tr {
    background: transparent !important;
}

.table-wrapper table.patient-table thead th,
.table-wrapper table.dataTable thead th {
    padding: 17px 14px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    color: var(--accent, #4b3ec8) !important;
    background-color: #f0f1ff !important;
    white-space: nowrap;
    letter-spacing: 0.2px;
    border-top: none !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: none !important;
    box-shadow: none !important;
    outline: none !important;
    cursor: pointer;
}

.table-wrapper table.patient-table thead th:first-child,
.table-wrapper table.dataTable thead th:first-child {
    border-radius: 10px 0 0 10px !important;
    padding-left: 20px !important;
}

.table-wrapper table.patient-table thead th:last-child,
.table-wrapper table.dataTable thead th:last-child {
    border-radius: 0 10px 10px 0 !important;
    padding-right: 20px !important;
    text-align: center !important;
}

/* Sort icons — tinted to theme */
.table-wrapper table.dataTable thead th.sorting,
.table-wrapper table.dataTable thead th.sorting_asc,
.table-wrapper table.dataTable thead th.sorting_desc {
    background-color: #f0f1ff !important;
}

.table-wrapper table.dataTable thead th.sorting::before,
.table-wrapper table.dataTable thead th.sorting::after,
.table-wrapper table.dataTable thead th.sorting_asc::before,
.table-wrapper table.dataTable thead th.sorting_asc::after,
.table-wrapper table.dataTable thead th.sorting_desc::before,
.table-wrapper table.dataTable thead th.sorting_desc::after {
    opacity: 0.3;
}

.table-wrapper table.dataTable thead th.sorting_asc::before,
.table-wrapper table.dataTable thead th.sorting_desc::after {
    opacity: 1;
    color: var(--accent, #4b3ec8);
}

/* ══ TBODY ROWS  — card-per-row ══ */

/* Kill ALL default DataTables row backgrounds */
.table-wrapper table.dataTable tbody tr,
.table-wrapper table.dataTable tbody tr.odd,
.table-wrapper table.dataTable tbody tr.even,
.table-wrapper table.patient-table tbody tr {
    background: transparent !important;
    /* let td background show */
    transition: transform 0.15s;
    box-shadow: 1px 4px 1px 0px rgba(75, 62, 200, 0.05);
}

/* TDs carry the white card background + borders + shadow */
.table-wrapper table.patient-table tbody tr td,
.table-wrapper table.dataTable tbody tr td {
    padding: 17px 14px !important;
    font-size: 16px !important;
    color: #33393E !important;
    white-space: nowrap;
    vertical-align: middle !important;
    /* background-color: #ffffff !important; */
    /* white card */
    border-top: 1.5px solid #ebebf5 !important;
    border-bottom: 1.5px solid #ebebf5 !important;
    border-left: none !important;
    border-right: none !important;

    transition: background-color 0.15s, box-shadow 0.15s;
}

/* Left edge of card */
.table-wrapper table.patient-table tbody tr td:first-child,
.table-wrapper table.dataTable tbody tr td:first-child {
    border-left: 1.5px solid #ebebf5 !important;
    border-radius: 10px 0 0 10px !important;
    padding-left: 20px !important;
}

/* Right edge of card */
.table-wrapper table.patient-table tbody tr td:last-child,
.table-wrapper table.dataTable tbody tr td:last-child {
    border-right: 1.5px solid #ebebf5 !important;
    border-radius: 0 10px 10px 0 !important;
    padding-right: 20px !important;
    text-align: center !important;
}

/* Hover lift */
.table-wrapper table.patient-table tbody tr:hover td,
.table-wrapper table.dataTable tbody tr:hover td {
    background-color: #faf9ff !important;
    box-shadow: 0 4px 18px rgba(75, 62, 200, -0.89) !important;
}

.table-wrapper table.patient-table tbody tr:hover,
.table-wrapper table.dataTable tbody tr:hover {
    transform: translateY(-1px);
}

/* ══ SELECTED ROW ══ */
.table-wrapper table.patient-table tbody tr.row-selected td,
.table-wrapper table.dataTable tbody tr.row-selected td {
    background-color: #ffffff !important;
    border-top-color: var(--accent, #4b3ec8) !important;
    border-top-width: 2px !important;
    border-bottom-color: var(--accent, #4b3ec8) !important;
    border-bottom-width: 2px !important;
    box-shadow: 0 3px 14px rgba(75, 62, 200, 0.15) !important;
}

.table-wrapper table.patient-table tbody tr.row-selected td:first-child,
.table-wrapper table.dataTable tbody tr.row-selected td:first-child {
    border-left-color: var(--accent, #4b3ec8) !important;
    border-left-width: 2.5px !important;
}

.table-wrapper table.patient-table tbody tr.row-selected td:last-child,
.table-wrapper table.dataTable tbody tr.row-selected td:last-child {
    border-right-color: var(--accent, #4b3ec8) !important;
    border-right-width: 2.5px !important;
}


/* ===========================
   ACTION LINK
=========================== */

.action-link {
    color: #3EAEB0;
    font-weight: 600;
    text-decoration: none;
}

.action-link:hover {
    text-decoration: underline;
}

/* ══ BOTTOM BAR: info + pagination ══ */
.table-wrapper .dt-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 20px 18px;
    background: #ffffff;
    border-top: 1.5px solid #f0f0f8;
}

.table-wrapper .dataTables_info {
    font-size: 13px;
    color: #666;
}

/* ══ PAGINATION ══ */
.table-wrapper .dataTables_paginate {

    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.table-wrapper .dataTables_paginate .paginate_button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 34px !important;
    height: 34px !important;
    padding: 0 12px !important;


    background: #ffffff !important;

    font-size: 13.5px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.15s !important;

    text-decoration: none !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
}

.table-wrapper .dataTables_paginate .paginate_button:hover {
    background: #f3f1ff !important;
    border-color: var(--accent, #4b3ec8) !important;
    color: var(--accent, #4b3ec8) !important;
    box-shadow: none !important;
}

.table-wrapper .dataTables_paginate .paginate_button.current,
.table-wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--accent, #4b3ec8) !important;
    border-color: var(--accent, #4b3ec8) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 3px 10px rgba(75, 62, 200, 0.28) !important;
}

.table-wrapper .dataTables_paginate .paginate_button.disabled,
.table-wrapper .dataTables_paginate .paginate_button.disabled:hover {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
    background: #ffffff !important;
    border-color: #e0dff5 !important;
    color: #aaa !important;
    box-shadow: none !important;
}

.table-wrapper .dataTables_paginate .paginate_button.previous,
.table-wrapper .dataTables_paginate .paginate_button.next {
    font-weight: 600 !important;
    padding: 0 10px !important;
}

.table-wrapper .dataTables_paginate .ellipsis {
    color: #aaa;
    padding: 0 4px;
    font-size: 15px;
    line-height: 34px;
    user-select: none;
}

.active>.page-link,
.page-link.active {
    color: #ffffff;
    background-color: #3EAEB0;
    border-color: #3EAEB0;
    border-radius: 5px;
}

/* ========================================================
   RE-OPTIMIZED RESPONSIVE FIX (Prevents Overflow & Clipping)
   ======================================================== */

@media screen and (max-width: 991px) {

    .table-wrapper .dataTables_wrapper {
        padding: 0;
        overflow: auto;
    }
}