/**
 * ABSANA DataTable Enhanced Styling
 * Modern & Professional DataTable design with ABSANA branding
 *
 * Color Palette:
 * - Navy Blue: #1D3557
 * - Sky Blue: #48CAE4
 * - Accent: #457B9D
 */

/* =========================================
   1. DATATABLE WRAPPER & CONTAINER
   ========================================= */
.dataTables_wrapper {
    font-family: 'Poppins', 'Inter', sans-serif;
}

/* Remove default margins */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin-top: 0;
    margin-bottom: 0;
}

/* =========================================
   2. TOP CONTROLS (Search & Length)
   ========================================= */
.dataTables_wrapper .row:first-child {
    padding: 20px 24px 16px 24px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 249, 250, 0.95) 100%);
    border-bottom: 2px solid rgba(72, 202, 228, 0.2);
}

/* Length Selector */
.dataTables_wrapper .dataTables_length {
    float: left;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dataTables_wrapper .dataTables_length label {
    font-weight: 500;
    color: #1D3557;
    margin: 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dataTables_wrapper .dataTables_length select {
    border: 1.5px solid rgba(29, 53, 87, 0.2);
    border-radius: 8px;
    padding: 8px 30px 8px 12px;
    font-size: 14px;
    font-weight: 500;
    color: #1D3557;
    background-color: white;
    transition: all 0.3s ease;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231D3557' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.dataTables_wrapper .dataTables_length select:focus {
    border-color: #48CAE4;
    outline: none;
    box-shadow: 0 0 0 3px rgba(72, 202, 228, 0.15);
}

.dataTables_wrapper .dataTables_length select:hover {
    border-color: #48CAE4;
}

/* Search Box */
.dataTables_wrapper .dataTables_filter {
    float: right;
}

.dataTables_wrapper .dataTables_filter label {
    font-weight: 500;
    color: #1D3557;
    margin: 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dataTables_wrapper .dataTables_filter input {
    border: 1.5px solid rgba(29, 53, 87, 0.2);
    border-radius: 8px;
    padding: 8px 16px 8px 40px;
    font-size: 14px;
    color: #1D3557;
    background-color: white;
    transition: all 0.3s ease;
    min-width: 280px;
    margin-left: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23457B9D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='m21 21-4.35-4.35'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
    background-size: 18px;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #48CAE4;
    outline: none;
    box-shadow: 0 0 0 3px rgba(72, 202, 228, 0.15);
    background-color: white;
}

.dataTables_wrapper .dataTables_filter input::placeholder {
    color: #6C757D;
    opacity: 0.6;
}

/* =========================================
   3. TABLE STYLING
   ========================================= */
table.dataTable {
    border-collapse: separate !important;
    border-spacing: 0;
    width: 100% !important;
    margin: 0 !important;
}

/* Header Cells */
table.dataTable thead th {
    background: #1D3557 !important;
    color: #FFFFFF !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 18px 16px !important;
    border: none !important;
    position: relative;
    white-space: nowrap;
    vertical-align: middle;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

table.dataTable thead th:first-child {
    border-top-left-radius: 8px;
}

table.dataTable thead th:last-child {
    border-top-right-radius: 8px;
}

/* Sortable Column Styling */
table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc {
    cursor: pointer;
    position: relative;
    padding-right: 35px !important;
}

/* Sort Icons */
table.dataTable thead .sorting:before,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_desc:before,
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
    position: absolute;
    display: block;
    opacity: 0.3;
    right: 12px;
    line-height: 9px;
    font-size: 0.8em;
}

table.dataTable thead .sorting:before,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_desc:before {
    content: "▲";
    top: 16px;
}

table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
    content: "▼";
    bottom: 16px;
}

table.dataTable thead .sorting_asc:before {
    opacity: 1;
    color: #48CAE4;
    font-weight: 900;
}

table.dataTable thead .sorting_desc:after {
    opacity: 1;
    color: #48CAE4;
    font-weight: 900;
}

table.dataTable thead .sorting:before,
table.dataTable thead .sorting:after {
    color: rgba(255, 255, 255, 0.4);
}

/* Body Cells */
table.dataTable tbody td {
    padding: 14px 16px !important;
    vertical-align: middle !important;
    color: #343A40 !important;
    font-size: 14px !important;
    border-bottom: 1px solid rgba(29, 53, 87, 0.08) !important;
}

/* Row Hover */
table.dataTable tbody tr {
    transition: all 0.2s ease;
}

table.dataTable tbody tr:hover {
    background-color: rgba(72, 202, 228, 0.05) !important;
}

/* Striped Rows */
table.dataTable.stripe tbody tr.odd,
table.dataTable.display tbody tr.odd {
    background-color: rgba(72, 202, 228, 0.02);
}

table.dataTable.stripe tbody tr.odd:hover,
table.dataTable.display tbody tr.odd:hover {
    background-color: rgba(72, 202, 228, 0.06) !important;
}

table.dataTable.stripe tbody tr.even:hover,
table.dataTable.display tbody tr.even:hover {
    background-color: rgba(72, 202, 228, 0.05) !important;
}

/* Selected Row */
table.dataTable tbody tr.selected {
    background-color: rgba(72, 202, 228, 0.15) !important;
}

/* =========================================
   4. BOTTOM CONTROLS (Info & Pagination)
   ========================================= */
.dataTables_wrapper .row:last-child {
    padding: 16px 24px 20px 24px;
    background: linear-gradient(135deg, rgba(248, 249, 250, 0.95) 0%, rgba(255, 255, 255, 0.98) 100%);
    border-top: 2px solid rgba(72, 202, 228, 0.2);
}

/* Info Text */
.dataTables_wrapper .dataTables_info {
    float: left;
    padding-top: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #1D3557;
}

/* Pagination */
.dataTables_wrapper .dataTables_paginate {
    float: right;
    text-align: right;
    padding: 0;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 2px;
    border: 1.5px solid rgba(29, 53, 87, 0.15);
    border-radius: 8px;
    background: white;
    color: #1D3557 !important;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #48CAE4 !important;
    color: white !important;
    border-color: #48CAE4;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(72, 202, 228, 0.3);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #1D3557 !important;
    color: white !important;
    border-color: #1D3557;
    box-shadow: 0 2px 8px rgba(29, 53, 87, 0.25);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: #0F1C2E !important;
    border-color: #0F1C2E;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    cursor: not-allowed;
    opacity: 0.4;
    background: white !important;
    color: #6C757D !important;
    border-color: rgba(29, 53, 87, 0.15);
    transform: none;
    box-shadow: none;
}

.dataTables_wrapper .dataTables_paginate .ellipsis {
    padding: 8px 6px;
    color: #6C757D;
}

/* Previous/Next buttons */
.dataTables_wrapper .dataTables_paginate .paginate_button.previous,
.dataTables_wrapper .dataTables_paginate .paginate_button.next {
    font-weight: 600;
}

/* =========================================
   5. PROCESSING INDICATOR
   ========================================= */
.dataTables_wrapper .dataTables_processing {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    margin-left: -100px;
    margin-top: -26px;
    text-align: center;
    padding: 16px 24px;
    background: linear-gradient(135deg, #1D3557 0%, #457B9D 100%);
    color: white;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(29, 53, 87, 0.25);
    font-weight: 600;
    font-size: 14px;
    z-index: 1000;
}

/* =========================================
   6. EMPTY STATE
   ========================================= */
.dataTables_wrapper .dataTables_empty {
    text-align: center !important;
    padding: 40px 20px !important;
    color: #6C757D !important;
    font-size: 14px !important;
    font-weight: 500;
    background: rgba(72, 202, 228, 0.03) !important;
}

.dataTables_wrapper .dataTables_empty:before {
    content: "📋";
    display: block;
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* =========================================
   7. SCROLLING TABLES
   ========================================= */
.dataTables_wrapper .dataTables_scroll {
    clear: both;
}

.dataTables_wrapper .dataTables_scrollHead {
    overflow: hidden;
    position: relative;
    border: 0;
    border-radius: 8px 8px 0 0;
}

.dataTables_wrapper .dataTables_scrollBody {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.dataTables_wrapper .dataTables_scrollBody::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.dataTables_wrapper .dataTables_scrollBody::-webkit-scrollbar-track {
    background: rgba(29, 53, 87, 0.05);
    border-radius: 4px;
}

.dataTables_wrapper .dataTables_scrollBody::-webkit-scrollbar-thumb {
    background: #48CAE4;
    border-radius: 4px;
}

.dataTables_wrapper .dataTables_scrollBody::-webkit-scrollbar-thumb:hover {
    background: #457B9D;
}

/* =========================================
   8. RESPONSIVE DESIGN
   ========================================= */
@media screen and (max-width: 767px) {
    .dataTables_wrapper .row:first-child {
        padding: 16px;
    }

    .dataTables_wrapper .row:last-child {
        padding: 16px;
    }

    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        float: none;
        text-align: left;
        margin-bottom: 12px;
    }

    .dataTables_wrapper .dataTables_filter input {
        min-width: 100%;
        width: 100%;
    }

    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        float: none;
        text-align: center;
        margin-top: 12px;
    }

    .dataTables_wrapper .dataTables_paginate {
        margin-top: 16px;
    }

    table.dataTable thead th,
    table.dataTable tbody td {
        padding: 10px 12px !important;
        font-size: 13px !important;
    }

    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 6px 10px;
        font-size: 13px;
        margin: 0 1px;
    }
}

/* =========================================
   9. COLUMN SPECIFIC STYLING
   ========================================= */
/* Center aligned columns */
table.dataTable th.text-center,
table.dataTable td.text-center {
    text-align: center !important;
}

/* Right aligned columns */
table.dataTable th.text-right,
table.dataTable td.text-right {
    text-align: right !important;
}

/* Nowrap columns */
table.dataTable th.dt-nowrap,
table.dataTable td.dt-nowrap {
    white-space: nowrap;
}

/* =========================================
   10. ACTION BUTTONS IN TABLE
   ========================================= */
table.dataTable tbody td ul.d-flex {
    padding: 0;
    margin: 0;
    list-style: none;
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

table.dataTable tbody td ul.d-flex li {
    margin: 0;
}

table.dataTable tbody td ul.d-flex li a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: #457B9D;
    transition: all 0.2s ease;
    background: rgba(72, 202, 228, 0.08);
}

table.dataTable tbody td ul.d-flex li a:hover {
    color: white;
    background: #48CAE4;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(72, 202, 228, 0.3);
}

table.dataTable tbody td ul.d-flex li a i,
table.dataTable tbody td ul.d-flex li a svg {
    width: 16px;
    height: 16px;
}

/* Delete button special styling */
table.dataTable tbody td ul.d-flex li a.delete,
table.dataTable tbody td ul.d-flex li a[class*="delete"] {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.08);
}

table.dataTable tbody td ul.d-flex li a.delete:hover,
table.dataTable tbody td ul.d-flex li a[class*="delete"]:hover {
    background: #dc3545;
    color: white;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* =========================================
   11. BADGES IN TABLE
   ========================================= */
table.dataTable tbody td .badge {
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    letter-spacing: 0.3px;
}

/* =========================================
   12. COMPACT MODE
   ========================================= */
table.dataTable.compact thead th,
table.dataTable.compact tbody td {
    padding: 8px 12px !important;
}

/* =========================================
   13. FIXED HEADER
   ========================================= */
.dataTables_wrapper .dataTables_scrollHead table.dataTable {
    margin-bottom: 0 !important;
}

/* =========================================
   14. LOADING ANIMATION
   ========================================= */
@keyframes dtSpinner {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.dataTables_wrapper .dataTables_processing:after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: dtSpinner 0.6s linear infinite;
}

/* =========================================
   15. CUSTOM UTILITY CLASSES
   ========================================= */
.dt-wrapper-absana {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(29, 53, 87, 0.08);
}

.dt-no-footer {
    border-bottom: 2px solid rgba(72, 202, 228, 0.2) !important;
}
